This repository was archived by the owner on Jul 21, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,13 +29,17 @@ public class GlobalConfiguration
2929
3030 public List < CheckerConfiguration > Checks { get ; set ; } = new ( ) ;
3131
32+ public bool IsFromConfigFile { get ; set ; }
33+
3234 public static GlobalConfiguration ReadConfiguration ( string path )
3335 {
36+ Console . WriteLine ( "Reading configuration file" ) ;
3437 var deserializer = new DeserializerBuilder ( )
3538 . IgnoreUnmatchedProperties ( )
3639 . Build ( ) ;
3740 var yaml = File . ReadAllText ( path ) ;
3841 var config = deserializer . Deserialize < GlobalConfiguration > ( yaml ) ;
42+ config . IsFromConfigFile = true ;
3943
4044 return config ;
4145 }
Original file line number Diff line number Diff line change 3535rootCommand . AddOption ( configOption ) ;
3636
3737// Create global config
38- var config = new GlobalConfiguration ( ) ;
38+ var config = GlobalConfiguration . ReadConfiguration ( "/app/config.yaml" ) ;
39+
3940
4041var commandLineBuilder = new CommandLineBuilder ( rootCommand ) ;
4142
4546 var tokens = context . ParseResult . Tokens ;
4647 var args = tokens . Select ( t => t . Value ) . ToArray ( ) ;
4748
48- // Set global options
49- config . GitIgnoreEnabled = ! args . Contains ( "--ignore-gitignore" ) ;
50- config . TruncateOutput = ! args . Contains ( "--disable-truncate" ) ;
51- config . CleanUp = ! args . Contains ( "--disable-cleanup" ) ;
52-
53- // Set path to save to
54- if ( context . ParseResult . HasOption ( pathToSaveOption ) )
55- {
56- config . PathToSaveGitRepos = context . ParseResult . GetValueForOption ( pathToSaveOption ) ! ;
57- }
58-
59- // Handle config file
6049 if ( context . ParseResult . HasOption ( configOption ) )
6150 {
6251 try
6352 {
6453 var configFile = context . ParseResult . GetValueForOption ( configOption ) ! ;
6554 var newConfig = GlobalConfiguration . ReadConfiguration ( configFile . FullName ) ;
66- if ( newConfig != null )
55+ if ( newConfig . IsFromConfigFile )
6756 {
6857 config = newConfig ;
6958 }
7564 }
7665 }
7766
67+ // Set global options
68+ config . GitIgnoreEnabled = ! args . Contains ( "--ignore-gitignore" ) ;
69+ config . TruncateOutput = ! args . Contains ( "--disable-truncate" ) ;
70+ config . CleanUp = ! args . Contains ( "--disable-cleanup" ) ;
71+
72+ // Set path to save to
73+ if ( context . ParseResult . HasOption ( pathToSaveOption ) )
74+ {
75+ config . PathToSaveGitRepos = context . ParseResult . GetValueForOption ( pathToSaveOption ) ! ;
76+ }
77+
7878 await next ( context ) ;
7979} ) ;
8080
Original file line number Diff line number Diff line change 11Checks :
22 - Name : " License Exists"
33 AllowedToFail : true
4-
5- PathToSaveGitRepos : " ~/RepositoryLinter/git_repos"
4+ - Name : " .gitignore exists"
5+ AllowedToFail : true
6+ - Name : " README exists"
7+ AllowedToFail : true
8+ - Name : " GitHub Workdflow exists"
9+ AllowedToFail : true
10+ - Name : " Secrets check"
11+ AllowedToFail : true
12+ - Name : " Tests exists"
13+ AllowedToFail : true
You can’t perform that action at this time.
0 commit comments