Showing 231 of 1,039 total issues
Avoid too many return
statements within this function. Open
return self._generate_defaults_content()
Avoid too many return
statements within this function. Open
return expr
Avoid too many return
statements within this function. Open
return self.__class__(*args).simplify()
Avoid too many return
statements within this function. Open
return current_status
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return self._final_scan_went_ok(runner, rule_id)
Function get_ovalfiles
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def get_ovalfiles(checks):
global exit_value
# Iterate over all checks, grab the OVAL files referenced within
ovalfiles = set()
for check in checks:
- 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 8 (exceeds 7 allowed). Consider refactoring. Open
def __init__(self, rule, cis_ns):
self.id = rule.get("id")
self.oval = rule.find('./{%s}check[@system="%s"]' % (XCCDF12_NS, oval_ns))
self.sce = rule.find('./{%s}check[@system="%s"]' % (XCCDF12_NS, sce_ns))
self.bash_fix = rule.find('./{%s}fix[@system="%s"]' % (XCCDF12_NS, bash_rem_system))
- 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 8 (exceeds 7 allowed). Consider refactoring. Open
def main():
args = parse_args()
input_path, input_basename, path_base, output_dir = \
ssg.build_guides.get_path_args(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 get_data_from_snippet
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def get_data_from_snippet(self, snippet_yaml, variables, refinements):
"""
Extracts and resolves tasks and variables from Ansible snippet.
"""
xccdf_var_pattern = re.compile(r"\(xccdf-var\s+(\S+)\)")
- 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 product_names_remediation
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def product_names_remediation(rule_obj, r_type):
"""
Checks the consistency between the scope of platforms and the product names of the
remediations of a given type for a rule object.
- 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 8 (exceeds 7 allowed). Consider refactoring. Open
def main():
args = parse_args()
product_yaml = os.path.join(args.ssg_root, "products", args.product, "product.yml")
if args.input_dir:
input_dir = args.input_dir
- 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 resolve
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def resolve(self, all_profiles, rules_by_id, controls_manager=None):
if self.resolved:
return
if controls_manager:
- 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 pretty
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def pretty(self, indent=0, debug=False):
"""
Return a pretty formatted representation of self as an indented tree.
If debug is True, also prints debug information for each expression arg.
- 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 product_names_oval
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def product_names_oval(rule_obj):
"""
Checks the consistency between the product names and OVAL object names for a given rule object.
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 join_text_elements
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def join_text_elements(self):
"""
Collects and concatenates text from relevant subelements of the root element.
This function iterates over the subelements of the root element, collects their text,
- 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 reorder_according_to_ordering
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def reorder_according_to_ordering(unordered, ordering, regex=None):
ordered = []
if regex is None:
regex = "|".join(["({0})".format(item) for item in ordering])
regex = re.compile(regex)
- 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_input_dict
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def process_input_dict(cls, input_contents, env_yaml, product_cpes=None):
data = super(Group, cls).process_input_dict(input_contents, env_yaml, product_cpes)
if data["rules"]:
rule_ids = data["rules"]
data["rules"] = {rid: None for rid in rule_ids}
- 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 filter_rule_ids
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def filter_rule_ids(all_keys, queries):
"""
Filters a set of keys based on a set of queries.
A set of queries is a comma separated list of queries, where a query is either a rule id or
- 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 make_items_product_specific
has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring. Open
def make_items_product_specific(items_dict, product_suffix, allow_overwrites=False):
"""
Function will normalize dictionary values for a specific product, by either
removing product qualifier from the key (reference@product: value -> reference: value),
or by dropping irrelevant entries (reference@other_product: value).
- 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"