Code Duplication    Length = 15-19 lines in 2 locations

utils/refchecker.py 1 location

@@ 25-43 (lines=19) @@
22
CONTROLS_DIR = os.path.join(SSG_ROOT, "controls")
23
24
25
def parse_args():
26
    parser = argparse.ArgumentParser(description="Check all rule.yml referenced in a given"
27
                                     "profile for a required reference identifier")
28
    parser.add_argument("-j", "--json", type=str, action="store",
29
                        default=RULES_JSON, help="File to read "
30
                        "json output of rule_dir_json from (defaults to "
31
                        "build/rule_dirs.json")
32
    parser.add_argument("-c", "--build-config-yaml", default=BUILD_CONFIG,
33
                        help="YAML file with information about the build configuration. "
34
                        "Defaults to build/build_config.yml")
35
    parser.add_argument("--controls", default=CONTROLS_DIR,
36
                        help="Directory that contains control files with policy controls.")
37
    parser.add_argument("-p", "--profiles-root",
38
                        help="Override where to look for profile files.")
39
    parser.add_argument("product", type=str, help="Product to check has required references")
40
    parser.add_argument("profile", type=str, help="Profile to iterate over")
41
    parser.add_argument("reference", type=str, help="Required reference system to check for")
42
43
    return parser.parse_args()
44
45
46
def load(rule_obj, env_yaml=None):

utils/controlrefcheck.py 1 location

@@ 26-40 (lines=15) @@
23
CONTROLS_DIR = os.path.join(SSG_ROOT, "controls")
24
25
26
def parse_args() -> argparse.Namespace:
27
    parser = argparse.ArgumentParser(description="Ensures that Control and rule files are in sync")
28
    parser.add_argument("-j", "--json", type=str, action="store",
29
                        default=RULES_JSON, help="File to read "
30
                        "json output of rule_dir_json from (defaults to "
31
                        f"{RULES_JSON}")
32
    parser.add_argument("-c", "--build-config-yaml", default=BUILD_CONFIG,
33
                        help="YAML file with information about the build configuration. "
34
                        f"Defaults to {BUILD_CONFIG}")
35
    parser.add_argument("--controls", default=CONTROLS_DIR,
36
                        help="Directory that contains control files with policy controls.")
37
    parser.add_argument("product", type=str, help="Product to check has required references")
38
    parser.add_argument("control", type=str, help="Control to iterate over")
39
    parser.add_argument("reference", type=str, help="Required reference system to check for")
40
    return parser.parse_args()
41
42
43
def check_product(product: str) -> None: