From 7b08e8d0d58925504de99839b6468ef54a15c446 Mon Sep 17 00:00:00 2001 From: "jonas-lt@live.dk" Date: Wed, 27 Sep 2023 12:03:30 +0200 Subject: [PATCH] ignore sonar --- .sonarcloud.properties | 2 +- lib/generator.js | 2 +- test/generator.test.js | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index c9486b17e..208c092d7 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,2 +1,2 @@ #we need to explicitly exclude them as some are commit to the repo -sonar.exclusions=test/test-project/node_modules/@asyncapi/html-template/**/* \ No newline at end of file +sonar.exclusions=test/**/* diff --git a/lib/generator.js b/lib/generator.js index 4444ccdd5..ee5592d97 100644 --- a/lib/generator.js +++ b/lib/generator.js @@ -159,7 +159,7 @@ class Generator { * @param {Object} [parseOptions={}] AsyncAPI Parser parse options. Check out {@link https://www.github.com/asyncapi/parser-js|@asyncapi/parser} for more information. Remember to use the right options to the right parser depending on the template you are using. * @return {Promise} */ - // NOSONAR + // eslint-disable-next-line sonarjs/cognitive-complexity async generate(asyncapiDocument, parseOptions = {}) { const isAlreadyParsedDocument = isAsyncAPIDocument(asyncapiDocument); const isParsableCompatible = asyncapiDocument || typeof asyncapiString === 'string'; diff --git a/test/generator.test.js b/test/generator.test.js index 1da8d2c12..054350318 100644 --- a/test/generator.test.js +++ b/test/generator.test.js @@ -272,7 +272,6 @@ describe('Generator', () => { it('calls this.generate', async () => { const gen = new Generator('testTemplate', __dirname); gen.generate = generateMock; - //NOSONAR await gen.generateFromString(dummyYAML); expect(generateMock).toHaveBeenCalled(); @@ -281,14 +280,12 @@ describe('Generator', () => { it('fails if asyncapiString is not provided', async () => { const gen = new Generator('testTemplate', __dirname); gen.generate = generateMock; - //NOSONAR expect(() => gen.generateFromString()).rejects.toThrow('Parameter "asyncapiString" must be a non-empty string.'); }); it('fails if asyncapiString is not a string', async () => { const gen = new Generator('testTemplate', __dirname); gen.generate = generateMock; - //NOSONAR expect(() => gen.generateFromString(1)).rejects.toThrow('Parameter "asyncapiString" must be a non-empty string.'); }); });