Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: some code smells by Sonarcloud fixes #869

Merged
merged 4 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/commands/generate/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,15 @@ export default class Models extends Command {
const models = await fileGenerator.generateToFiles(
convertedDoc as any,
output,
{ ...fileOptions, } as any);
{ ...fileOptions, });
const generatedModels = models.map((model) => { return model.modelName; });
this.log(`Successfully generated the following models: ${generatedModels.join(', ')}`);
return;
}

const models = await fileGenerator.generateCompleteModels(
convertedDoc as any,
{ ...fileOptions } as any);
{ ...fileOptions });
const generatedModels = models.map((model) => {
return `
## Model name: ${model.modelName}
Expand Down
2 changes: 1 addition & 1 deletion src/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export const watchFlag = (description?: string) => {
return Flags.boolean({
default: false,
char: 'w',
description: description || 'Enable watch mode',
description: description ?? 'Enable watch mode',
});
};
2 changes: 1 addition & 1 deletion src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type SpecWatcherParams = {

export const specWatcher = (params: SpecWatcherParams) => {
if (!params.spec.getFilePath()) { return WATCH_MESSAGES.logOnAutoDisable(params.docVersion); }
if (CHOKIDAR_INSTANCE_STORE.get(params.label || '_default')) { return; }
if (CHOKIDAR_INSTANCE_STORE.get(params.label ?? '_default')) { return; }

const filePath = params.spec.getFilePath() as string;
try {
Expand Down
3 changes: 1 addition & 2 deletions src/hooks/command_not_found/myhook.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Hook, toConfiguredId, CliUx} from '@oclif/core';
import {Help, Hook, toConfiguredId, CliUx} from '@oclif/core';
import chalk from 'chalk';
import {default as levenshtein} from 'fast-levenshtein';
import { Help } from '@oclif/core';

export const closest = (target: string, possibilities: string[]): string =>
possibilities
Expand Down
2 changes: 1 addition & 1 deletion src/models/SpecificationFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class Specification {
}

getSource() {
return this.getFilePath() || this.getFileURL();
return this.getFilePath() ?? this.getFileURL();
}

toSourceString() {
Expand Down