Skip to content

[Bug]: Many linters fail with --@aspect_rules_lint//lint:fail_on_violation #495

@fzakaria

Description

@fzakaria

What happened?

Our code gets run in a TTY on our CI session.

  1. --aspect:interactive=false but turns out error code is not propagated by default
  2. --@aspect_rules_lint//lint:fail_on_violation but then we hit the below error.

Here is an example from running within rules_lint itself.

> bazel lint //src:unused_import --@aspect_rules_lint//lint:fail_on_violation
INFO: Invocation ID: 930021c7-989d-4163-a400-25a161718aa9
WARNING: Build option --@@aspect_rules_lint~//lint:fail_on_violation has changed, discarding analysis cache (this can be expensive, see https://bazel.build/advanced/performance/iteration-speed).
ERROR: /Users/fzakaria/code/github.com/aspect-build/rules_lint/example/src/BUILD.bazel:64:11: in //tools/lint:linters.bzl%ruff aspect on py_library rule //src:unused_import:
Traceback (most recent call last):
        File "/private/var/tmp/_bazel_fzakaria/671b66063935a10d3c52389fcec1c769/external/aspect_rules_lint~/lint/ruff.bzl", line 176, column 17, in _ruff_aspect_impl
                ruff_fix(ctx, ctx.executable, files_to_lint, ctx.files._config_files, outputs.patch, outputs.human.out, outputs.human.exit_code, env = color_env)
        File "/private/var/tmp/_bazel_fzakaria/671b66063935a10d3c52389fcec1c769/external/aspect_rules_lint~/lint/ruff.bzl", line 148, column 58, in ruff_fix
                "JS_BINARY__EXIT_CODE_OUTPUT_FILE": exit_code.path,
Error: 'NoneType' value has no field or method 'path'
Target //src:unused_import up-to-date (nothing to build)
ERROR: Analysis of aspects '[//tools/lint:linters.bzl%eslint, //tools/lint:linters.bzl%buf, //tools/lint:linters.bzl%ktlint, //tools/lint:linters.bzl%pmd, //tools/lint:linters.bzl%stylelint, //tools/lint:linters.bzl%ruff, //tools/lint:linters.bzl%vale, //tools/lint:linters.bzl%checkstyle, //tools/lint:linters.bzl%clang_tidy, //tools/lint:linters.bzl%spotbugs, //tools/lint:linters.bzl%keep_sorted] with parameters {} on //src:unused_import' failed; build aborted: Analysis of target '//src:unused_import' failed
INFO: Elapsed time: 0.568s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully

Version

Development (host) and target OS/architectures:

Output of bazel --version:

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

How to reproduce

Any other information?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingengagement noterelated to an Aspect engagement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions