Conditions | 7 |
Total Lines | 34 |
Code Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python |
||
16 | def main(): |
||
17 | """ |
||
18 | Walk through all known products in the ssg root specified in sys.argv[1], |
||
19 | and ensure that all fixes in all rule directories are parsable under |
||
20 | ssg.fixes.parse_platform(...). |
||
21 | """ |
||
22 | |||
23 | if len(sys.argv) != 2: |
||
24 | print("Error! Must supply only path to root of ssg directory", |
||
25 | file=sys.stderr) |
||
26 | sys.exit(1) |
||
27 | |||
28 | ssg_root = sys.argv[1] |
||
29 | |||
30 | guide_dirs = set() |
||
31 | for product in ssg.constants.product_directories: |
||
32 | product_dir = os.path.join(ssg_root, product) |
||
33 | product_yaml_path = os.path.join(product_dir, "product.yml") |
||
34 | product_yaml = ssg.yaml.open_raw(product_yaml_path) |
||
35 | |||
36 | guide_dir = os.path.join(product_dir, product_yaml['benchmark_root']) |
||
37 | if guide_dir in guide_dirs: |
||
38 | continue |
||
39 | |||
40 | for rule_dir in ssg.rules.find_rule_dirs(guide_dir): |
||
41 | for lang in REMEDIATION_LANGS: |
||
42 | for fix in ssg.rules.get_rule_dir_remediations(rule_dir, lang): |
||
43 | fix_contents = ssg.utils.read_file_list(fix) |
||
44 | results = ssg.fixes.parse_platform(fix_contents) |
||
45 | |||
46 | assert results is not None |
||
47 | assert isinstance(results, int) |
||
48 | |||
49 | guide_dirs.add(guide_dir) |
||
50 | |||
54 |