silverstripe/moduleratings
Composer 安装命令:
composer require silverstripe/moduleratings
包简介
A library to provide module code quality ratings
README 文档
README
This module provides a check suite, and a set of automated checks that can be run over a SilverStripe module to determine a "quality rating".
This library can be installed into a SilverStripe 3 or 4 project that uses Composer.
Installation
You can install this library with Composer if you want to use its public API:
composer require silverstripe/moduleratings
You can also install the silverstripe/moduleratings-plugin Composer plugin, which will provide a Composer command you can run locally to check module quality ratings. Please see the readme in that module for more information on using it.
Requirements
- symfony/finder 3 or 4
- symfony/yaml 3 or 4
Note: If you have conflicts with any of the symfony components (if using the Composer plugin) during installation, you may need to manually require an older version of one or both of those packages, e.g.:
composer require symfony/yaml ~3.0
composer require symfony/console ~3.0
Using the API
To create a check suite, use the SilverStripe\ModuleRatings\CheckSuite class. You will need to provide the
directory path to the module code you want to check, and optionally the GitHub repository slug for the
module (note: only GitHub supported at this stage). Providing the repository slug will enable checks that
look at external continuous integration system APIs to determine quality metrics (e.g. Travis, Scrutinizer).
$checkSuite = new \SilverStripe\ModuleRatings\CheckSuite(); $checkSuite ->setModuleRoot('/path/to/silverstripe/framework') ->setRepositorySlug('silverstripe/silverstripe-framework'); $checkSuite->run(); echo 'Framework has scored ' . $checkSuite->getScore() . ' out of 100 points. Details:', PHP_EOL; print_r($checkSuite->getCheckDetails());
The return data from CheckSuite::getCheckDetails is an array with the following example structure
(note that example is JSON encoded):
{
"good_code_coverage": {
"description": "Has a \"good\" level of code coverage (greater than 40%, requires slug)",
"points": 5,
"maximum": 5
},
"has_code_of_conduct_file": {
"description": "Has a code of conduct file",
"points": 2,
"maximum": 2
},
"coding_standards": {
"description": "The PHP code in this module passes the SilverStripe lint rules (mostly PSR-2)",
"points": 0,
"maximum": 10
}
}
Available checks
- "Good" code coverage (>= 40%) (via either Scrutinizer CI or Codecov.io)
- "Great" code coverage (>= 75%) (via either Scrutinizer CI or Codecov.io)
- PHP code is in either "code" or "src" folder
- PHP code passes a PSR-2-ish linting standards check (phpcs.xml.dist is stored in
src/Check/CodingStandardCheckfor reference) - Contributing guide file exists
- Has documentation
- EditorConfig configuration file exists
- .gitattributes file exists
- A license file exists
- The repository has a readme
- Scrutinizer CI is configured and has a "good" quality rating (>= 6.5/10)
- One of either Travis CI or CircleCI is configured and the last build passed successfully
The registered checks are defined in config.yml along with the number of points awarded for each check given that
it passes.
Caveats
Please note the following caveats/gotchas/todos:
- Code repositories must exist on GitHub for external API checks to work
Thanks!
A huge thank you to Chris Pitt who originally wrote Helpful Robot, the inspiration for this library.
The checks in this library are heavily inspired by the original Helpful Robot checks, and are designed to match the SilverStripe commercially supported module standard.
Without Helpful Robot the SilverStripe community would look a lot less tidy today!
silverstripe/moduleratings 适用场景与选型建议
silverstripe/moduleratings 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 546 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 silverstripe/moduleratings 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 silverstripe/moduleratings 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 546
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2018-04-12