Showing 51 of 57 total issues

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

    def convert(
Severity: Minor
Found in tsdat/io/converters/string_to_datetime.py - About 35 mins to fix

    Function assert_close has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Confirmed

    def assert_close(
    Severity: Minor
    Found in tsdat/testing.py - About 35 mins to fix

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

          def _free_memory(self, adi_dataset: CDSGroup):
              # First we MUST walk through the object tree and detatch data pointers for all variables. We need
              #   to do this because the group delete will delete everything in the hierarchy, and we don't want  to
              #   delete the data because it's being shared with xarray.
              #   * Note that we don't attach/detatch for time because we have to copy those values because of numpy datetime64
      Severity: Minor
      Found in tsdat/transform/adi.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_all_ascii has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate_all_ascii(cls, values: Dict[Any, Any]) -> Dict[str, str]:
              for key, value in values.items():
                  if not isinstance(key, str) or not key.isascii():
                      raise ValueError(f"'{key}' contains a non-ascii character.")
                  if isinstance(value, str) and not value.isascii():
      Severity: Minor
      Found in tsdat/config/attributes/attribute_model.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 convert_to_adi_format has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def convert_to_adi_format(
              self, transform_parameters: Dict[Any, Any]
          ) -> Dict[str, str]:
              transforms: Dict[Any, Any] = {}
              """ 
      Severity: Minor
      Found in tsdat/transform/adi.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 _back_convert_qc_atts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def _back_convert_qc_atts(self, adi_qc_atts: Dict) -> Dict:
              """-------------------------------------------------------------------------------------------------------------
              We are converting from exploded ADI format:
                  bit_1_description = "Value is equal to _FillValue or NaN"
                  bit_1_assessment = "Bad"
      Severity: Minor
      Found in tsdat/transform/adi.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 _set_bounds_transform_parameters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def _set_bounds_transform_parameters(
              self, variable_name: str, xr_dataset: xr.Dataset, obs_or_coord_group: CDSGroup
          ):
              # Get the bounds variable for each dimension used by our variable.  If no bounds variable exists, then skip.
              # Bounds variable saves the offset for each data point instead of full value
      Severity: Minor
      Found in tsdat/transform/adi.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 _update_xr_attrs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _update_xr_attrs(
              self,
              variable_name: str,
              output_dataset: xr.Dataset,
              transformed_dataset: CDSGroup,
      Severity: Minor
      Found in tsdat/transform/adi.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 _get_threshold has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_threshold(
              self,
              dataset: xr.Dataset,
              variable_name: str,
              min_: bool,
      Severity: Minor
      Found in tsdat/qc/checkers/threshold_checker.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_regex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def _generate_regex(template: str) -> str:
          """Generates a regex pattern which can be used to extract the values substituted
          into a template string.
      
          Args:
      Severity: Minor
      Found in tsdat/tstring.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 _match_inputs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _match_inputs(self, input_keys: List[str]) -> Dict[str, DataReader]:
              input_reader_mapping: Dict[str, DataReader] = {}
              for input_key in input_keys:
                  for regex, reader in self.readers.items():  # type: ignore
                      regex = cast(Pattern[str], regex)
      Severity: Minor
      Found in tsdat/io/retrievers/default_retriever.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