update lint.py
This commit is contained in:
parent
b52f354580
commit
9efb347aa2
31
lint.py
31
lint.py
@ -4,18 +4,33 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Ignore folder created by venv
|
exclude_dirs_flag = ""
|
||||||
exclude_dirs_flag = "--exclude bin,lib"
|
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_both_steps = "--count --statistics"
|
||||||
additional_flags_first_step = "--select=E9,F63,F7,F82 --show-source"
|
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)
|
status = os.system(flake8_first_step_cmd)
|
||||||
if os.WEXITSTATUS(status) != 0:
|
if os.name == "nt":
|
||||||
print("Flake8 linter errors")
|
if status != 0:
|
||||||
sys.exit(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 = (
|
flake8_second_step_cmd = (
|
||||||
f"flake8 . {additional_flags_both_steps} --exit-zero --max-complexity=10 "
|
f"flake8 . {additional_flags_both_steps} {additional_flags_second_step}"
|
||||||
f"--max-line-length=127 {exclude_dirs_flag}"
|
f" {exclude_dirs_flag}"
|
||||||
)
|
)
|
||||||
os.system(flake8_second_step_cmd)
|
os.system(flake8_second_step_cmd)
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 0039a0ec67217765b9dabfbc35dcb34b6ff81c08
|
Subproject commit 8580a08e9876efc542e19dc957f220be3b250dc8
|
2
tmtccmd
2
tmtccmd
@ -1 +1 @@
|
|||||||
Subproject commit 49cf288831216c0680aedab88e31d684ba5b8da8
|
Subproject commit f7bbf4bd9f6dc169a8b9e6a76fa9ef0aceb341d4
|
Loading…
Reference in New Issue
Block a user