Skip to content

Commit ab0a62d

Browse files
authored
[tools] Remove bzlcodestyle (#23520)
It is not a good value. Buildifier is sufficient on its own.
1 parent 8e81972 commit ab0a62d

File tree

5 files changed

+5
-148
lines changed

5 files changed

+5
-148
lines changed

doc/_pages/code_style_tools.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ User manuals for the style-checking tools are as follows:
4040
[http://pycodestyle.readthedocs.io/en/latest/intro.html](http://pycodestyle.readthedocs.io/en/latest/intro.html).
4141
* The syntax ``# noqa`` can be used to quiet the warning about an overly-long
4242
line.
43-
* Bazel: Uses both pycodestyle like Python, and also the buildifier tool as
44-
described in [Updating BUILD files](/bazel.html#updating-build-files).
43+
* Bazel: Uses the buildifier tool as described in
44+
[Updating BUILD files](/bazel.html#updating-build-files).
4545

4646
To opt-out of all linting (e.g., when committing vendored copies of third-party
4747
external files into Drake's workspace), add `tags = ["nolint"]` to the

tools/lint/BUILD.bazel

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,6 @@ drake_py_binary(
8282
],
8383
)
8484

85-
drake_py_binary(
86-
name = "bzlcodestyle",
87-
srcs = ["bzlcodestyle.py"],
88-
main = "bzlcodestyle.py",
89-
deps = [
90-
":module_py",
91-
"@pycodestyle_internal//:pycodestyle",
92-
],
93-
)
94-
9585
drake_py_binary(
9686
name = "install_lint_reporter",
9787
testonly = 1,

tools/lint/bazel_lint.bzl

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,10 @@ load("//tools/skylark:drake_py.bzl", "py_test_isolated")
33
#------------------------------------------------------------------------------
44
# Internal helper; set up test given name and list of files. Will do nothing
55
# if no files given.
6-
def _bazel_lint(name, files, ignore):
6+
def _bazel_lint(name, files):
77
if files:
8-
ignores = ["E%s" % e for e in (ignore or [])]
9-
10-
# W504 relates to linebreaks around binary operators; buildifier
11-
# disagrees with what pycodestyle wants to do.
12-
ignores.append("W504")
13-
14-
ignores_as_arg = ["--ignore=" + ",".join(ignores)]
158
locations = ["$(locations %s)" % f for f in files]
169

17-
py_test_isolated(
18-
name = name + "_codestyle",
19-
size = "small",
20-
srcs = ["@drake//tools/lint:bzlcodestyle"],
21-
data = files,
22-
args = ignores_as_arg + locations + ["--max-line-length=80"],
23-
main = "@drake//tools/lint:bzlcodestyle.py",
24-
tags = ["bzlcodestyle", "lint"],
25-
)
26-
2710
py_test_isolated(
2811
name = name + "_buildifier",
2912
size = "small",
@@ -37,32 +20,20 @@ def _bazel_lint(name, files, ignore):
3720
#------------------------------------------------------------------------------
3821
def bazel_lint(
3922
name = "bazel",
40-
ignore = None,
4123
extra_srcs = None,
4224
exclude = None):
4325
"""
44-
Runs the ``bzlcodestyle`` code style checker on all Bazel files in the
45-
current directory. The tool is based on the ``pycodestyle`` :pep:`8` code
46-
style checker, but always disables certain checks while adding others.
26+
Runs ``buildifier -mode=check`` format checker on all Bazel files in the
27+
current directory.
4728
4829
Args:
4930
name: Name prefix of the test (default = "bazel").
50-
ignore: List of errors (as integers, without the 'E') to ignore
51-
(default = [265, 302, 305]).
5231
extra_srcs: List of files to lint that would otherwise be missed by the
5332
default glob pattern for Bazel source code.
5433
exclude: List to be passed to the skylark glob function for files that
5534
should not be linted (e.g., vendored files).
56-
57-
Example:
58-
BUILD:
59-
load("//tools/lint:bazel_lint.bzl", "bazel_lint")
60-
61-
bazel_lint()
6235
"""
6336

64-
if ignore == None:
65-
ignore = [265, 302, 305]
6637
if extra_srcs == None:
6738
extra_srcs = []
6839
if exclude == None:
@@ -82,5 +53,4 @@ def bazel_lint(
8253
exclude = exclude,
8354
allow_empty = True,
8455
) + extra_srcs,
85-
ignore = ignore,
8656
)

tools/lint/bzlcodestyle.py

Lines changed: 0 additions & 101 deletions
This file was deleted.

tools/lint/lint.bzl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def add_lint_tests(
1010
python_lint_exclude = None,
1111
python_lint_extra_srcs = None,
1212
python_lint_use_ruff = False,
13-
bazel_lint_ignore = None,
1413
bazel_lint_extra_srcs = None,
1514
bazel_lint_exclude = None,
1615
enable_install_lint = True,
@@ -39,7 +38,6 @@ def add_lint_tests(
3938
use_ruff = python_lint_use_ruff,
4039
)
4140
bazel_lint(
42-
ignore = bazel_lint_ignore,
4341
extra_srcs = bazel_lint_extra_srcs,
4442
exclude = bazel_lint_exclude,
4543
)

0 commit comments

Comments
 (0)