()
| 5061 | |
| 5062 | |
| 5063 | def main(): |
| 5064 | parser = get_args_parser() |
| 5065 | args = parser.parse_args() |
| 5066 | settings = MisraSettings(args) |
| 5067 | checker = MisraChecker(settings) |
| 5068 | |
| 5069 | checker.path_premium_addon = cppcheckdata.get_path_premium_addon() |
| 5070 | |
| 5071 | if args.generate_table: |
| 5072 | generateTable() |
| 5073 | sys.exit(0) |
| 5074 | |
| 5075 | if args.rule_texts: |
| 5076 | filename = os.path.expanduser(args.rule_texts) |
| 5077 | filename = os.path.normpath(filename) |
| 5078 | checker.ruleText_filename = filename |
| 5079 | if os.path.isfile(filename): |
| 5080 | checker.loadRuleTexts(filename) |
| 5081 | if args.verify_rule_texts: |
| 5082 | checker.verifyRuleTexts() |
| 5083 | sys.exit(0) |
| 5084 | else: |
| 5085 | if args.verify_rule_texts: |
| 5086 | print('Fatal error: file is not found: ' + filename) |
| 5087 | sys.exit(1) |
| 5088 | |
| 5089 | |
| 5090 | if args.verify_rule_texts and not args.rule_texts: |
| 5091 | print("Error: Please specify rule texts file with --rule-texts=<file>") |
| 5092 | sys.exit(1) |
| 5093 | |
| 5094 | if args.suppress_rules: |
| 5095 | checker.setSuppressionList(args.suppress_rules) |
| 5096 | |
| 5097 | if args.file_prefix: |
| 5098 | checker.setFilePrefix(args.file_prefix) |
| 5099 | |
| 5100 | dump_files, ctu_info_files = cppcheckdata.get_files(args) |
| 5101 | |
| 5102 | if (not dump_files) and (not ctu_info_files): |
| 5103 | if not args.quiet: |
| 5104 | print("No input files.") |
| 5105 | sys.exit(0) |
| 5106 | |
| 5107 | if args.severity: |
| 5108 | checker.setSeverity(args.severity) |
| 5109 | |
| 5110 | for item in dump_files: |
| 5111 | checker.parseDump(item,checker.path_premium_addon) |
| 5112 | |
| 5113 | if settings.verify: |
| 5114 | verify_expected = checker.get_verify_expected() |
| 5115 | verify_actual = checker.get_verify_actual() |
| 5116 | |
| 5117 | exitCode = 0 |
| 5118 | for expected in verify_expected: |
| 5119 | if expected not in verify_actual: |
| 5120 | print('Expected but not seen: ' + expected) |
no test coverage detected