KarrLab/obj_tables

View on GitHub

Showing 425 of 542 total issues

Function validate has a Cognitive Complexity of 12 (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
Severity: Minor
Found in obj_tables/core.py - About 1 hr 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_attribute_inheritance has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_attribute_inheritance(metacls, name, bases, namespace):
        """ Check attribute inheritance

        Raises:
            :obj:`ValueError`: if subclass overrides a superclass attribute (instance of Attribute) with an incompatible
Severity: Minor
Found in obj_tables/core.py - About 1 hr 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_attrs_by_val has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def get_attrs_by_val(self, type=None, reverse=True,
                         include=None, exclude=None):
        """ Get attributes whose type is :obj:`type` and values are
        in :obj:`include` and not :obj:`exclude`, optionally including attributes
        from related classes. By default, get all attributes.
Severity: Minor
Found in obj_tables/core.py - About 1 hr 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 clean has a Cognitive Complexity of 12 (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
Severity: Minor
Found in obj_tables/core.py - About 1 hr 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_related_models has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def get_related_models(root_model, include_root_model=False):
    """ Get the models that have relationships to a model

    Args:
        root_model (:obj:`type`): subclass of :obj:`Model`
Severity: Minor
Found in obj_tables/utils.py - About 1 hr 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 make_metadata_objects has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def make_metadata_objects(self, data_repo_metadata, path, schema_package):
        """ Make models that store Git repository metadata

        Metadata models can only be created from suitable Git repos.
        Failures to obtain metadata are reported as warnings that do not interfeer with writing
Severity: Minor
Found in obj_tables/io.py - About 1 hr 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 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, registry, choices=None, none=True, default=None, default_cleaned_value=None,
Severity: Major
Found in obj_tables/sci/units.py - About 1 hr to fix

    Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, registry, choices=None, none=True, default=None, default_cleaned_value=None,
    Severity: Major
    Found in obj_tables/sci/units.py - About 1 hr to fix

      Function save_out_workbook has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def save_out_workbook(format, objs, schema_name, doc_metadata, model_metadata, models,
      Severity: Major
      Found in obj_tables/web_service.py - About 1 hr to fix

        Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, related_class, related_name='',
        Severity: Major
        Found in obj_tables/core.py - About 1 hr to fix

          Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, min_length=0, max_length=255, none=False, default='', default_cleaned_value='', none_value='',
          Severity: Major
          Found in obj_tables/core.py - About 1 hr to fix

            Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, min_length=0, max_length=2**32 - 1, none=False, default='', default_cleaned_value='', none_value='',
            Severity: Major
            Found in obj_tables/core.py - About 1 hr to fix

              Function load_config_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def load_config_file(data_schema_migration_conf_file):
                      """ Load a data-schema migration config file
              
                      Args:
                          data_schema_migration_conf_file (:obj:`str`): path to the data-schema migration config file
              Severity: Minor
              Found in obj_tables/migrate.py - About 1 hr 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 _set_lin_coeffs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _set_lin_coeffs(self):
                      """ Set the linear coefficients for the related objects
              
                      Assumes `_validate()` has been called
                      """
              Severity: Minor
              Found in obj_tables/math/expression.py - About 1 hr 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 deserialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def deserialize(self, value):
                      """ Deserialize value
              
                      Args:
                          value (:obj:`str`): string representation of structure
              Severity: Minor
              Found in obj_tables/sci/refs.py - About 1 hr 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 __str__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __str__(self):
                      """ Provide a string representation
              
                      Returns:
                          :obj:`str`: a string representation of this `GitRepo`
              Severity: Minor
              Found in obj_tables/migrate.py - About 1 hr 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 _check_imported_models has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _check_imported_models(self, module=None):
                      """ Check consistency of an imported module
              
                      Args:
                          module (:obj:`Module`, optional): a `Module` containing subclasses of `obj_tables.Model`;
              Severity: Minor
              Found in obj_tables/migrate.py - About 1 hr 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_renamed_attrs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _validate_renamed_attrs(self):
                      """ Validate renamed attributes
              
                      Ensure that renamed attributes:
              
              
              Severity: Minor
              Found in obj_tables/migrate.py - About 1 hr 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 _migrate_model has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _migrate_model(self, existing_model, existing_model_def, migrated_model_def):
                      """ Migrate a model instance's non-related attributes
              
                      Args:
                          existing_model (:obj:`obj_tables.Model`): an existing model instance
              Severity: Minor
              Found in obj_tables/migrate.py - About 1 hr 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 _match_tokens has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _match_tokens(self, token_pattern, idx):
                      """ Indicate whether :obj:`tokens` begins with a pattern of tokens that match :obj:`token_pattern`
              
                      Args:
                          token_pattern (:obj:`tuple` of :obj:`int`): a tuple of Python token numbers, taken from the
              Severity: Minor
              Found in obj_tables/math/expression.py - About 1 hr 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

              Severity
              Category
              Status
              Source
              Language