Showing 75 of 182 total issues
Function get_current_index
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_current_index(self):
current = self.es.indices.get(self.es_index, ignore=[400, 404])
if "status" in current and current["status"] == 404:
current = None
current_name = None
- 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 build_es_search_body_request
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_es_search_body_request(query, category, es_query, json_response_fields, search_fields, sort_by):
Function index_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def index_data(self, data, data_type, op_type):
s = time.time()
bulk_data = []
id_to_use = None
- 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
Avoid deeply nested control flow statements. Open
if value.split(" ")[-2] == "EXACT":
value = (" ".join(value.split(" ")[:-2]))[1:-1]
else:
continue
if key == "def":
Avoid deeply nested control flow statements. Open
if value.split(" ")[-2] == "EXACT":
value = (" ".join(value.split(" ")[:-2]))[1:-1]
else:
continue
if key == "def":
Avoid deeply nested control flow statements. Open
if pubMedId is not None:
if ':' in pubMedId:
localPubMedId = pubMedId.split(":")[1]
publicationModId = pub.get('modPublicationId')
Function get_species
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_species(self, taxon_id):
if taxon_id in ("NCBITaxon:7955"):
return "Danio rerio"
elif taxon_id in ("NCBITaxon:6239"):
return "Caenorhabditis elegans"
- 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 search
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def search(self, query, limit, offset, category, sort_by, params):
Avoid deeply nested control flow statements. Open
if publicationModId is not None:
localPubModId = publicationModId.split(":")[1]
if pubMedId is not None:
Avoid deeply nested control flow statements. Open
if pubMedId is not None:
pubs.append({'pubMedId': pubMedId, 'pubMedUrl': 'https://www.ncbi.nlm.nih.gov/pubmed/' + localPubMedId})
else:
if publicationModId is not None:
pubs.append({'publicationModId': publicationModId, 'pubModUrl': self.get_complete_pub_url(localPubModId, publicationModId)})
Function add_disease_annotation_to_gene
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_disease_annotation_to_gene(self, gene_id, omim_id, species):
if omim_id not in self.omim_dataset or gene_id not in self.genes:
return
gene_symbol = self.genes[gene_id]["symbol"].upper()
- 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 filter_highlighting
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def filter_highlighting(highlight):
if highlight is None:
return None
for k in highlight.keys():
- 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 build_search_query
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_search_query(query, search_fields, category, category_filters, args):
Function _process_gene_id_from_panther
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _process_gene_id_from_panther(self, gene_ids_panther, genes):
gene_ids = gene_ids_panther.split("|")
if gene_ids[0] in self.organism_to_mods:
mod = self.organism_to_mods[gene_ids[0]]
- 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 searchReducer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const searchReducer = function (state = DEFAULT_STATE, action) {
// TODO cleanup fromJS/toJS handling here.
switch(action.type) {
case 'SEARCH_ERROR':
if (!action.payload) {
- 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 build_search_query
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_search_query(query, search_fields, category, category_filters, args):
es_query = build_search_params(query, search_fields)
if category == '':
return es_query
- 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 build_es_search_body_request
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_es_search_body_request(query, category, es_query, json_response_fields, search_fields, sort_by):
es_search_body = {
'_source': json_response_fields,
'highlight': {
'fields': {}
- 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 load_go
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_go(self):
path = "tmp"
S3File("mod-datadumps/GO/ANNOT", "gene_association.human.gz", path).download()
go_annot_dict = {}
with gzip.open(path + "/gene_association.human.gz", 'rb') as file:
- 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 attach_annotations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def attach_annotations(self, genes):
for annot in self.annots:
go_id = annot['go_id']
gene_id = annot['gene_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
Function build_search_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_search_params(query, search_fields):
if query is "":
es_query = {"match_all": {}}
else:
es_query = {'bool':
- 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"