Repository navigation
SP-4487: fix scanoss.json skip patterns for fingerprinting and negation - #219
Conversation
Two distinct issues with settings.skip.patterns: - Fingerprinting skip rules were ignored: wfp_folder built FileFilters with operation_type='scanning', so settings.skip.patterns.fingerprinting (and sizes.fingerprinting) were never read. Now uses 'fingerprinting'. - Gitignore-style negation (!) was defeated by directory pruning: a broad root pattern such as "/*" matches the scan root '.', which pruned the whole tree before any "!keep" negation could re-include a descendant. The scan root is no longer treated as a candidate for exclusion. Add regression tests and document the anchored-negation pattern (["/*", "!/game"]).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughCorrects fingerprinting skip-pattern selection and gitignore-style negation handling, adds focused tests and documentation, and releases the changes as version 1.54.1. ChangesSkip pattern corrections
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
SCANOSS SCAN Completed 🚀
View more details on SCANOSS Action Summary |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/test_file_filters.py (1)
326-416: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winGood regression coverage for both fixes.
The test classes
TestSkipPatternOperationTypeandTestSkipPatternNegationdirectly validate the two bugs being fixed:
- Operation-type scoping:
test_fingerprinting_patterns_applied_to_fingerprintingandtest_scanning_patterns_not_applied_to_fingerprintingconfirm patterns are read from the correct settings section.- Negation:
test_anchored_negation_reincludes_foldercovers the["/*", "!/game"]regression, andtest_root_is_never_pruned_by_broad_patternadds an extra guard with!/game/**.The static-analysis path-traversal warnings on lines 338 and 380 are false positives — the paths are hardcoded in test methods, not user-supplied.
One small suggestion:
TestSkipPatternNegation._filtersalways usesoperation_type='scanning'. Consider adding at least one negation test withoperation_type='fingerprinting'to confirm the root guard works across both operation types, since the guard inshould_skip_diris shared.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/test_file_filters.py` around lines 326 - 416, Add a negation regression test in TestSkipPatternNegation that constructs filters with operation_type='fingerprinting' and verifies the root guard preserves the expected re-included paths, while keeping the existing scanning coverage. Update _filters or add a dedicated helper so the operation type can be selected without duplicating setup.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/test_file_filters.py`:
- Around line 326-416: Add a negation regression test in TestSkipPatternNegation
that constructs filters with operation_type='fingerprinting' and verifies the
root guard preserves the expected re-included paths, while keeping the existing
scanning coverage. Update _filters or add a dedicated helper so the operation
type can be selected without duplicating setup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c0c082da-280c-4e2c-976d-f3acc5ea2863
📒 Files selected for processing (6)
CHANGELOG.mddocs/source/scanoss_settings_schema.rstsrc/scanoss/__init__.pysrc/scanoss/file_filters.pysrc/scanoss/scanner.pytests/test_file_filters.py
| [1.53.0]: https://github.com/scanoss/scanoss.py/compare/v1.52.1...v1.53.0 | ||
| [1.53.1]: https://github.com/scanoss/scanoss.py/compare/v1.53.0...v1.53.1 | ||
| [1.53.2]: https://github.com/scanoss/scanoss.py/compare/v1.53.1...v1.53.2 | ||
| [1.54.0]: https://github.com/scanoss/scanoss.py/compare/v1.53.2...v1.54.0 |
There was a problem hiding this comment.
Please add the new release 1.54.1 in line 917 to see the full changelog
SCANOSS SCAN Completed 🚀
View more details on SCANOSS Action Summary |
Two distinct issues with settings.skip.patterns:
Fingerprinting skip rules were ignored: wfp_folder built FileFilters with operation_type='scanning', so settings.skip.patterns.fingerprinting (and sizes.fingerprinting) were never read. Now uses 'fingerprinting'.
Gitignore-style negation (!) was defeated by directory pruning: a broad root pattern such as "/*" matches the scan root '.', which pruned the whole tree before any "!keep" negation could re-include a descendant. The scan root is no longer treated as a candidate for exclusion.
Add regression tests and document the anchored-negation pattern (["/*", "!/game"]).
Summary by CodeRabbit
!) now properly re-includes folders/files after broad skip patterns.