KarrLab/obj_tables

View on GitHub

Showing 425 of 542 total issues

Avoid too many return statements within this function.
Open

            return (None, InvalidAttribute(self, ['Multiple matching objects with primary attribute = {}'.format(value)]))
Severity: Major
Found in obj_tables/core.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return (datetime.combine(date_value, time_value), None)
    Severity: Major
    Found in obj_tables/core.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return True
      Severity: Major
      Found in obj_tables/core.py - About 30 mins to fix

        Function verify_schemas has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def verify_schemas(self):
                """ Verify that each schema can be independently imported
        
                It can be difficult to import a schema via `importlib.import_module()` in
                `import_module_for_migration()`. This method tests that proactively.
        Severity: Minor
        Found in obj_tables/migrate.py - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def __str__(self):
                """ Get string representation
        
                Returns:
                    :obj:`str`: string representation of a :obj:`Migrator`; collections attributes are rendered
        Severity: Minor
        Found in obj_tables/migrate.py - About 25 mins 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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def load(schema_changes_file):
                """ Read a schema changes file
        
                Args:
                    schema_changes_file (:obj:`str`): path to the schema changes file
        Severity: Minor
        Found in obj_tables/migrate.py - About 25 mins 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 6 (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/sci/units.py - About 25 mins 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 plot_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def plot_data(data_filename=DATA_FILENAME, plot_filename=PLOT_FILENAME):
            data = wc_utils.workbook.io.read(data_filename)['!!Data']
            data = data[3:]
        
            rxn_ids = []
        Severity: Minor
        Found in examples/merged_metabolic_model/run.py - About 25 mins 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 6 (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/sci/uncertainty.py - About 25 mins 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 commits_as_graph has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def commits_as_graph(self):
                """ Make a DAG for this repo's commit dependencies - edges point from dependent commit to parent commit
        
                The DAG contains all commits in the repo on which the latest commit depends. Also creates
                `git_hash_map`, a map from all git hashes to their commits.
        Severity: Minor
        Found in obj_tables/migrate.py - About 25 mins 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 _decode_instance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def _decode_instance(encoded_data, decoded_objects, data_to_decode):
            """ Decode a data structure
        
            Args:
                encoded_data (:obj:`dict`, :obj:`list`, or scalar): data structure with
        Severity: Minor
        Found in examples/decode_json_data.py - About 25 mins 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 6 (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
        Severity: Minor
        Found in obj_tables/sci/refs.py - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self):
                """ Validate files to migrate, and load all schema changes files
        
                Raises:
                    :obj:`MigratorError`: if any files to migrate do not exist,
        Severity: Minor
        Found in obj_tables/migrate.py - About 25 mins 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_mapped_attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_mapped_attribute(self, existing_class, existing_attribute):
                """ Get the corresponding migrated class and attribute for the existing class and attribute
        
                Args:
                    existing_class (:obj:`obj_tables.core.ModelMeta` or :obj:`str`): an existing class
        Severity: Minor
        Found in obj_tables/migrate.py - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def deserialize(self, value):
                """ Deserialize value
        
                Args:
                    value (:obj:`str`): semantically equivalent representation
        Severity: Minor
        Found in obj_tables/bio/seq.py - About 25 mins 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 _dump_index_dicts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _dump_index_dicts(self, file=None):
                """ Dump the index dictionaries for debugging
        
                Args:
                    file (:obj:`object`, optitonal): an object with a :obj:`write(string)` method
        Severity: Minor
        Found in obj_tables/core.py - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def clean(self, value):
                """ Deserialize value
        
                Args:
                    value (:obj:`str`): semantically equivalent representation
        Severity: Minor
        Found in obj_tables/core.py - About 25 mins 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 6 (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 25 mins 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 _gc_weaksets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _gc_weaksets(self):
                """ Garbage collect empty WeakSets formed by deletion of weak refs to :obj:`Model` instances with no strong refs
        
                Returns:
                    :obj:`int`: number of empty WeakSets deleted
        Severity: Minor
        Found in obj_tables/core.py - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, min=float('nan'), max=float('nan'), nan=True,
                         default=float('nan'), default_cleaned_value=float('nan'), none_value=float('nan'), verbose_name='', description='',
                         primary=False, unique=False):
                """
                Args:
        Severity: Minor
        Found in obj_tables/core.py - About 25 mins 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