Showing 13 of 35 total issues
Function parse
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def parse(self, file_obj): # noqa
"""
Read an OpenSSH config from the given file object.
:param file_obj: a file-like object to read the config file from
- 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
ApplicationStorage
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class ApplicationStorage(object):
"""Storage for user data."""
path = '{application_directory}/storage'
defaultstorage = list
Function __call__
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, parser, namespace, values, option_string=None):
app = self.default
parser.print_help(app.stdout)
app.stdout.write('\nCommands:\n')
command_manager = app.command_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 take_action
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def take_action(self, parsed_args):
if parsed_args.cmd:
try:
the_cmd = self.app.command_manager.find_command(
parsed_args.cmd,
- 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_sessions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parse_sessions(self, sessions, parent_node):
"""Parse SecureCRT sessions."""
for session in sessions:
if session.get('name') not in self.meta_sessions:
if not self.is_session_group(session):
- 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 serialize_identity_field
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def serialize_identity_field(self, args, instance):
"""Serialize identity."""
if (args.password or args.username) and args.identity:
raise InvalidArgumentException()
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, filename, flag='c', mode=None, _format='json',
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, command, save_strategy=None,
Function is_host_exists
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def is_host_exists(self, new_host):
"""Retrieve exited host for new host."""
existed_hosts = self.storage.filter(Host, label=new_host.label)
for host in existed_hosts:
if host.group and new_host.group:
- 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 update_model_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_model_fields(self, model, payload):
"""Update model's fields with payload."""
fk_fields = model.fk_field_names()
models_fields = {
i: payload[i]
- 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 serialize_args
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def serialize_args(self, args, instance=None):
"""Convert args to instance."""
instance = instance or self.model_class()
for i in self.model_class.fields:
try:
- 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_groups
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sort_groups(self, groups):
"""Sort to prevent missing parent groups."""
def has_parent(group):
return group['parent_group'] 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
Function create_entries_from_tree
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_entries_from_tree(self, tree, result_hosts, parent_group=None):
"""Create instances from groups tree."""
for label, node in tree.items():
if not isinstance(node, dict):
continue
- 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"