Skip to content

Commit

Permalink
Improve the log and correct the path
Browse files Browse the repository at this point in the history
  • Loading branch information
aayushRedHat committed Sep 19, 2023
1 parent 54c0c92 commit 23182a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/commands/optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ export default class Optimize extends Command {

const specPath = specFile.getFilePath();
let newPath = '';
let originalPath = '';

Check failure on line 102 in src/commands/optimize.ts

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

'originalPath' is never reassigned. Use 'const' instead

Check failure on line 102 in src/commands/optimize.ts

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

'originalPath' is assigned a value but never used

if (specPath) {
const pos = specPath.lastIndexOf('.');
newPath = `${specPath.substring(0,pos) }_optimized.${ specPath.substring(pos+1)}`;

Check failure on line 106 in src/commands/optimize.ts

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Block must not be padded by blank lines

} else {
newPath = 'optimized-asyncapi.yaml';
}
Expand All @@ -113,7 +116,8 @@ export default class Optimize extends Command {
this.log(`Created file ${newPath}...`);
} else if (this.outputMethod === Outputs.OVERWRITE) {
await writeFile(specPath ?? 'asyncapi.yaml', optimizedDocument, { encoding: 'utf8' });
this.log(`Created file ${newPath}...`);

this.log(`Updated file ${specPath}...`);
}
} catch (error) {
throw new ValidationError({
Expand Down

0 comments on commit 23182a7

Please sign in to comment.