addon/misra.py: fix problem with summary

This commit is contained in:
Daniel Marjamäki 2019-04-16 08:45:06 +02:00
parent e0da316759
commit 7f19a9a255
1 changed files with 6 additions and 3 deletions

View File

@ -2016,7 +2016,7 @@ class MisraChecker:
if not severity in self.violations: if not severity in self.violations:
self.violations[severity] = [] self.violations[severity] = []
self.violations[severity].append(errorId) self.violations[severity].append('misra-' + errorId)
def loadRuleTexts(self, filename): def loadRuleTexts(self, filename):
num1 = 0 num1 = 0
@ -2316,8 +2316,11 @@ else:
convert = lambda text: int(text) if text.isdigit() else text convert = lambda text: int(text) if text.isdigit() else text
misra_sort = lambda key: [ convert(c) for c in re.split('[\.-]([0-9]*)', key) ] misra_sort = lambda key: [ convert(c) for c in re.split('[\.-]([0-9]*)', key) ]
for misra_id in sorted(rules_violated.keys(), key=misra_sort): for misra_id in sorted(rules_violated.keys(), key=misra_sort):
num = misra_id[len("misra-c2012-"):] res = re.match(r'misra-c2012-([0-9]+)\\.([0-9]+)', misra_id)
num = int(num[:num.index(".")]) * 100 + int(num[num.index(".")+1:]) if res is None:
num = 0
else:
num = int(res.group(1)) * 100 + int(res.group(2))
severity = '-' severity = '-'
if num in checker.ruleTexts: if num in checker.ruleTexts:
severity = checker.ruleTexts[num].severity severity = checker.ruleTexts[num].severity