Skip to content

Conversation

@j-luong
Copy link
Contributor

@j-luong j-luong commented Nov 11, 2025

This PR fixes a code file filtering issue by adding support for ignoring ignore rules that are not valid when constructing the filter rules for native code scans.

For example, a .gitignore file with . is not a valid rule and will be skipped when building the glob patterns for file filtering.

This option was chosen as the parser accepts multiple types of ignore files (e.g. .gitignore, .snyk), which may have slightly different syntax.

This PR also fixes cases where .gitignore file contains rules with special characters, e.g. *$ should now work as expected.

@snyk-io
Copy link

snyk-io bot commented Nov 11, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@snyk-io
Copy link

snyk-io bot commented Nov 11, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@j-luong j-luong force-pushed the fix/cli-1220_fileFilterInvalidRule branch 3 times, most recently from 0633198 to eba9a86 Compare November 12, 2025 12:26
@j-luong j-luong changed the title fix: support for filtering invalid ignore rules when filtering files fix: support special characters and filtering invalid ignore rules when filtering files Nov 12, 2025
@j-luong j-luong changed the title fix: support special characters and filtering invalid ignore rules when filtering files fix: support special characters and invalid ignore rules when filtering files Nov 12, 2025
@j-luong j-luong force-pushed the fix/cli-1220_fileFilterInvalidRule branch from eba9a86 to 75e1023 Compare November 12, 2025 12:37
@j-luong j-luong marked this pull request as ready for review November 12, 2025 12:46
@j-luong j-luong requested review from a team as code owners November 12, 2025 12:46
@PeterSchafer
Copy link
Contributor

Since this implementation is about creating parity with the git behaviour, maybe we can consider a comparison test? I can imagine that this uncovers some more discrepancies?

@j-luong j-luong force-pushed the fix/cli-1220_fileFilterInvalidRule branch from 75e1023 to 6e3c186 Compare November 18, 2025 18:15
@j-luong j-luong force-pushed the fix/cli-1220_fileFilterInvalidRule branch from 6e3c186 to 7cb0fc8 Compare November 20, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants