Class to keep rule text and metadata
| 1450 | |
| 1451 | |
| 1452 | class Rule(): |
| 1453 | """Class to keep rule text and metadata""" |
| 1454 | |
| 1455 | MISRA_SEVERITY_LEVELS = ['Required', 'Mandatory', 'Advisory'] |
| 1456 | |
| 1457 | def __init__(self, num1, num2): |
| 1458 | self.num1 = num1 |
| 1459 | self.num2 = num2 |
| 1460 | self.text = '' |
| 1461 | self.misra_severity = '' |
| 1462 | |
| 1463 | @property |
| 1464 | def num(self): |
| 1465 | return self.num1 * 100 + self.num2 |
| 1466 | |
| 1467 | @property |
| 1468 | def misra_severity(self): |
| 1469 | return self._misra_severity |
| 1470 | |
| 1471 | @misra_severity.setter |
| 1472 | def misra_severity(self, val): |
| 1473 | if val in self.MISRA_SEVERITY_LEVELS: |
| 1474 | self._misra_severity = val |
| 1475 | else: |
| 1476 | self._misra_severity = '' |
| 1477 | |
| 1478 | @property |
| 1479 | def cppcheck_severity(self): |
| 1480 | return 'style' |
| 1481 | |
| 1482 | def __repr__(self): |
| 1483 | return "%d.%d (%s)" % (self.num1, self.num2, self.misra_severity) |
| 1484 | |
| 1485 | |
| 1486 | class MisraSettings(): |