forked from github/pelican
Ensure invoke lint task & its docs are in sync
Someday the entire Pelican code base will perhaps have Black and isort formatting applied to it, but it doesn't make sense for the linter to check that until it's actually done. This changes the `lint` Invoke task to run Flake8 on changed lines only, which should bring it into line with both the current Pre-commit and CI configurations. Also, the docs erroneously stated that `invoke tests` would also check for code style compliance, which has herein been fixed.
This commit is contained in:
parent
4b79d6dae6
commit
f21969a016
2 changed files with 9 additions and 8 deletions
|
|
@ -75,11 +75,14 @@ via::
|
||||||
|
|
||||||
invoke tests
|
invoke tests
|
||||||
|
|
||||||
In addition to running the test suite, the above invocation will also check code
|
In addition to running the test suite, it is important to also ensure that any
|
||||||
style and let you know whether non-conforming patterns were found. In some cases
|
lines you changed conform to code style guidelines. You can check that via::
|
||||||
these linters will make the needed changes directly, while in other cases you
|
|
||||||
may need to make additional changes until ``invoke tests`` no longer reports any
|
invoke lint
|
||||||
code style violations.
|
|
||||||
|
If code style violations are found in lines you changed, correct those lines
|
||||||
|
and re-run the above lint command until they have all been fixed. You do not
|
||||||
|
need to address style violations, if any, for code lines you did not touch.
|
||||||
|
|
||||||
After making your changes and running the tests, you may see a test failure
|
After making your changes and running the tests, you may see a test failure
|
||||||
mentioning that "some generated files differ from the expected functional tests
|
mentioning that "some generated files differ from the expected functional tests
|
||||||
|
|
|
||||||
4
tasks.py
4
tasks.py
|
|
@ -70,13 +70,11 @@ def isort(c, check=False, diff=False):
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def flake8(c):
|
def flake8(c):
|
||||||
c.run(f"{VENV_BIN}/flake8 {PKG_PATH} tasks.py")
|
c.run(f"git diff HEAD | {VENV_BIN}/flake8 --diff --max-line-length=88")
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def lint(c):
|
def lint(c):
|
||||||
isort(c, check=True)
|
|
||||||
black(c, check=True)
|
|
||||||
flake8(c)
|
flake8(c)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue