Showing 217 of 237 total issues
Avoid deeply nested control flow statements. Open
Open
if ( attrs[ i ] ) {
name = attrs[ i ].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = camelCase( name.slice( 5 ) );
dataAttr( elem, name, data[ name ] );
Avoid deeply nested control flow statements. Open
Open
if ( conv && s.throws ) {
response = conv( response );
} else {
try {
response = conv( response );
Function on
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function on( elem, types, selector, data, fn, one ) {
Avoid deeply nested control flow statements. Open
Open
if ( copyIsArray && !Array.isArray( src ) ) {
clone = [];
} else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
clone = {};
} else {
Avoid deeply nested control flow statements. Open
Open
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
Avoid deeply nested control flow statements. Open
Open
if ( hasScripts ) {
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( scripts, getAll( node, "script" ) );
Avoid deeply nested control flow statements. Open
Open
if ( newContext !== context || !support.scope ) {
// Capture the context ID, setting it first if necessary
if ( ( nid = context.getAttribute( "id" ) ) ) {
nid = nid.replace( rcssescape, fcssescape );
Avoid deeply nested control flow statements. Open
Open
if ( !selector ) {
push.apply( results, seed );
return results;
}
Avoid deeply nested control flow statements. Open
Open
if ( restoreDisplay == null ) {
display = style.display;
restoreDisplay = display === "none" ? "" : display;
}
Avoid deeply nested control flow statements. Open
Open
if entity_type == "Gene":
self.make_pharmgkb_gene_node(
fh=node,
this_id=entity_id,
name=entity_name,
Avoid deeply nested control flow statements. Open
Open
if protein in string_to_uniprot_id_map:
uniprot_curie = (
f"UniProtKB:{string_to_uniprot_id_map[protein]}"
)
uniprot_curie = collapse_uniprot_curie(uniprot_curie)
Avoid deeply nested control flow statements. Open
Open
if cur_gene_name in linec_split:
#print("found")
found = 1
countORFs = countORFs + 1
Avoid deeply nested control flow statements. Open
Open
if not item:
continue # not xrefs, skip
item = item.strip('"') # remove quotes around each item
Function result_dict_to_tsv
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def result_dict_to_tsv(result_dict: dict, outfile: str) -> None:
"""Convert a result_dict to a TSV for output."""
with open(outfile, "wt") as f:
# header
f.write("\t".join(result_dict["head"]["vars"]) + "\n")
- 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 transform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def transform(
input_dir: str, output_dir: str, sources: Optional[List[str]] = None
) -> None:
"""Call scripts in kg_covid_19/transform/[source name]/ to transform data.
- 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
Open
if self.key_parsed_ids not in dat:
dat[self.key_parsed_ids] = dict()
dat[self.key_parsed_ids][key] = value
Avoid deeply nested control flow statements. Open
Open
for x in v:
r = self.parse_doc_fields(x, allowed_properties, remap)
for k2, v2 in r.items():
update_properties(k2, v2)
else:
Function make_id_mapping_file
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def make_id_mapping_file(
Avoid deeply nested control flow statements. Open
Open
if gene not in seen_genes:
seen_genes.add(gene)
ensemble_gene = f"ENSEMBL:{gene}"
gene_informations = self.gene_info_map[
self.ensembl2ncbi_map[gene]
Function elastic_search_query
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def elastic_search_query(