Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aydinhassan/phpgithooks
Some simple git hooks to run a variety of PHP analysis tools, including PHPUnit
https://github.com/aydinhassan/phpgithooks
Last synced: 1 day ago
JSON representation
Some simple git hooks to run a variety of PHP analysis tools, including PHPUnit
- Host: GitHub
- URL: https://github.com/aydinhassan/phpgithooks
- Owner: AydinHassan
- License: gpl-2.0
- Created: 2014-01-23T00:31:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-01-23T17:40:13.000Z (over 10 years ago)
- Last Synced: 2024-04-19T07:21:34.202Z (6 months ago)
- Language: PHP
- Size: 164 KB
- Stars: 8
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PhpGitHooks
===========
[![Latest Stable Version](https://poser.pugx.org/aydin-hassan/php-git-hooks/v/stable.png)](https://packagist.org/packages/aydin0hassan/php-git-hooks)
[![Latest Unstable Version](https://poser.pugx.org/aydin-hassan/php-git-hooks/v/unstable.png)](https://packagist.org/packages/aydin-hassan/php-git-hooks)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 SnifferThe 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](https://github.com/php-fig/fig-standards) 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.shIf 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