migraf/fhir-kindling

View on GitHub

Showing 93 of 93 total issues

Avoid deeply nested control flow statements.
Open

                    for value in field_value:
                        resource, resource_id = value.get("reference").split("/")
                        references.append((field.name, resource, resource_id, True))
                # add the reference
                else:
Severity: Major
Found in fhir_kindling/util/references.py - About 45 mins to fix

    Function _validate_args has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _validate_args(self, freq, period, period_unit, start, end, n):
    Severity: Minor
    Found in fhir_kindling/generators/time_series_generator.py - About 45 mins to fix

      Function _generate_resource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def _generate_resource(
              self, generate_id: bool, as_dict: bool = False
          ) -> Union[FHIRResourceModel, dict]:
              # construct a resource object to hold the generated fields
              resource = self.resource.construct()
      Severity: Minor
      Found in fhir_kindling/generators/resource_generator.py - About 45 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 transfer has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def transfer(
      Severity: Minor
      Found in fhir_kindling/fhir_server/fhir_server.py - About 45 mins to fix

        Function from_env has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def from_env(cls, no_auth: bool = False) -> "FhirServer":
                api_address = _api_address_from_env()
                server_type = os.getenv("FHIR_SERVER_TYPE")
        
                if no_auth:
        Severity: Minor
        Found in fhir_kindling/fhir_server/fhir_server.py - About 45 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 has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def has(
        Severity: Minor
        Found in fhir_kindling/fhir_query/base.py - About 45 mins to fix

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

              def __init__(
          Severity: Minor
          Found in fhir_kindling/fhir_query/base.py - About 45 mins to fix

            Function _generate_birthdate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _generate_birthdate(self):
                    if not self._birthdate_range:
                        if self.age_range:
                            if isinstance(self.age_range[0], int):
                                # generate age range from youngest to oldest based on the given tuple of ages
            Severity: Minor
            Found in fhir_kindling/generators/patient.py - About 45 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 include has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def include(
            Severity: Minor
            Found in fhir_kindling/fhir_query/base.py - About 45 mins to fix

              Function add_all has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def add_all(
                      self,
                      resources: List[Union[Resource, FHIRAbstractModel, dict]],
                      batch_size: int = 1000,
                      display: bool = True,
              Severity: Minor
              Found in fhir_kindling/fhir_server/fhir_server.py - About 45 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 _get_transfer_resources has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def _get_transfer_resources(
                  source: "FhirServer",
                  resources: List[Union[Resource, FHIRAbstractModel]] = None,
                  query: FhirQuerySync = None,
                  get_missing: bool = True,
              Severity: Minor
              Found in fhir_kindling/fhir_server/transfer.py - About 45 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

              Consider simplifying this complex logical expression.
              Open

                      if has_param and (
                          resource or reference_param or search_param or operator or value
                      ):
                          raise ValueError("Cannot use both has_param and kv parameters")
              
              
              Severity: Major
              Found in fhir_kindling/fhir_query/base.py - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                        if not has_param and not (
                            resource or reference_param or search_param or operator or value
                        ):
                            raise ValueError(
                                "Must provide either has_param or a valid set of kv parameters"
                Severity: Major
                Found in fhir_kindling/fhir_query/base.py - About 40 mins to fix

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

                      def __init__(
                  Severity: Minor
                  Found in fhir_kindling/generators/dataset.py - About 35 mins to fix

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

                    def plot_resource_field(
                    Severity: Minor
                    Found in fhir_kindling/figures/resource_plots.py - About 35 mins to fix

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

                          def __init__(
                      Severity: Minor
                      Found in fhir_kindling/generators/patient.py - About 35 mins to fix

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

                            def __init__(
                        Severity: Minor
                        Found in fhir_kindling/fhir_server/server_responses.py - About 35 mins to fix

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

                              def __init__(
                          Severity: Minor
                          Found in fhir_kindling/fhir_query/query_response.py - About 35 mins to fix

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

                            def flatten(
                            Severity: Minor
                            Found in fhir_kindling/serde/flatten.py - About 35 mins to fix

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

                                  def add_resource_generator(
                              Severity: Minor
                              Found in fhir_kindling/generators/dataset.py - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language