Showing 229 of 962 total issues
Function main
has a Cognitive Complexity of 13 (exceeds 7 allowed). Consider refactoring. Open
def main():
overall_result = True
args = parse_args()
if args.datastream is not None:
build_dir = os.path.dirname(args.datastream)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function print_result_differences
has a Cognitive Complexity of 13 (exceeds 7 allowed). Consider refactoring. Open
def print_result_differences(json_results):
results = [json.load(open(fname, "r")) for fname in json_results]
rules = [common.RuleResult(r) for r in sum(results, [])]
aggregated_results = aggregate_results_by_scenarios(rules)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function process_results
has a Cognitive Complexity of 13 (exceeds 7 allowed). Consider refactoring. Open
def process_results(result_path):
ret_val = True
tree = ET.parse(result_path)
root = tree.getroot()
results = root.find("./{%s}results" % scapval_results_ns)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function parse_stats_subcommand
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_stats_subcommand(subparsers):
parser_stats = subparsers.add_parser(
"stats",
description=(
"Obtains and displays XCCDF profile statistics. Namely number of rules in the profile,"
Function main
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main():
args = _parse_args()
base_path = args.base
target_path = args.target
target_sheet = get_worksheet(base_path)
Function _walk_rule
has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring. Open
def _walk_rule(args, rule_obj, oval_func, remediation_func, verbose_output):
"""
Walks a single rule and updates verbose_output if visited. Returns visited
state as a boolean.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function load_sce_and_metadata_parsed
has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring. Open
def load_sce_and_metadata_parsed(raw_content):
metadata = dict()
sce_content = []
keywords = ['platform', 'check-import', 'check-export', 'complex-check']
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function build
has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring. Open
def build(self, profile_id=None, rule_id=None):
"""
Creates Playbooks for a specified profile.
If profile is not given, creates playbooks for all profiles
in the product.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validate_references
has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring. Open
def validate_references(self, yaml_file):
if self.references is None:
raise ValueError("Empty references section in file %s" % yaml_file)
for ref_type, ref_val in self.references.items():
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function load_entities
has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring. Open
def load_entities(self, rules_by_id, values_by_id, groups_by_id):
for rid, val in self.rules.items():
if not val:
self.rules[rid] = rules_by_id[rid]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __lt__
has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring. Open
def __lt__(self, other):
comparator = Expression.__lt__(self, other)
if comparator is not NotImplemented:
return comparator
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function machine_platform_missing_in_rules
has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring. Open
def machine_platform_missing_in_rules(ds_path, short_ids_to_check):
machine_platform_missing = False
tree = ET.parse(ds_path)
root = tree.getroot()
only_rules_query = ".//{%s}Rule" % ssg.constants.XCCDF12_NS
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_viable_profiles
has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring. Open
def get_viable_profiles(selected_profiles, datastream, benchmark, script=None):
"""Read data stream, and return set intersection of profiles of given
benchmark and those provided in `selected_profiles` parameter.
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validate_playbook
has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring. Open
def validate_playbook(playbook, args):
assert "name" in playbook, "playbook doesn't have a name"
assert "hosts" in playbook, "playbook doesn't have the hosts entry"
assert playbook["hosts"] == "@@HOSTS@@", "playbook's hosts is not set to @@HOSTS@@"
assert "become" in playbook, "playbook doesn't have a become key"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function from_control_dict
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def from_control_dict(cls, control_dict, env_yaml=None, default_level=["default"]):
cls._check_keys(control_dict)
control = cls()
control.id = ssg.utils.required_key(control_dict, "id")
control.title = control_dict.get("title")
Function move_patches_up_to_date_to_source_data_stream_component
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def move_patches_up_to_date_to_source_data_stream_component(datastreamtree):
ds_checklists = datastreamtree.find(
".//{%s}checklists" % datastream_namespace)
checklists_component_ref = ds_checklists.find(
"{%s}component-ref" % datastream_namespace)
Function reference_check
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def reference_check(env_yaml, rule_dirs, profile_path, product, product_yaml, reference,
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, TRUE_class=None, FALSE_class=None, Symbol_class=None, Function_class=None,
Function handle_control
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def handle_control(product: str, control: ssg.controls.Control, env_yaml: ssg.environment,