KarrLab/obj_tables

View on GitHub

Showing 542 of 542 total issues

Function _get_inconsistencies has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_inconsistencies(self, existing_model, migrated_model):
        """ Detect inconsistencies between `existing_model` and `migrated_model` model classes

        Detect inconsistencies between `existing_model` and `migrated_model`. Inconsistencies arise if the loaded `existing_model`
        or `migrated_model` definitions are not consistent with their model or attribute renaming specifications
Severity: Minor
Found in obj_tables/migrate.py - About 7 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 deserialize_from_cell has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

    def deserialize_from_cell(self, values, objects, decoded=None):
        """ Deserialize value from cell

        Args:
            values (:obj:`str`): String representation
Severity: Minor
Found in obj_tables/core.py - About 7 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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

class StoichiometricMatrix(obj_tables.Model):
    reaction_i_d = obj_tables.StringAttribute(verbose_name='ReactionID')
    stoichiometry = obj_tables.StringAttribute(verbose_name='Stoichiometry')
    substrate = obj_tables.StringAttribute(verbose_name='Substrate')
    product = obj_tables.StringAttribute(verbose_name='Product')
Severity: Major
Found in examples/sbtab/SBtab.py and 2 other locations - About 6 hrs to fix
examples/sbtab/SBtab.py on lines 646..663
examples/sbtab/SBtab.py on lines 794..811

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 109.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

class Definition(obj_tables.Model):
    component_name = obj_tables.StringAttribute(verbose_name='ComponentName')
    component_type = obj_tables.StringAttribute(verbose_name='ComponentType')
    is_part_of = obj_tables.StringAttribute(verbose_name='IsPartOf')
    format = obj_tables.StringAttribute(verbose_name='Format')
Severity: Major
Found in examples/sbtab/SBtab.py and 2 other locations - About 6 hrs to fix
examples/sbtab/SBtab.py on lines 774..791
examples/sbtab/SBtab.py on lines 794..811

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 109.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

class Measurement(obj_tables.Model):
    sample = obj_tables.StringAttribute(verbose_name='Sample')
    time = obj_tables.StringAttribute(verbose_name='Time')
    unit = obj_tables.StringAttribute(verbose_name='Unit')
    value_type = obj_tables.StringAttribute(verbose_name='ValueType')
Severity: Major
Found in examples/sbtab/SBtab.py and 2 other locations - About 6 hrs to fix
examples/sbtab/SBtab.py on lines 646..663
examples/sbtab/SBtab.py on lines 774..791

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 109.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File units.py has 452 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Unit attribute

:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2019-01-20
:Copyright: 2019, Karr Lab
Severity: Minor
Found in obj_tables/sci/units.py - About 6 hrs to fix

    Function _tree_str has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

        def _tree_str(self, printed_objs, depth, max_depth):
            """ Obtain a nested list of string representations of this Model.
    
                Follows the graph of related :obj:`Model`'s up to a depth of :obj:`max_depth`. Called recursively.
    
    
    Severity: Minor
    Found in obj_tables/core.py - About 6 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

    File seq.py has 442 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """ Biological attributes
    
    :Author: Jonathan Karr <karr@mssm.edu>
    :Date: 2017-05-10
    :Copyright: 2017, Karr Lab
    Severity: Minor
    Found in obj_tables/bio/seq.py - About 6 hrs to fix

      Function _render_difference has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          def _render_difference(self, difference):
              """ Generate string representation of difference data structure
      
              Args:
                  difference (:obj:`dict`): representation of the semantic difference between two objects
      Severity: Minor
      Found in obj_tables/core.py - About 6 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 _simplify_difference has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          def _simplify_difference(self, difference):
              """ Simplify difference data structure
      
              Args:
                  difference (:obj:`dict`): representation of the semantic difference between two objects
      Severity: Minor
      Found in obj_tables/core.py - About 6 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 read_sheet has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

          def read_sheet(self, model, reader, sheet_name, num_row_heading_columns=0, num_column_heading_rows=0,
                         ignore_empty_rows=False, ignore_empty_cols=False):
              """ Read worksheet or file into a two-dimensional list
      
              Args:
      Severity: Minor
      Found in obj_tables/io.py - About 6 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 38 (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=False, write_schema=False, write_empty_models=True, write_empty_cols=True,
                  extra_entries=0, group_objects_by_model=True,
      Severity: Minor
      Found in obj_tables/io.py - About 5 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      class Gene(obj_tables.Model):
          id = obj_tables.StringAttribute(primary=True, unique=True, verbose_name='Id')
          symbol = obj_tables.StringAttribute(verbose_name='Symbol')
          location = obj_tables.OneToOneAttribute('Location', related_name='genes', verbose_name='Location')
      
      
      Severity: Major
      Found in examples/genomics/schema.py and 1 other location - About 5 hrs to fix
      examples/address_book/schema.py on lines 13..26

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 92.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      class Company(obj_tables.Model):
          name = obj_tables.StringAttribute(primary=True, unique=True, verbose_name='Name')
          url = obj_tables.UrlAttribute(verbose_name='URL')
          address = obj_tables.OneToOneAttribute('Address', related_name='company', verbose_name='Address')
      
      
      Severity: Major
      Found in examples/address_book/schema.py and 1 other location - About 5 hrs to fix
      examples/genomics/schema.py on lines 13..26

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 92.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function eval has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          def eval(self, values, with_units=False):
              """ Evaluate the expression
      
              Approach:
      
      
      Severity: Minor
      Found in obj_tables/math/expression.py - About 5 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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      class Metabolite(obj_tables.Model):
          id = obj_tables.StringAttribute(primary=True, unique=True)
          name = obj_tables.StringAttribute(none=True, default=None, default_cleaned_value=None)
          formula = obj_tables.chem.ChemicalFormulaAttribute()
      
      
      Severity: Major
      Found in examples/kinetic_metabolic_model/schema.py and 1 other location - About 5 hrs to fix
      examples/thermodynamic_metabolic_model/schema.py on lines 38..51

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 88.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      class Metabolite(obj_tables.Model):
          id = obj_tables.StringAttribute(primary=True, unique=True)
          name = obj_tables.StringAttribute(none=True, default=None, default_cleaned_value=None)
          formula = obj_tables.chem.ChemicalFormulaAttribute()
      
      
      Severity: Major
      Found in examples/thermodynamic_metabolic_model/schema.py and 1 other location - About 5 hrs to fix
      examples/kinetic_metabolic_model/schema.py on lines 42..55

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 88.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      class ProteinSeqAttribute(SeqAttribute):
          """ Bio.Seq.Seq attribute with Bio.Alphabet.ProteinAlphabet
          """
      
          def __init__(self, min_length=0, max_length=float('inf'), default=None, none_value=None, verbose_name='', description='',
      Severity: Major
      Found in obj_tables/bio/seq.py and 2 other locations - About 5 hrs to fix
      obj_tables/bio/seq.py on lines 355..376
      obj_tables/bio/seq.py on lines 403..424

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 87.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      class RnaSeqAttribute(SeqAttribute):
          """ Bio.Seq.Seq attribute with Bio.Alphabet.RNAAlphabet
          """
      
          def __init__(self, min_length=0, max_length=float('inf'), default=None, none_value=None, verbose_name='', description='',
      Severity: Major
      Found in obj_tables/bio/seq.py and 2 other locations - About 5 hrs to fix
      obj_tables/bio/seq.py on lines 355..376
      obj_tables/bio/seq.py on lines 379..400

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 87.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      class DnaSeqAttribute(SeqAttribute):
          """ Bio.Seq.Seq attribute with Bio.Alphabet.DNAAlphabet
          """
      
          def __init__(self, min_length=0, max_length=float('inf'), default=None, none_value=None, verbose_name='', description='',
      Severity: Major
      Found in obj_tables/bio/seq.py and 2 other locations - About 5 hrs to fix
      obj_tables/bio/seq.py on lines 379..400
      obj_tables/bio/seq.py on lines 403..424

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 87.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language