question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

custom committer plugin not found when using cz check via git hook

See original GitHub issue

Description

I wrote a custom plugin to enforce our desired commit message template, it works fine when I invoke cz check but when I call cz check via the git commit hook it fails

The committer has not been found in the system.

Try running 'pip install cz_algotec'

my githook is written in python and invoked via shebang, I tried adding an install via pip to the custom plugin package (locally avilable0 but it doesn’t help. I verified the package is found when using pip list and also it works when I invoke cz check from the command line I don’t know what’s the difference from the hook invocation (calling sub_process.run - with shell:True)

Steps to reproduce

  1. write a custom plugin, use it’s name in the …cz.toml file
  2. call cz check to invoke commitizen from the commit-msg script

Current behavior

fail to run the custom logic

Desired behavior

custom logic runs,

Environment

cz version 2.20.0 Python Version: 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] Operating System: Windows

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nadavsinai-philipscommented, Nov 14, 2021

I think I found the cause, it related to this https://github.com/ros/rosdistro/issues/18116 - the use of _ (underscopes) in pip package names, when I use pip list it shows me I have cz-algotec (with hypen) and that’s why it can’t find it ??? still reseaching, some help would be appriciated, has anyone managed to use custom rules at all??

0reactions
nadavsinai-philipscommented, Jan 17, 2022

(FYI I corrected my previous post. You’re likely right about the circular import issue. I had a similar problem reported in #474)

In case this is helpful, I use my custom plugin cz_legacy in pre-commit as an extra dependency:

  - repo: https://github.com/commitizen-tools/commitizen
    rev: v2.20.3
    hooks:
      - id: commitizen
        # yamllint disable-line rule:line-length
        additional_dependencies:
          [
            "git+https://github.com/KyleKing/cz_legacy.git@bfff2ab4134c26a31f1e7f9c3a8d4bedba824b08",
          ]
        stages: [commit-msg]

KyleKing/calcipy@128a883/.pre-commit-config.yaml#L39-L48

thanks @KyleKing , I ditched commitizen for now and moved to use commitlint

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git Hooks - Git SCM
Like many other Version Control Systems, Git has a way to fire off custom scripts when certain important actions occur. There are two...
Read more >
git - pre-commit/hook: No such file or directory - Stack Overflow
Go to .git/hooks directory and remove pre-commit file, as its trying to reference to node_modules/pre-commit/hook .
Read more >
commit-msg Hook - gerrit-review
A Git hook automatically invoked by git commit , and most other commit creation tools such as git citool or git gui ....
Read more >
Ensure Conventional Commits in your SBT projects
After experimenting with a couple of conventional commit tools I came ... changes to the custom git hooks, committers must remember to copy ......
Read more >
Git commit messages for the bold and the daring - Nulab
If you're not sure whether you're already using a Git template in your ... use custom scripts to make sure those hooks are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found