cookiecutter/cookiecutter

View on GitHub

Showing 30 of 32 total issues

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

def generate_file(
Severity: Minor
Found in cookiecutter/generate.py - About 35 mins to fix

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

def _run_hook_from_repo_dir(
Severity: Minor
Found in cookiecutter/generate.py - About 35 mins to fix

Function determine_repo_dir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def determine_repo_dir(
    template: str,
    abbreviations: dict[str, str],
    clone_to_dir: Path | str,
    checkout: str | None,
Severity: Minor
Found in cookiecutter/repository.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

Avoid too many return statements within this function.
Open

        return get_config(env_config_file)
Severity: Major
Found in cookiecutter/config.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return copy.copy(DEFAULT_CONFIG)
Severity: Major
Found in cookiecutter/config.py - About 30 mins to fix

Function run_script has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def run_script(script_path: str, cwd: Path | str = '.') -> None:
    """Execute a script from a working directory.

    :param script_path: Absolute path to the script to run.
    :param cwd: The directory to run the script from.
Severity: Minor
Found in cookiecutter/hooks.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

subprocess call - check for execution of untrusted input.
Open

                subprocess.check_output(
                    [repo_type, 'checkout', *checkout_params],
                    cwd=repo_dir,
                    stderr=subprocess.STDOUT,
Severity: Info
Found in cookiecutter/vcs.py by bandit

subprocess call - check for execution of untrusted input.
Open

            subprocess.check_output(
                [repo_type, 'clone', repo_url],
                cwd=clone_to_dir,
                stderr=subprocess.STDOUT,
Severity: Info
Found in cookiecutter/vcs.py by bandit

Consider possible security implications associated with subprocess module.
Open

import subprocess
Severity: Info
Found in cookiecutter/hooks.py by bandit

Consider possible security implications associated with subprocess module.
Open

import subprocess
Severity: Info
Found in cookiecutter/vcs.py by bandit
Severity
Category
Status
Source
Language