Retiring pylint-full.py, bye bye.
This commit is contained in:
1 parent
2a8dd11322
commit
f631ecd8ba
2 files changed
+1
-61
No files matched your search
@@ -1,59 +0,0 @@
|
|||||||
DOCSTR = """
|
|
||||||
Runs a full pylint inspection.
|
|
||||||
|
|
||||||
If evaluation score is under the min-eval variable,
|
|
||||||
this program will exit with exit code 1.
|
|
||||||
"""
|
|
||||||
|
|
||||||
__doc__ = DOCSTR
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import re
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
os.chdir("..") # leave bin/
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(DOCSTR)
|
|
||||||
|
|
||||||
parser.add_argument("--min-eval", dest="min_eval", type=float, default=10.00,
|
|
||||||
help="The minimum allowed global evaluation score."
|
|
||||||
"If the score is lower than this number,"
|
|
||||||
"the program will exit with exit code 1.")
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
PYLINT = ("pylint", "-f", "colorized", "minecraft", "--disable=E")
|
|
||||||
EVAL_PATTERN = (r"Global evaluation\n-----------------\n"
|
|
||||||
r"Your code has been rated at (\d*\.\d+)/10")
|
|
||||||
|
|
||||||
|
|
||||||
def get_evaluation_score_and_output():
|
|
||||||
"""
|
|
||||||
Returns a tuple containing ``(output, eval_score)`` where:
|
|
||||||
``output`` is a ``str`` with the pylint output.
|
|
||||||
``eval_score`` is a ``float`` with the pylint evaluation score
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
output = subprocess.check_output(PYLINT)
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
output = e.output
|
|
||||||
output = output.decode()
|
|
||||||
|
|
||||||
global_eval_pattern = re.compile(EVAL_PATTERN)
|
|
||||||
|
|
||||||
match = global_eval_pattern.search(output)
|
|
||||||
|
|
||||||
evaluation = float(match.group(1))
|
|
||||||
|
|
||||||
return (output, evaluation)
|
|
||||||
|
|
||||||
output, evaluation = get_evaluation_score_and_output()
|
|
||||||
print(output) # We want to appear as if we're pylint
|
|
||||||
|
|
||||||
if evaluation < args.min_eval:
|
|
||||||
print("ERROR: Evaluation score must be over {}".format(str(args.min_eval)))
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
sys.exit(0)
|
|
||||||
@@ -53,9 +53,8 @@ basepython = python3.4
|
|||||||
deps =
|
deps =
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
pylint
|
pylint
|
||||||
changedir = bin
|
|
||||||
commands =
|
commands =
|
||||||
python pylint-full.py --min-eval=9.5
|
pylint -f colorized minecraft --disable=E
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
basepython = python3.4
|
basepython = python3.4
|
||||||
|
|||||||
Reference in new issue
Block a user