(self, location, num1, num2)
| 4483 | cppcheckdata.reportError(location, cppcheck_severity, errmsg, 'misra', error_id) |
| 4484 | |
| 4485 | def reportError(self, location, num1, num2): |
| 4486 | ruleNum = num1 * 100 + num2 |
| 4487 | |
| 4488 | if self.isRuleGloballySuppressed(ruleNum): |
| 4489 | return |
| 4490 | |
| 4491 | if self.settings.verify: |
| 4492 | self.verify_actual.append('%s:%d %d.%d' % (location.file, location.linenr, num1, num2)) |
| 4493 | elif self.isRuleSuppressed(location.file, location.linenr, ruleNum): |
| 4494 | # Error is suppressed. Ignore |
| 4495 | self.suppressionStats.setdefault(ruleNum, 0) |
| 4496 | self.suppressionStats[ruleNum] += 1 |
| 4497 | return |
| 4498 | else: |
| 4499 | errorId = 'c2012-' + str(num1) + '.' + str(num2) |
| 4500 | misra_severity = 'Undefined' |
| 4501 | cppcheck_severity = 'style' |
| 4502 | if ruleNum in self.ruleTexts: |
| 4503 | errmsg = self.ruleTexts[ruleNum].text |
| 4504 | if self.ruleTexts[ruleNum].misra_severity: |
| 4505 | misra_severity = self.ruleTexts[ruleNum].misra_severity |
| 4506 | cppcheck_severity = self.ruleTexts[ruleNum].cppcheck_severity |
| 4507 | elif len(self.ruleTexts) == 0: |
| 4508 | if self.ruleText_filename is None: |
| 4509 | errmsg = 'misra violation (use --rule-texts=<file> to get proper output)' |
| 4510 | else: |
| 4511 | errmsg = 'misra violation (rule-texts-file not found: ' + self.ruleText_filename + ')' |
| 4512 | else: |
| 4513 | errmsg = 'misra violation %s with no text in the supplied rule-texts-file' % (ruleNum) |
| 4514 | |
| 4515 | if self.severity: |
| 4516 | cppcheck_severity = self.severity |
| 4517 | |
| 4518 | this_violation = '{}-{}-{}-{}'.format(location.file, location.linenr, location.column, ruleNum) |
| 4519 | |
| 4520 | # If this is new violation then record it and show it. If not then |
| 4521 | # skip it since it has already been displayed. |
| 4522 | if this_violation not in self.existing_violations: |
| 4523 | self.existing_violations.add(this_violation) |
| 4524 | cppcheckdata.reportError(location, cppcheck_severity, errmsg, 'misra', errorId, misra_severity) |
| 4525 | |
| 4526 | if misra_severity not in self.violations: |
| 4527 | self.violations[misra_severity] = [] |
| 4528 | self.violations[misra_severity].append('misra-' + errorId) |
| 4529 | |
| 4530 | def loadRuleTexts(self, filename): |
| 4531 | num1 = 0 |
no test coverage detected