def get_args(): parser = cppcheckdata.ArgumentParser() parser.add_argument("dumpfile", nargs='*', help="Path of dump files from cppcheck") parser.add_argument('-q', '--quiet', action='store_true', help='do not print "Checking ..." lines') parser.add_argument('--cli', help='Addon is executed from Cppcheck', action='store_true') parser.add_argument("-verify", help=argparse.SUPPRESS, action="store_true") return parser.parse_args()
def runcheckers(): # If there are no checkers then don't run if len(__checkers__) == 0: return global __addon_name__ global __errorid__ addon = sys.argv[0] parser = cppcheckdata.ArgumentParser() args = parser.parse_args() __addon_name__ = os.path.splitext(os.path.basename(addon))[0] for dumpfile in args.dumpfile: if not args.quiet: print('Checking %s...' % dumpfile) data = cppcheckdata.CppcheckData(dumpfile) for cfg in data.iterconfigurations(): if not args.quiet: print('Checking %s, config %s...' % (dumpfile, cfg.name)) for c in __checkers__: __errorid__ = c.__name__ c(cfg, data)
def get_args_parser(): parser = cppcheckdata.ArgumentParser() parser.add_argument("-verify", help=argparse.SUPPRESS, action="store_true") return parser
def get_args(): parser = cppcheckdata.ArgumentParser() return parser.parse_args()
for (top, subdirs, files) in os.walk(path): for file in files: if file.endswith('.dump'): f = top + '/' + file if f not in dumpfiles: dumpfiles.append(f) dumpfiles.sort() return dumpfiles # ----------------- # Let's get to work # ----------------- # extend cppcheck parser with our own options parser = cppcheckdata.ArgumentParser() parser.add_argument('-q', '--quiet', action='store_true', help='do not print "Checking ..." lines') parser.add_argument('paths', nargs='+', metavar='path', help='path to dump file or directory') # parse command line args = parser.parse_args() # now operate on each file in turn dumpfiles = find_dump_files(args.paths)