Skip to content

Commit

Permalink
ignore sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Sep 27, 2023
1 parent 8221fd6 commit 7b08e8d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -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/**/*
sonar.exclusions=test/**/*
2 changes: 1 addition & 1 deletion lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 0 additions & 3 deletions test/generator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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.');
});
});
Expand Down

0 comments on commit 7b08e8d

Please sign in to comment.