Skip to content

Conventional Commit hook fails outside workspace root #2042

@cbrown1234

Description

@cbrown1234

Summary

Running git commit -am "feat: Add mixed-line-ending" fails the check for the subdirectory pre-commit config

Truncated output:

Running hooks for `template`:
<truncated>
Running hooks for `.`:
<truncated>
Running hooks for `template`:
<truncated>
Conventional Commit......................................................Failed
- hook id: conventional-pre-commit
- exit code: 1

  usage: conventional-pre-commit [-h] [--no-color] [--force-scope]
                                 [--scopes SCOPES] [--strict] [--verbose]
                                 [types ...] input
  conventional-pre-commit: error: the following arguments are required: input

Running hooks for `.`:
<truncated>
Conventional Commit......................................................Passed

Possible duplicate of or related to #1194

Willing to submit a PR?

  • Yes — I’m willing to open a PR to fix this.

Platform

Ubuntu 24.04 (Linux 6.8.0-110-generic x86_64 GNU/Linux)

Version

prek 0.3.11

.pre-commit-config.yaml

Project Root

default_install_hook_types:
  - pre-commit
  - commit-msg

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: end-of-file-fixer
      - id: trailing-whitespace
      - id: check-added-large-files
      - id: check-yaml
      - id: check-toml
      - id: check-json
      - id: check-case-conflict
      - id: check-executables-have-shebangs
      - id: check-merge-conflict
        args: [--assume-in-merge]
  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.30.1
    hooks:
      - id: gitleaks
  - repo: https://github.com/astral-sh/ruff-pre-commit
    # Ruff version.
    rev: v0.15.12
    hooks:
      # Run the linter.
      - id: ruff-check
        args: [--fix]
      # Run the formatter.
      - id: ruff-format
  - repo: https://github.com/astral-sh/uv-pre-commit
    rev: 0.11.8
    hooks:
      - id: uv-lock
  - repo: https://github.com/adrienverge/yamllint.git
    rev: v1.38.0
    hooks:
      - id: yamllint
        args: [--strict]
  - repo: https://github.com/shellcheck-py/shellcheck-py
    rev: v0.11.0.1
    hooks:
      - id: shellcheck
  - repo: https://github.com/python-jsonschema/check-jsonschema
    rev: 0.37.1
    hooks:
      - id: check-github-workflows
        args: ["--verbose"]
      - id: check-gitlab-ci
        args: ["--verbose"]
      - id: check-taskfile
        args: ["--verbose"]
      - id: check-renovate
        args: ["--verbose"]
        additional_dependencies: ['pyjson5']
  - repo: https://github.com/compilerla/conventional-pre-commit
    rev: v4.4.0
    hooks:
      - id: conventional-pre-commit
        stages: [commit-msg]
        args: []

In template dir

default_install_hook_types:
  - pre-commit
  - commit-msg

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: end-of-file-fixer
      - id: trailing-whitespace
      - id: no-commit-to-branch
      - id: mixed-line-ending
      - id: check-added-large-files
      - id: check-yaml
      - id: check-toml
      - id: check-json
      - id: check-case-conflict
      - id: check-executables-have-shebangs
      - id: check-merge-conflict
        args: [--assume-in-merge]
  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.30.1
    hooks:
      - id: gitleaks
  - repo: https://github.com/astral-sh/ruff-pre-commit
    # Ruff version.
    rev: v0.15.12
    hooks:
      # Run the linter.
      - id: ruff-check
        args: [--fix]
      # Run the formatter.
      - id: ruff-format
  - repo: https://github.com/astral-sh/uv-pre-commit
    rev: 0.11.8
    hooks:
      - id: uv-lock
  - repo: https://github.com/adrienverge/yamllint.git
    rev: v1.38.0
    hooks:
      - id: yamllint
        args: [--strict]
  - repo: https://github.com/shellcheck-py/shellcheck-py
    rev: v0.11.0.1
    hooks:
      - id: shellcheck
  - repo: https://github.com/python-jsonschema/check-jsonschema
    rev: 0.37.2
    hooks:
      - id: check-github-workflows
        args: ["--verbose"]
      - id: check-gitlab-ci
        args: ["--verbose"]
      - id: check-taskfile
        args: ["--verbose"]
      - id: check-renovate
        args: ["--verbose"]
        additional_dependencies: ['pyjson5']
  - repo: https://github.com/compilerla/conventional-pre-commit
    rev: v4.4.0
    hooks:
      - id: conventional-pre-commit
        stages: [commit-msg]
        args: []

Log file

prek.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions