tooling: add black and flake8 for python formatting/linting (#6454)
This commit is contained in:
@@ -16,6 +16,21 @@ function run_tests {
|
||||
for f in ./pages.*; do
|
||||
tldr-lint --ignore "TLDR003,TLDR004,TLDR005,TLDR015,TLDR104" ${f}
|
||||
done
|
||||
run_black
|
||||
flake8 scripts
|
||||
}
|
||||
|
||||
# Wrapper around black as it outputs everything to stderr,
|
||||
# but we want to only print if there are actual errors, and not
|
||||
# the "All done!" success message.
|
||||
function run_black {
|
||||
# we want to ignore the exit code from black on failure, so that we can
|
||||
# do the conditional printing below
|
||||
errs=$(black scripts --check 2>&1 || true)
|
||||
if [[ ${errs} != "All done!"* ]]; then
|
||||
echo -e "${errs}" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Special test function for GitHub Actions pull request builds.
|
||||
|
Reference in New Issue
Block a user