Skip to content

Commit 0f83c55

Browse files
committed
python linter
Signed-off-by: BluThaitanium <[email protected]>
1 parent d78055e commit 0f83c55

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,13 @@ check_license: ## Make sure source files have license header
3636
@git grep -L "SPDX-License-Identifier: Apache-2.0" -- *.py *.yml *.yaml *.sh *.html *.js *.css *.ts *.tsx ':!*.bundle.js' | \
3737
grep . && echo "Missing license headers in files above. Run './tools/bash/add_license_headers.sh'" && exit 1 || \
3838
echo "$@: OK"
39+
40+
.PHONY: lint_python
41+
lint_python: venv ## Check Python code style compliance
42+
@which flake8 > /dev/null || pip install flake8 || pip3 install flake8
43+
@flake8 . --show-source --statistics \
44+
--select=E9,E2,E3,E5,F63,F7,F82,F4,F841,W291,W292 \
45+
--per-file-ignores sdk/python/tests/compiler/testdata/*:F841,F821 \
46+
--exclude .git,__pycache__,docs/source/conf.py,old,build,dist,venv \
47+
--max-line-length=140
48+
@echo "$@: OK"

0 commit comments

Comments
 (0)