py-topdir.mk: Use ruff and yapf
- Use ruff and yapf for the targets py-check-syntax, py-format and py-check-format.- Add a pyproject.toml for those. It also includes configuration for isort, albeit not being directly used in the linter targets.- Make .gitignore igore that in newly created projects.
- Add ruff, yapf and isort to pkg.requires.release, anticipating their use by CI.Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
d933c59ada
commit
36d854ce19
4 changed files with 81 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
TD_COPY_FILES +=
|
||||
TD_COPY_FILES += pyproject.toml
|
||||
|
||||
PY_CHECK_EXCLUDE ?=
|
||||
PY_SRC_ROOT += $(wildcard $(TOPDIR)/src $(TOPDIR)/tools)
|
||||
|
|
@ -11,13 +11,16 @@ check-format: py-check-format
|
|||
|
||||
py-check: py-check-syntax py-check-format
|
||||
py-check-syntax:
|
||||
ruff check $(addprefix --exclude ,$(PY_CHECK_EXCLUDE)) $(PY_SRC_ROOT)
|
||||
mypy $(addprefix --exclude ,$(PY_CHECK_EXCLUDE)) $(PY_SRC_ROOT)
|
||||
|
||||
py-check-format:
|
||||
yapf --diff --recursive .
|
||||
|
||||
py-format:
|
||||
find . -type f -name '*.py' -print0 | \
|
||||
xargs -0 sed -i -E '1{/^# -\*- coding: utf-8 -\*-$$/{:a;N;/\n[[:space:]]*$$/ba;s/^# -\*- coding: utf-8 -\*-\n([[:space:]]*\n)*/ /;s/^ //}}'
|
||||
yapf --in-place --recursive .
|
||||
|
||||
py-format-assignments:
|
||||
find . \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue