Function make_doc
has a Cognitive Complexity of 121 (exceeds 5 allowed). Consider refactoring. Open
def make_doc(self, file_names, file_dict):
os.makedirs(os.path.dirname(
self.cache_directory + 'docs/'), exist_ok=True)
null = 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
File sabio_rk_json_mongo.py
has 652 lines of code (exceeds 250 allowed). Consider refactoring. Open
'''Parse SabioRk json files into MongoDB documents
(json files acquired by running sqlite_to_json.py)
:Author: Zhouyang Lian <zhouyang.lian@familian.life>
:Author: Jonathan <jonrkarr@gmail.com>
:Date: 2019-04-02
Function add_inchi_hash
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def add_inchi_hash(self, ids=None):
'''
Add inchi key values of _value_inchi in sabio_rk collection
'''
- 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 fill_reactant_aggregate_name
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def fill_reactant_aggregate_name(self, start=0):
"""Fill sabio documents with reactant aggregate
information by reactants' name.
"""
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 __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, db = None, MongoDB = None, cache_directory=None,
Function fill_kegg_meta
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def fill_kegg_meta(self, start=0):
"""Fill kegg information for reactions.
Args:
start (:obj:`int`, optional): Starting document. Defaults to 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
Avoid deeply nested control flow statements. Open
for k in range(len(cur_entry_synonym_list)):
cur_entry_synonym_dict = cur_entry_synonym_list[k]
synonym__id = cur_entry_synonym_dict['synonym__id']
synonyms.append(
synonym_list[synonym__id-1]['name'])
Avoid deeply nested control flow statements. Open
for k in range(len(cur_compound_compound_structure_list)):
compound_structure__id = cur_compound_compound_structure_list[
k]['compound_structure__id']
cur_compound_structure_dict = next(
item for item in compound_structure_list if item['_id'] == compound_structure__id)
Function fill_ec_meta
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fill_ec_meta(self, start=0):
"""Fill sabio documents with ec meta information.
"""
query = {}
docs = self.collection.find(filter=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 add_taxon_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_taxon_info(self):
"""Fill in taxonomic information
"""
projection = {'_id': 0, 'kinlaw_id': 1, 'taxon_id': 1}
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"