migraf/fhir-kindling

View on GitHub

Showing 93 of 93 total issues

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

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

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

    def parse_parameter_value(
        url_value: str,
    ) -> Tuple[QueryOperators, Union[int, float, bool, str, list]]:
        """
        Parse a query parameter value for operators and value types
    Severity: Minor
    Found in fhir_kindling/fhir_query/query_parameters.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 from_url_param has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def from_url_param(cls, url_string: str) -> "IncludeParameter":
            field, param = url_string.split("=")
            split_field = field.split(":")
            if len(split_field) == 2:
                reverse = split_field[0] == "_revinclude"
    Severity: Minor
    Found in fhir_kindling/fhir_query/query_parameters.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 _get_next_time has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_next_time(self) -> datetime:
            """Get the next time in the series based on the frequency. Updates the internal state of the generator.
    
            Raises:
                ValueError: If the frequency is not valid
    Severity: Minor
    Found in fhir_kindling/generators/time_series_generator.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 _param_from_field has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _param_from_field(field, operator, value):
            if not (operator or operator == "") and value:
                kv_error_message = (
                    f"\n\tField: {field}\n\tOperator: {operator}\n\tValue: {value}"
                )
    Severity: Minor
    Found in fhir_kindling/fhir_query/base.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 generate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def generate(self):
            # generate based on the likelihood
            if self.likelihood < 1.0:
                if random.random() > self.likelihood:
                    return None
    Severity: Minor
    Found in fhir_kindling/generators/dataset.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 _process_server_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _process_server_response(
            self, response: Union[httpx.Response, str, dict]
        ) -> Union[Dict, Bundle, str]:
            """
            Handle the initial response from the server and resolve pagination if necessary.
    Severity: Minor
    Found in fhir_kindling/fhir_query/query_response.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

    Avoid too many return statements within this function.
    Open

            return patients
    Severity: Major
    Found in fhir_kindling/generators/patient.py - About 30 mins to fix

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

          def _setup_transport(
              self, async_transport: bool = False
          ) -> Union[RetryTransport, httpx.AsyncHTTPTransport, httpx.HTTPTransport]:
              """Setup the transport for the httpx client if retryable methods or status codes are set
              for the server the requests will be retried according to the configuration
      Severity: Minor
      Found in fhir_kindling/fhir_server/fhir_server.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 resources has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def resources(self) -> List[FHIRAbstractModel]:
              """
              List of primary resources returned by the server.
      
              Returns:
      Severity: Minor
      Found in fhir_kindling/fhir_query/query_response.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, file_path: Union[str, pathlib.Path], output_format: str = "json"
          ) -> None:
              """
              Save the response to a file.
      Severity: Minor
      Found in fhir_kindling/fhir_query/query_response.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 add_resource_generator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_resource_generator(
              self,
              resource_generator: BaseGenerator,
              name: str,
              depends_on: Union[str, List[str]] = "base",
      Severity: Minor
      Found in fhir_kindling/generators/dataset.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,
              resource: Union[str, Any],
              n: int = None,
              field_values: dict = None,
      Severity: Minor
      Found in fhir_kindling/generators/resource_generator.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