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

Ignoring commits based on rules #54

Closed
martinchaves opened this issue Jan 19, 2018 · 2 comments
Closed

Ignoring commits based on rules #54

martinchaves opened this issue Jan 19, 2018 · 2 comments
Labels
enhancement User-facing feature enhancements

Comments

@martinchaves
Copy link

There are plans to add some sort of rule based commit ignoring?

We are using maven and the release precess add commits with messages like:

[maven-release-plugin] prepare for next development iteration

Or

[maven-release-plugin] prepare release <tag>

I can modify maven configuration to include a gitlint-ignore: all but thats really not the best solution IMO.

The idea was something in the line of author, title or body ignore rule, if the commit match that rule then is not processed.

@jorisroovers
Copy link
Owner

I can modify maven configuration to include a gitlint-ignore: all but thats really not the best solution IMO

Agreed that this isn't the ideal solution.

I'll tag this as an enhancement, but just FYI that I don't think I'll be able to work on this for a while (think months).

Potential workaround is to put gitlint in a bash script and just do some bash magic (untested, probably buggy):

#!/bin/bash
set -e # fail on error, needed for the script to skip gitlint for maven messages

MESSAGE=$(git log -1 --pretty=%B)
echo "$MESSAGE" | grep -v "[maven-release-plugin] prepare release"
echo "$MESSAGE" | grep -v "[maven-release-plugin] something else to ignore"
echo "$MESSAGE" | grep -v "[maven-release-plugin] ignoring more"
echo "$MESSAGE" | gitlint

@jorisroovers jorisroovers added the enhancement User-facing feature enhancements label Jan 19, 2018
@jorisroovers
Copy link
Owner

FYI that there's some work going on related to this: #57

No ETA on when this will land.

jorisroovers pushed a commit that referenced this issue Mar 30, 2018
Very much WIP, still need to write/fix tests, docs, etc.

This is part of #54 and #57.
jorisroovers pushed a commit that referenced this issue Mar 30, 2018
Added a new IgnoreByTitle rule that is based on a new more generic rule
construct called ConfigurationRule.

ConfigurationRules can modify gitlint configuration (and therefore
behavior) on a per commit basis.

Added some tests and docs, more docs and integration tests to follow in
additional commits.

This is part of #54 and #57.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement User-facing feature enhancements
Projects
None yet
Development

No branches or pull requests

2 participants