Showing 231 of 1,039 total issues
File templates.py
has 490 lines of code (exceeds 400 allowed). Consider refactoring. Open
"""
Common functions for processing Templates in SSG
"""
from __future__ import absolute_import
File common.py
has 489 lines of code (exceeds 400 allowed). Consider refactoring. Open
from __future__ import print_function
import functools
import logging
import os
File ansible_playbook_to_role.py
has 487 lines of code (exceeds 400 allowed). Consider refactoring. Open
#!/usr/bin/python3
from __future__ import print_function
from tempfile import mkdtemp
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
File build_remediations.py
has 480 lines of code (exceeds 400 allowed). Consider refactoring. Open
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
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
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.
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 translate
has a Cognitive Complexity of 27 (exceeds 7 allowed). Consider refactoring. Open
def translate(self, tree, store_defname=False):
"""
Translates the IDs of elements in an XML tree to new identifiers.
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 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
File rule_dir_stats.py
has 453 lines of code (exceeds 400 allowed). Consider refactoring. Open
"""
This module contains common code shared by utils/rule_dir_stats.py and utils/rule_dir_diff.py.
This code includes functions for walking the output of the utils/rule_dir_json.py script, and
filtering functions used in both scripts.
"""
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:
File constants.py
has 442 lines of code (exceeds 400 allowed). Consider refactoring. Open
from __future__ import absolute_import
from __future__ import print_function
import os.path
import os
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 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.
- 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 in a YAML file.
Note that these duplicated keys are silently ignored by the YAML parser used.
- 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 automatus.py
has 433 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 = {