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

Ignore commented lines? #7

Open
eyefodder opened this issue Aug 21, 2022 · 3 comments · May be fixed by #18
Open

Ignore commented lines? #7

eyefodder opened this issue Aug 21, 2022 · 3 comments · May be fixed by #18

Comments

@eyefodder
Copy link

Is it possible to get commitlint to ignore commented lines? For example this commit message:

ops: update CommitLint allowed types
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch DAY-36-enforce-git-hygeine
# Your branch is up to date with 'origin/DAY-36-enforce-git-hygeine'.
#
# Changes to be committed:
#	modified:   .commitlint.yml
#

will fail because there's not an empty line after ops: update CommitLint allowed types but given the rest of the lines are all commented out, I think it should pass? I'm also finding the same thing if e.g. some of the commented lines are longer than the rules (this often happens if the path to a modified file is long)

Cheers!

@danbernier
Copy link

I'd add to @eyefodder's point that anything that git commit -v ignores, so should commitlint.

@gumbo2k
Copy link

gumbo2k commented Jun 27, 2024

Yes, it would be lovely to have the git commit's cleanup of comments and verbose diff happen before commitlint sees the message.

This would shift the burden of maintaining the filtering of comments and diff's (in case of git commit -v) to git itself, instead of trying to emulate that (configurable) behavior. 🤔

Unfortunately there seems to be no postprocess-commit-msg hook in the Committing-Workflow Hooks that we could use.

@gumbo2k
Copy link

gumbo2k commented Jun 27, 2024

gumbo2k added a commit to gumbo2k/commitlint that referenced this issue Jul 15, 2024
Similar to git itself, we now add a cleanup step before processing
the commit message.
Check `git-commit` man page for the `--cleanup` option.
In contrast to `git` we do "strip" and "scissors" in one step.

closes conventionalcommit#7
@gumbo2k gumbo2k linked a pull request Jul 15, 2024 that will close this issue
gumbo2k added a commit to gumbo2k/commitlint that referenced this issue Jul 16, 2024
Similar to git itself, we now add a cleanup step before processing
the commit message.
Check `git-commit` man page for the `--cleanup` option.
In contrast to `git` we do "strip" and "scissors" in one step.

closes conventionalcommit#7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants