if __name__ == "__main__":

    args = parse()
    try:
        cpath = UF.get_juliet_testpath(args.cwe, args.test)
        UF.check_analysis_results(cpath)
    except UF.CHError as e:
        print(str(e.wrap()))
        exit(1)

    sempath = os.path.join(cpath, "semantics")

    try:
        cfapp = CApplication(sempath, args.cfile)
        cfile = cfapp.get_cfile()
    except UF.CHCFileNotFoundError as e:
        print(str(e.wrap()))
        exit(1)

    dc = ["deadcode"]

    if args.showcode:
        if args.open:
            print(
                RP.file_code_open_tostring(cfile,
                                           showinvs=args.showinvariants))
        else:
            print(RP.file_code_tostring(cfile, showinvs=args.showinvariants))

    print(RP.file_proofobligation_stats_tostring(cfile, extradsmethods=dc))
コード例 #2
0
        UF.check_analysis_results(cpath)
    except UF.CHError as e:
        print(str(e.wrap()))
        exit(1)

    sempath = os.path.join(cpath, 'semantics')
    if not os.path.isdir(sempath):
        print(UP.semantics_not_found_err_msg(cpath))
        exit(1)

    try:
        cfapp = CApplication(sempath, args.cfile)
        cfile = cfapp.get_cfile()
    except UF.CFileNotFoundException as e:
        print(str(e.wrap()))
        exit(0)

    try:
        if args.showcode:
            if args.open:
                print(RP.file_code_open_tostring(cfile,
                                                 showinvs=args.showinvs))
            else:
                print(RP.file_code_tostring(cfile))

        print(RP.file_proofobligation_stats_tostring(cfile))
    except IndexedTableError as e:
        print('\n' + ('*' * 80) + '\nThe analysis results format has changed' +
              '\nYou may have to re-run the analysis first: ' + '\n' + e.msg +
              '\n' + ('*' * 80))