buildtools icon indicating copy to clipboard operation
buildtools copied to clipboard

fix silently fails to fix

Open maliberty opened this issue 2 months ago • 1 comments

-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)

maliberty avatar Oct 22 '25 21:10 maliberty

Using

% buildifier --version
buildifier version: 8.2.1 
buildifier scm revision: b1e23f1025b8556cc75eebb28ff7f40b8930d353 

maliberty avatar Oct 22 '25 21:10 maliberty