andreoliwa/nitpick

View on GitHub

Showing 7 of 47 total issues

Function enforce_present_absent has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring.
Open

    def enforce_present_absent(self, *partial_names: str) -> Iterator[Fuss]:
        """Enforce files that should be present or absent.

        :param partial_names: Names of the files to enforce configs for.
        :return: Fuss generator.
Severity: Minor
Found in src/nitpick/core.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 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
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 ci_build has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def ci_build(c, full=False, recreate=False, docs=True, python=""):
      Severity: Minor
      Found in tasks.py - About 35 mins to fix

        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

        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
                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

        Severity
        Category
        Status
        Source
        Language