I want to ignore test files in codeql result. but this query includes test files.
import codeql.ruby.AST
from RegExpLiteral t, File f
where not f.getBaseName().regexpMatch("spec")
select t
ignore test files in the result
I want to ignore test files in codeql result. but this query includes test files.
import codeql.ruby.AST
from RegExpLiteral t, File f
where not f.getBaseName().regexpMatch("spec")
select t
ignore test files in the result
Copyright © 2021 Jogjafile Inc.
regexpMatch
requires that the given pattern matches the entire receiver. In your case that means it would only succeed if the file name is exactly "spec". Maybe you rather want to test for".*spec.*"
(or usematches("%spec%")
).I am not sure though if that answers your question. As far as I know there is in general no direct way to ignore test sources. You could however do one of the following things: