thoughtsideas / ti-wpcs
此包已被弃用且不再维护。未建议替换包。
Thoughts & Ideas WordPress项目的PHP CodeSniffer规则
v1.1.1
2017-08-09 07:40 UTC
Requires
- dealerdirect/phpcodesniffer-composer-installer: ^0.4.1
- phpmd/phpmd: ^2.6.0
- squizlabs/php_codesniffer: ^3.0.2
- wimg/php-compatibility: ^8.0.0
- wp-coding-standards/wpcs: ^0.13.1
This package is not auto-updated.
Last update: 2021-07-10 10:38:26 UTC
README
⚠️ 存档: 2021-07-09 ⚠️
Thoughts & Ideas WordPress编码标准(TI-WPCS)是我们WordPress PHP项目的测试编码风格和质量的开发依赖项。保持代码库一致并突出潜在问题,有助于开发者更好地掌握我们的项目并在生产中提高其可靠性。
安装
Thoughts & Ideas推荐通过Composer安装此依赖项。
作为Composer依赖项
要将这些标准作为项目的一部分,请将此存储库作为开发依赖项要求。
composer require --dev thoughtsideas/ti-wpcs
修复程序和测试可以从命令行运行。
./vendor/bin/phpcbf ./
./vendor/bin/phpcs ./
./vendor/bin/phpmd ./ text ./vendor/thoughtsideas/ti-wpcs/ti-wpmd/ruleset.xml
在每次Git提交之前自动运行测试。
Thoughts & Ideas推荐使用pre-commit Git Hook。
创建pre-commit钩子文件。
mkdir ./_scripts && touch ./_scripts/pre-commit
将pre-commit钩子添加到我们的新文件中。
#!/bin/sh
#
# Pre Commit Hook.
# Remove un-staged changes.
git stash -q --keep-index
# Run QA script.
echo "Running WordPress PHP Coding Standards test"
composer run test-phpcbf
composer run test-phpcs
# PHPCS Results (bool)
QA_PHPCS=$?
echo "Running WordPress PHP Mess Detector test"
composer run test-phpmd
# PHPMD Results (bool)
QA_PHPMD=$?
# Apply un-staged changes.
git stash pop -q
# Get our test QA results.
[ $QA_PHPCS -ne 0 ] && exit 1
[ $QA_PHPMD -ne 0 ] && exit 1
# If test pass exit successfully.
exit 0
将我们的新文件链接到我们的git仓库。
ln -s ../../_scripts/pre-commit ./.git/hooks/pre-commit
每次您提交到Git仓库时,TI-WPCS测试将自动运行。
问题报告
如果您发现任何问题,请通过GitHub问题跟踪器创建工单。包括问题、浏览器和操作系统以及如何复现它。如果问题是安全相关的,请使用以下联系信息。
联系方式
Thoughts & Ideas - hello@thoughtsideas.uk
许可证
本项目根据MIT许可证的条款进行许可。请参阅LICENSE文件。
版权
除非另有说明,否则版权所有 © Thoughts & Ideas。保留所有权利。