php 代码质量检测工具,GrumPHP - 一个PHP代码质量工具

68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f706870726f2f6772756d7068702f6d61737465722e73766768747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f39613334353032312d633861312d346634382d393438612d6431356465353164393930392e73766768747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f74746c62617532736a673336657030312f6272616e63682f6d61737465723f7376673d7472756568747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706870726f2f6772756d7068702e73766768747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706870726f2f6772756d7068702e737667

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f547769747465722d2534306772756d7068702d626c75652e73766768747470733a2f2f696d672e736869656c64732e696f2f62616467652f467265656e6f64652d2532336772756d7068702d626c75652e73766768747470733a2f2f6261646765732e6769747465722e696d2f706870726f2f6772756d7068702e737667

GrumPHP

2db254492bc8fdbddd3785bc1a654c58.png

Sick and tired of defending code quality over and over again? GrumPHP will do it for you! This composer plugin will register some git hooks in your package repository. When somebody commits changes, GrumPHP will run some tests on the committed code. If the tests fail, you won't be able to commit your changes. This handy tool will not only improve your codebase, it will also teach your co-workers to write better code following the best practices you've determined as a team.

GrumPHP has a set of common tasks built-in. You will be able to use GrumPHP with a minimum of configuration.

We don't want to bore you with all the details, so quick: install it yourself and unleash the power of GrumPHP!

Demo

demo.gif

Installation

In order for this package to work, you have to make sure following tools are discoverable on the command-line:

php

composer

git

This package is a composer plugin and should be installed to your project's dev dependency using composer:

Install GrumPHP as a phar without dependencies:

composer require --dev phpro/grumphp-shim

Install GrumPHP with dependencies:

composer require --dev phpro/grumphp

Install GrumPHP without dependencies and automated git hooks through phive

phive install grumphp

When the package is installed, GrumPHP will attach itself to the git hooks of your project. You will see following message in the composer logs:

Watch out! GrumPHP is sniffing your commits!

GrumPHP will never push you into using a specific task. You can choose the tasks that fit your needs, and activate or deactivate any task in no time! See the suggest section in composer.json.

Note: GrumPHP will overwrite existing hooks unless you run composer install with --no-plugins or --no-scripts. Be sure to backup your hooks before you try to install GrumPHP.

Having trouble installing GrumPHP? Find out how to:

Configuration

Some things in GrumPHP can be configured in a grumphp.yml or grumphp.yml.dist file in the root of your project (the directory where you run the grumphp command). You can specify a custom config filename and location in composer.json or in the --config option of the console commands.

# grumphp.yml

grumphp:

hooks_dir: ~

hooks_preset: local

git_hook_variables:

VAGRANT_HOST_DIR: .

VAGRANT_PROJECT_DIR: /var/www

EXEC_GRUMPHP_COMMAND: exec

stop_on_failure: false

ignore_unstaged_changes: false

hide_circumvention_tip: false

process_timeout: 60

ascii:

failed: grumphp-grumpy.txt

succeeded: grumphp-happy.txt

parallel:

enabled: true

max_workers: 32

fixer:

enabled: true

fix_by_default: false

tasks: {}

testsuites: []

extensions: []

Details of the configuration are broken down into the following sections.

Parameters – Configuration settings for GrumPHP itself.

Tasks – External tasks performing code validation and their respective configurations.

Commands

Since GrumPHP is just a CLI tool, these commands can be triggered:

Compatibility

GrumPHP works with PHP 5.6 or above.

This package has been tested with following git clients:

CLI Unix

CLI Mac

CLI Windows

PhpStorm Git

Atlassian SourceTree

Syntevo SmartGit

Roadmap

Lots of tasks are already available to make sure your team writes great code. We are always looking to support new tasks. Feel free to log an issue or create a pull request for a task we forgot.

Are you missing a feature or did you find a bug? Log it in the issue tracker! Want to help out? Feel free to contact us!

FAQ

About

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub. Please take a look at our rules before contributing your code.

License

GrumPHP is licensed under the MIT License.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值