Showing 425 of 542 total issues
Consider simplifying this complex logical expression. Open
if (callable(default) or
(isinstance(default, list) and len(default) > 0) or
(not isinstance(default, list) and default is not None)) and \
(callable(related_default) or
(isinstance(related_default, list) and len(related_default) > 0) or
Function __init__
has 16 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, related_class, related_name='', default=list(), default_cleaned_value=list(),
Consider simplifying this complex logical expression. Open
if not row or all(cell in ['', None] for cell in row):
rows.remove(row)
elif row and isinstance(row[0], str) and \
row[0].startswith('%/') and row[0].endswith('/%') and \
not any(row[1:]):
Consider simplifying this complex logical expression. Open
if (not case_insensitive and ((not verbose_name and attr.name == attr_name) or
(verbose_name and attr.verbose_name == attr_name))) or \
(case_insensitive and ((not verbose_name and attr.name.lower() == attr_name.lower()) or
(verbose_name and attr.verbose_name.lower() == attr_name.lower()))):
return (None, attr)
Function create_template
has 16 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_template(path, schema_name, models, title=None, description=None, keywords=None,
Function validate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, obj, value):
""" Determine if :obj:`value` is a valid value
Args:
obj (:obj:`Model`): class 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"
Further reading
Function get_or_create_model_obj
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_or_create_model_obj(self, model, _serialized_val=None, _clean=True,
**kwargs):
""" Get a instance of a model with serialized value :obj:`_serialized_val`, or
create an instance if there is no such instance
- 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 get_xlsx_validation
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_xlsx_validation(self, sheet_models=None, doc_metadata_model=None):
""" Get XLSX validation
Args:
sheet_models (:obj:`list` of :obj:`Model`, optional): models encoded as separate sheets
- 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 related_validate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def related_validate(self, obj, value):
""" Determine if :obj:`value` is a valid value of the related 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"
Further reading
Function deserialize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def deserialize(self, value, objects, decoded=None):
""" Deserialize value
Args:
value (:obj:`str`): String 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 related_validate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def related_validate(self, obj, value):
""" Determine if :obj:`value` is a valid value of the related 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"
Further reading
Function clean
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def clean(self, value):
""" Convert attribute value into the appropriate type
Args:
value (:obj:`object`): value of attribute to clean
- 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 related_validate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def related_validate(self, obj, value):
""" Determine if :obj:`value` is a valid value of the related 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"
Further reading
Function __init__
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, related_class, related_name='',
Function __init__
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, related_class, related_name='', default=list(), default_cleaned_value=list(),
Function write_model
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def write_model(self, writer, model, objects, schema_name, date, doc_metadata, doc_metadata_model, model_metadata, sheet_models,
Function init_schema
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init_schema(filename, out_filename=None):
""" Initialize an `ObjTables` schema from a tabular declarative specification in
:obj:`filename`. :obj:`filename` can be a XLSX, CSV, or TSV file.
Schemas (classes and attributes) should be defined using the following tabular format.
Function value
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def value(self, value):
if value is None:
self._value = None
self._serialized_value = None
self._serialized_format = 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 get_xlsx_validation
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_xlsx_validation(self, sheet_models=None, doc_metadata_model=None):
""" Get XLSX validation
Args:
sheet_models (:obj:`list` of :obj:`Model`, optional): models encoded as separate sheets
- 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 transform
has a Cognitive Complexity of 14 (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"