Showing 122 of 193 total issues
Class GeneCategorySearchResultsPresenter
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class GeneCategorySearchResultsPresenter
include Genome::Extensions
attr_reader :search_results
def initialize(search_results, params, start_time, view_context)
Function fnUpdate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
"fnUpdate": function ( oSettings, fnDraw ) {
var iListLength = 5;
var oPaging = oSettings.oInstance.fnPagingInfo();
var an = oSettings.aanFeatures.p;
var i, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
- 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
Method interaction_search_results
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def interaction_search_results
if !params[:name].nil?
params[:search_mode] = 'drugs'
params[:identifiers] = params[:name]
params[:gene_categories] = DataModel::GeneClaimCategory.all_category_names unless params[:gene_categories]
- 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 parse
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def parse(self):
self.rows = []
with open(os.path.join(self.download_path, 'gene_info.human')) as f:
fieldnames = ['tax_id', 'entrez_id', 'entrez_gene_symbol', 'locus_tag',
'entrez_gene_synonyms', 'dbXrefs', 'chromosome', 'map_loc',
- 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 get_drugbank.py
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
__author__ = 'Kelsy C Cotto'
import zipfile
import os
import sys
Class InteractionSearchResultApiV1Presenter
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class InteractionSearchResultApiV1Presenter
def initialize(search_result, identifier, interactions)
@result = search_result
@identifier = identifier
@interactions = interactions.flat_map(&:interaction_claims).map{|i| InteractionWrapper.new(i)}
Method dgidb_go_terms
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dgidb_go_terms
@dgidb_go_terms ||= [{short_name: "Kinase", full_go_name: "KinaseActivity",
human_readable: "Kinase", go_id: "GO0016301"},
{short_name: "TyrosineKinase", full_go_name: "ProteinTyrosineKinaseActivity",
human_readable: "Tyrosine Kinase", go_id: "GO0004713"},
Consider simplifying this complex logical expression. Open
elsif val =~ /other/ || val =~ /unknown/ || val == 'protector' || val == 'oxidizer' || val == 'coating agent' || val == 'dilator' || val == 'deoxidizer' || val == 'diffusing substance'|| val == 'vesicant' || val == 'gene replacement'
'other/unknown'
elsif val == 'neutralizer' || val == 'reducer' || val == 'metabolizer' || val == 'acetylation' || val == 'chelator' || val == 'cross-linking/alkylation' || val == 'regulator'
'modulator'
elsif val == 'positive allosteric modulator' || val == 'regulator (upregulator)' || val == 'enhancer' || val == 'modulator (allosteric modulator)'
Function truncate
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function truncate() {
var data = this.data('trunk8'),
settings = data.settings,
width = settings.width,
side = settings.side,
Method get_normalized_record_for_chembl_match
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_normalized_record_for_chembl_match(chembl_match)
records = chembl_match['records']
if records.size == 1
return get_normalized_record_or_drug_for_chembl_id(records.first['concept_identifier'])
else
- 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
Method get_normalized_record_for_multi_matches
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_normalized_record_for_multi_matches(matches)
#2. a.
matches_with_chembl_id = matches.select{|t, m| chembl_ids_for_records(m['records']).size > 0}
if matches_with_chembl_id.size == 0
matches_with_chembl_id = matches
Method match_objects_to_drugs
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.match_objects_to_drugs(unfiltered_results, filtered_results, search_terms)
results_to_drug_groups = search_terms.each_with_object({}) { |term, h| h[term] = [] }
ids_to_results = filtered_results.each_with_object({}) { |result, h| h[result.id] = result}
unfiltered_results.each do |unfiltered_result|
result = ids_to_results[unfiltered_result.id]
- 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
Method create_interaction_claims
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create_interaction_claims
CSV.foreach(file_path, :headers => true, :col_sep => "\t") do |row|
next if row['Association'] == 'not associated' || row['Association'] == 'ambiguous'
if row['Entity1_type'] == 'Gene' and row['Entity2_type'] == 'Chemical'
gene_name = row['Entity1_name']
- 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 fnUpdate
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
"fnUpdate": function ( oSettings, fnDraw ) {
var iListLength = 5;
var oPaging = oSettings.oInstance.fnPagingInfo();
var an = oSettings.aanFeatures.p;
var i, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
Method to_tsv
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_tsv
# entrez = Genome::Updaters::GetEntrez.new
# f = open(entrez.local_path('gene_info.gz'))
check_files
f = File.open(local_path('gene_info.gz'))
Method name_normalizer
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.name_normalizer(val)
val = val.downcase.strip
if val == 'na' || val == 'n/a'
'n/a'
elsif val =~ /other/ || val =~ /unknown/ || val == 'protector' || val == 'oxidizer' || val == 'coating agent' || val == 'dilator' || val == 'deoxidizer' || val == 'diffusing substance'|| val == 'vesicant' || val == 'gene replacement'
Method uniquify_interaction_claims
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.uniquify_interaction_claims
DataModel::InteractionClaim.find_each do |ic|
all_matching_claims = DataModel::InteractionClaim.where(drug_claim_id: ic.drug_claim_id, gene_claim_id: ic.gene_claim_id, source_id: ic.source_id).all
next if all_matching_claims.length == 1
- 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
Method query_drug_claim_aliases
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def query_drug_claim_aliases(drug_claim_aliases)
record = nil
drug_claim_aliases.each do |a|
normalized_record = find_normalized_record_for_term(a.alias)
unless normalized_record.nil?
- 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
Method original_data_source_url
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def original_data_source_url
base_url = self.source.base_url
name = self.name
case self.source.source_db_name
when 'DrugBank'
Method process_drug
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_drug(current_id, alternate_names)
if alternate_names.any? { |name| existing_drugs[name.upcase.strip] }
pubchem_primary_name = alternate_names.first.upcase.strip
drug_claim = DataModel::DrugClaim.create(
{