Showing 425 of 542 total issues
Avoid deeply nested control flow statements. Open
if compiled_mod_pattern.search(name):
if hasattr(module, '__file__'):
print('\t', name, module.__file__)
else:
print('\t', name)
Avoid deeply nested control flow statements. Open
if len(pair) != 2 or not isinstance(pair[0], str) or not isinstance(pair[1], str):
errors.append(required_structure)
except TypeError as e:
Function _expr_has_a_constant
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _expr_has_a_constant(self):
""" Determine whether the expression contains a constant term
The expression must be transformed by removing unary operators, distribing multiplication,
moving coeffecients left, and multiplying numbers before calling this.
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def serialize(self, value):
""" Serialize ontology instance
Args:
value (:obj:`pronto.Term`): Python representation
- 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 gen_transformer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def gen_transformer(cls, model):
""" Generate transformer for model
Args:
model (:obj:`type`): 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"
Further reading
Avoid deeply nested control flow statements. Open
if existing_rel_attr != migrated_rel_attr:
inconsistencies.append("{}.{}.{} is '{}', which differs from the migrated value "
"of {}.{}.{}, which is '{}'".format(
existing_model, existing_attr_name, rel_attr,
existing_rel_attr, migrated_class, migrated_attr, rel_attr, migrated_rel_attr))
Function visit_BinOp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def visit_BinOp(self, node):
self.generic_visit(node)
if (isinstance(node.op, ast.Mult) and
(isinstance(node.right, (ast.Num, ast.Name, ast.UnaryOp, ast.BinOp)) and
(isinstance(node.left, ast.BinOp) 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 value_equal
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def value_equal(self, val1, val2, tol=0.):
""" Determine if attribute values are equal
Args:
val1 (:obj:`uncertainties.core.Variable`): first 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"
Further reading
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, schema_repo=None, schema_changes_file=None, commit_hash=None, renamed_models=None,
Avoid deeply nested control flow statements. Open
for model in val:
migrated_val.append(getattr(model, self._migrated_copy_attr_name))
else:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, default=None, none_value=None, verbose_name='', description='',
Avoid deeply nested control flow statements. Open
if cls.__module__ + '.' + cls.__name__ == self.compartment_cls:
self.compartment_cls = cls
break
else:
Function transform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def transform(filename):
# read
wb = openpyxl.load_workbook(filename=filename)
for ws in wb:
- 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
Avoid deeply nested control flow statements. Open
if cls is not None:
raise ParsedExpressionError(f"multiple models with id='{id}' in expression '{self.expression}'")
cls, model = related_class, related_obj
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, default=None, none_value=None, verbose_name='', description="A chemical formula (e.g. 'H2O', 'CO2', or 'NaCl')",
Function _get_model_defs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_model_defs(self, module):
""" Obtain the `obj_tables.Model`\ s in a module
Args:
module (:obj:`Module`): a `Module` containing subclasses of `obj_tables.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"
Further reading
Function automated_migrate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def automated_migrate(self, tmp_dir=None):
""" Migrate the *data* repo's data files
Migrate to the latest commit referenced by a schema changes file in the *schema* repo, and
migrate data files in place.
- 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
Avoid deeply nested control flow statements. Open
if os.path.isfile(path):
print_file(path)
self.module_name, self.directory
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, default=None, none_value=None, verbose_name='', description='',
Function validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, obj, value):
""" Determine if :obj:`value` is a valid value of the attribute
Args:
obj (:obj:`Model`): object being validated
- 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"