adeira/code-quality

此包已被废弃,不再维护。未建议替代包。

Adeira 包代码质量规则的来源

1.0 2016-10-02 12:00 UTC

This package is not auto-updated.

Last update: 2019-02-20 19:03:14 UTC


README

将这些规则添加到您喜欢的 CI 服务器的工作脚本中。 您应该创建包含以下内容的自定义 ruleset.xml 文件:

<?xml version="1.0"?>
<ruleset>
	<rule ref="./vendor/adeira/code-quality/ruleset.xml"/>
</ruleset>

针对 Travis (与 Gitlab-CI 类似)

before_script:
  - vendor/bin/parallel-lint . -e php,php3,php4,php5,phtml,phpt --exclude vendor --blame

script:
  - vendor/bin/tester tests -C
  - vendor/bin/phpcs --standard=ruleset.xml --extensions=php --encoding=utf-8 --tab-width=4 -sp app/ src/ --ignore=bootstrap.php
  - vendor/bin/phpcs --standard=ruleset.xml --extensions=php,phpt --encoding=utf-8 --tab-width=4 -sp tests/ --ignore=*/output/*,_temp/*,bootstrap.php

完整的 Travis 示例

language: php

php:
  - 7.0
  - 7.1

before_script:
  - composer selfupdate --no-progress
  - travis_retry composer install --prefer-dist
  - vendor/bin/parallel-lint . -e php,php3,php4,php5,phtml,phpt --exclude vendor --blame

script:
  - vendor/bin/tester tests -C
  - vendor/bin/phpcs --standard=ruleset.xml --extensions=php --encoding=utf-8 --tab-width=4 -sp src/ --ignore=bootstrap.php
  - vendor/bin/phpcs --standard=ruleset.xml --extensions=php,phpt --encoding=utf-8 --tab-width=4 -sp tests/ --ignore=*/output/*,_temp/*,bootstrap.php

notifications:
  email: false

设置您最喜欢的编辑器。以我的情况为例,是 PhpStorm。首先设置代码嗅探器

Step 1

然后启用并设置代码嗅探器的规则

Step 2