roger-sei / super-giggle
SuperGiggle 检查特定提交更改的编码规范
v1.0.3
2021-03-03 00:32 UTC
Requires
- php: >=7.2
- squizlabs/php_codesniffer: 3.*
Requires (Dev)
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2024-09-04 13:06:01 UTC
README
当与旧代码或已有的大量代码一起工作时,验证它可能成为一场噩梦,你不可能一夜之间改进旧代码。
但与此同时,你仍然希望实施好的做法和标准化,至少,你的新代码。SuperGiggle 正是关于检查你存储库中已做的更改,忽略已有的代码。你甚至可以在 CI 工具中使用 super-giggle。
要求
- PHP 7.2 或更高版本
- PHPCS 3 或更高版本
- Linux/Windows
安装和使用
Composer
composer global require roger-sei/super-giggle
# Export composer path to your enviroment path, if it isn't exported.
# Notice however it may have different path accordingly to composer version.
# Check **composer global --help** for more information.
export PATH=$PATH:$HOME/.config/composer/vendor/bin/
super-giggle --help
Git 克隆
git clone https://github.com/roger-sei/SuperGiggle.git && cd SuperGiggle
composer install
php bin/super-giggle --help
选项
bin/super-giggle [--repo] [--commit] [options]
--all Checks the whole file. Same as *git diff [file]*.
--repo The working git repository.
--commit The specific commit to validate.
--diff-cached Checks the uncommited files.
--phpcs Path to phpcs executable, required only if not using composer or if phpcs isn't in your PATH env.
--fullscan Performs a full scan in the whole project.
--type <show|diff> *diff* validates the local changes. *show* validate changes in a specific commit.
--file Force checking this file, regardless the type or commit options.
--diff Validates changes on the current repository, between commits or branches.
--verbose Prints additional information.
--warnings Displays also warnings and not only errors.
--standard The name or path of the coding standard. Defaults to PSR12.
运行测试
$ composer test
许可证
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.