Skip to content

Commit

Permalink
fix: arguments of getImpactFailureLevels(),
Browse files Browse the repository at this point in the history
fix: retype
  • Loading branch information
adelkahomolova committed Oct 30, 2019
1 parent fae2a41 commit 53a15d6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DXScannerCommand extends Command {
const scanPath = args.path || process.cwd();
cli.action.start(`Scanning URI: ${scanPath}`);

const container = createRootContainer({ uri: scanPath, auth: authorization, json: json, fail: <PracticeImpact>fail });
const container = createRootContainer({ uri: scanPath, auth: authorization, json: json, fail: <PracticeImpact | 'all'>fail });
const scanner = container.get(Scanner);

try {
Expand Down
19 changes: 19 additions & 0 deletions src/scanner/ScannerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { PracticeImpact } from '../model';
import { IPracticeWithMetadata } from '../practices/DxPracticeDecorator';
import { IPractice } from '../practices/IPractice';
import { PracticeWithContext } from './Scanner';
import { assertNever } from '../lib/assertNever';

/**
* Scanner helpers & utilities
Expand Down Expand Up @@ -99,4 +100,22 @@ export class ScannerUtils {

return { customApplicablePractices, practicesOff };
}

/**
* Get all levels to fail on
*/
static getImpactFailureLevels = (impact: PracticeImpact | 'all' | undefined) => {
switch (impact) {
case PracticeImpact.high:
return [PracticeImpact.high];
case PracticeImpact.medium:
return [PracticeImpact.high, PracticeImpact.medium];
case PracticeImpact.small:
return [PracticeImpact.high, PracticeImpact.medium, PracticeImpact.small];
case PracticeImpact.hint:
return [PracticeImpact.high, PracticeImpact.medium, PracticeImpact.small, PracticeImpact.hint];
default:
return [];
}
};
}

0 comments on commit 53a15d6

Please sign in to comment.