reimandlab/Visualistion-Framework-for-Genome-Mutations

View on GitHub

Showing 340 of 340 total issues

Function SearchBar has 150 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var SearchBar = function ()
{
    var input
    var results_div
    var current_query
Severity: Major
Found in website/static/searchbar.js - About 6 hrs to fix

    Function Orbits has 137 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var Orbits = function ()
    {
        var nodes = null
        var central_node = null
    
    
    Severity: Major
    Found in website/static/orbits.js - About 5 hrs to fix

      File cms.py has 386 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import os
      import pickle
      from contextlib import suppress
      from datetime import datetime
      from datetime import timedelta
      Severity: Minor
      Found in website/models/cms.py - About 5 hrs to fix

        Function AsyncFiltersHandler has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

        var AsyncFiltersHandler = function()
        {
            var config;
            var form;
            var current_state_checksum;
        Severity: Minor
        Found in website/static/filters.js - About 5 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 initTable has 130 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function initTable($table, query, additional_columns)
        {
            var initial_query = query
        
            function detailFormatter(index, row, $element)
        Severity: Major
        Found in website/static/pathways.js - About 5 hrs to fix

          Function MutationTable has 124 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var MutationTable = function ()
          {
              var element
              var mutations
              var impact_importances = {}
          Severity: Major
          Found in website/static/table.js - About 4 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                def list(self, pathways_list_name):
                    query = request.args.get('query', '')
                    pathways_list = PathwaysList.query.filter_by(name=pathways_list_name).first_or_404()
                    dataset = source_manager.source_by_name[pathways_list.mutation_source_name]
                    return template(
            Severity: Major
            Found in website/views/pathway.py and 1 other location - About 4 hrs to fix
            website/views/pathway.py on lines 121..130

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 84.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                def with_significant_genes(self, significant_gene_list_name):
                    query = request.args.get('query', '')
                    gene_list = GeneList.query.filter_by(name=significant_gene_list_name).first_or_404()
                    dataset = source_manager.source_by_name[gene_list.mutation_source_name]
                    return template(
            Severity: Major
            Found in website/views/pathway.py and 1 other location - About 4 hrs to fix
            website/views/pathway.py on lines 191..200

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 84.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

            File protein.py has 358 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            from typing import List, TYPE_CHECKING
            
            from sqlalchemy import select, case, exists, and_, func, distinct
            from sqlalchemy.ext.associationproxy import association_proxy
            from sqlalchemy.ext.hybrid import hybrid_property
            Severity: Minor
            Found in website/models/bio/protein.py - About 4 hrs to fix

              Function extract_drugs has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

              def extract_drugs(path: str):
                  root = ElementTree.iterparse(path, events=['start', 'end'])
              
                  namespace = '{http://www.drugbank.ca}'
                  state = State(
              Severity: Minor
              Found in website/imports/drugbank.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 from_query has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

                  def from_query(
                      query, count_query=None,
                      results_mapper=json_results_mapper, filters_class=None,
                      search_filter=None, search_sort=None,
                      prepare_for_sorting=None, **kwargs
              Severity: Minor
              Found in website/helpers/views.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 add_references_by_uniprot has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

                  def add_references_by_uniprot(self, data):
              
                      full_uniprot, ref_type, value = data
              
                      if '-' in full_uniprot:
              Severity: Minor
              Found in website/imports/external_references.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

              ContentManagementSystem has 35 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class ContentManagementSystem(FlaskView):
              
                  route_base = '/'
              
                  @staticmethod
              Severity: Minor
              Found in website/views/cms.py - About 4 hrs to fix

                File network.py has 354 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                from collections import namedtuple
                
                from flask import jsonify
                from flask import redirect
                from flask import render_template as template
                Severity: Minor
                Found in website/views/network.py - About 4 hrs to fix

                  Function InlineEditManager has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var InlineEditManager = function()
                  {
                      // values in the default config are dummy - just to illustrate the concept
                      var config = {
                          endpoint_save: '/save_message/',
                  Severity: Major
                  Found in website/static/inline_edit.js - About 4 hrs to fix

                    File sites.py has 343 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import re
                    from functools import lru_cache
                    
                    from pathlib import Path
                    from sys import float_info
                    Severity: Minor
                    Found in website/models/bio/sites.py - About 4 hrs to fix

                      File gene.py has 342 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import flask
                      from flask import render_template as template
                      from flask import jsonify
                      from flask import request
                      from flask_classful import FlaskView
                      Severity: Minor
                      Found in website/views/gene.py - About 4 hrs to fix

                        File filters.py has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        from sqlalchemy import exists
                        
                        from models import MC3Mutation, Disease, source_manager, SiteType, PCAWGMutation
                        from models.bio.drug import DrugGroup, Drug
                        from models import Cancer
                        Severity: Minor
                        Found in website/views/filters.py - About 4 hrs to fix

                          File table.py has 337 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          from collections import defaultdict
                          from typing import Iterable, Dict, Callable
                          
                          from sqlalchemy import distinct, and_
                          from tqdm import tqdm
                          Severity: Minor
                          Found in website/stats/table.py - About 4 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language