Commit e969f68d authored by Himanshu Kapoor's avatar Himanshu Kapoor

Put .gitlab-ci.yml linting in IDE behind a feature flag

This is needed so that we turn on the feature flag only for GitLab.com
and turn it off for self-managed by default. Since this feature sends a request to
a third party URL, some self-managed hosts may not like it much.
parent 3bb340f2
......@@ -45,7 +45,10 @@ export default class Editor {
setupThemes();
registerLanguages(...languages);
registerSchemas(...schemas);
if (gon.features?.schemaLinting) {
registerSchemas(...schemas);
}
this.debouncedUpdate = debounce(() => {
this.updateDimensions();
......
......@@ -8,6 +8,7 @@ class IdeController < ApplicationController
before_action do
push_frontend_feature_flag(:build_service_proxy)
push_frontend_feature_flag(:schema_linting)
end
def index
......
......@@ -200,6 +200,20 @@ describe('Multi-file editor library', () => {
});
describe('schemas', () => {
let originalGon;
beforeEach(() => {
originalGon = window.gon;
window.gon = { features: { schemaLinting: true } };
delete Editor.editorInstance;
instance = Editor.create();
});
afterEach(() => {
window.gon = originalGon;
});
it('registers custom schemas defined with Monaco', () => {
expect(monacoLanguages.yaml.yamlDefaults.diagnosticsOptions).toMatchObject({
schemas: [{ fileMatch: ['*.gitlab-ci.yml'] }],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment