Function record_project_job
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def record_project_job(project, job_id, analysis_dir, workflow=None, engine='rna_ngi', run_mode='local', config=None, config_file_path=None):
with get_session() as db_session:
project_db_obj=ProjectAnalysis(project_id=project.project_id,
job_id=job_id,
project_name=project.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 update_analysis
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def update_analysis(project_id, status):
charon_session=CharonSession()
mail_analysis(project_id, engine_name='rna_ngi', level='INFO' if status else 'ERROR')
new_sample_status='ANALYZED' if status else 'FAILED'
new_seqrun_status='DONE' if status else 'FAILED'
- 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 update_charon_with_local_jobs_status
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update_charon_with_local_jobs_status(quiet=False, config=None, config_file_path=None):
jobs=[]
with get_session() as db_session:
jobs=db_session.query(ProjectAnalysis).filter(ProjectAnalysis.engine=='rna_ngi').all()
- 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 record_project_job
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def record_project_job(project, job_id, analysis_dir, workflow=None, engine='rna_ngi', run_mode='local', config=None, config_file_path=None):
Avoid deeply nested control flow statements. Open
if CharonSession().libprep_get(project.project_id, sample.name, libprep.name).get('qc') != "FAILED":
for seqrun in libprep:
if seqrun.being_analyzed:
CharonSession().seqrun_update(project.project_id, sample.name, libprep.name, seqrun.name, alignment_status="RUNNING")
except Exception as e:
Avoid deeply nested control flow statements. Open
for seqrun in charon_session.libprep_get_seqruns(project_id, sample.get('sampleid'),libprep.get('libprepid')).get('seqruns', {}):
if seqrun.get('alignment_status')=="RUNNING":
LOG.info("Marking analysis of seqrun {}/{}/{}/{} as {}".format(project_id, sample.get('sampleid'),libprep.get('libprepid'), seqrun.get('seqrunid'), new_seqrun_status))
charon_session.seqrun_update(project_id, sample.get('sampleid'),libprep.get('libprepid'), seqrun.get('seqrunid'), alignment_status=new_seqrun_status)