File tree Expand file tree Collapse file tree 2 files changed +36
-12
lines changed
Expand file tree Collapse file tree 2 files changed +36
-12
lines changed Original file line number Diff line number Diff line change @@ -15,29 +15,39 @@ fn main() -> std::io::Result<()> {
1515 let mut cmd = Command :: new ( codeql) ;
1616 cmd. arg ( "database" )
1717 . arg ( "index-files" )
18+ . arg ( "--include-extension=.ql" )
19+ . arg ( "--include-extension=.qll" )
20+ . arg ( "--include-extension=.dbscheme" )
21+ . arg ( "--include=**/qlpack.yml" )
1822 . arg ( "--size-limit=5m" )
1923 . arg ( "--language=ql" )
2024 . arg ( "--working-dir=." )
2125 . arg ( db) ;
2226
23- let mut has_include_dir = false ; // TODO: This is a horrible hack, wait for the post-merge discussion in https://github.com/github/codeql/pull/7444 to be resolved
27+ let pwd = env :: current_dir ( ) ? ;
2428 for line in env:: var ( "LGTM_INDEX_FILTERS" )
2529 . unwrap_or_default ( )
2630 . split ( '\n' )
2731 {
2832 if let Some ( stripped) = line. strip_prefix ( "include:" ) {
29- cmd. arg ( "--include" ) . arg ( stripped) ;
30- has_include_dir = true ;
33+ let path = pwd
34+ . join ( stripped)
35+ . join ( "**" )
36+ . into_os_string ( )
37+ . into_string ( )
38+ . unwrap ( ) ;
39+ cmd. arg ( "--also-match" ) . arg ( path) ;
3140 } else if let Some ( stripped) = line. strip_prefix ( "exclude:" ) {
32- cmd. arg ( "--exclude" ) . arg ( stripped) ;
41+ let path = pwd
42+ . join ( stripped)
43+ . join ( "**" )
44+ . into_os_string ( )
45+ . into_string ( )
46+ . unwrap ( ) ;
47+ // the same as above, but starting with "!"
48+ cmd. arg ( "--also-match" ) . arg ( "!" . to_owned ( ) + & path) ;
3349 }
3450 }
35- if !has_include_dir {
36- cmd. arg ( "--include-extension=.ql" )
37- . arg ( "--include-extension=.qll" )
38- . arg ( "--include-extension=.dbscheme" )
39- . arg ( "--include=**/qlpack.yml" ) ;
40- }
4151 let exit = & cmd. spawn ( ) ?. wait ( ) ?;
4252 std:: process:: exit ( exit. code ( ) . unwrap_or ( 1 ) )
4353}
Original file line number Diff line number Diff line change @@ -24,14 +24,28 @@ fn main() -> std::io::Result<()> {
2424 . arg ( "--working-dir=." )
2525 . arg ( db) ;
2626
27+ let pwd = env:: current_dir ( ) ?;
2728 for line in env:: var ( "LGTM_INDEX_FILTERS" )
2829 . unwrap_or_default ( )
2930 . split ( '\n' )
3031 {
3132 if let Some ( stripped) = line. strip_prefix ( "include:" ) {
32- cmd. arg ( "--include" ) . arg ( stripped) ;
33+ let path = pwd
34+ . join ( stripped)
35+ . join ( "**" )
36+ . into_os_string ( )
37+ . into_string ( )
38+ . unwrap ( ) ;
39+ cmd. arg ( "--also-match" ) . arg ( path) ;
3340 } else if let Some ( stripped) = line. strip_prefix ( "exclude:" ) {
34- cmd. arg ( "--exclude" ) . arg ( stripped) ;
41+ let path = pwd
42+ . join ( stripped)
43+ . join ( "**" )
44+ . into_os_string ( )
45+ . into_string ( )
46+ . unwrap ( ) ;
47+ // the same as above, but starting with "!"
48+ cmd. arg ( "--also-match" ) . arg ( "!" . to_owned ( ) + & path) ;
3549 }
3650 }
3751 let exit = & cmd. spawn ( ) ?. wait ( ) ?;
You can’t perform that action at this time.
0 commit comments