Commit 8f176a2
committed
ci: check lint with Black
Summary:
The Black binary only runs Python 3.6 and up, so we only lint in the
Python 3 CI build, but that’s perfectly fine. I’ve moved that build to
be first so that we can fail fast.
The preceding large sequence of change commits was generated with:
```
#!/bin/sh
set -eu
black .
docformatter -i -r .
black . # should be a no-op
export GIT_AUTHOR_NAME="TensorBoard Gardener"
export GIT_AUTHOR_EMAIL="tensorboard-gardener@google.com"
# Commit each directory in order of longest-named directory to
# shortest-named, to force a topological ordering. Collapse some select
# subtrees to reduce the number of commits.
git diff --numstat \
| awk '{ print $3 }' \
| rev \
| cut -d / -f 2- \
| rev \
| sed -e 's#/\(test\|demo\)$##' \
| sed -e 's#^\(tensorboard/compat\)/.*#\1#' \
| sed -e 's#^\(tensorboard/plugins/interactive_inference\)/.*#\1#' \
| sed -e 's#^\(tensorboard/summary\)/.*#\1#' \
| sort -u \
| awk '{ print length($0), $0 }' \
| sort -nrs \
| awk '{ print $2 }' \
| while read -r dir
do
git add "${dir}"
if git commit -m "black: reformat directory ${dir}" >/dev/null 2>&1; then
printf 'reformat %s: ' "${dir}"
git show --oneline --shortstat | tail -n 1
else
printf 'skip %s (covered by subtrees)\n' "${dir}"
fi
done
```
Test Plan:
Running `black --check .` currently passes, as all files have been fixed
up. It takes about 0.3 seconds on my machine.
wchargin-branch: ci-black1 parent b7ce827 commit 8f176a2
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| 92 | + | |
| 93 | + | |
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
| |||
0 commit comments