-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@W-14689342@: (Part 8) Introduce ResultsProcessorFactory and inject i…
…t as dependency to run actions
- Loading branch information
1 parent
8c8e4bd
commit 5d920d1
Showing
8 changed files
with
77 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {Display} from "../Display"; | ||
import {JsonReturnValueHolder} from "./JsonReturnValueHolder"; | ||
import {RunOutputOptions, RunResultsProcessor} from "./RunResultsProcessor"; | ||
import {CompositeResultsProcessor, ResultsProcessor} from "./ResultsProcessor"; | ||
import {ENV_VAR_NAMES} from "../../Constants"; | ||
import {inferFormatFromInternalOutfile, OutputFormat} from "./OutputFormat"; | ||
import {OutfileResultsProcessor} from "./OutfileResultsProcessor"; | ||
|
||
export interface ResultsProcessorFactory { | ||
createResultsProcessor(display: Display, runOutputOptions: RunOutputOptions, | ||
jsonReturnValueHolder: JsonReturnValueHolder): ResultsProcessor | ||
} | ||
|
||
export class ResultsProcessorFactoryImpl implements ResultsProcessorFactory { | ||
public createResultsProcessor(display: Display, runOutputOptions: RunOutputOptions, | ||
jsonReturnValueHolder: JsonReturnValueHolder): ResultsProcessor { | ||
|
||
const resultsProcessors: ResultsProcessor[] = [new RunResultsProcessor(display, runOutputOptions, jsonReturnValueHolder)]; | ||
|
||
const internalOutfile: string = process.env[ENV_VAR_NAMES.SCANNER_INTERNAL_OUTFILE]; | ||
if (internalOutfile && internalOutfile.length > 0) { | ||
const internalOutputFormat: OutputFormat = inferFormatFromInternalOutfile(internalOutfile); | ||
resultsProcessors.push(new OutfileResultsProcessor(internalOutputFormat, internalOutfile, runOutputOptions.verboseViolations)); | ||
} | ||
|
||
return new CompositeResultsProcessor(resultsProcessors); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters