static code analysis: make it pass flake8 3.5.0
This commit adds two new ignores to the flake8 call: * W504 line break after binary operator * W605 invalid escape sequence 'x' Without these, newer flake8 versions, such as the one shipped by Arch Linux, don't run through on the code base (which leads to not running it at all locally, only in CI). Additional changes: * Don't give the exception instance of subprocess.CalledProcessError a name, so it does not trigger F841 * Dont' advise to run "autopep8" anymore, because that will likely touch unrelated code. For reference, here is the list of error codes: https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
This commit is contained in:
parent
3631d314d4
commit
74e103d1f2
|
@ -42,7 +42,7 @@ def check_checksums(package):
|
|||
command = ['./pmbootstrap.py', 'checksum', package]
|
||||
try:
|
||||
subprocess.check_output(command)
|
||||
except subprocess.CalledProcessError as e:
|
||||
except subprocess.CalledProcessError:
|
||||
print("Something gone wrong in pmbootstrap. Log:")
|
||||
logfile = os.path.expanduser("~/.local/var/pmbootstrap/log.txt")
|
||||
with open(logfile) as log:
|
||||
|
|
|
@ -67,10 +67,9 @@ done
|
|||
# E722: do not use bare except
|
||||
cd "$DIR"/..
|
||||
echo "Test with flake8: *.py"
|
||||
echo "NOTE: Run 'autopep8 -ria $PWD' to fix code style issues"
|
||||
# Note: omitting a virtualenv if it is here (e.g. gitlab CI)
|
||||
py_files="$(find . -not -path '*/venv/*' -name '*.py')"
|
||||
_ignores="E501,E402,E722"
|
||||
_ignores="E501,E402,E722,W504,W605"
|
||||
# shellcheck disable=SC2086
|
||||
flake8 --exclude=__init__.py --ignore "$_ignores" $py_files
|
||||
# shellcheck disable=SC2086
|
||||
|
|
Loading…
Reference in New Issue