-
-
Notifications
You must be signed in to change notification settings - Fork 613
Fix errors when scanning METADATA.bzl #4207
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
Fix errors when scanning METADATA.bzl #4207
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.
Thanks a lot for detecting this and providing the fix @vasily-pozdnyakov we seem to have missed this when we moved to a different package assembly process and model here.
We were only testing the package data parsing here, but not the package assembly here (which is where assign_package_to_resources is called) hence the miss.
Do you mind also adding a test similarly like
def test_end2end_scan_can_detect_bazel(self):
test_file = self.get_test_loc('metadatabzl/new-format/METADATA.bzl')
expected_file = self.get_test_loc('metadatabzl/new-format/metadatabzl-expected.json')
result_file = self.get_temp_file('results.json')
run_scan_click(['--package', test_file, '--json-pp', result_file])
check_json_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES)
You also have to create the test file at tests/packagedcode/data/build/metadatabzl/new-format/metadatabzl-expected.json and regen this newly added test to populate this.
Signed-off-by: Vasily Pozdnyakov <vasily.pozdnyakov@tngtech.com>
Signed-off-by: Vasily Pozdnyakov <vasily.pozdnyakov@tngtech.com>
30b3167 to
bddc5a1
Compare
@AyanSinhaMahapatra
I added a test, as you proposed. Unfortunately I get an error locally, the problem is probably here:
https://github.com/aboutcode-org/scancode-toolkit/blob/4b57a7fe86e60e14694445a63f379b22ecbd7135/src/packagedcode/build.py#L270C6-L270C7
mstykow
commented
Jun 27, 2025
@AyanSinhaMahapatra how can we move this forward?
Uh oh!
There was an error while loading. Please reload this page.
Fixes #4206
Tasks
Run tests locally to check for errors.