Skip to content

Commit 47c5fae

Browse files
redsun82Copilot
andcommitted
Just: inline the single-use values no other repository redirects
A name here is an interface a consuming root may assign, so the ones worth keeping are the ones someone would reasonably point elsewhere, not the ones used more than once. Neither of these is: quieting bazel shapes output only, and the dropped tally is deliberately not the lever for a noisy one. Their reasons move to what is left, next to the argument split that is genuinely not obvious. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent fd05c30 commit 47c5fae

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

misc/just/format.just

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@ _bazel_workspace := quote(parent_directory(parent_directory(source_dir())))
1414

1515
_bazel_formatter := (if SEMMLE_CODE != "" { '"$SEMMLE_CODE/tools/bazel"' } else { "bazel" }) + " run @buildifier_prebuilt//:buildifier"
1616

17+
# Kept out of the formatter, unlike the other three: bazel's own flags have to sit between
18+
# the target and `--`, so no single string spans both sides of it.
1719
_bazel_args := "-mode=fix -lint=fix"
1820

19-
# These have to sit between the target and `--`, which is what keeps `_bazel_args` from
20-
# folding into the invocation the way the other formatters' arguments do. Only output is
21-
# at stake here, which is what the banner leaves out.
22-
_bazel_quiet := "--noshow_progress --ui_event_filters=,+error,+fail"
23-
2421
# Keep both in step with the `buildifier` target. The names are what it recognises walking a
2522
# workspace, a check it skips for paths handed to it, so anything extra here is rewritten
2623
# regardless. Exclusions match the path as walked, so one naming a directory has to cover
@@ -29,14 +26,11 @@ _bazel_names := "BUILD,WORKSPACE,*.bazel,*.bzl,*.sky,*.star"
2926

3027
_bazel_excluded := ".git/*,*/.git/*,*misc/bazel/3rdparty/*_deps/*"
3128

32-
# `-v` accounts for every file, so the empty tally is dropped. A non-zero one is kept: it is
33-
# the only notice of warnings buildifier could not fix, as the exit code stays 0 regardless.
34-
_bazel_accounting := ': applied fixes, 0 warnings left$'
35-
3629
# These formatters take files rather than directories, so `run_on_files.py` collects them
37-
# and passes them positionally, which is what lets paths contain spaces. `codeql query
38-
# format` likewise only reports what it rewrote if it also names everything it did not, so
39-
# those lines are dropped and nothing else is.
30+
# and passes them positionally, which is what lets paths contain spaces. Both name every
31+
# file they were given, so the lines saying nothing happened are dropped: for buildifier
32+
# that is an empty warning tally, and a non-zero one is left alone, being the only notice
33+
# of what it could not fix now that the exit code is 0 either way.
4034
#
4135
# The banner is a report rather than a command to paste: it names the formatter and what
4236
# it is told to do, and leaves out the collecting, the patterns walked and the flags that
@@ -73,4 +67,4 @@ _bazel_accounting := ': applied fixes, 0 warnings left$'
7367
[positional-arguments]
7468
@_format_bazel *ARGS=".":
7569
echo "$CMD_BEGIN-> "{{ quote(_bazel_formatter + " -- " + _bazel_args) }}" -- $*$CMD_END" >&2
76-
{{ py }} "{{ source_dir() }}/run_on_files.py" --absolute --chdir {{ _bazel_workspace }} --within {{ _bazel_workspace }} --drop '{{ _bazel_accounting }}' --exclude '{{ _bazel_excluded }}' "{{ _bazel_names }}" {{ _bazel_formatter }} {{ _bazel_quiet }} -- {{ _bazel_args }} -v -- "$@"
70+
{{ py }} "{{ source_dir() }}/run_on_files.py" --absolute --chdir {{ _bazel_workspace }} --within {{ _bazel_workspace }} --drop ': applied fixes, 0 warnings left$' --exclude '{{ _bazel_excluded }}' "{{ _bazel_names }}" {{ _bazel_formatter }} --noshow_progress --ui_event_filters=,+error,+fail -- {{ _bazel_args }} -v -- "$@"

0 commit comments

Comments
 (0)