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

False positives when using the slash symbol ("/") in scope #262

Closed
yenbekbay opened this issue Feb 1, 2018 · 5 comments · Fixed by #265
Closed

False positives when using the slash symbol ("/") in scope #262

yenbekbay opened this issue Feb 1, 2018 · 5 comments · Fixed by #265
Labels

Comments

@yenbekbay
Copy link

If you include the slash symbol (/) in the scope of a commit message, subject-empty and type-empty rules start throwing errors.

Current Behavior

For the commit message feat(components/Component): subject, I am currently getting the following output:

> commitlint -e

⧗   input: feat(components/Component): subject
✖   message may not be empty [subject-empty]
✖   type may not be empty [type-empty]
✖   found 2 problems, 0 warnings

Expected Behavior

The commit message feat(components/Component): subject should pass.

Affected packages

Not sure.

Possible Solution

Not sure.

Steps to Reproduce (for bugs)

  1. Stage any changes.
  2. Commit the changes with the message that has a slash in the scope – e.g. feat(components/Component): subject
  3. Run commitlint -e
commitlint.config.js
module.exports = {
  extends: ['@anvilabs/commitlint-config'],
};

Context

Can't use scopes with slashes in them.

Your Environment

Executable Version
commitlint --version 6.0.2
git --version 2.16.1
node --version 9.4.0
@marionebl
Copy link
Contributor

Probably a bug with conventional-commits-parser, will investigate.

@marionebl marionebl added the bug label Feb 1, 2018
@jiffybank
Copy link

Having the same issue with commas in scopes with recent releases. Works in v5.2.3, breaks in v5.2.4.

@marionebl
Copy link
Contributor

marionebl commented Feb 3, 2018

Fixed via 6.1.0. Let me know if you still run into problems!

λ commitlint -v
6.1.0

λ echo "feat(components/component): subject" | commitlint
⧗   input: feat(components/component): subject
✔   found 0 problems, 0 warnings

λ echo "feat(components, component): subject" | commitlint
⧗   input: feat(components, component): subject
✔   found 0 problems, 0 warnings

@Stupidism
Copy link

Stupidism commented May 9, 2018

@marionebl It's happening again and it's different. Example repo is here.

Looks like there's an extra new-line before my commit message:

➜  cra-rewired-starter git:(master) ✗ gc -m "feat(store/modules): add runtime"
husky > npm run -s precommit (node v8.11.1)

 ✔ Running tasks for {src,config}/**/*.{js,jsx,json}
 ↓ Running tasks for src/**/*.{css,less} [skipped]
   → No staged files match src/**/*.{css,less}
husky > npm run -s commitmsg (node v8.11.1)

⧗   input:
feat(store/modules): add runtime

✖   message may not be empty [subject-empty]
✖   type may not be empty [type-empty]
✖   scope may not be empty [scope-empty]
✖   found 3 problems, 0 warnings

without slash:

➜  cra-rewired-starter git:(master) ✗ gc -m "feat(store-modules): add runtime"
husky > npm run -s precommit (node v8.11.1)

 ✔ Running tasks for {src,config}/**/*.{js,jsx,json}
 ↓ Running tasks for src/**/*.{css,less} [skipped]
   → No staged files match src/**/*.{css,less}
husky > npm run -s commitmsg (node v8.11.1)

⧗   input: feat(store-modules): add runtime
✔   found 0 problems, 0 warnings

version:

➜  cra-rewired-starter git:(master) ✗ node -v
v8.11.1
➜  cra-rewired-starter git:(master) npm -v
6.0.0
➜ cra-rewired-starter git:(master) ✗ grep 'version' node_modules/@commitlint/cli/package.json
    "type": "version",
  "version": "6.2.0",

cli-test:

➜  cra-rewired-starter git:(master) ✗ echo "feat(components, component): subject" | ./node_modules/.bin/commitlint
⧗   input: feat(components, component): subject
✔   found 0 problems, 0 warnings

➜  cra-rewired-starter git:(master) ✗ echo "feat(components/component): subject" | ./node_modules/.bin/commitlint
⧗   input: feat(components/component): subject
✔   found 0 problems, 0 warnings

@Stupidism
Copy link

@marionebl Did you see this? Do I need to submit a new issue?

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

Successfully merging a pull request may close this issue.

4 participants