reimandlab/Visualistion-Framework-for-Genome-Mutations

View on GitHub
website/analyses/motifs.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function gather_muts_and_sites has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def gather_muts_and_sites(
        self, mutations: BaseQuery, sites: BaseQuery,
        show_progress=True, occurrences_in: List[MutationSource] = None, intersection=None
    ) -> MotifsData:
        """If occurrences_in is provided, the count of mutations will
Severity: Minor
Found in website/analyses/motifs.py - About 3 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 count_by_sources has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def count_by_sources(
Severity: Major
Found in website/analyses/motifs.py - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if is_affected(mutated_sequence, motif):
                                sites_with_broken_motif[motif_name].add(site)
                                muts_breaking_sites_motif[motif_name][mutation] = count
    
    
    Severity: Major
    Found in website/analyses/motifs.py - About 45 mins to fix

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

      def count_by_active_driver(
      Severity: Minor
      Found in website/analyses/motifs.py - About 35 mins to fix

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

            def gather_muts_and_sites(
        Severity: Minor
        Found in website/analyses/motifs.py - About 35 mins to fix

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

          def select_sites_with_motifs(sites: Iterable, motifs) -> Mapping[MotifName, set]:
          
              sites_with_motif = defaultdict(set)
          
              for site in sites:
          Severity: Minor
          Found in website/analyses/motifs.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