Showing 168 of 557 total issues
Function convert_results
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def convert_results(patient, sda_lab_orders):
user = get_import_user()
results = list()
- 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 validate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, serial_data):
# Validating reconsent letter sent and returned dates make sense
errors_dict = {}
if serial_data['reconsent_letter_sent_date']:
- 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 export
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def export(self, sheet, errorfmt, warningfmt):
entries = [entry for entry in self.patient.entries if entry.form.slug == 'socio-economic']
if entries:
for entry in entries:
data = get_form_data(entry, slice(1, -4), self.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 export
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def export(self, sheet, errorfmt, warningfmt):
entries = [entry for entry in self.patient.entries if entry.form.slug == 'anthropometrics']
if entries:
for entry in entries:
- 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 setup
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup(app):
alport.register_views(app)
consents.register_views(app)
consultants.register_views(app)
demographics.register_views(app)
File views.py
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Admin views."""
import glob
import io
import os
Function create_renal_imaging_f
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create_renal_imaging_f():
def create_renal_imaging(patient, source_group, source_type, n):
for _ in range(n):
renal_imaging = RenalImaging()
renal_imaging.patient = patient
- 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 export
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def export(self, sheet, errorfmt=None, warningfmt=None):
recorded = False
for diagnosis in self.diagnoses:
if diagnosis.diagnosis not in self.primary_diagnoses:
continue
- 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 get_rows
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_rows(self):
observations = queries.get_observations()
for observation in observations:
self._columns.append(column(observation.short_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_system_groups
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update_system_groups(patient):
"""Check that patient system group still has some children groups."""
systems = patient.systems
if len(systems) == 1:
- 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 create_patients
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def create_patients(n, data=True):
hospital_groups = Group.query.filter(Group.type == GROUP_TYPE.HOSPITAL).all()
cohort_groups = Group.query.filter(Group.type == GROUP_TYPE.COHORT).all()
source_types = [SOURCE_TYPE_MANUAL, SOURCE_TYPE_UKRDC]
- 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 main
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def main():
logging.basicConfig(level=logging.INFO)
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
- 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 export
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def export(self, sheet, errorfmt=None, warningfmt=None):
visit_dates = [i.data.get('date') for i in self.patient.entries if i.form.slug == 'nurtureckd']
visit_dates = [datetime.datetime.strptime(i, '%Y-%m-%d').date() for i in visit_dates]
# TODO: clean this stuff up.
- 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 export
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def export(self, sheet, errorfmt=None, warningfmt=None):
progressions = self.patient.renal_progressions
if progressions:
for instance in progressions:
data = [getattr(instance, field) for field in self.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 consent_status
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def consent_status(self):
"""Return what consent status patient is in."""
if self.year_of_death:
return CONSENT_STATUS.OK
- 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 has_object_permission
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def has_object_permission(self, request, user, obj):
if not super(SystemSourceObjectPermission, self).has_object_permission(request, user, obj):
return False
if is_safe_method(request):
- 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 create_results_f
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create_results_f():
observations = Observation.query.filter(Observation.value_type == OBSERVATION_VALUE_TYPE.REAL).all()
def create_results(patient, source_group, source_type, x, y):
for observation in random.sample(observations, min(x, len(observations))):
- 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 make_row
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def make_row(self, record, diagnosis):
'''
Returns a list that represents the content of a single row
in a CSV file that provides data about a patients diagnoses.
- 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 validate_is_bot
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_is_bot(self, is_bot):
current_user = self.context['user']
instance = self.instance
if instance is 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 ckd_epi_egfr_calculated_with_ethnicity
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def ckd_epi_egfr_calculated_with_ethnicity(self):
if self.observation.short_name.lower() != "creatinine" or not self.value:
return ""
black_ethnicities = (
- 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"