py-check.mk: Add target py-check-bad-patterns

Add target py-check-bad-patterns, which currently looks for leftover
breakpoints and orphaned "export" comments on the closing line of a
function prototype.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-07-24 08:36:09 +02:00
commit 4bf6445412
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -44,7 +44,7 @@ format: py-format
check-syntax: py-check-syntax
check-format: py-check-format
py-check: py-check-syntax py-check-format
py-check: py-check-syntax py-check-format py-check-bad-patterns
py-check-syntax:
ifneq ($(PY_CHECK_RUFF),)
@ -55,6 +55,10 @@ ifneq ($(PY_CHECK_PYRIGHT),)
$(PY_CHECK_PYRIGHT) $(PY_CHECK_ROOTS)
endif
py-check-bad-patterns:
if find $(PY_CHECK_ROOTS) -type f -name '*.py' -print0 | xargs -0 grep breakpoint; then exit 1; fi
if find $(PY_CHECK_ROOTS) -type f -name '*.py' -print0 | xargs -0 grep "^\s*).*#\s*export"; then exit 1; fi
py-check-format:
ifneq ($(PY_CHECK_YAPF),)
$(PY_CHECK_YAPF) --diff --recursive $(PY_CHECK_ROOTS)