dealer-teamwork/codacy-coverage
Composer 安装命令:
composer require dealer-teamwork/codacy-coverage
包简介
Sends PHP test coverage information to Codacy.
README 文档
README
Codacy coverage support for PHP. Get coverage reporting and code analysis for PHP from Codacy.
Started from the codacy-coverage library which is available on Packagist.
NOTE: Only PHPUnit is supported by this version of the library.
Reason
- codacy-coverage was not parsing my PHPUnit XML correctly
- I wanted to get this done ASAP, so didn't have time to fork/PR on original repo
Prerequisites
- PHP 5.3 or later
- One of the following coverage report formats
- PHPUnit XML (e.g.
`--coverage-xml`in PHPUnit)
- PHPUnit XML (e.g.
Installation
Setup codacy-coverage-mod with Composer, just add the following to your composer.json:
// composer.json
{
"require-dev": {
"dealer-teamwork/codacy-coverage": "dev-master"
}
}
Download the dependencies by running Composer in the directory of your composer.json:
# install
$ php composer.phar install --dev
# update
$ php composer.phar update dealer-teamwork/codacy-coverage --dev
dealer-teamwork/codacy-coverage library is available on Packagist.
Add the autoloader to your php script:
require_once 'vendor/autoload.php';
Note: We have php5-curl dependency, if you have issues related to curl_init() please install it with:
sudo apt-get install php5-curl
Updating Codacy
To update Codacy, you will need your project API token. You can find the token in Project -> Settings -> Integrations -> Project API.
Then set it in your terminal, replacing %Project_Token% with your own token:
export CODACY_PROJECT_TOKEN=%Project_Token%
Note: You should keep your API token well protected, as it grants owner permissions to your projects.
To send coverage in the enterprise version you should:
export CODACY_API_BASE_URL=<Codacy_instance_URL>:16006
Usage
Run `vendor/bin/codacycoverage` to see a list of commands.
Basic usage for PHPUnit XML format:
By default we assume that
- your PHPUnit XML report is saved in the directory ```build/coverage-xml```
#### Optional parameters:
You can specify the path to your report with the second parameter:
- PHPUnit XML
- ```php vendor/bin/codacycoverage phpunit directory/path/to/phpunitreport```
Even more control:
- ```--base-url=<OTHER_URL>``` defaults to http://codacy.com
- ```--git-commit=<COMMIT_HASH>``` defaults to the last commit hash
## Circle CI
This project sends its own coverage during the build in circleCI.
Feel free to check our `circle.yml`, and send your coverage as a step of your build process.
## Travis CI
Add codacycoverage to your `.travis.yml`:
```yml
# .travis.yml
language: php
# Do not forget to provide your CODACY_PROJECT_TOKEN as described in https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings
php:
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm
# In case of timeouts and build failures you may want to prepend 'travis_retry' to the following commands:
before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install -n
script:
- php vendor/bin/phpunit
after_script:
- php vendor/bin/codacycoverage clover path/to/clover.xml
```
## Troubleshooting
If you have a fatal error regarding curl_init():
```
PHP Fatal error: Uncaught Error: Call to undefined function Codacy\Coverage\Util\curl_init() in /src/Codacy/Coverage/Util/CodacyApiClient.php:30
```
Run: ```sudo apt-get install php5-curl```
## What is Codacy?
[Codacy](https://www.codacy.com/) is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.
### Among Codacy’s features:
- Identify new Static Analysis issues
- Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
- Auto-comments on Commits and Pull Requests
- Integrations with Slack, HipChat, Jira, YouTrack
- Track issues in Code Style, Security, Error Proneness, Performance, Unused Code and other categories
Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.
Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.
### Free for Open Source
Codacy is free for Open Source projects.
## License
[MIT](LICENSE)
dealer-teamwork/codacy-coverage 适用场景与选型建议
dealer-teamwork/codacy-coverage 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.81k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 11 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 dealer-teamwork/codacy-coverage 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dealer-teamwork/codacy-coverage 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13.81k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-10