Skip to content

Commit e575a84

Browse files
authored
Update misra.py to not run a few rules for cppcheck premium (#4970)
1 parent 89c33b4 commit e575a84

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

addons/misra.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4254,7 +4254,7 @@ def executeCheck(self, rule_num, check_function, *args):
42544254
if (not self.is_cpp) or rule_num in misra_cpp:
42554255
check_function(*args)
42564256

4257-
def parseDump(self, dumpfile):
4257+
def parseDump(self, dumpfile, path_premium_addon=None):
42584258
def fillVerifyExpected(verify_expected, tok):
42594259
"""Add expected suppressions to verify_expected list."""
42604260
rule_re = re.compile(r'[0-9]+\.[0-9]+')
@@ -4264,7 +4264,6 @@ def fillVerifyExpected(verify_expected, tok):
42644264
verify_expected.append('%s:%d %s' % (tok.file, tok.linenr, word))
42654265

42664266
data = cppcheckdata.parsedump(dumpfile)
4267-
42684267
typeBits['CHAR'] = data.platform.char_bit
42694268
typeBits['SHORT'] = data.platform.short_bit
42704269
typeBits['INT'] = data.platform.int_bit
@@ -4299,7 +4298,8 @@ def fillVerifyExpected(verify_expected, tok):
42994298
if not self.settings.quiet:
43004299
self.printStatus('Checking %s, config %s...' % (dumpfile, cfg.name))
43014300

4302-
self.executeCheck(104, self.misra_1_4, cfg)
4301+
if not path_premium_addon:
4302+
self.executeCheck(104, self.misra_1_4, cfg)
43034303
self.executeCheck(202, self.misra_2_2, cfg)
43044304
self.executeCheck(203, self.misra_2_3, dumpfile, cfg.typedefInfo)
43054305
self.executeCheck(204, self.misra_2_4, dumpfile, cfg)
@@ -4346,14 +4346,15 @@ def fillVerifyExpected(verify_expected, tok):
43464346
self.executeCheck(904, self.misra_9_4, cfg)
43474347
if cfgNumber == 0:
43484348
self.executeCheck(905, self.misra_9_5, cfg, data.rawTokens)
4349-
self.executeCheck(1001, self.misra_10_1, cfg)
4350-
self.executeCheck(1002, self.misra_10_2, cfg)
4351-
self.executeCheck(1003, self.misra_10_3, cfg)
4352-
self.executeCheck(1004, self.misra_10_4, cfg)
4353-
self.executeCheck(1005, self.misra_10_5, cfg)
4354-
self.executeCheck(1006, self.misra_10_6, cfg)
4355-
self.executeCheck(1007, self.misra_10_7, cfg)
4356-
self.executeCheck(1008, self.misra_10_8, cfg)
4349+
if not path_premium_addon:
4350+
self.executeCheck(1001, self.misra_10_1, cfg)
4351+
self.executeCheck(1002, self.misra_10_2, cfg)
4352+
self.executeCheck(1003, self.misra_10_3, cfg)
4353+
self.executeCheck(1004, self.misra_10_4, cfg)
4354+
self.executeCheck(1005, self.misra_10_5, cfg)
4355+
self.executeCheck(1006, self.misra_10_6, cfg)
4356+
self.executeCheck(1007, self.misra_10_7, cfg)
4357+
self.executeCheck(1008, self.misra_10_8, cfg)
43574358
self.executeCheck(1101, self.misra_11_1, cfg)
43584359
self.executeCheck(1102, self.misra_11_2, cfg)
43594360
self.executeCheck(1103, self.misra_11_3, cfg)
@@ -4676,7 +4677,7 @@ def main():
46764677
checker.setSeverity(args.severity)
46774678

46784679
for item in dump_files:
4679-
checker.parseDump(item)
4680+
checker.parseDump(item,checker.path_premium_addon)
46804681

46814682
if settings.verify:
46824683
verify_expected = checker.get_verify_expected()

0 commit comments

Comments
 (0)