Git Product home page Git Product logo

phpgithooks's Introduction

PhpGitHooks

Latest Stable Version Latest Unstable Version

This project contains some simple scripts to run Unit tests and static analysis tools before allowing a commit.

Currently the tool will run:

  1. PHPUnit
  2. PHP Copy Paste Detector
  3. PHP Code Sniffer

The tool will only run phpcs on modified files where phpcpd will be run against all files. PHPUnit will be run if there if a phpunit.xml or phpunit.xml.dist file in the root of the project.

PHP Code Sniffer will be run with ps2 coding standard and warning will be ingored (eg line limits)

This script will look for binaries in either the project's vendor/bin directory first and will fall back to ~/.composer/vendor/bin so make sure the tools are installed with composer.

See PHP-FIG for the coding standards.

Install tools

composer global require 'phpunit/phpunit:3.7.*'
composer global require 'squizlabs/php_codesniffer:1.5.1'
composer global require 'sebastian/phpcpd=2.0.0'

Install hooks

composer global require 'aydin-hassan/php-git-hooks:0.1.0-beta3'
cd ~/.composer/vendor/aydin-hassan/php-git-hooks
./install.sh

If you have any existing repositories you should run git init in the root of the repo to enable the hooks in them. All new repos will inherit the hooks.

Done

Everytime you commit something from any newly cloned/ created repository these checks will be executed!

Todo

  • Figure out how to execute global hooks if local repo hooks are defined

phpgithooks's People

Contributors

aydinhassan avatar

Stargazers

Jared avatar dengwei avatar Bryan "BJ" Hoffpauir avatar Jaap van Otterdijk avatar  avatar Shane Osbourne avatar Adam Paterson avatar  avatar

Watchers

James Cloos avatar  avatar Ben Lill avatar  avatar

Forkers

adam-paterson

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.