@@ -23,7 +23,6 @@ export interface ConfigModel {
2323}
2424
2525export class AnnotatedConfigModel implements ConfigModel {
26- private readonly config : CodeAnalyzerConfig ; // TODO: It would be nice if we updated the CodeAnalyzer (in our core module) to just return its CodeAnalyzerConfig with a getter so we didn't need to pass it around
2726 private readonly codeAnalyzer : CodeAnalyzer ;
2827 private readonly userRules : RuleSelection ;
2928 private readonly allDefaultRules : RuleSelection ;
@@ -34,8 +33,7 @@ export class AnnotatedConfigModel implements ConfigModel {
3433 // configs not associated with the user's rule selection, thus we can't use the engines from allDefaultRules.
3534 private readonly relevantEngines : Set < string > ;
3635
37- constructor ( config : CodeAnalyzerConfig , codeAnalyzer : CodeAnalyzer , userRules : RuleSelection , allDefaultRules : RuleSelection , relevantEngines : Set < string > ) {
38- this . config = config ;
36+ constructor ( codeAnalyzer : CodeAnalyzer , userRules : RuleSelection , allDefaultRules : RuleSelection , relevantEngines : Set < string > ) {
3937 this . codeAnalyzer = codeAnalyzer ;
4038 this . userRules = userRules ;
4139 this . allDefaultRules = allDefaultRules ;
@@ -45,9 +43,9 @@ export class AnnotatedConfigModel implements ConfigModel {
4543 toFormattedOutput ( format : OutputFormat ) : string {
4644 // istanbul ignore else: Should be impossible
4745 if ( format === OutputFormat . STYLED_YAML ) {
48- return new StyledYamlFormatter ( this . config , this . codeAnalyzer , this . userRules , this . allDefaultRules , this . relevantEngines ) . toYaml ( ) ;
46+ return new StyledYamlFormatter ( this . codeAnalyzer , this . userRules , this . allDefaultRules , this . relevantEngines ) . toYaml ( ) ;
4947 } else if ( format === OutputFormat . RAW_YAML ) {
50- return new PlainYamlFormatter ( this . config , this . codeAnalyzer , this . userRules , this . allDefaultRules , this . relevantEngines ) . toYaml ( ) ;
48+ return new PlainYamlFormatter ( this . codeAnalyzer , this . userRules , this . allDefaultRules , this . relevantEngines ) . toYaml ( ) ;
5149 } else {
5250 throw new Error ( `Unsupported` )
5351 }
@@ -61,8 +59,8 @@ abstract class YamlFormatter {
6159 private readonly allDefaultRules : RuleSelection ;
6260 private readonly relevantEngines : Set < string > ;
6361
64- protected constructor ( config : CodeAnalyzerConfig , codeAnalyzer : CodeAnalyzer , userRules : RuleSelection , allDefaultRules : RuleSelection , relevantEngines : Set < string > ) {
65- this . config = config ;
62+ protected constructor ( codeAnalyzer : CodeAnalyzer , userRules : RuleSelection , allDefaultRules : RuleSelection , relevantEngines : Set < string > ) {
63+ this . config = codeAnalyzer . getConfig ( ) ;
6664 this . codeAnalyzer = codeAnalyzer ;
6765 this . userRules = userRules ;
6866 this . allDefaultRules = allDefaultRules ;
@@ -214,8 +212,8 @@ abstract class YamlFormatter {
214212}
215213
216214class PlainYamlFormatter extends YamlFormatter {
217- constructor ( config : CodeAnalyzerConfig , codeAnalyzer : CodeAnalyzer , userRules : RuleSelection , allDefaultRules : RuleSelection , relevantEngines : Set < string > ) {
218- super ( config , codeAnalyzer , userRules , allDefaultRules , relevantEngines ) ;
215+ constructor ( codeAnalyzer : CodeAnalyzer , userRules : RuleSelection , allDefaultRules : RuleSelection , relevantEngines : Set < string > ) {
216+ super ( codeAnalyzer , userRules , allDefaultRules , relevantEngines ) ;
219217 }
220218
221219 protected toYamlComment ( commentText : string ) : string {
@@ -224,8 +222,8 @@ class PlainYamlFormatter extends YamlFormatter {
224222}
225223
226224class StyledYamlFormatter extends YamlFormatter {
227- constructor ( config : CodeAnalyzerConfig , codeAnalyzer : CodeAnalyzer , userRules : RuleSelection , allDefaultRules : RuleSelection , relevantEngines : Set < string > ) {
228- super ( config , codeAnalyzer , userRules , allDefaultRules , relevantEngines ) ;
225+ constructor ( codeAnalyzer : CodeAnalyzer , userRules : RuleSelection , allDefaultRules : RuleSelection , relevantEngines : Set < string > ) {
226+ super ( codeAnalyzer , userRules , allDefaultRules , relevantEngines ) ;
229227 }
230228
231229 protected toYamlComment ( commentText : string ) : string {
0 commit comments