@@ -65,7 +65,8 @@ pub async fn run_main(args: Vec<String>) -> i32 {
65
65
}
66
66
67
67
if cli. repo_root != "." {
68
- env:: set_current_dir ( Path :: new ( & cli. repo_root ) ) . unwrap ( ) ;
68
+ env:: set_current_dir ( Path :: new ( & cli. repo_root ) )
69
+ . unwrap_or_else ( |_| panic ! ( "'{}' is inaccessible or does not exist" , cli. repo_root) ) ;
69
70
}
70
71
71
72
let rest_api_client = GithubApiClient :: new ( ) ;
@@ -78,6 +79,9 @@ pub async fn run_main(args: Vec<String>) -> i32 {
78
79
79
80
let mut file_filter = FileFilter :: new ( & cli. ignore , cli. extensions . clone ( ) ) ;
80
81
file_filter. parse_submodules ( ) ;
82
+ if let Some ( files) = & cli. not_ignored {
83
+ file_filter. not_ignored . extend ( files. clone ( ) ) ;
84
+ }
81
85
82
86
if !file_filter. ignored . is_empty ( ) {
83
87
log:: info!( "Ignored:" ) ;
@@ -92,14 +96,6 @@ pub async fn run_main(args: Vec<String>) -> i32 {
92
96
}
93
97
}
94
98
95
- if let Some ( files) = args. get_many :: < Vec < String > > ( "files" ) {
96
- for list in files {
97
- file_filter
98
- . not_ignored
99
- . extend ( list. iter ( ) . map ( |v| v. to_string ( ) ) . collect :: < Vec < String > > ( ) ) ;
100
- }
101
- }
102
-
103
99
start_log_group ( String :: from ( "Get list of specified source files" ) ) ;
104
100
let files = if cli. lines_changed_only != LinesChangedOnly :: Off || cli. files_changed_only {
105
101
// parse_diff(github_rest_api_payload)
@@ -140,7 +136,10 @@ mod test {
140
136
run_main( vec![
141
137
"cpp-linter" . to_string( ) ,
142
138
"-l" . to_string( ) ,
143
- "false" . to_string( )
139
+ "false" . to_string( ) ,
140
+ "--repo-root" . to_string( ) ,
141
+ "tests" . to_string( ) ,
142
+ "demo/demo.cpp" . to_string( ) ,
144
143
] )
145
144
. await ,
146
145
0
0 commit comments