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<()> {
15
15
let mut cmd = Command :: new ( codeql) ;
16
16
cmd. arg ( "database" )
17
17
. arg ( "index-files" )
18
+ . arg ( "--include-extension=.ql" )
19
+ . arg ( "--include-extension=.qll" )
20
+ . arg ( "--include-extension=.dbscheme" )
21
+ . arg ( "--include=**/qlpack.yml" )
18
22
. arg ( "--size-limit=5m" )
19
23
. arg ( "--language=ql" )
20
24
. arg ( "--working-dir=." )
21
25
. arg ( db) ;
22
26
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 ( ) ? ;
24
28
for line in env:: var ( "LGTM_INDEX_FILTERS" )
25
29
. unwrap_or_default ( )
26
30
. split ( '\n' )
27
31
{
28
32
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) ;
31
40
} 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) ;
33
49
}
34
50
}
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
- }
41
51
let exit = & cmd. spawn ( ) ?. wait ( ) ?;
42
52
std:: process:: exit ( exit. code ( ) . unwrap_or ( 1 ) )
43
53
}
Original file line number Diff line number Diff line change @@ -24,14 +24,28 @@ fn main() -> std::io::Result<()> {
24
24
. arg ( "--working-dir=." )
25
25
. arg ( db) ;
26
26
27
+ let pwd = env:: current_dir ( ) ?;
27
28
for line in env:: var ( "LGTM_INDEX_FILTERS" )
28
29
. unwrap_or_default ( )
29
30
. split ( '\n' )
30
31
{
31
32
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) ;
33
40
} 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) ;
35
49
}
36
50
}
37
51
let exit = & cmd. spawn ( ) ?. wait ( ) ?;
You can’t perform that action at this time.
0 commit comments