Skip to content
Snippets Groups Projects
Commit f6091610 authored by Grigoris Pavlakis's avatar Grigoris Pavlakis Committed by kongr45gpen
Browse files

Attempt to fix the script not running in gitlab runners

parent 157d3be2
No related branches found
No related tags found
No related merge requests found
...@@ -8,17 +8,18 @@ from collections import Counter ...@@ -8,17 +8,18 @@ from collections import Counter
Naive parser and pretty printer for the MISRA reports by cppcheck Naive parser and pretty printer for the MISRA reports by cppcheck
""" """
red = "\033[91m"
yellow = "\033[93m"
green = "\033[92m"
bold = "\033[1m"
end = "\033[0m"
class Summarizer(object): class Summarizer(object):
def __init__(self, report_name): def __init__(self, report_name):
with open(report_name, 'r') as f: with open(report_name, 'r') as f:
self.file_lines = f.readlines() self.file_lines = f.readlines()
f.close() f.close()
self.red = "\033[91m"
self.yellow = "\033[93m"
self.green = "\033[92m"
self.bold = "\033[1m"
self.end = "\033[0m"
def analyze(self): def analyze(self):
""" """
...@@ -55,19 +56,19 @@ class Summarizer(object): ...@@ -55,19 +56,19 @@ class Summarizer(object):
Pretty-prints the contents of the error dictionary with colors and stuff Pretty-prints the contents of the error dictionary with colors and stuff
""" """
print(bold + red + "=================================================\n" + end) print(self.bold + self.red + "=================================================\n" + self.end)
print(bold + red + " Static analysis results: Error Summary \n" + end) print(self.bold + self.red + " Static analysis results: Error Summary \n" + self.end)
for key in errors: for key in errors:
for error in errors[key]: for error in errors[key]:
name_string = f"{bold}{red}File {yellow}{key}{red}" name_string = f"{self.bold}{self.red}File {self.yellow}{key}{self.red}"
rule_violated_string = f"violates rule {yellow}#{error[1]}{red} of the MISRA C 2012 standard" rule_violated_string = f"violates rule {self.yellow}#{error[1]}{self.red} of the MISRA C 2012 standard"
line_number_string = f"at line {yellow}{error[0]}{end}" line_number_string = f"at line {self.yellow}{error[0]}{self.end}"
print(f"{name_string.ljust(75)} {rule_violated_string} {line_number_string}") print(f"{name_string.ljust(75)} {rule_violated_string} {line_number_string}")
print("") print("")
print("") print("")
print(bold + red +"=================================================" + end) print(self.bold + self.red +"=================================================" + self.end)
if __name__ == "__main__": if __name__ == "__main__":
......
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