Showing 231 of 1,039 total issues
Function _find_all_component_contents
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def _find_all_component_contents(self):
"""
Finds and collects all component contents from the XML document.
This method iterates over all components in the XML document, extracts relevant
- 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 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 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 _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.
Args:
- 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 fetch_all_templated_tests_paths
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def fetch_all_templated_tests_paths(rule_template):
"""
Builds a dictionary of a test case relative path -> test case absolute path mapping.
Here, we want to know what the relative path on disk (under the tests/
- 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 check_all_rules
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def check_all_rules(root, filter_profiles):
rules_missing_cce = []
root = ssg.xml.parse_file(args.datastream_path)
for benchmark in root.findall(".//{%s}Benchmark" % (XCCDF12_NS)):
selected_rules = get_selected_rules(benchmark, filter_profiles)
- 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 _remove_files_to_clean
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def _remove_files_to_clean(self):
if self.clean_files:
for fname in tuple(self._filenames_to_clean_afterwards):
try:
if os.path.exists(fname):
- 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 main
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def main():
ssg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
max_path = ""
for dir_, _, files in os.walk(ssg_root):
# Don't check for path len of log files
- 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 _has_invalid_param
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def _has_invalid_param(root: str, test_file: str) -> bool:
full_path = os.path.join(root, test_file)
has_no_errors = True
with open(full_path, "r") as f:
for line in f:
- 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 group_symbolic_permissions
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def group_symbolic_permissions(mode_dict):
search_mode = ''
fix_mode = ''
for k in mode_dict:
if mode_dict[k] != '':
- 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 preprocess
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def preprocess(data, lang):
if lang == "oval":
pathid = ssg.utils.escape_id(data["path"])
# remove root slash made into '_'
pathid = pathid[1:]
- 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_requirements_with_no_cces
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
def get_requirements_with_no_cces(sheet: Worksheet, end_row: int) -> list:
result = list()
for i in range(2, end_row):
requirement = sheet[f'F{i}'].value
if requirement is None or requirement.strip() == "":
- 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
Avoid too many return
statements within this function. Open
return self._generate_meta_content()
Avoid too many return
statements within this function. Open
return self.annihilator
Avoid too many return
statements within this function. Open
return args[0]
Avoid too many return
statements within this function. Open
return proposed
Avoid too many return
statements within this function. Open
return args[0]
Avoid too many return
statements within this function. Open
return current_status
Avoid too many return
statements within this function. Open
return 0