updated linter python script

This commit is contained in:
Robin Müller 2021-08-09 11:38:37 +02:00
parent 6824e7d8c7
commit 5ea6903881
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
1 changed files with 11 additions and 2 deletions

13
lint.py
View File

@ -4,11 +4,20 @@ import sys
def main():
status = os.system("flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics")
# Ignore folder created by venv
exclude_dirs_flag = '--exclude bin,lib'
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}'
status = os.system(flake8_first_step_cmd)
if os.WEXITSTATUS(status) != 0:
print("Flake8 linter errors")
sys.exit(0)
os.system("flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics")
flake8_second_step_cmd = \
f'flake8 . {additional_flags_both_steps} --exit-zero --max-complexity=10 ' \
f'--max-line-length=127 {exclude_dirs_flag}'
os.system(flake8_second_step_cmd)
if __name__ == "__main__":