bazel-contrib / bazel-contrib/buildtools

fix silently fails to fix

Open
#1,406 1 comment 0 reactions 0 assignees View on GitHub
P2
Dominant language
Go
Stars
1.2k
Forks
471
Avg merge
2d 22h
Merged PRs (30d)
13

Description

-lint=fix doesn't fix an unused-variable silently leaving the impression there are no problems. If it fails it should print the lint=warn message.

Very trivial test case:
```
ALL_TESTS2 = COMPULSORY_TESTS
```

```
% buildifier --lint=warn BUILD
BUILD:1: unused-variable: Variable "ALL_TESTS2" is unused. Please remove it. (https://github.com/bazelbuild/buildtools/blob/main/WARNINGS.md#unused-variable)

% buildifier --lint=fix BUILD

% buildifier --lint=warn BUILD
BUILD:1: unused-variable: Variable "ALL_TESTS2" is unused. Please remove it. (https://github.com/bazelbuild/buildtools/blob/main/WARNINGS.md#unused-variable)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior with the provided BUILD file and the buildifier commands using --lint=warn and --lint=fix. Trace the buildifier lint=fix entry point and compare its handling of the unused-variable case with lint=warn; done means the fix attempt reports the warning when the issue remains.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.