renalreg/radar

View on GitHub

Showing 557 of 557 total issues

Function ethnic_group has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def ethnic_group(self):
        ethnicity = get_path(self.data, 'ethnic_group', 'code')

        if ethnicity is not None:
            ethnicity = ethnicity.upper()
Severity: Minor
Found in radar/ukrdc_importer/demographics.py - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def export(self, sheet, errorfmt=None, warningfmt=None):
        recorded = False
        for diagnosis in self.diagnoses:
            if diagnosis.diagnosis in self.primary_diagnoses:
                continue
Severity: Minor
Found in radar/exporter/nurture_validator.py - About 25 mins to fix

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 check_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def check_config(config):
    debug = config.setdefault('DEBUG', False)
    testing = config.setdefault('TESTING', False)

    if config.get('SECRET_KEY') is None:
Severity: Minor
Found in radar/config.py - About 25 mins to fix

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 build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def build(self, permissions=True, current=None):
        query = self.query

        if permissions and not self.current_user.is_admin:
            # Filter the patients based on the user's permissions and the type of query
Severity: Minor
Found in radar/patient_search.py - About 25 mins to fix

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 _select_past has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _select_past(self, a, b):
        """Return the membership with the latest to date.

        Settle ties using the newest membership (by ID).
        """
Severity: Minor
Found in radar/ukrdc_exporter/group_selector.py - About 25 mins to fix

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_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def has_permission_for_user(user, other_user, permission, explicit=False):
    """Check that the the user has a permission on any of the groups
    they share with the user."""

    if user.is_admin:
Severity: Minor
Found in radar/permissions.py - About 25 mins to fix

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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def save(self):
        group_patient = super(GroupPatientSerializer, self).save()

        patient = group_patient.patient
        parent_group = group_patient.group.parent_group
Severity: Minor
Found in radar/api/serializers/group_patients.py - About 25 mins to fix

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 request_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def request_json(serializer_class):
    def decorator(f):
        @wraps(f)
        def wrapper(*args, **kwargs):
            json = request.get_json()
Severity: Minor
Found in radar/api/views/generics.py - About 25 mins to fix

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 generate_number has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def generate_number(prefix=''):
    while True:
        number = prefix + ''.join(str(random.randint(0, 9)) for _ in range(9 - len(prefix)))

        check_digit = 0
Severity: Minor
Found in radar/fixtures/utils.py - About 25 mins to fix

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 debug_teardown_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def debug_teardown_request(exception):
    """Log slow responses and queries."""

    url = request.url

Severity: Minor
Found in radar/api/debug.py - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def filter_query(self, query):
        query = super(EthnicityListView, self).filter_query(query)
        args = parse_args(DemographicsRequestSerializer)
        if args['patient']:
            subquery = (
Severity: Minor
Found in radar/api/views/demographics.py - About 25 mins to fix

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 in_range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def in_range(values):
    for first, second in itertools.combinations(values, 2):
        if first is None or second is None:
            return False
        if abs(first - second) > BLOOD_PRESSURE_DELTA:
Severity: Minor
Found in radar/exporter/nurture_validator.py - About 25 mins to fix

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_patient_numbers_f has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def create_patient_numbers_f():
    number_groups = [
        (Group.query.filter(Group.code == GROUP_CODE_NHS, Group.type == GROUP_TYPE.OTHER).one(), generate_nhs_no),
        (Group.query.filter(Group.code == GROUP_CODE_CHI, Group.type == GROUP_TYPE.OTHER).one(), generate_chi_no),
        (Group.query.filter(Group.code == GROUP_CODE_UKRR, Group.type == GROUP_TYPE.OTHER).one(), generate_ukrr_no),
Severity: Minor
Found in radar/fixtures/patients.py - About 25 mins to fix

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 format has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def format(self, data):
        raw_data = {}

        for field in self.fields:
            name = field.name
Severity: Minor
Found in radar/marmoset/schema.py - About 25 mins to fix

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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, field, validator_data):
        self.values = []

        for value in validator_data['values']:
            if value is not None:
Severity: Minor
Found in radar/marmoset/validators.py - About 25 mins to fix

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_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def export_name(rda_patient, patient):
    if patient.radar_first_name or patient.radar_last_name:
        rda_name = rda_patient['name'] = {}

        if patient.radar_first_name:
Severity: Minor
Found in radar/ukrdc_exporter/patients.py - About 25 mins to fix

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 parse_float has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def parse_float(value):
    if isinstance(value, float):
        return value
    elif isinstance(value, int):
        return float(value)
Severity: Minor
Found in radar/marmoset/types.py - About 25 mins to fix

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

Severity
Category
Status
Source
Language