Skip to content

Commit

Permalink
Clean some repeated code
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-rr committed Feb 6, 2024
1 parent d096c54 commit 5fe9bc4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/commands/optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ export default class Optimize extends Command {
this.optimizations = flags.optimization as Optimizations[];
this.outputMethod = flags.output as Outputs;

this.metricsMetadata.optimized = true;

if (!(report.moveToComponents?.length || report.removeComponents?.length || report.reuseComponents?.length)) {
this.metricsMetadata.optimized = false;
this.log(`No optimization has been applied since ${this.specFile.getFilePath() ?? this.specFile.getFileURL()} looks optimized!`);
this.metricsMetadata.optimized = false;
return;
}

Expand All @@ -102,7 +104,6 @@ export default class Optimize extends Command {
reuseComponents: this.optimizations.includes(Optimizations.REUSE_COMPONENTS)
}, output: Output.YAML});

this.metricsMetadata.optimized = true;
await this.collectMetricsData(report);

const specPath = this.specFile.getFilePath();
Expand Down Expand Up @@ -138,8 +139,6 @@ export default class Optimize extends Command {
return;
}

this.metricsMetadata.optimized = true;

for (let i = 0; i < elements.length; i++) {
const element = elements[+i];
if (element.action==='move') {
Expand Down

0 comments on commit 5fe9bc4

Please sign in to comment.