reimandlab/Visualistion-Framework-for-Genome-Mutations

View on GitHub
website/imports/mutations/mutation_importer/__init__.py

Summary

Maintainability
D
2 days
Test Coverage

Function export_genomic_coordinates_of_ptm has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    def export_genomic_coordinates_of_ptm(
        self, export_path=None, path=None,
        only_primary_isoforms=False, only_confirmed_mutations=True
    ):
        path = self.choose_path(path)
Severity: Minor
Found in website/imports/mutations/mutation_importer/__init__.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 __init__.py has 320 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import gc
import gzip
from abc import abstractmethod
from collections import defaultdict
from typing import List, Iterable
Severity: Minor
Found in website/imports/mutations/mutation_importer/__init__.py - About 3 hrs to fix

    MutationImporter has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MutationImporter(BioImporter, MutationExporter):
    
        @abstract_property
        def name(self):
            """Name of the mutations importer"""
    Severity: Minor
    Found in website/imports/mutations/mutation_importer/__init__.py - About 3 hrs to fix

      Avoid deeply nested control flow statements.
      Open

                              if relevant:
                                  protein_mutations.append(protein_mutation)
                                  sites_affected.append(mutation_sites)
      
      
      Severity: Major
      Found in website/imports/mutations/mutation_importer/__init__.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                for site in mutation.get_affected_ptm_sites():
                                    relevant_proteome_coordinates.append(
                                        (pos, protein, alt, ref, site)
                                    )
        
        
        Severity: Major
        Found in website/imports/mutations/mutation_importer/__init__.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for pos, protein, alt, ref, site in relevant_proteome_coordinates:
                                      if (
                                          protein_mutation.startswith(protein.gene_name + ':' + protein.refseq)
                                          and
                                          protein_mutation.endswith(ref + str(pos) + alt)
          Severity: Major
          Found in website/imports/mutations/mutation_importer/__init__.py - About 45 mins to fix

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

                def load(self, path=None, update=False, **kwargs):
                    """Load, parse and insert mutations from given path.
            
                    If update is True, old mutations will be updated and new added.
                    Essential difference when using update is that 'update' prevents
            Severity: Minor
            Found in website/imports/mutations/mutation_importer/__init__.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 look_after_duplicates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def look_after_duplicates(self, mutation_id, mutations_details, values):
                    """To prevent inclusion of duplicate data use this function to check for duplicates
                    before adding any data to mutations_details insertion list.
            
                    For example, assuming that clinvar_mutations is an insertion list use:
            Severity: Minor
            Found in website/imports/mutations/mutation_importer/__init__.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

            There are no issues that match your filters.

            Category
            Status