DEV Community

Discussion on: Chickity-check yo self before you wreck yo self!

Collapse
jonasbn profile image
jonasbn

Hi Kyle,

Great article, I only just recently discovered pre-commit myself and did a short write up myself.

I am working on my own pre-commit hooks, currently only having two:

  • spellcheck
  • prohibit-commit-main

When I went over your configuration I discovered: no-commit-to-branch, which does somewhat the same as the last one in my list, so I will be change to be using that instead.

Anyway I noted that your example output, somewhat broke due to the ' (apostrophe). I do not see this as a serious issue, but in case you did not know you can overwrite the text output and avoid the single apostrophe in: "Don't commit to branch", which is the text emitted default by the hook.

    -   id: no-commit-to-branch
        name: "Do not commit to main"
        args: [--branch, main]
Enter fullscreen mode Exit fullscreen mode

And it will output:

Do not commit to main....................................................Passed
Enter fullscreen mode Exit fullscreen mode

Thanks for the article, I learn something new and expanded my toolbox.