-
Notifications
You must be signed in to change notification settings - Fork 798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a --no-verify option to prevent git hooks from being verified #44
Conversation
Depends on how you see the scope of this module. I personally think it should be consistent with But I like this feature. Maybe we could add it to |
@noahrc mind rebasing with master? |
@@ -94,6 +94,17 @@ As long as your git commit messages are conventional and accurate, you no longer | |||
|
|||
After you cut a release, you can push the new git tag and `npm publish` (or `npm publish --tag next`) when you're ready. | |||
|
|||
### Prevent Git Hooks | |||
|
|||
If you use git hooks, like pre-commit, to test your code before committing, you can prevent hooks from being verified during the commit step by passing the `--no-verify` option: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, nice work!
Thanks, all. I rebased off master and added some CLI help text for no-verify. |
@@ -31,6 +31,13 @@ var argv = require('yargs') | |||
default: false, | |||
global: true | |||
}) | |||
.option('no-verify', { | |||
alias: 'n', | |||
describe: 'Bypass pre-commit or commit-msg git hooks during the commit phase.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can you remove the full-stop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stevemao Not sure what you mean. Do you want Noah to remove the period at the end of the description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, just to be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok gotcha, that makes sense. Thanks for clarifying. 👍
@noahrc Because of the way that To reconcile the difference, I think we should add a check for var verify = argv.verify === false ? '--no-verify ' : '' to this: var verify = argv.verify === false || argv.n ? '--no-verify ' : '' According to my tests, that produces the desired behavior. $ ./index.js
OLD: use --no-verify? false
NEW: use --no-verify? false $ ./index.js --no-verify
OLD: use --no-verify? true
NEW: use --no-verify? true $ ./index.js -n
OLD: use --no-verify? false
NEW: use --no-verify? true |
Interesting, thanks for the explanation of how yargs works. I'll make that change and add a test for '-n'. |
Hmm... A bit counterintuitive and nowadays I tend not to do too much magic to modules. But since it's already doing it, maybe its worth to fix it in |
I went ahead and added the argv.n check, but can revert if yargs-parser changes. |
I totally forgot about the ability to disable boolean negation in "yargs": {
"boolean-negation": false
} But we'd still have to check for Either way, this will now work as is and looks shippable to me. I vote merge. 😎 |
@noahrc give this a shot:
thanks a ton for the contribution. |
works for me! Thanks for making great open source tools 😀 |
Thanks for the awesome tool! We use a git pre-commit hook to test our code before committing and it seems to prevent the last step of standard-version (git tag). This PR adds a --no-verify option to disable git hook verification.