2021-06-30 11:18:57 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2021-08-09 11:38:37 +02:00
|
|
|
# Ignore folder created by venv
|
2022-01-18 14:03:56 +01:00
|
|
|
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}"
|
2021-08-09 11:38:37 +02:00
|
|
|
status = os.system(flake8_first_step_cmd)
|
2021-06-30 11:18:57 +02:00
|
|
|
if os.WEXITSTATUS(status) != 0:
|
|
|
|
print("Flake8 linter errors")
|
|
|
|
sys.exit(0)
|
2022-01-18 14:03:56 +01:00
|
|
|
flake8_second_step_cmd = (
|
|
|
|
f"flake8 . {additional_flags_both_steps} --exit-zero --max-complexity=10 "
|
|
|
|
f"--max-line-length=127 {exclude_dirs_flag}"
|
|
|
|
)
|
2021-08-09 11:38:37 +02:00
|
|
|
os.system(flake8_second_step_cmd)
|
2021-06-30 11:18:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|