Configure CodeQL to exclude test directories from security scanning#403
Merged
thomasturrell merged 2 commits intomainfrom Nov 20, 2025
Merged
Configure CodeQL to exclude test directories from security scanning#403thomasturrell merged 2 commits intomainfrom
thomasturrell merged 2 commits intomainfrom
Conversation
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update CodeQL workflow to ignore test files and directories
Configure CodeQL to exclude test directories from security scanning
Nov 20, 2025
thomasturrell
approved these changes
Nov 20, 2025
|
Contributor
There was a problem hiding this comment.
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 |
Comment on lines
+19
to
+21
| - "**/target/**" | ||
| - "**/build/**" | ||
| - "**/.mvn/**" |
There was a problem hiding this comment.
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.
Suggested change
| - "**/target/**" | |
| - "**/build/**" | |
| - "**/.mvn/**" | |
| - "**/target/**" | |
| - "**/build/**" | |
| - "**/.mvn/**" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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.