Skip to content
Snippets Groups Projects
Commit 3f2c1bb5 authored by Florin Postolache's avatar Florin Postolache
Browse files

Add linter errors in checker output


Signed-off-by: default avatarFlorin Postolache <florin.postolache.of@gmail.com>
parent 4232ac99
No related branches found
No related tags found
No related merge requests found
Pipeline #68587 passed
......@@ -88,24 +88,16 @@ def test_bonus():
def run_linter():
global points
linter_points= 5.0
source_list = ['task-1/paranthesinator.asm', 'task-2/subtask_1.asm', 'task-2/subtask_2.asm', 'task-3/task_3.asm', 'bonus/functional.asm']
print("======================= Linter =======================\n")
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../task-1/paranthesinator.asm", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../task-2/subtask_1.asm", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../task-2/subtask_2.asm", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../task-3/task_3.asm", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../bonus/functional.asm", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
for source in source_list:
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../{source}", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
print(f'Linter errors in: {source}')
print(checkerOutput)
print(f"LINTER SCORE: {linter_points} / 5.00\n")
points += linter_points
......
......@@ -12,8 +12,9 @@ argParser = argparse.ArgumentParser(description="Python Checker for PCLP2 Homewo
group = argParser.add_mutually_exclusive_group()
group.add_argument("-t", "--task", help="Run tests for a certain task.")
group.add_argument("--all", action="store_true", help="Run all tasks.")
group.add_argument("--zip", action="store_true", help="Make zip file for VMChecker")
argParser.add_argument("--no_clean", action="store_false", help="Do not clean outputs after run")
group.add_argument("--zip", action="store_true", help="Make zip file for VMChecker.")
group.add_argument("--linter", action="store_true", help="Run only the linter.")
argParser.add_argument("--no_clean", action="store_false", help="Do not clean outputs after run.")
args = argParser.parse_args()
if len(sys.argv) == 1:
......@@ -91,24 +92,16 @@ def test_bonus():
def run_linter():
global points
linter_points= 5.0
source_list = ['task-1/paranthesinator.asm', 'task-2/subtask_1.asm', 'task-2/subtask_2.asm', 'task-3/task_3.asm', 'bonus/functional.asm']
print("======================= Linter =======================\n")
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../task-1/paranthesinator.asm", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../task-2/subtask_1.asm", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../task-2/subtask_2.asm", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../task-3/task_3.asm", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../bonus/functional.asm", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
for source in source_list:
checkerOutput = str(subprocess.check_output(f"cd {linterDir} && ./linter-script-file ../{source}", shell=useShell), encoding='utf-8')
if len(checkerOutput) > 0:
linter_points = 0.0
print(f'Linter errors in: {source}')
print(checkerOutput)
print(f"LINTER SCORE: {linter_points} / 5.00\n")
points += linter_points
......@@ -130,9 +123,15 @@ if args.zip:
rc = subprocess.call(f"zip -r {zipName} */*.asm README", shell=useShell)
exit(rc)
points = 0
if args.linter:
run_linter()
exit(0)
print("\n" + header)
points = 0
#================================ TESTS ================================#
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment