1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-20 13:50:12 +01:00

Merge branch 'consistent-linting-formatting' into 'master'

make linting and formatting rules consistent

See merge request fdroid/fdroidserver!1160
This commit is contained in:
Hans-Christoph Steiner 2023-05-04 14:12:09 +00:00
commit 41104e217b
3 changed files with 25 additions and 22 deletions

View File

@ -52,20 +52,6 @@ else
done done
fi fi
# We ignore the following PEP8 warnings
# * E123: closing bracket does not match indentation of opening bracket's line
# - Broken if multiple indentation levels start on a single line
# * E203: whitespace before ':'
# - E203 is not PEP 8 compliant and conflict with black
# * E501: line too long (82 > 79 characters)
# - Recommended for readability but not enforced
# - Some lines are awkward to wrap around a char limit
# * W503: line break before binary operator
# - Quite pedantic
PEP8_IGNORE="E123,E203,E501,W503"
err() { err() {
echo >&2 ERROR: "$@" echo >&2 ERROR: "$@"
exit 1 exit 1
@ -96,7 +82,7 @@ find_command() {
DASH=$(find_command dash) DASH=$(find_command dash)
PYDOCSTYLE=$(find_command pydocstyle) PYDOCSTYLE=$(find_command pydocstyle)
PYFLAKES=$(find_command pyflakes) PYFLAKES=$(find_command pyflakes)
PEP8=$(find_command pycodestyle pep8) PYCODESTYLE=$(find_command pycodestyle pep8)
RUBY=$(find_command ruby) RUBY=$(find_command ruby)
YAMLLINT=$(find_command yamllint) YAMLLINT=$(find_command yamllint)
@ -110,16 +96,13 @@ if [ "$PY_FILES $PY_TEST_FILES" != " " ]; then
fi fi
if [ "$PY_FILES" != "" ]; then if [ "$PY_FILES" != "" ]; then
if ! $PEP8 --ignore=$PEP8_IGNORE $PY_FILES; then if ! $PYCODESTYLE $PY_FILES; then
err "pep8 tests failed!" err "pep8 tests failed!"
fi fi
fi fi
# The tests use a little hack in order to cleanly import the fdroidserver
# package locally like a regular package. pep8 doesn't see that, so this
# makes pep8 skip E402 on the test files that need that hack.
if [ "$PY_TEST_FILES" != "" ]; then if [ "$PY_TEST_FILES" != "" ]; then
if ! $PEP8 --ignore=$PEP8_IGNORE,E402 $PY_TEST_FILES; then if ! $PYCODESTYLE $PY_TEST_FILES; then
err "pep8 tests failed!" err "pep8 tests failed!"
fi fi
fi fi

View File

@ -1,3 +1,23 @@
# We ignore the following PEP8 warnings
# * E123: closing bracket does not match indentation of opening bracket's line
# - Broken if multiple indentation levels start on a single line
# * E203: whitespace before ':'
# - E203 is not PEP 8 compliant and conflict with black
# * E402: module level import not at top of file
# - The tests use a little hack in order to cleanly import the
# fdroidserver package locally like a regular package. pep8 doesn't
# see that, so this makes pep8 skip E402 on the test files that need
# that hack.
# * E501: line too long (82 > 79 characters)
# - Recommended for readability but not enforced
# - Some lines are awkward to wrap around a char limit
# * W503: line break before binary operator
# - Quite pedantic
[tool.autopep8]
ignore = "E123,E203,E402,E501,W503"
[tool.black] [tool.black]
skip-string-normalization = true skip-string-normalization = true
target-version = ["py38"] target-version = ["py38"]

View File

@ -40,11 +40,11 @@ domain = fdroidserver
directory = locale directory = locale
[pycodestyle] [pycodestyle]
ignore = E203,W503 ignore = E123,E203,E402,E501,W503
max-line-length = 88 max-line-length = 88
[flake8] [flake8]
ignore = E203,W503 ignore = E123,E203,E402,E501,W503
max-line-length = 88 max-line-length = 88
# Settings for docstrings linter # Settings for docstrings linter