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

Remove an unnecessary statement

Test commit for Python version
parent f6091610
No related branches found
No related tags found
No related merge requests found
...@@ -26,4 +26,5 @@ sed -i -r 's/(.*Script.*)|(.*Checking.*)|(.*MISRA.*)//gm; /(^$)/d; s/(\s\(.*\)\s ...@@ -26,4 +26,5 @@ sed -i -r 's/(.*Script.*)|(.*Checking.*)|(.*MISRA.*)//gm; /(^$)/d; s/(\s\(.*\)\s
# run the summarizer for a nice, clean summary of errors # run the summarizer for a nice, clean summary of errors
echo -e "\u001b[34;1mSummarizing results...\u001b[0m" echo -e "\u001b[34;1mSummarizing results...\u001b[0m"
python3 --version
python3 ci/summarizer.py ci/report.msr python3 ci/summarizer.py ci/report.msr
#!/bin/env python3 #!/bin/env python3
from sys import argv from sys import argv
from sys import exit
from collections import Counter from collections import Counter
""" """
...@@ -33,22 +32,21 @@ class Summarizer(object): ...@@ -33,22 +32,21 @@ class Summarizer(object):
if len(self.file_lines) == 0: if len(self.file_lines) == 0:
print(bold + green + "Static analysis for MISRA compliance complete. No errors found." + end) print(bold + green + "Static analysis for MISRA compliance complete. No errors found." + end)
return 0 return 0
else: for line in self.file_lines: # remove duplicate lines
for line in self.file_lines: # remove duplicate lines if line not in lines_seen:
if line not in lines_seen: lines_seen.add(line)
lines_seen.add(line)
line_contents = line.split(':') line_contents = line.split(':')
file_name = line_contents[0] # first part is the filename (index 0) file_name = line_contents[0] # first part is the filename (index 0)
error = (line_contents[1], line_contents[2].strip('\n')) # index 1 is the line number, index 2 is the number of violated rule error = (line_contents[1], line_contents[2].strip('\n')) # index 1 is the line number, index 2 is the number of violated rule
if file_name not in errors_map.keys(): if file_name not in errors_map.keys():
errors_map[file_name] = list() # create a new list for the new filename and append the tuple in it errors_map[file_name] = list() # create a new list for the new filename and append the tuple in it
errors_map[file_name].append(error) errors_map[file_name].append(error)
else: else:
errors_map[file_name].append(error) # do not append if it already exists errors_map[file_name].append(error) # do not append if it already exists
return errors_map # return the completed error dictionary return errors_map # return the completed error dictionary
def pretty_print(self, errors): def pretty_print(self, errors):
......
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