-
Notifications
You must be signed in to change notification settings - Fork 4
Configure CodeQL to exclude test directories from security scanning #403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR configures CodeQL to exclude test directories from security scanning, focusing analysis on production code and reducing noise from test sources. It implements a two-layer exclusion strategy using both workflow triggers and analysis-level configuration.
- Created
.github/codeql-config.ymlwith path exclusions for test files and build artifacts - Updated
.github/workflows/codeql.ymlto use the custom config and skip workflow triggers for test-only changes
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
.github/codeql-config.yml |
Defines CodeQL configuration to exclude test directories, test files, and build artifacts from security scanning |
.github/workflows/codeql.yml |
Updated workflow to reference custom config file and added paths-ignore filters to prevent triggering on test-only changes |
| - "**/target/**" | ||
| - "**/build/**" | ||
| - "**/.mvn/**" |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YAML syntax error: Lines 19-21 are incorrectly indented under the comment on line 18. These lines should be at the same indentation level as line 13 (under paths-ignore:), not as separate items.
| - "**/target/**" | |
| - "**/build/**" | |
| - "**/.mvn/**" | |
| - "**/target/**" | |
| - "**/build/**" | |
| - "**/.mvn/**" |



Description
Configures CodeQL to exclude test directories from security analysis, focusing scanning on production code and reducing noise from test sources.
Resolves #399
Changes
Created
.github/codeql-config.yml:**/src/test/**,**/test/**,**/*Test.java,**/*Tests.java**/target/**,**/build/**,**/.mvn/**Updated
.github/workflows/codeql.yml:paths-ignoreto push/pull_request triggers to skip workflow when only tests changeconfig-file: ./.github/codeql-config.ymlImpact
Checklist:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.