reimandlab/Visualistion-Framework-for-Genome-Mutations

View on GitHub
website/analyses/variability_in_population.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function ptm_variability_population_rare_substitutions has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def ptm_variability_population_rare_substitutions(site_type, motif=None):
    """Compare variability of sequence in PTM sites
    with the variability of sequence outside of PTM sites,
    using frequency of rare substitutions.
    """
Severity: Minor
Found in website/analyses/variability_in_population.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 proteins_variability has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def proteins_variability(source, only_primary=True, site_type=None, without_sites=False, by_counts=False, site_motif=None):
Severity: Minor
Found in website/analyses/variability_in_population.py - About 45 mins to fix

    Function proteins_variability has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def proteins_variability(source, only_primary=True, site_type=None, without_sites=False, by_counts=False, site_motif=None):
    
        if by_counts:
            variability_measure = func.count(distinct(source.id))
        else:
    Severity: Minor
    Found in website/analyses/variability_in_population.py - About 45 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 variability_in_population has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def variability_in_population(
    Severity: Minor
    Found in website/analyses/variability_in_population.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if muts_count == 0:
                              percentage = 0
                          variability.append(float(percentage))
      Severity: Major
      Found in website/analyses/variability_in_population.py - About 45 mins to fix

        Function group_by_substitution_rates has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def group_by_substitution_rates(source, only_primary=True, bins_count=100, by_frequency=False, site_type=None):
        Severity: Minor
        Found in website/analyses/variability_in_population.py - About 35 mins to fix

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

          def variability_in_population(
              source, site_type=None, protein_subset=None, rare_threshold=0.5,
              only_primary=True, site_motif=None
          ):
          
          
          Severity: Minor
          Found in website/analyses/variability_in_population.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 proteins_variability_by_ptm_presence has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def proteins_variability_by_ptm_presence(site_type, by_counts, site_motif=None):
              results = {}
          
              for group, without_ptm, site_type in [('Without PTM sites', True, None), ('With PTM sites', False, site_type)]:
                  result = {}
          Severity: Minor
          Found in website/analyses/variability_in_population.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