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
Function Orbits
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Orbits = function ()
{
var nodes = null
var central_node = null
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
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;
- Read upRead up
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)
Function MutationTable
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
var MutationTable = function ()
{
var element
var mutations
var impact_importances = {}
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(
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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(
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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()
- Read upRead up
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
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(
- Read upRead up
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
- Read upRead up
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:
- Read upRead up
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
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
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/',
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
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
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
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