Unidata/MetPy

View on GitHub
src/metpy/xarray.py

Summary

Maintainability
B
5 hrs
Test Coverage

MetPyDataArrayAccessor has 33 functions (exceeds 20 allowed). Consider refactoring.
Open

class MetPyDataArrayAccessor:
    r"""Provide custom attributes and methods on xarray DataArrays for MetPy functionality.

    This accessor provides several convenient attributes and methods through the ``.metpy``
    attribute on a DataArray. For example, MetPy can identify the coordinate corresponding
Severity: Minor
Found in src/metpy/xarray.py - About 4 hrs to fix

    Function coordinates has a Cognitive Complexity of 21 (exceeds 15 allowed). Consider refactoring.
    Wontfix

        def coordinates(self, *args):
            """Return the coordinate variables corresponding to the given axes types.
    
            Parameters
            ----------
    Severity: Minor
    Found in src/metpy/xarray.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 wrapper has a Cognitive Complexity of 20 (exceeds 15 allowed). Consider refactoring.
    Wontfix

            def wrapper(*args, **kwargs):
                bound_args = sig.bind(*args, **kwargs)
    
                # Auto-broadcast select xarray arguments, and update bound_args
                if broadcast is not None:
    Severity: Minor
    Found in src/metpy/xarray.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 find_axis_number has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring.
    Open

        def find_axis_number(self, axis):
            """Return the dimension number of the axis corresponding to the given identifier.
    
            Parameters
            ----------
    Severity: Minor
    Found in src/metpy/xarray.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

    Consider simplifying this complex logical expression.
    Wontfix

                    if (
                        (arg == 'latitude' and latitude is None)
                        or (arg == 'longitude' and longitude is None)
                    ):
                        # Try to compute on the fly
    Severity: Major
    Found in src/metpy/xarray.py - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Wontfix

              if (
                      (hasattr(self, 'crs')
                       and self.crs._attrs['grid_mapping_name'] == 'latitude_longitude')
                      or (hasattr(self, 'longitude') and self.longitude.squeeze().ndim == 1
                          and hasattr(self, 'latitude') and self.latitude.squeeze().ndim == 1)
      Severity: Major
      Found in src/metpy/xarray.py - About 40 mins to fix

        There are no issues that match your filters.

        Category
        Status