diff --git a/Makefile b/Makefile index d4aa18166..c6fe53dbc 100644 --- a/Makefile +++ b/Makefile @@ -5,20 +5,26 @@ help: ## show this help ## style commands: +PY_FILES = $(shell find -type f -name '*.py' | grep -f ./tools/style.py.include | grep -v -f ./tools/style.py.exclude ) +C_FILES = $(shell find -type f -name '*.[ch]' | grep -f ./tools/style.c.include | grep -v -f ./tools/style.c.exclude ) + + style_check: ## run code style check on application sources and tests flake8 --version isort --version | awk '/VERSION/{print $$2}' black --version - flake8 $(shell find -type f -name '*.py' | grep -f ./tools/style.py.include | grep -v -f ./tools/style.py.exclude ) - isort --check-only $(shell find -type f -name '*.py' | grep -f ./tools/style.py.include | grep -v -f ./tools/style.py.exclude ) - black --check $(shell find -type f -name '*.py' | grep -f ./tools/style.py.include | grep -v -f ./tools/style.py.exclude ) + flake8 $(PY_FILES) + isort --check-only $(PY_FILES) + black --check $(PY_FILES) + make -C python style_check style: ## apply code style on application sources and tests - isort $(shell find -type f -name '*.py' | grep -f ./tools/style.py.include | grep -v -f ./tools/style.py.exclude ) - black $(shell find -type f -name '*.py' | grep -f ./tools/style.py.include | grep -v -f ./tools/style.py.exclude ) + isort $(PY_FILES) + black $(PY_FILES) + make -C python style cstyle_check: ## run code style check on low-level C code - ./tools/clang-format-check $(shell find -type f -name '*.c' -o -name '*.h' | grep -f ./tools/style.c.include | grep -v -f ./tools/style.c.exclude ) + ./tools/clang-format-check $(C_FILES) cstyle: ## apply code style on low-level C code - clang-format -i $(shell find -type f -name '*.c' -o -name '*.h' | grep -f ./tools/style.c.include | grep -v -f ./tools/style.c.exclude ) + clang-format -i $(C_FILES) diff --git a/core/setup.cfg b/core/setup.cfg index 60d212f45..8ec74f772 100644 --- a/core/setup.cfg +++ b/core/setup.cfg @@ -12,10 +12,6 @@ ignore = E501, # E741 ambiguous variable name E741, - # F403: star import used, unable to detect undefined names - F403, - # F405: name may be undefined, or defined from star imports - F405, # W503: line break before binary operator W503 diff --git a/setup.cfg b/setup.cfg index de91c44fd..f31ed523c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,10 +12,6 @@ ignore = E501, # E741 ambiguous variable name E741, - # F403: star import used, unable to detect undefined names - F403, - # F405: name may be undefined, or defined from star imports - F405, # W503: line break before binary operator W503 @@ -30,8 +26,5 @@ forced_separate = apps known_standard_library = micropython,ubinascii,ustruct,uctypes,utime,utimeq,trezorio,trezorui,trezorutils,trezorconfig known_third_party = curve25519,ecdsa,hypothesis -# TODO: ask matejcik if we can omit this completely -# [tool:pytest] -# addopts = --pyargs trezorlib.tests.device_tests -# xfail_strict = true -# run_xfail = +[tool:pytest] +xfail_strict = true