MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / MisraChecker

Class MisraChecker

addons/misra.py:1517–5008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1515
1516
1517class MisraChecker:
1518
1519 def __init__(self, settings, stdversion="c89"):
1520 """
1521 :param settings: misra.py script settings.
1522 """
1523
1524 self.settings = settings
1525
1526 # Test validation rules lists
1527 self.verify_expected = []
1528 self.verify_actual = []
1529
1530 # List of formatted violation messages
1531 self.violations = {}
1532
1533 # if --rule-texts is specified this dictionary
1534 # is loaded with descriptions of each rule
1535 # by rule number (in hundreds).
1536 # ie rule 1.2 becomes 102
1537 self.ruleTexts = {}
1538 self.ruleText_filename = None
1539
1540 # Dictionary of dictionaries for rules to suppress
1541 # Dict1 is keyed by rule number in the hundreds format of
1542 # Major * 100 + minor. ie Rule 5.2 = (5*100) + 2
1543 # Dict 2 is keyed by filename. An entry of None means suppress globally.
1544 # Each file name entry contains a list of tuples of (lineNumber, symbolName)
1545 # or an item of None which indicates suppress rule for the entire file.
1546 # The line and symbol name tuple may have None as either of its elements but
1547 # should not be None for both.
1548 self.suppressedRules = {}
1549
1550 # Prefix to ignore when matching suppression files.
1551 self.filePrefix = None
1552
1553 # Number of all violations suppressed per rule
1554 self.suppressionStats = {}
1555
1556 self.stdversion = stdversion
1557
1558 self.severity = None
1559
1560 self.existing_violations = set()
1561
1562 self._ctu_summary_typedefs = False
1563 self._ctu_summary_tagnames = False
1564 self._ctu_summary_identifiers = False
1565 self._ctu_summary_usage = False
1566
1567 self.path_premium_addon = None
1568
1569 def __repr__(self):
1570 attrs = ["settings", "verify_expected", "verify_actual", "violations",
1571 "ruleTexts", "suppressedRules", "filePrefix",
1572 "suppressionStats", "stdversion", "severity"]
1573 return "{}({})".format(
1574 "MisraChecker",

Callers 2

checkerFunction · 0.90
mainFunction · 0.85

Calls

no outgoing calls

Tested by 1

checkerFunction · 0.72