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

Can't disallow fixup! messages #769

Closed
1 of 4 tasks
ResDiaryLewis opened this issue Jul 30, 2019 · 4 comments
Closed
1 of 4 tasks

Can't disallow fixup! messages #769

ResDiaryLewis opened this issue Jul 30, 2019 · 4 comments

Comments

@ResDiaryLewis
Copy link
Contributor

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

  • 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 ```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
@marionebl
Copy link
Contributor

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

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

we should do the following:

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

Want to lend a hand?

@yzevm
Copy link

yzevm commented Aug 10, 2019

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

@ResDiaryLewis
Copy link
Contributor Author

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

@byCedric
Copy link
Member

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 😄

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

No branches or pull requests

4 participants