Пример #1
0
            if not t in ppotagtotals: ppotagtotals[t] = {}
            for dm in ppod[t]:
                if not dm in ppotagtotals[t]: ppotagtotals[t][dm] = 0
                ppotagtotals[t][dm] += ppod[t][dm]
        for dm in dsmethods:
            ppoprojecttotals[p][dm] = sum([ppod[t][dm] for t in ppod])
        for t in spod:
            if not t in spotagtotals: spotagtotals[t] = {}
            for dm in spod[t]:
                if not dm in spotagtotals[t]: spotagtotals[t][dm] = 0
                spotagtotals[t][dm] += spod[t][dm]
        for dm in dsmethods:
            spoprojecttotals[p][dm] = sum([spod[t][dm] for t in spod])

    print('Primary Proof Obligations')
    print('\n'.join(RP.totals_to_string(ppoprojecttotals)))
    print('\nPrimary Proof Obligations (in percentages)')
    print('\n'.join(RP.totals_to_string(ppoprojecttotals, False)))
    print('\nSupporting Proof Obligations')
    print('\n'.join(RP.totals_to_string(spoprojecttotals)))
    print('\nSupporting Proof Obligations (in percentages)')
    print('\n'.join(RP.totals_to_string(spoprojecttotals, False)))

    print('\n\nPrimary Proof Obligations')
    print('\n'.join(RP.totals_to_string(ppotagtotals)))
    print('\nSupporting Proof Obligations')
    print('\n'.join(RP.totals_to_string(spotagtotals)))

    if len(nosummary) > 0:
        print('\n\nNo summary results found for:')
        print('-' * 28)
    parser.add_argument(
        'variant',
        help=('sequence number of variant, e.g., 01, or 09 or 61, etc.' +
              ' (type ? to see a list of available variants)'))
    parser.add_argument('--cwe',
                        help='only report on the given cwe, e.g., CWE121')
    args = parser.parse_args()
    return args


if __name__ == '__main__':

    args = parse()
    cwe = 'all'
    if args.cwe is not None: cwe = args.cwe

    if not args.variant in JTC.variants:
        print('*' * 80)
        print('Variant ' + args.variant +
              ' not found. Variants available are: ')
        for v in sorted(JTC.variants):
            print(v + ': ' + JTC.variants[v])
        print('*' * 80)
        exit(1)

    (ppoprojecttotals, spoprojecttotals,
     nosummary) = JVR.get_ppo_project_variant_totals(args.variant, cwe)

    print('\n\nPrimary Proof Obligations')
    print('\n'.join(RP.totals_to_string(ppoprojecttotals)))