socialengine/sniffer-rules
最新稳定版本:2.3.0
Composer 安装命令:
composer require socialengine/sniffer-rules
包简介
A Lumen 5 and Laravel 5 SquizLabs Code Sniffer 2.0 artisan command. Detect violations of a defined coding standard. It helps your code remains clean and consistent.
README 文档
README
This is a Laravel 5 package that hooks up SquizLabs CodeSniffer 2 into Laravel-based apps. It can also be used manually, so read on.
Detect violations of a defined coding standard. It helps your code remain clean and consistent. Available options are: PSR2, PSR1, Zend, PEAR, Squiz, PHPCS and SocialEngine.
Setup
Require this package in composer:
$ composer require socialengine/sniffer-rules
Laravel 5
In your config/app.php add 'SocialEngine\SnifferRules\ServiceProvider'
to $providers array:
'providers' => [ 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', 'SocialEngine\SnifferRules\ServiceProvider', ],
Laravel 5: Publish the configuration file
$ php artisan vendor:publish
Manual
Install our Standard by configuring PHP_CodeSniffer to look for it.
$ php ./vendor/bin/phpcs --config-set installed_paths ./vendor/socialengine/src/Socialengine/SnifferRules/Standard/
Usage
Laravel
$ php artisan sniff
To run the sniffer in a CI environment, the -n option should be set to remove
interaction:
$ php artisan sniff -n
Manual
$ php ./vendor/bin/phpcs --standard=SocialEngine path/to/code
It's encouraged to add a Makefile to your project that makes it
trivial for other developers. Use Makefile in this directory and adjust as
needed to fit your project requirements.
Travis
In combination with the Makefile, Travis has issues finding the
standard, we had to add a before_script to make it work. See
Unum repo for example.
before_script: php ./vendor/bin/phpcs --config-set installed_paths "`pwd`/vendor/socialengine/sniffer-rules/src/SocialEngine/SnifferRules/Standard/"
SocialEngine Coding Standards
Coding standards
Addendum and Clarifications
namespaceshould be on the same line as opening php tag. e.g.:<?php namespace SocialEngine\Amazing- Property names should be camelCase
- Test names should use underscores, not camelCase. e.g.:
test_cats_love_catnip
License
MIT
统计信息
- 总下载量: 48.25k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-10