Showing 229 of 962 total issues
Function walk_rules_diff
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def walk_rules_diff(args, left_rules, right_rules, oval_func, remediation_func):
Function checks
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def checks(env_yaml, yaml_path, sce_dirs, template_builder, output):
Function build_index
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_index(benchmarks, input_basename, index_links, index_options,
Function handle_rule_yaml
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def handle_rule_yaml(product, rule_id, rule_dir, guide_dir, env_yaml):
Function create_playbook
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_playbook(self, snippet_path, rule_id, variables,
Function render_policy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_policy(
Function generate_diff_text
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def generate_diff_text(self, old_r, new_r,
Function print_stats
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def print_stats(status_count, control_list, rules_count, vars_count, args):
Function rewrite_section_value
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def rewrite_section_value(file_contents, yaml_contents, section, keys, transform):
Function _add_cce
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _add_cce(directory, cce_pool, rules, product_yaml, args):
Function _check_rule
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _check_rule(self, rule, scenarios, remote_dir, state, remediation_available):
Function find_fix_in_benchmark
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_fix_in_benchmark(datastream, benchmark_id, rule_id, fix_type='bash', logging=None):
Function handle_rule_yaml
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def handle_rule_yaml(args, rule_id, rule_dir, guide_dir, env_yaml):
Function handle_rule_yaml
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def handle_rule_yaml(product_list, product_yamls, rule_id, rule_dir, guide_dir):
Function flatten_stig_results
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def flatten_stig_results(stig_results: dict) -> dict:
base_stig_flat_results = dict()
for stig, results in stig_results.items():
if len(results) == 1:
base_stig_flat_results[stig] = results[0]
- 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 9 (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 _open_yaml
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def _open_yaml(stream, original_file=None, substitutions_dict={}):
"""
Open given file-like object and parse it as YAML.
Optionally, pass the path to the original_file for better error handling
- 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 parse_affected
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def parse_affected(oval_contents):
"""
Returns the tuple (start_affected, end_affected, platform_indents) for
the passed oval file contents. start_affected is the line number of
starting tag of the <affected> element, end_affected is the line number of
- 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 fill_queue
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def fill_queue(benchmarks, benchmark_profile_pairs, input_path, path_base,
output_dir):
"""
For each benchmark and profile in the benchmark, create a queue of
tasks for later processing. A task is a named tuple (benchmark_id,
- 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 a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def __init__(self, filepath, product=""):
self.tree = None
try:
with open(filepath, 'r') as xccdf_file:
file_string = xccdf_file.read()
- 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"