diff --git a/Makefile b/Makefile index 1c38638b9..d72be2ae6 100644 --- a/Makefile +++ b/Makefile @@ -469,12 +469,24 @@ fix-imports-only: mkdir-reports ## apply import code checks corrections isort --recursive $(APP_ROOT) \ 1> >(tee "$(REPORTS_DIR)/fixed-imports.txt")' +# FIXME: https://github.com/PyCQA/pycodestyle/issues/996 +# Tool "pycodestyle" doesn't respect "# noqa: E241" locally, but "flake8" and other tools do. +# Because "autopep8" uses "pycodestyle", it is impossible to disable locally extra spaces (as in tests to align values). +# Override the codes here from "setup.cfg" because "autopep8" also uses the "flake8" config, and we want to preserve +# global detection of those errors (typos, bad indents), unless explicitly added and excluded for readability purposes. +# WARNING: this will cause inconsistencies between what 'check-lint' detects and what 'fix-lint' can actually fix +_DEFAULT_SETUP_ERROR := E126,E226,E402,F401,W503,W504 +_EXTRA_SETUP_ERROR := E241 + .PHONY: fix-lint-only fix-lint-only: mkdir-reports ## fix some PEP8 code style problems automatically @echo "Fixing PEP8 code style problems..." @-rm -fr "$(REPORTS_DIR)/fixed-lint.txt" @bash -c '$(CONDA_CMD) \ - autopep8 -v -j 0 -i -r $(APP_ROOT) \ + autopep8 \ + --global-config "$(APP_ROOT)/setup.cfg" \ + --ignore "$(_DEFAULT_SETUP_ERROR),$(_EXTRA_SETUP_ERROR)" \ + -v -j 0 -i -r $(APP_ROOT) \ 1> >(tee "$(REPORTS_DIR)/fixed-lint.txt")' # FIXME: move parameters to setup.cfg when implemented (https://github.com/myint/docformatter/issues/10) diff --git a/setup.cfg b/setup.cfg index 060fd0ac7..3561a9852 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,21 +5,21 @@ tag = True tag_name = {new_version} [bumpversion:file:CHANGES.rst] -search = +search = `Unreleased `_ (latest) ======================================================================== -replace = +replace = `Unreleased `_ (latest) ======================================================================== - + Changes: -------- - No change. - + Fixes: ------ - No change. - + `{new_version} `_ ({now:%%Y-%%m-%%d}) ======================================================================== @@ -40,12 +40,12 @@ search = LABEL version="{current_version}" replace = LABEL version="{new_version}" [tool:pytest] -addopts = +addopts = --strict-markers --tb=native weaver/ python_files = test_*.py -markers = +markers = testbed14: mark test as 'testbed14' validation functional: mark test as functionality validation workflow: mark test as workflow execution (E2E) @@ -70,9 +70,12 @@ exclude = *.egg-info,build,dist,env,tests,./tests,test_* targets = . [flake8] +# FIXME: https://github.com/PyCQA/pycodestyle/issues/996 +# see Makefile for some specific overrides to avoid false-positive during 'fix-lint' +# new codes must be synced between below list and corresponding one in Makefile ignore = E126,E226,E402,F401,W503,W504 max-line-length = 120 -exclude = +exclude = src, .git, __pycache__, @@ -88,18 +91,19 @@ max-line-length = 120 ignore-path = docs/build,docs/source/autoapi [pylint] +# use .pylintrc [coverage:run] branch = true source = ./ include = weaver/* -omit = +omit = setup.py docs/* tests/* [coverage:report] -exclude_lines = +exclude_lines = pragma: no cover raise AssertionError raise NotImplementedError