Skip to content

Commit

Permalink
fix: rename totalComponents,
Browse files Browse the repository at this point in the history
fix: use cli.info instead of console.info
  • Loading branch information
adelkahomolova committed Nov 11, 2019
1 parent b2c5cd6 commit 9acb9ad
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/scanner/Scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { ScannerContextFactory, Types } from '../types';
import { ScannerUtils } from './ScannerUtils';
import _ from 'lodash';
import { sharedSubpath } from '../detectors/utils';
import { cli } from 'cli-ux';

@injectable()
export class Scanner {
Expand All @@ -37,7 +38,7 @@ export class Scanner {
private readonly argumentsProvider: ArgumentsProvider;
private readonly scanDebug: debug.Debugger;
private shouldExitOnEnd = false;
private totalComponents: ProjectComponentAndLangContext[] | undefined;
private allDetectedComponents: ProjectComponentAndLangContext[] | undefined;

constructor(
@inject(ScanningStrategyDetector) scanStrategyDetector: ScanningStrategyDetector,
Expand All @@ -53,7 +54,7 @@ export class Scanner {
this.practices = practices;
this.argumentsProvider = argumentsProvider;
this.scanDebug = debug('scanner');
this.totalComponents = undefined;
this.allDetectedComponents = undefined;
}

async scan(): Promise<ScanResult> {
Expand Down Expand Up @@ -147,7 +148,7 @@ export class Scanner {
}
}
}
this.totalComponents = components;
this.allDetectedComponents = components;
const relevantComponents = await this.getRelevantComponents(components);
return { relevantComponents, components };
}
Expand Down Expand Up @@ -186,10 +187,10 @@ export class Scanner {
? console.log(reportString)
: console.log(util.inspect(reportString, { showHidden: false, depth: null }));

if (this.totalComponents!.length > 1 && !this.argumentsProvider.recursive) {
console.info(
if (this.allDetectedComponents!.length > 1 && !this.argumentsProvider.recursive) {
cli.info(
`Found more than 1 component. To scan all ${
this.totalComponents!.length
this.allDetectedComponents!.length
} components run the scanner with an argument --recursive\n`,
);
}
Expand Down

0 comments on commit 9acb9ad

Please sign in to comment.