update lint.py

This commit is contained in:
Robin Mueller 2022-03-01 16:57:40 +01:00
parent b52f354580
commit 9efb347aa2
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 25 additions and 10 deletions

31
lint.py
View File

@ -4,18 +4,33 @@ import sys
def main():
# Ignore folder created by venv
exclude_dirs_flag = "--exclude bin,lib"
exclude_dirs_flag = ""
if not os.path.exists("setup.cfg"):
exclude_dirs_flag = (
"--exclude .git,__pycache__,docs/conf.py,old,build,dist,venv"
)
additional_flags_both_steps = "--count --statistics"
additional_flags_first_step = "--select=E9,F63,F7,F82 --show-source"
flake8_first_step_cmd = f"flake8 . {additional_flags_both_steps} {additional_flags_first_step} {exclude_dirs_flag}"
flake8_first_step_cmd = (
f"flake8 . {additional_flags_both_steps} "
f"{additional_flags_first_step} {exclude_dirs_flag}"
)
status = os.system(flake8_first_step_cmd)
if os.WEXITSTATUS(status) != 0:
print("Flake8 linter errors")
sys.exit(0)
if os.name == "nt":
if status != 0:
print(f"Flake8 linter errors with status {status}")
else:
if os.WEXITSTATUS(status) != 0:
print(f"Flake8 linter errors with status {status}")
sys.exit(0)
additional_flags_second_step = (
'--exit-zero --max-complexity=10 --per-file-ignores="__init__.py:F401"'
)
if not os.path.exists("setup.cfg"):
additional_flags_second_step += " --max-line-length=100"
flake8_second_step_cmd = (
f"flake8 . {additional_flags_both_steps} --exit-zero --max-complexity=10 "
f"--max-line-length=127 {exclude_dirs_flag}"
f"flake8 . {additional_flags_both_steps} {additional_flags_second_step}"
f" {exclude_dirs_flag}"
)
os.system(flake8_second_step_cmd)

@ -1 +1 @@
Subproject commit 0039a0ec67217765b9dabfbc35dcb34b6ff81c08
Subproject commit 8580a08e9876efc542e19dc957f220be3b250dc8

@ -1 +1 @@
Subproject commit 49cf288831216c0680aedab88e31d684ba5b8da8
Subproject commit f7bbf4bd9f6dc169a8b9e6a76fa9ef0aceb341d4