Skip to content

Commit

Permalink
fix sonar issue
Browse files Browse the repository at this point in the history
  • Loading branch information
aayushRedHat committed Dec 19, 2023
1 parent 3659ddc commit c49ce78
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Generator {
const options = arguments[arguments.length - 1];
const invalidOptions = getInvalidOptions(GENERATOR_OPTIONS, options || []);
if (invalidOptions.length) throw new Error(`These options are not supported by the generator: ${invalidOptions.join(', ')}`);
if (options && options.registry) {
if (options && this.verifyRegistryOption(options.registry)) {
const invalidRegOptions = getInvalidOptions(REGISTRY_OPTIONS, options.registry || []);
this.isInvalidRegOptions(invalidRegOptions);
}
Expand Down Expand Up @@ -161,6 +161,18 @@ class Generator {
isInvalidRegOptions(invalidRegOptions) {
if (invalidRegOptions.length) throw new Error(`These options are not supported by the generator to configure private registry: ${invalidRegOptions.join(', ')}`);
}

/**
* Check if the Registry Options is present or not.
*
* @private
* @param {Object} registryOption Registry Options.
* @return {boolean}
*/

verifyRegistryOption(registryOption) {
return registryOption === null;
}

/**
* Generates files from a given template and an AsyncAPIDocument object.
Expand Down

0 comments on commit c49ce78

Please sign in to comment.