-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlint.py
34 lines (26 loc) · 903 Bytes
/
lint.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Implementing linting script also used by CI
https://medium.com/analytics-vidhya/pylint-static-code-analysis-github-action-to-fail-below-a-score-threshold-58a124aafaa0
was used as a reference
"""
import sys
import logging
from pylint.lint import Run
__author__ = "Marco"
__date__ = "25.04.2020 (date of doc. creation)"
logging.getLogger().setLevel(logging.INFO)
path = ["view", "controller", "test", "util", "network", "assets"]
threshold = 9.5
results = Run(path, do_exit=False)
final_score = results.linter.stats['global_note']
if final_score < threshold:
message = ('PyLint Failed | '
'Score: {} | '
'Threshold: {} '.format(final_score, threshold))
logging.error(message)
raise Exception(message)
message = ('PyLint Passed | '
'Score: {} | '
'Threshold: {} '.format(final_score, threshold))
logging.info(message)
sys.exit(0)