Skip to content
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 crash caused by fail-on-violation and no lintable files in target #362

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

tokongs
Copy link
Contributor

@tokongs tokongs commented Aug 9, 2024

#331 introduced a bug where the noop lint fails if running with fail on validation.

If we have a lint aspect that has no files to lint and run with fail-on-validation the exit_code file will be set to None. Which is why we need to check that its not None before trying to access its path.

Relevant error

Traceback (most recent call last):
        File "/home/tokongs/.cache/bazel/_bazel_tokongs/51d0d670cf09bb319bf1151bdc73a969/external/aspect_rules_lint~/lint/ruff.bzl", line 165, column 25, in _ruff_aspect_impl
                noop_lint_action(ctx, outputs)
        File "/home/tokongs/.cache/bazel/_bazel_tokongs/51d0d670cf09bb319bf1151bdc73a969/external/aspect_rules_lint~/lint/private/lint_aspect.bzl", line 144, column 65, in noop_lint_action
                commands.append("echo 0 > {}".format(outputs.human.exit_code.path))
Error: 'NoneType' value has no field or method 'path'

Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: no
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: yes

Suggested release notes: fix crash caused by noop lints running with fail-on-validation

@CLAassistant
Copy link

CLAassistant commented Aug 9, 2024

CLA assistant check
All committers have signed the CLA.

If we have a lint aspect that has no files to lint and run with fail-on-validation
the exit_code file will be set to None. Which is why we need to check
that its not None before trying to access its path.
@tokongs tokongs changed the title Fix creash caused by fail-on-violation and no lintable files in target Fix crash caused by fail-on-violation and no lintable files in target Aug 9, 2024
@alexeagle alexeagle merged commit 76382bc into aspect-build:main Aug 9, 2024
8 checks passed
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.

3 participants