Conversation
| - '**/test*' | ||
| - '**/__test__/**' | ||
| - '**/__tests__/**' | ||
| - '**/*test.*' No newline at end of file |
There was a problem hiding this comment.
Hmm, looking at https://github.com/search?q=org%3Aopengovsg+path%3A*test*&type=code I see a couple of matches like:
The rest that are in this search would be matched by the folder rules or maybe an additional folder:
- '**/test/*'
- '**/tests/*'
Would this make sense?
There was a problem hiding this comment.
Just to clarify is this what youre proposing?
- '**/*test*'
- '**/test/*'
- '**/tests/*'
I think that makes sense
There was a problem hiding this comment.
Yep! Actually just the foldernames
There was a problem hiding this comment.
Ok I figured out a way to test across all repos and I tested with
- '**/test/*'
- '**/tests/*'
- '**/__test__/*'
- '**/__tests__/*'
There are still some paths that are considered tests by AI and not covered
Of the above, I think we should add the unit tests and the playwright tests to the exclusion list with *.test.*
* feat: add nestjs and restore open redirect queries * feat: add ci checks * fix: removed duplicate checkout action * fix: add security events write to reduce configuration drift * feat: specify pack versions (#7) * feat: ignore test paths (#8) * feat: ignore test paths * feat: exclude missing workflow permissions * feat: add sample workflow with local config override support (#11) * feat: add sample workflow with local config override support * fix: add placeholder TS file for CodeQL CI --------- Co-authored-by: Eugene Lim <eugene.gvt@open.gov.sg>
Context
This repo contains a custom codeql config which is used by some repos in their workflows.
We note that there are many CodeQL alerts generated from test files, which are all irrelevant as the tests are not deployed in production code.
Of 300+ alerts on our repo, 30+ of them are alerts from test files, and all of them have been evaluated to be ignoreable.
Approach
This PR adjusts the CodeQL config to remove test files from being scanned, using the
paths-ignoredirective.Risks
Due to the regex used, there is a possibility of interpreting non-test files as test files and therefore ignoring them.
However the reduction in false positives should readily outweigh potentially missing a finding or two.