-
-
Notifications
You must be signed in to change notification settings - Fork 644
Support directory paths in referenced_filenames rule attribute #4647
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
base: develop
Are you sure you want to change the base?
Support directory paths in referenced_filenames rule attribute #4647
Conversation
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 enhances the find_referenced_resource function to support directory paths and glob patterns in the referenced_filenames rule attribute, addressing issue #4276. The function now returns a list of Resources instead of a single Resource to accommodate multiple matches.
Key changes:
- Modified
find_referenced_resourceandfind_referenced_resource_from_packageto return lists of Resources instead of single Resources - Added glob pattern support using
fnmatchfor matching multiple files - Added directory support to return all children when a directory path is referenced
- Updated calling code in
update_detection_from_referenced_filesto handle list returns
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| src/licensedcode/detection.py | Updated find_referenced_resource and related functions to support glob patterns and directory paths, changing return type from single Resource to list of Resources |
| tests/licensedcode/test_plugin_license_detection.py | Updated existing tests to expect list returns instead of single Resource objects |
| tests/licensedcode/test_issue_4276.py | Added new test cases for glob pattern matching and directory reference functionality |
| CHANGELOG.rst | Added changelog entry documenting the new feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This change updates find_referenced_resource to return a list of resources matching the referenced path, enabling support for directory paths in referenced_filenames. Explicit support for glob patterns is also verified. Fixes aboutcode-org#4276 Signed-off-by: Aditya <[email protected]> Signed-off-by: Aditya Shirsatrao <[email protected]>
f78f365 to
4a9b365
Compare
This PR updates 'find_referenced_resource' to support directory paths in 'referenced_filenames', enabling rules to match all files within a referenced directory. This fixes #4276.