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.

Pre-commit: No hook with id `gitlint`

See original GitHub issue

Installed gitlint with pre-commit following the doc, and it doesn’t work.

(py37) ➜  workspace git:(develop) ✗ git commit -m 'testlkasdklnalgklkwamglamweoingienibgblalsjkdlgjldjlgasdgfasdfasdfasdgwebbffsdfsdnsdfsgwrqwrqwr'
autopep8.................................................................Passed
Check for added large files..............................................Passed
Check JSON...............................................................Passed
Check for merge conflicts................................................Passed
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Flake8...................................................................Passed
Fix requirements.txt.....................................................Passed
Don't commit to branch...................................................Passed
Trim Trailing Whitespace.................................................Passed
[develop (root-commit) 8ae7eec] testlkasdklnalgklkwamglamweoingienibgblalsjkdlgjldjlgasdgfasdfasdfasdgwebbffsdfsdnsdfsgwrqwrqwr
 17 files changed, 825 insertions(+)

When run pre-commit run gitlint, I got:

No hook with id `gitlint`

Here is my .pre-commit-config.yaml:

repos:

-   repo: https://github.com/pre-commit/mirrors-autopep8
    rev: v1.4.4
    hooks:
    -   id: autopep8
        args:
        - --in-place
        - --ignore=E501

-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v2.2.3
    hooks:
    -   id: check-added-large-files
    -   id: check-json
    -   id: check-merge-conflict
    -   id: check-yaml
    -   id: end-of-file-fixer
    -   id: flake8
        args:
        - --extend-ignore=E501
    -   id: requirements-txt-fixer
        files: requirements*
    -   id: no-commit-to-branch
    -   id: trailing-whitespace
        args:
        - --markdown-linebreak-ext=md

-   repo: https://github.com/jorisroovers/gitlint
    rev:  master
    hooks:
    -   id: gitlint
 

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
esciaracommented, Jun 18, 2019

@retr0h to avoid the pb, you need to set the top-level property default_changes to whatever stages your want to, probably the commit stage:

default_stages: [commit]
...
- repo: https://github.com/jorisroovers/gitlint
  rev: master
  hooks:
    - id: gitlint
      name: gitlint
      language: python
      entry: gitlint --msg-filename
      stages: [commit-msg]

Or you could set for each hook the specific stage you want it to be installed in.

1reaction
esciaracommented, Jun 18, 2019

@asottile : done 😜

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting up gitlint pre-commit local for a repository
- hook id: gitlint - exit code: 253 Usage: gitlint [OPTIONS] COMMAND [ARGS]... Try 'gitlint --help' for help. Error: No such command '.pre-...
Read more >
pre-commit hook fails when adding args · Issue #109 - GitHub
I've set up my .pre-commit-config.yml like this: default_stages: [commit ... hooks: - id: gitlint stages: [commit-msg] args: [--contrib=CT1].
Read more >
Supported hooks - pre-commit
github.com/pre-commit/pre-commit-hooks. check-added-large-files - prevents giant files from being committed. check-ast - simply checks whether the files ...
Read more >
Gitlint - Joris Roovers
When no COMMAND is specified, gitlint defaults to 'gitlint lint'. Using gitlint as a commit-msg hook. Introduced in gitlint v0.4.0. You can also...
Read more >
Available Hooks
Below is a comprehensive list with all hooks from {precommit} as well as their ... Some hooks will fail without changing the files...
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