Showing 229 of 962 total issues
File test_env.py
has 482 lines of code (exceeds 400 allowed). Consider refactoring. Open
from __future__ import print_function
import contextlib
import json
import logging
Function get_profile_stats
has a Cognitive Complexity of 28 (exceeds 7 allowed). Consider refactoring. Open
def get_profile_stats(self, profile):
"""Obtain statistics for the profile"""
# Holds the intermediary statistics for profile
profile_stats = {
- 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_idents
has a Cognitive Complexity of 28 (exceeds 7 allowed). Consider refactoring. Open
def remove_idents(tree_root, namespace, prod="RHEL"):
"""
Remove product identifiers from rules in XML tree
"""
- 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
Rule
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class Rule(XCCDFEntity, Templatable):
"""Represents XCCDF Rule
"""
KEYS = dict(
description=lambda: "",
File build_remediations.py
has 469 lines of code (exceeds 400 allowed). Consider refactoring. Open
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
File controls.py
has 468 lines of code (exceeds 400 allowed). Consider refactoring. Open
import collections
import os
import copy
from glob import glob
Function translate
has a Cognitive Complexity of 27 (exceeds 7 allowed). Consider refactoring. Open
def translate(self, tree, store_defname=False):
for element in tree.iter():
idname = element.get("id")
if idname:
# store the old name if requested (for OVAL definitions)
- 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 sort_section_keys
has a Cognitive Complexity of 27 (exceeds 7 allowed). Consider refactoring. Open
def sort_section_keys(file_path, file_contents, sections, sort_func=None):
"""
Sort subkeys in a YAML file's section.
"""
- 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 createPlatformRuleFunc
has a Cognitive Complexity of 26 (exceeds 7 allowed). Consider refactoring. Open
def createPlatformRuleFunc(args):
url = args.url
retries = 0
namespace_flag = ''
if args.namespace is not None:
- 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
Benchmark
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Benchmark(XCCDFEntity):
"""Represents XCCDF Benchmark
"""
KEYS = dict(
status=lambda: "",
RuleChecker
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class RuleChecker(oscap.Checker):
"""
Rule checks generally work like this -
for every profile that supports that rule:
Function move_patches_up_to_date_to_source_data_stream_component
has a Cognitive Complexity of 23 (exceeds 7 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)
- 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_duplicated_subkeys
has a Cognitive Complexity of 23 (exceeds 7 allowed). Consider refactoring. Open
def has_duplicated_subkeys(file_path, file_contents, sections):
"""
Checks whether a section has duplicated keys. Note that these are silently
eaten by the YAML parser we use.
"""
- 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 walk_rules_parallel
has a Cognitive Complexity of 23 (exceeds 7 allowed). Consider refactoring. Open
def walk_rules_parallel(args, left_rules, right_rules, oval_func, remediation_func):
"""
Walks two sets of known_rules (left_rules and right_rules) with identical
keys and returns left_only, right_only, and common_only output from
_walk_rule. If the outputted data for a rule when called on left_rules and
- 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 determine_ip
has a Cognitive Complexity of 23 (exceeds 7 allowed). Consider refactoring. Open
def determine_ip(domain):
GUEST_AGENT_XML = ("<channel type='unix'>"
" <source mode='bind'/>"
" <target type='virtio'"
" name='org.qemu.guest_agent.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
File constants.py
has 434 lines of code (exceeds 400 allowed). Consider refactoring. Open
from __future__ import absolute_import
from __future__ import print_function
import os.path
import os
File automatus.py
has 434 lines of code (exceeds 400 allowed). Consider refactoring. Open
#!/usr/bin/python3
from __future__ import print_function
import argparse
import contextlib
Function get_profile_stats
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_profile_stats(self, profile):
"""Obtain statistics for the profile"""
# Holds the intermediary statistics for profile
profile_stats = {
Function main
has a Cognitive Complexity of 21 (exceeds 7 allowed). Consider refactoring. Open
def main():
args = parse_args()
product_allowlist = set(PRODUCT_ALLOWLIST)
profile_allowlist = set(PROFILE_ALLOWLIST)
- 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 ssg_xccdf_stigid_mapping
has a Cognitive Complexity of 21 (exceeds 7 allowed). Consider refactoring. Open
def ssg_xccdf_stigid_mapping(ssgtree):
xccdf_ns = ssg.xml.determine_xccdf_tree_namespace(ssgtree)
xccdftostig_idmapping = {}
for rule in ssgtree.findall(".//{%s}Rule" % xccdf_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"