migraf/fhir-kindling

View on GitHub

Showing 93 of 93 total issues

Function make_transaction_bundle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def make_transaction_bundle(
    transaction_type: TransactionType = TransactionType.TRANSACTION,
    method: Union[TransactionMethod, str] = TransactionMethod.POST,
    resources: Union[List[Resource], List[dict]] = None,
    references: Union[List[Reference], List[str]] = None,
Severity: Minor
Found in fhir_kindling/fhir_server/transactions.py - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(
        self,
        base_url: str,
        resource: Union[
            FHIRResourceModel, fhir.resources.FHIRAbstractModel, str
Severity: Minor
Found in fhir_kindling/fhir_query/base.py - About 1 hr 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 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in fhir_kindling/fhir_query/query_sync.py - About 1 hr to fix

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

        def __init__(
    Severity: Major
    Found in fhir_kindling/fhir_query/query_async.py - About 1 hr to fix

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

          def __init__(
      Severity: Major
      Found in fhir_kindling/util/retry_transport.py - About 1 hr to fix

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

            def __init__(
        Severity: Major
        Found in fhir_kindling/generators/time_series_generator.py - About 1 hr to fix

          Function _make_k_anon_query_for_row has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def _make_k_anon_query_for_row(
              row: pd.Series,
              df: pd.DataFrame,
              excluded_cols: List[str] = None,
              id_cols: List[str] = None,
          Severity: Minor
          Found in fhir_kindling/privacy/k_anonymity.py - About 55 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_choices_and_probabilities has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_choices_and_probabilities(cls, values):
                  if values.get("choices"):
                      if values.get("choice_probabilities"):
                          if len(values["choices"]) != len(values["choice_probabilities"]):
                              raise ValueError("Number of choices and probabilities must match")
          Severity: Minor
          Found in fhir_kindling/generators/field_generator.py - About 55 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 _make_query_string has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def _make_query_string(self) -> str:
                  """
                  Make the query string from the query parameters
          
                  Returns:
          Severity: Minor
          Found in fhir_kindling/fhir_query/base.py - About 55 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 _calculate_sleep has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def _calculate_sleep(
                  self, attempts_made: int, headers: Union[httpx.Headers, Mapping[str, str]]
              ) -> float:
                  retry_after_header = (headers.get("Retry-After") or "").strip()
                  if self.respect_retry_after_header and retry_after_header:
          Severity: Minor
          Found in fhir_kindling/util/retry_transport.py - About 55 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_server_status has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def check_server_status(
              server_1: str,
              server_2: str,
          ):
              increments = [5, 10, 30, 30, 60, 120]
          Severity: Minor
          Found in testing/prefill.py - About 55 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 _resource_ids_from_query_response has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def _resource_ids_from_query_response(response: QueryResponse) -> dict:
              contained_resources = {}
              for resource in response.resources:
                  resource_id_set = contained_resources.get(resource.resource_type)
                  if resource_id_set is None:
          Severity: Minor
          Found in fhir_kindling/util/references.py - About 55 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_field_values has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def _validate_field_values(self):
                  field_values = self.params.field_values
                  resource_count = self.params.count
          
                  for field_value in field_values:
          Severity: Minor
          Found in fhir_kindling/generators/resource_generator.py - About 55 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 from_query_string has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def from_query_string(cls, query_string: str) -> "FhirQueryParameters":
                  # split resource and query parameters
                  resource, query = query_string.split("?")
          
                  # clean up and validate resource
          Severity: Minor
          Found in fhir_kindling/fhir_query/query_parameters.py - About 55 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 reference_graph has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def reference_graph(resources: List[Union[Resource, FHIRAbstractModel]]) -> nx.DiGraph:
              """
              Creates a graph of the references in a list of resources.
          
              Args:
          Severity: Minor
          Found in fhir_kindling/fhir_server/transfer.py - About 55 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 subtract has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def subtract(
          Severity: Major
          Found in fhir_kindling/util/date_utils.py - About 50 mins to fix

            Function transfer has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

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

                  def __init__(
              Severity: Major
              Found in fhir_kindling/benchmark/bench.py - About 50 mins to fix

                Function add has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def add(
                Severity: Major
                Found in fhir_kindling/util/date_utils.py - About 50 mins to fix

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

                      def to_query_string(self) -> str:
                          """
                          Converts the parameters to a query string that can be used with a fhir server's REST API
                          Returns:
                          """
                  Severity: Minor
                  Found in fhir_kindling/fhir_query/query_parameters.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

                  Severity
                  Category
                  Status
                  Source
                  Language