-
Notifications
You must be signed in to change notification settings - Fork 75
chore: Don't check readme pre push but check commit message #599
Conversation
Honestly, I think we can remove the eslint check from the pre-push hook altogether. The main reason I wanted to get the changelog-lint as a commit hook is because once you push a bad commit message, the PR will fail indefinitely and this is hard to fix if you aren't familiar with rebasing. |
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 didn't work for me when I tried committing a message that was formatted incorrectly. I did not receive an error.
I think it's because npm run changelog-lint
only looks at previously commits by default. The way we do this on web-ext is with a custom script that pipes the temporary commit message file into the lint checker: https://github.com/mozilla/web-ext/blob/master/.githooks/commit-msg/check-for-changelog-lint#L7
Is there an easy way to do that with husky?
@kumar303 just tested this version in a windows shell with git and it worked fine, though I still had an error when using the GitHub client. |
Huh, this is confusing. On Mac OS X (tried in Node 6.3.0 and 4.3.0), I see this:
However, if I run this in my shell it works as expected:
I don't understand what black magic npm (or husky) might be doing to cause this. On a hunch, I tried applying this patch but it made no difference: diff --git a/package.json b/package.json
index 0c9a56f..511c0c6 100644
--- a/package.json
+++ b/package.json
@@ -19,9 +19,10 @@
"lint": "eslint bin/jpm lib test",
"test": "node ./test/run.js",
"prepush": "npm run lint",
- "commitmsg": "echo \"params: $GIT_PARAMS\"",
+ "commitmsg": "cat \"$GIT_PARAMS\" | npm run changelog-lint-from-stdin --silent",
"changelog": "conventional-changelog -p angular -u",
"changelog-lint": "conventional-changelog-lint --from master",
+ "changelog-lint-from-stdin": "conventional-changelog-lint",
"get-unbranded-firefox": "get-firefox -ecb unbranded-release"
},
"homepage": "https://github.com/mozilla-jetpack/jpm", Any ideas on what could be wrong? I take it that you do not see this on your system? |
The important bit is updating the husky version, too and then regenerating the git hooks, since the current version the package.json specifies does not have $GIT_PARAMS in the hook script template yet. Edit: I wonder if this is some nvm oddness or something? |
I removed my entire |
This runs the changelog-lint script at the git "commit-msg" hook, like the web-ext setup does. I've also tested it on Windows, where it works, except with GitHub for Windows, which probably doesn't support git hooks, though I suspect push would fail there too.
Further it removes the documentation spellcheck from pre-push. While doing that, I was wondering, if ti was worth adding
--cache
to the pre-push eslint, though I think there's not enough push frequency and it's not that slow to warrant that.This fixes #594