aspect-build / aspect-build/rules_lint
[Bug]: custom buildifier with flags doesn't seem to work
- Dominant language
- Starlark
- Stars
- 154
- Forks
- 125
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 20
Description
### What happened?
Here's my setup:
```starlark
load("@aspect_rules_lint//format:defs.bzl", "multi_formatter_binary")
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
load("@npm//:prettier/package_json.bzl", prettier = "bin")
buildifier(
name = "buildifier",
exclude_patterns = ["./node_modules/*"],
lint_mode = "fix",
lint_warnings = [
"attr-cfg",
"attr-license",
"attr-non-empty",
"attr-output-default",
"attr-single-file",
"constant-glob",
"ctx-actions",
"ctx-args",
"depset-iteration",
"depset-union",
"dict-concatenation",
"duplicated-name",
"filetype",
"git-repository",
"http-archive",
"integer-division",
"load",
"load-on-top",
"native-build",
"native-package",
"out-of-order-load",
"output-group",
"package-name",
"package-on-top",
"positional-args",
"redefined-variable",
"repository-name",
"same-origin-load",
"string-iteration",
"unsorted-dict-items",
"unused-variable",
],
verbose = True,
)
multi_formatter_binary(
name = "format",
javascript = ":prettier",
# TODO: This seems to break
starlark = ":buildifier",
visibility = ["//visibility:public"],
)
```
The `buildifier` target as you can see has a bunch of flags presets. When I try to run the format target it bombs out:
```
Running Buildifier...
FAILED: A formatter tool exited with code 1
Try running 'bazel run //:format' to fix this.
```
### Version
Development (host) and target OS/architectures:
Output of `bazel --version`: aspect 5.3.4
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
_No response_
### Any other information?
_No response_
Contributor guide
Research direction
Start by reproducing the failure from the issue's `buildifier` and `multi_formatter_binary` targets, including the listed lint flags, and run the `format` target. Trace how the custom Buildifier target is invoked and identify why the flags produce exit code 1. Done means the format target runs successfully with the configured flags.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100