Showing 122 of 193 total issues
Function parse
has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring. Open
def parse(self):
print('Parsing Entrez...')
symbol_to_info = dict()
hgnc_id_to_info = dict()
entrez_to_info = dict()
- 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 59 (exceeds 5 allowed). Consider refactoring. Open
def create_interaction_claims
CSV.foreach(file_path, :headers => true, :col_sep => "\t") do |row|
next if row['Drug'].nil? || row['Drug'] == '[]'
if row['Drug'].include?(',') || row['Drug'].include?(';')
combination_drug_name = row['Drug']
- 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 run
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def run(source_id: nil)
claims = DataModel::DrugClaim.eager_load(:drug_claim_aliases, :drug_claim_attributes).where(drug_id: nil)
unless source_id.nil?
claims = claims.where(source_id: source_id)
end
- 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 import_claims
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def import_claims
CSV.foreach(file_path, :col_sep => "\t", :headers => true) do |row|
drug_claim = create_drug_claim(row['drug_id'].upcase, row['drug_name'], 'DrugBank Drug Identifier')
create_drug_claim_alias(drug_claim, row['drug_name'].upcase, 'DrugBank Drug 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
Method cleanup_whitespaces
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.cleanup_whitespaces
DataModel::InteractionClaimType.where("type LIKE ' %' or type LIKE '% '").all.each do |t|
t.value = t.value.strip
t.save!
end
Method import_claims
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def import_claims
CSV.foreach(gene_file_path, :headers => true) do |line|
gene_name = line['Human Entrez Gene']
next if blank?(gene_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
File database.rb
has 380 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Utils
module Database
def self.delete_genes
sql = <<-SQL
Method cleanup_whitespaces
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def self.cleanup_whitespaces
DataModel::InteractionClaimType.where("type LIKE ' %' or type LIKE '% '").all.each do |t|
t.value = t.value.strip
t.save!
end
- 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 import_claims
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def import_claims
CSV.foreach(file_path, :headers => true, :col_sep => ",") do |row|
next if row['Highest_status'] == 'Terminated' || row['Highest_status'] == 'Withdrawn from market' || row['Highest_status'].match(/Discontinued/) || row['Highest_status'] == 'Investigative'
gene_name, gene_abbreviation = row['Target_Name'].split(' (', 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
File drug_grouper.rb
has 364 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'net/https'
module Genome
module Groupers
class DrugGrouper
Method destroy_na
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.destroy_na
sql = <<-SQL
delete from drug_claim_types_drug_claims d
where
d.drug_claim_id in
Method create_interaction_claims
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_interaction_claims
CSV.foreach(file_path, :headers => true, :col_sep => "\t") do |row|
next if row['Drug'].nil? || row['Drug'] == '[]'
if row['Drug'].include?(',') || row['Drug'].include?(';')
combination_drug_name = row['Drug']
Method get_normalized_record_for_multi_matches
has a Cognitive Complexity of 22 (exceeds 5 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
- 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 name_normalizer
has a Cognitive Complexity of 21 (exceeds 5 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'
- 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 write
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def write(self):
print('Writing to .tsv...')
i = 0
no_ensembl = no_entrez = total = 0
header = ('count', 'drug_id', 'drug_name', 'drug_synonyms', 'drug_cas_number', 'drug_brands',
- 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 to_tsv
has a Cognitive Complexity of 20 (exceeds 5 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'))
- 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
Consider simplifying this complex logical expression. Open
elsif val == 'inhibitor, competitive' || val == 'gating inhibitor' || val == 'inhibitor; antagonist; blocker' || val == 'inhibitor (gating inhibitor)' || val == 'growth_inhibition' || val == 'inhibition' || val == 'weak inhibitor' || val == 'aggregation inhibitor' || val == 'inhibition of synthesis' || val == "translocation inhibitor" || val == 'inhibits downstream inflammation cascades' || val == 'inactivator'
'inhibitor'
elsif val == 'channel blocker' || val == 'blocker (channel blocker)' || val == 'nucleotide exchange blocker'
'blocker'
elsif val == 'antisense' || val == 'sirna drug'
Method create_interaction_claims
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def create_interaction_claims
CSV.foreach(file_path, :headers => true) do |row|
drug_id = row['compound_id']
drug_name = row['compound_name']
gene_name = row['gene_names']
- 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 run
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(source_id: nil)
claims = DataModel::DrugClaim.eager_load(:drug_claim_aliases, :drug_claim_attributes).where(drug_id: nil)
unless source_id.nil?
claims = claims.where(source_id: source_id)
end
Method import_claims
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_claims
CSV.foreach(gene_file_path, :headers => true) do |line|
gene_name = line['Human Entrez Gene']
next if blank?(gene_name)