Unidata/MetPy

View on GitHub
src/metpy/calc/tools.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function parse_grid_arguments has a Cognitive Complexity of 73 (exceeds 15 allowed). Consider refactoring.
Wontfix

def parse_grid_arguments(func):
    """Parse arguments to functions involving derivatives on a grid."""
    from ..xarray import dataarray_arguments

    # Dynamically add new parameters for lat, lon, and crs to the function signature
Severity: Minor
Found in src/metpy/calc/tools.py - About 1 day 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_bound_pressure_height has a Cognitive Complexity of 44 (exceeds 15 allowed). Consider refactoring.
Open

def _get_bound_pressure_height(pressure, bound, height=None, interpolate=True):
    """Calculate the bounding pressure and height in a layer.

    Given pressure, optional heights and a bound, return either the closest pressure/height
    or interpolated pressure/height. If no heights are provided, a standard atmosphere
Severity: Minor
Found in src/metpy/calc/tools.py - About 5 hrs 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 vector_derivative has a Cognitive Complexity of 26 (exceeds 15 allowed). Consider refactoring.
Wontfix

def vector_derivative(u, v, *, dx=None, dy=None, x_dim=-1, y_dim=-2,
                      parallel_scale=None, meridional_scale=None, return_only=None):
    r"""Calculate the projection-correct derivative matrix of a 2D vector.

    Parameters
Severity: Minor
Found in src/metpy/calc/tools.py - About 2 hrs 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_layer has a Cognitive Complexity of 17 (exceeds 15 allowed). Consider refactoring.
Open

def get_layer(pressure, *args, height=None, bottom=None, depth=None, interpolate=True):
    r"""Return an atmospheric layer from upper air data with the requested bottom and depth.

    This function will subset an upper air dataset to contain only the specified layer. The
    bottom of the layer can be specified with a pressure or height above the surface
Severity: Minor
Found in src/metpy/calc/tools.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 angle_to_direction has a Cognitive Complexity of 17 (exceeds 15 allowed). Consider refactoring.
Open

def angle_to_direction(input_angle, full=False, level=3):
    """Convert the meteorological angle to directional text.

    Works for angles greater than or equal to 360 (360 -> N | 405 -> NE)
    and rounds to the nearest angle (355 -> N | 404 -> NNE)
Severity: Minor
Found in src/metpy/calc/tools.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

There are no issues that match your filters.

Category
Status