jumanjihouse / pre-commit-hooks

git pre-commit hooks that work with http://pre-commit.com/
MIT License
113 stars 52 forks source link

create hook to check mailmap #17

Closed jumanjiman closed 6 years ago

jumanjiman commented 6 years ago

Background

git shortlog -sn is useful to summarize contributions to a git repo.

However, it gets muddy when an email address is associated with multiple names. Reasons include:

Create a pre-commit hook that detects botched translations.

Hook source

https://gist.github.com/jumanjiman/75616ec91f115abba0cde6f47bea2cb4

Sample outputs

Good condition

$ pre-commit run check-mailmap --all-files --verbose
[check-mailmap] Detect if an email address needs to be added to mailmap.......................Passed

Bad condition

$ pre-commit run check-mailmap --all-files --verbose
[check-mailmap] Detect if an email address needs to be added to mailmap.......................Failed
hookid: check-mailmap

The following email addresses are associated with more than one name:

        jdoe@example.com
        billy.bob@example.com

The associations include:

     13 John Doe <jdoe@example.com>
      4 jdoe <jdoe@example.com>

      2 Billy Bob <billy.bob@example.com>
      2 Bubba <billy.bob@example.com>