andreoliwa/nitpick

View on GitHub
src/nitpick/blender.py

Summary

Maintainability
A
3 hrs
Test Coverage

Function traverse_yaml_tree has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

def traverse_yaml_tree(yaml_obj: YamlObject, change: JsonDict):
    """Traverse a YAML document recursively and change values, keeping its formatting and comments."""
    for key, value in change.items():
        if key not in yaml_obj:
            if isinstance(yaml_obj, dict):
Severity: Minor
Found in src/nitpick/blender.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 _compare_list_elements has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _compare_list_elements(  # pylint: disable=too-many-arguments # noqa: PLR0913
Severity: Minor
Found in src/nitpick/blender.py - About 45 mins to fix

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

        def __init__(
    Severity: Minor
    Found in src/nitpick/blender.py - About 35 mins to fix

      Function _compare_list_elements has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
      Open

          def _compare_list_elements(  # pylint: disable=too-many-arguments # noqa: PLR0913
              self, key: str, parent_key: str, child_key: str, actual_detail: ListDetail, expected_detail: ListDetail
          ) -> None:
              """Compare list elements by their keys or hashes."""
              display = []
      Severity: Minor
      Found in src/nitpick/blender.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 __call__ has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
      Open

          def __call__(self) -> Comparison:
              """Compare two flattened dictionaries and compute missing and different items."""
              if self.flat_expected.items() <= self.flat_actual.items():
                  return self
      
      
      Severity: Minor
      Found in src/nitpick/blender.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

      There are no issues that match your filters.

      Category
      Status