Showing 425 of 542 total issues
Avoid deeply nested control flow statements. Open
Open
for i_val2 in range(i_val, len(val)):
difference['attributes'][attr_name].append(
'No matching element {}'.format(serial_vals[i_val2][0]))
elif val is None:
Avoid deeply nested control flow statements. Open
Open
if v not in objs_to_keep:
val.remove(v)
else:
Avoid deeply nested control flow statements. Open
Open
if validation_error:
validation_error.set_location_and_value(utils.source_report(obj, sub_attr.name),
attr_value)
obj_errors.append(validation_error)
setattr(obj, sub_attr.name, value)
Avoid deeply nested control flow statements. Open
Open
if val is None:
pass
elif isinstance(val, Model):
pairs_to_check.append((val, other_val, ))
elif len(val) != len(other_val):
Avoid deeply nested control flow statements. Open
Open
for oo in getattr(o, attr_name):
objs[attr.related_class][oo.serialize()] = oo
Avoid deeply nested control flow statements. Open
Open
if isinstance(attr, (
OneToOneAttribute,
OneToManyAttribute,
ManyToOneAttribute,
ManyToManyAttribute)) and \
Avoid deeply nested control flow statements. Open
Open
if attr.related_class not in objects_by_primary_attribute:
objects_by_primary_attribute[attr.related_class] = {}
serialized_val = val.serialize()
Avoid deeply nested control flow statements. Open
Open
if isinstance(val, list) and len(val) > 1:
if attr_name in obj.Meta.attributes:
cls = attr.related_class
else:
cls = attr.primary_class
Avoid deeply nested control flow statements. Open
Open
if v not in printed_objs:
iter_attr.append(v._tree_str(
printed_objs, depth + 1, max_depth))
attrs.extend(iter_attr)
Avoid deeply nested control flow statements. Open
Open
if deserialize_error:
deserialize_error.set_location_and_value(utils.source_report(obj, sub_attr.name),
attr_value)
obj_errors.append(deserialize_error)
if validation_error:
Function import_module_for_migration
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def import_module_for_migration(self, validate=True, required_attrs=None, debug=False,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, path_name, sheet_name, attribute_seq, row, table_id=None):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, attribute, messages, related=False, location=None, value=None):
Function get_children
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def get_children(self, kind=None, __type=None, recursive=True, **kwargs):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, default=False, default_cleaned_value=None, none_value=None, verbose_name='', description='Enter a Boolean value'):
Function add_to_decoding_queue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_to_decoding_queue(json, models_by_name=models_by_name, decoded=decoded, to_decode=to_decode,
Function get_attrs_by_val
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def get_attrs_by_val(self, type=None, reverse=True,
Function get_attribute_by_name
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def get_attribute_by_name(cls, group_name, attr_name, verbose_name=False, case_insensitive=False):
Function to_pandas
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def to_pandas(objs, models=None, get_related=True,
Function _default
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def _default(self):
args = self.app.pargs
schema_name, schema, models = get_schema_models(args.schema_file)
for model in models:
if model.__name__ == args.model:
- 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"