Skip to content
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

Different results from the same commit message between cli and actual commit #445

Closed
b6pzeusbc54tvhw5jgpyw8pwz2x6gs opened this issue Sep 16, 2018 · 2 comments
Labels

Comments

@b6pzeusbc54tvhw5jgpyw8pwz2x6gs

Expected Behavior

Below two commands should be passed in my config. At least the same result should be output.

$ cat .git/COMMIT_EDITMSG | npx commitlint
$ git commit -m "chore(component,demo): bump"

Current Behavior

$ cat .git/COMMIT_EDITMSG | npx commitlint
⧗   input: chore(component,demo): bump
✔   found 0 problems, 0 warnings

Above command passed but below failed.

$ git commit -m "chore(component,demo): bump"
husky > commit-msg (node v8.12.0)
.git/COMMIT_EDITMSG
⧗   input:
chore(component,demo): bump

✖   scope may not be empty [scope-empty]
✖   message may not be empty [subject-empty]
✖   type may not be empty [type-empty]
✖   found 3 problems, 0 warnings
husky > commit-msg hook failed (add --no-verify to bypass)

Affected packages

  • [?] cli
  • [?] core
  • [?] prompt
  • [?] config-angular

Possible Solution

Steps to Reproduce (for bugs)

commitlint.config.js ```js ```

Context

Your Environment

package.json:

{
  "name": "root",
  "private": true,
  "devDependencies": {
    "husky": "^1.0.0-rc.14",
    "js-combinatorics": "^0.5.3",
    "lerna": "^3.3.1",
    "wsrun": "^2.2.1"
  },
  "workspaces": [
    "packages/*"
  ],
  "dependencies": {
    "@babel/cli": "^7.0.0",
    "@babel/core": "^7.0.1",
    "@babel/preset-env": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "@commitlint/cli": "^7.1.2",
    "@commitlint/config-conventional": "^7.1.2",
    "babel-eslint": "^9.0.0",
    "eslint": "^5.5.0",
    "eslint-plugin-react": "^7.11.1"
  },
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/b6pzeusbc54tvhw5jgpyw8pwz2x6gs/react-utterances.git"
  }
}
// commitlint.config.js
const Combinatorics = require('js-combinatorics')

const scopeList = ['root','component','demo']
const scopeEnumList = []

Combinatorics.power(scopeList).forEach( subset => {
  if( subset.length < 1 ) return

  const isAll = subset.length === scopeList.length
  scopeEnumList.push( isAll ? 'all' : subset.join(','))
})

module.exports = {
  rules: {
    'body-leading-blank': [1, 'always'],
    'footer-leading-blank': [1, 'always'],
    'header-max-length': [2, 'always', 72],
    'scope-case': [2, 'always', 'lower-case'],
    'scope-enum': [2, 'always', scopeEnumList],
    // scopeEnumList: [ 'root',  'component',  'root,component',  'demo',  'root,demo',  'component,demo',  'all' ]
    'scope-empty': [2, 'never'],
    'subject-case': [2, 'never', ['sentence-case','start-case','pascal-case','upper-case']],
    'subject-empty': [2, 'never'],
    'subject-full-stop': [2, 'never', '.'],
    'type-case': [2, 'always', 'lower-case'],
    'type-empty': [2, 'never'],
    'type-enum': [2, 'always', ['build','chore','ci','docs','feat','fix','perf','refactor','revert','style','test','dx']],
  }
}

version:

$ npx commitlint --version
7.1.2
$ git --version
git version 2.15.2 (Apple Git-101.1)
$ node --version
v8.12.0
@tomraithel
Copy link

Probably a duplicate of #341

@marionebl
Copy link
Contributor

Probably addressed via #496. Feel free to reopen if the problem persists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants