andreoliwa/nitpick

View on GitHub

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

        Starting a process with a partial executable path
        Open

                output = subprocess.check_output(  # noqa: S603
                    # TODO: fix: this command might not work on Windows; maybe read ~/.gitconfig directly instead?
                    ["git", "config", "--get", GIT_CORE_EXCLUDES_FILE],  # noqa: S607
                    universal_newlines=True,
        Severity: Info
        Found in src/nitpick/generic.py by bandit

        Unexpected tabs found.
        Open

            @echo '  pytest      to run tests'

        Unexpected tabs found.
        Open

            pytest

        Unexpected tabs found.
        Open

            sphinx-apidoc --force --module-first --separate --implicit-namespaces --output-dir docs/source nitpick/

        Unexpected tabs found.
        Open

            pre-commit gc

        Unexpected tabs found.
        Open

            -rm .cache/make/sphinx

        Unexpected tabs found.
        Open

            pre-commit install --hook-type commit-msg

        Unexpected tabs found.
        Open

            @echo '  pre-commit  to install and update pre-commit hooks'

        Unexpected tabs found.
        Open

            poetry update

        Unexpected tabs found.
        Open

            $(MAKE)

        Unexpected tabs found.
        Open

            @fd --changed-before $(RERUN_AFTER) auto .cache/make --exec-batch rm '{}' ;

        Unexpected tabs found.
        Open

            pre-commit autoupdate

        Unexpected tabs found.
        Open

            -rm .cache/make/run
        Severity
        Category
        Status
        Source
        Language