Skip to content

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

vasily-pozdnyakov
Copy link
Contributor

@vasily-pozdnyakov vasily-pozdnyakov commented Mar 20, 2025

Fixes #4206

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁

Signed-off-by: Vasily Pozdnyakov <vasily.pozdnyakov@tngtech.com>
Copy link
Member

@AyanSinhaMahapatra AyanSinhaMahapatra left a 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):
like the following:

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.

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.

Errors when scanning METADATA.bzl
2 participants