Skip to content

Plugin-based system to run specific actions and checks when git hooks are triggered.

License

Notifications You must be signed in to change notification settings

guillaumeaubert/App-GitHooks

Repository files navigation

App-GitHooks

Build Status Coverage Status CPAN License

App::GitHooks is an extensible and easy to configure git hooks framework that supports many plugins.

OVERVIEW

  • Here's an example of it in action, running the pre-commit hook checks before the commit message can be entered:

    Successful checks

  • Here is another example, with a Perl file that fails compilation this time:

    Failing checks

INSTALLATION

  1. Install this distribution (with cpanm or your preferred CPAN client):

     cpanm App::GitHooks
    
  2. Install the plugins you are interested in (with cpanmor your prefered CPAN client), as App::GitHooks does not bundle them. See the list of plugins below, but for example:

     cpanm App::GitHooks::Plugin::BlockNOCOMMIT
     cpanm App::GitHooks::Plugin::DetectCommitNoVerify
     ...
    
  3. Go to the git repository for which you want to set up git hooks, and run:

     githooks install
    
  4. Enjoy!

OFFICIALLY SUPPORTED PLUGINS

Prevent committing code with #NOCOMMIT mentions.

Prevent commits in a production environment.

Find out when someone uses --no-verify and append the pre-commit checks to the commit message.

Force running a specific tool at regular intervals.

Detect discrepancies between the ticket ID specified by the branch name and the one in the commit message.

Verify that Perl files compile without errors.

Verify that all changes and addition to the Perl files pass PerlCritic checks.

Enforce a specific Perl interpreter on the first line of Perl files.

Verify that the syntax of PgBouncer auth files is correct.

Derive a ticket ID from the branch name and prepend it to the commit-message.

Require a commit message.

Verify that staged Ruby files compile.

Validate POD format in Perl and POD files.

CONTRIBUTED PLUGINS

Verify that staged Ruby files compile.

Prevent trailing whitespace from being committed.

SUPPORT AND DOCUMENTATION

After installing, you can find documentation for this module with the perldoc command.

perldoc App::GitHooks

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright (C) 2013-2017 Guillaume Aubert.

This code is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file for more details.