KarrLab/obj_tables

View on GitHub

Showing 425 of 542 total issues

Function validate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self, obj, value):
        """ Determine if :obj:`value` is a valid value for this QuantityAttribute

        Args:
            obj (:obj:`Model`): class being validated
Severity: Minor
Found in obj_tables/sci/units.py - About 2 hrs to fix

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 validate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self, obj, value):
        """ Determine if :obj:`value` is a valid value for this UnitAttribute

        Args:
            obj (:obj:`Model`): class being validated
Severity: Minor
Found in obj_tables/sci/units.py - About 2 hrs to fix

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 validate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(schema_changes_kwargs):
        """ Check that the attributes of the arguments to :obj:`SchemaChanges` have the right structure

        Args:
            schema_changes_kwargs (:obj:`dict`): kwargs arguments to :obj:`SchemaChanges` generated by loading a schema
Severity: Minor
Found in obj_tables/migrate.py - About 2 hrs to fix

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 a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, model_cls, attr, expression, objs):
        """ Create an instance of ParsedExpression

        Args:
            model_cls (:obj:`type`): the :obj:`Model` which has an expression
Severity: Minor
Found in obj_tables/math/expression.py - About 2 hrs to fix

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 a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, ontology, namespace=None, namespace_sep=':', terms=None, none=True,
                 default=None, default_cleaned_value=None, none_value=None,
                 verbose_name='', description='',
                 primary=False, unique=False, unique_case_insensitive=False):
        """
Severity: Minor
Found in obj_tables/sci/onto.py - About 2 hrs to fix

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 copy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def copy(self):
        """ Create a copy

        Returns:
            :obj:`Model`: model copy
Severity: Minor
Found in obj_tables/core.py - About 2 hrs to fix

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 validate_attributes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_attributes(metacls, name, bases, namespace):
        """ Validate attribute values

        Raises:
            :obj:`ValueError`: if attributes are not valid
Severity: Minor
Found in obj_tables/core.py - About 2 hrs to fix

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 is_equal has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def is_equal(self, other, tol=0.):
        if self.__class__ != other.__class__:
            return False

        min_eq = self.min.__class__ == other.min.__class__ and (
Severity: Minor
Found in obj_tables/core.py - About 2 hrs to fix

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 write_sheet has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def write_sheet(self, writer, model, data, headings, metadata_headings, validation,
                    extra_entries=0, merge_ranges=None, protected=True):
        """ Write data to sheet

        Args:
Severity: Minor
Found in obj_tables/io.py - About 2 hrs to fix

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

GitRepo has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class GitRepo(object):
    """ Methods for processing a git repo and its commit history

    Attributes:
        repo_dir (:obj:`str`): the repo's root directory
Severity: Minor
Found in obj_tables/migrate.py - About 2 hrs to fix

    Function _is_equal_attributes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _is_equal_attributes(self, other, tol=0.):
            """ Determine if the attributes of two objects are semantically equal
    
            Args:
                other (:obj:`Model`): object to compare
    Severity: Minor
    Found in obj_tables/core.py - About 2 hrs to fix

    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 17 (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
    Severity: Minor
    Found in obj_tables/core.py - About 2 hrs to fix

    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 _generate_normalize_sort_keys has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _generate_normalize_sort_keys(cls):
            """ Generates keys for sorting the class """
            generated_keys = []
            keys_to_generate = [cls]
            while keys_to_generate:
    Severity: Minor
    Found in obj_tables/core.py - About 2 hrs to fix

    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 write_schema has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def write_schema(self, writer, models, name, date, doc_metadata, protected=True):
            """ Write a worksheet with a schema
    
            Args:
                writer (:obj:`wc_utils.workbook.io.Writer`): io writer
    Severity: Minor
    Found in obj_tables/io.py - About 2 hrs to fix

    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 run has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(self, path, objects, schema_name=None, doc_metadata=None, model_metadata=None,
                models=None, get_related=True, include_all_attributes=True, validate=True,
                title=None, description=None, keywords=None, version=None, language=None, creator=None,
                write_toc=True, write_schema=False, write_empty_models=True, write_empty_cols=True,
                extra_entries=0, group_objects_by_model=True, data_repo_metadata=False, schema_package=None,
    Severity: Minor
    Found in obj_tables/io.py - About 2 hrs to fix

    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_ordered_attributes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_ordered_attributes(cls, include_all_attributes=True):
        """ Get the attributes for a class in the order that they should be printed
    
        Args:
            cls (:obj:`type`): Model type (subclass of :obj:`Model`)
    Severity: Minor
    Found in obj_tables/io.py - About 2 hrs to fix

    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 a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, _comments=None, **kwargs):
            """
            Args:
                **kwargs: dictionary of keyword arguments with keys equal to the names of the model attributes
    
    
    Severity: Minor
    Found in obj_tables/core.py - About 2 hrs to fix

    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 randomize_object_graph has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def randomize_object_graph(obj):
        """ Randomize the order of the edges (RelatedManagers) in the object's object graph.
    
        Args:
            obj (:obj:`Model`): instance of :obj:`Model`
    Severity: Minor
    Found in obj_tables/utils.py - About 2 hrs to fix

    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 changeMethod has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function changeMethod(evt){
        var method = $('#method').val();
        switch(method) {
            case 'convert':
                $('#label_model').hide()
    Severity: Major
    Found in obj_tables/web/js/app.js - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                  if (include is None or (value in include or
                                          (include_nan
                                           and (isinstance(value, numbers.Number)
                                                and isnan(value))))) and \
                     (exclude is None or (value not in exclude
      Severity: Critical
      Found in obj_tables/core.py - About 2 hrs to fix
        Severity
        Category
        Status
        Source
        Language