Skip to content

cz init fails, When any one or none of the pre-commit hooks are selected #694

@ChauhanKrunal

Description

@ChauhanKrunal

Description

When I run cz init and choose none of the pre-commit hooks from commit-msg and pre-push, or one of them, it displays the following message.

commitizen already in pre-commit config
Failed to install pre-commit hook.
pre-commit is not installed in current environment.

Steps to reproduce

  1. Run cz init
  2. Choose any one of the commit rule
  3. Enter the version
  4. Select any one or none of the pre-commit hooks from commit-msg, pre-pushrules

Current behavior

Displaying an error message

commitizen already in pre-commit config
Failed to install pre-commit hook.
pre-commit is not installed in current environment.

Desired behavior

I'm not sure if this is expected behavior, but I believe prompting a well-suited error message would be appropriate; if not, I believe it requires a fix.

Screenshots

Screenshot from 2023-04-01 21-59-16
Screenshot from 2023-04-01 21-59-32

Environment

  • commitizen version: 2.42.1
  • python version: 3.8.10
  • operating system: Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions