Commitlint: Can't disallow fixup! messages

Created on 30 Jul 2019  Â·  4Comments  Â·  Source: conventional-changelog/commitlint

defaultIgnores doesn't seem to stop the commit message fixup! from bypassing rules:

module.exports = {
    defaultIgnores: false,
    rules: {
        'subject-empty': [2, 'never']
    }
};

Example:

> commitlint -v
8.1.0

> "foo: bar" | commitlint -V
â§—   input: foo: bar
✔   found 0 problems, 0 warnings

> "foo:" | commitlint -V
â§—   input: foo:
✖   subject may not be empty [subject-empty]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

> "foxup!" | commitlint -V
â§—   input: foxup!
✖   subject may not be empty [subject-empty]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

> "fixup!" | commitlint -V
â§—   input: fixup!
✔   found 0 problems, 0 warnings

Expected Behavior

The message fixup! should fail in the same way as foxup!, as it breaks the subject-empty rule and defaultIgnores has been set to false.

Current Behavior

The message fixup! ignores the subject-empty rule.

Affected packages

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

Steps to Reproduce (for bugs)

  1. Create a commitlint.config.js with a single rule to disallow the message fixup! and set defaultIgnores: false _(see above)_
  2. Run echo "fixup!" | commitlint or any other message beginning with fixup!


commitlint.config.js

module.exports = {
    defaultIgnores: false,
    rules: {
        'subject-empty': [2, 'never']
    }
};

Context

I want to disallow fixups from being merged into my main branch.

Your Environment

| Executable | Version |
| ---: | :--- |
| commitlint --version | 8.1.0 |
| git --version | git version 2.22.0.windows.1 |
| node --version | v11.2.0 |

bug help wanted

Most helpful comment

I've just published 8.2.0, which includes the fix for this issue. Sorry it took a while! Please try it out tell us if you encounter any issues 😄

All 4 comments

Just verified this. We fail to transfer the defaultIgnores from user options to our defaults, this is very much like #668, so the same type of fix applies:

Analogous to

https://github.com/conventional-changelog/commitlint/blob/6332d97da8b187368b272d59a280f7e241bf234f/%40commitlint/cli/src/cli.js#L158-L160

we should do the following:

 if (loaded.defaultIgnores) { 
    opts.defaultIgnores = loaded.defaultIgnores; 
} 

Want to lend a hand?

@ResDiaryLewis I see your pull request is merged. Is this issue still open?

Hi @YegorZaremba, I'd probably consider the issue to be open until we can use the fix in a release

I've just published 8.2.0, which includes the fix for this issue. Sorry it took a while! Please try it out tell us if you encounter any issues 😄

Was this page helpful?
0 / 5 - 0 ratings