openimis/openimis-be-api_fhir_py

View on GitHub

Showing 28 of 117 total issues

Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, name, property_type, count_max=1, count_min=0, required=False):
Severity: Minor
Found in api_fhir/models/__init__.py - About 35 mins to fix

    Function build_imis_gender has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_imis_gender(cls, imis_insuree, fhir_patient):
            gender = fhir_patient.gender
            if gender is not None:
                imis_gender_code = None
                if gender == AdministrativeGender.MALE.value:
    Severity: Minor
    Found in api_fhir/converters/patientConverter.py - About 35 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 validate_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_type(self, value):
            if value is not None:
                local_type = self.eval_property_type()
                if local_type is FHIRDate and not FHIRDate.validate_type(value):
                    raise ValueError(gettext('Value "{}" is not a valid value of FHIRDate').format(value))
    Severity: Minor
    Found in api_fhir/models/__init__.py - About 35 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_fhir_marital_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_fhir_marital_status(cls, fhir_patient, imis_insuree):
            if imis_insuree.marital is not None:
                if imis_insuree.marital == ImisMaritalStatus.MARRIED.value:
                    fhir_patient.maritalStatus = \
                        cls.build_codeable_concept(Stu3MaritalConfig.get_fhir_married_code(),
    Severity: Minor
    Found in api_fhir/converters/patientConverter.py - About 35 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_imis_addresses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_imis_addresses(cls, imis_insuree, fhir_patient):
            addresses = fhir_patient.address
            if addresses is not None:
                for address in addresses:
                    if address.type == AddressType.PHYSICAL.value:
    Severity: Minor
    Found in api_fhir/converters/patientConverter.py - About 35 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_for_exception has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_for_exception(cls, obj):
            result = None
            if isinstance(obj, FHIRException):
                result = cls.build_for_fhir_exception(obj)
            elif isinstance(obj, ClaimSubmitError):
    Severity: Minor
    Found in api_fhir/converters/operationOutcomeConverter.py - About 35 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_imis_phone_num_and_email has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_imis_phone_num_and_email(cls, telecom):
            phone = None
            email = None
            if telecom is not None:
                for contact_point in telecom:
    Severity: Minor
    Found in api_fhir/converters/personConverterMixin.py - About 35 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_fhir_gender has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_fhir_gender(cls, fhir_patient, imis_insuree):
            if hasattr(imis_insuree, "gender") and imis_insuree.gender is not None:
                code = imis_insuree.gender.code
                if code == GeneralConfiguration.get_male_gender_code():
                    fhir_patient.gender = AdministrativeGender.MALE.value
    Severity: Minor
    Found in api_fhir/converters/patientConverter.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