From 9efb347aa241e5fb7a864540edbd87908110339c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 1 Mar 2022 16:57:40 +0100 Subject: [PATCH] update lint.py --- lint.py | 31 +++++++++++++++++++++++-------- spacepackets | 2 +- tmtccmd | 2 +- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/lint.py b/lint.py index 25bfdce..27291b2 100755 --- a/lint.py +++ b/lint.py @@ -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) diff --git a/spacepackets b/spacepackets index 0039a0e..8580a08 160000 --- a/spacepackets +++ b/spacepackets @@ -1 +1 @@ -Subproject commit 0039a0ec67217765b9dabfbc35dcb34b6ff81c08 +Subproject commit 8580a08e9876efc542e19dc957f220be3b250dc8 diff --git a/tmtccmd b/tmtccmd index 49cf288..f7bbf4b 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 49cf288831216c0680aedab88e31d684ba5b8da8 +Subproject commit f7bbf4bd9f6dc169a8b9e6a76fa9ef0aceb341d4