Showing 168 of 557 total issues
Function egfr_calculated
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def egfr_calculated(self):
if self.observation.short_name.lower() != "creatinine" or not self.value:
return ""
creat88 = self.value / 88.4
- 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_enabled
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_is_enabled(self, is_enabled):
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 has_permission_for_group
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def has_permission_for_group(user, group, permission, explicit=False):
"""Check that the user has a permission on a group."""
if user.is_admin:
return True
- 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"
Further reading
Function list_patients
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_patients():
args = parse_args(PatientListRequestSerializer)
builder = PatientQueryBuilder(current_user)
Function _create_patient
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _create_patient(self):
logger.info("Creating patient number={}".format(self.number))
system_group = self.cohort_group.parent_group
patient = Patient()
Function export_validate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def export_validate():
primary = GROUP_DIAGNOSIS_TYPE.PRIMARY
nurtureins = Group.query.filter_by(code='NURTUREINS').first()
nurtureins_primary_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 filter_query
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def filter_query(self, query):
query = super(PatientDiagnosisListView, self).filter_query(query)
args = parse_args(PatientDiagnosisRequestSerializer)
- 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 import_sda
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def import_sda(data, sequence_number, patient_id=None):
# Note about data types:
# The code that produces SDA JSON files in the UKRDC determines types based on the
# content of the value.
# A value that is all digits will be sent as a JSON number.
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def get_rows(self):
headers = [col[0] for col in self._columns]
yield headers
q = queries.get_results(self.config)
- 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 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self):
super(RadarAdmin, self).__init__(template_folder='admin/templates')
self.context_processor(inject_current_user)
Function list_users
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def list_users():
args = parse_args(UserListRequestSerializer)
builder = UserQueryBuilder(current_user)
- 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 sort_query
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def sort_query(self, query):
sort, reverse = self.get_sort_args()
if sort is not None:
# Can be a dict or a 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 get_user_session
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_user_session():
if has_request_context() and not hasattr(_request_ctx_stack.top, 'user_session'):
# Look in the header
user_session = get_user_session_from_header()
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, data):
if data['normal_pregnancy'] is False:
self.run_validators_on_field(data, 'abnormal_pregnancy_text', [not_empty()])
if data['neurological_problems']:
- 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 _nhs_no
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _nhs_no(value, min_value=None, max_value=None):
if not isinstance(value, str):
value = str(value)
# Remove non-digits
- 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_admin
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_is_admin(self, is_admin):
current_user = self.context['user']
instance = self.instance
if is_admin:
- 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_contact_info
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def export_contact_info(sda_patient, patient):
if (
patient.home_number or
patient.work_number or
patient.mobile_number or
- 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 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def export(self):
try:
patient = self.data[0]
except IndexError:
print('No {} patients found in {}'.format(self.kind.upper(), self.hospital.name))