reimandlab/Visualistion-Framework-for-Genome-Mutations

View on GitHub
website/views/search.py

Summary

Maintainability
D
2 days
Test Coverage

File search.py has 682 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import pickle
from collections import defaultdict
from urllib.parse import unquote

from flask import make_response, redirect, abort
Severity: Major
Found in website/views/search.py - About 1 day to fix

    Function mutations has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        def mutations(self):
            """Render search form and results (if any) for proteins or mutations"""
            task_id = request.args.get('task_id', None)
            use_celery = current_app.config.get('USE_CELERY', False)
            filter_manager = SearchViewFilters()
    Severity: Minor
    Found in website/views/search.py - About 4 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 autocomplete_all has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def autocomplete_all(self):
            """
            Supports:
                Protein or gene:
                {refseq_id}
    Severity: Minor
    Found in website/views/search.py - About 1 hr 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 search_proteins has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def search_proteins(
    Severity: Minor
    Found in website/views/search.py - About 35 mins to fix

      Function search_proteins has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def search_proteins(
              phrase, limit=None, filter_manager=None,
              features=('gene_symbol', 'refseq', 'gene_name', 'uniprot'),
              engines=advanced_search_engines
      ):
      Severity: Minor
      Found in website/views/search.py - About 35 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 progress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def progress(self, task_id):
      
              celery_task = celery.AsyncResult(task_id)
              status = celery_task.status
      
      
      Severity: Minor
      Found in website/views/search.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