archived-codacy / php-codacy-coverage Goto Github PK
View Code? Open in Web Editor NEWPhar for uploading PHP code coverage to Codacy
Home Page: https://www.codacy.com
License: MIT License
Phar for uploading PHP code coverage to Codacy
Home Page: https://www.codacy.com
License: MIT License
Hello.
This is mistake in https://github.com/codacy/php-codacy-coverage/blob/master/bin/codacycoverage#L5
Why this line should be looked for first?
It's really BAD idea use vendor/bin
at first.
For example, I have global installed codacycoverage. I go to a project with vendor dir, where codacycoverage not installed (but has autoload.php). So codacycovarage take those autoload instead own.
I test various situation with codacycoverage:
git clone
and run codacycoverage with different platform (Windows, Linux, Mac OS X) in differrent folders (in root repo, in vendor dir, in /tmp dir, in repo dir with vendor without codacycoverage installed). It's work fine with those lines:
$files = array(
__DIR__ . "/../../vendor/autoload.php",
__DIR__ . "/../../../autoload.php",
dirname(__DIR__) . "/vendor/autoload.php"
);
NO other line should specified.
A line "vendor/autoload.php
really buggy, and not work. Please, remove it.
Hey guys,
I'm trying to upload code coverage via a new ubuntu 14.04 installation that I've setup with Jenkins (I've managed to get code coverage working on my local mac). After I run unit tests, I issue the following command:
php vendor/bin/codacycoverage clover tests/coverage.xml
and end up with this stack trace:
PHP Fatal error: Uncaught Error: Call to undefined function Codacy\Coverage\Util\curl_init() in /var/lib/jenkins/workspace/develop-test/vendor/codacy/coverage/src/Codacy/Coverage/Util/CodacyApiClient.php:30
Stack trace:
#0 /var/lib/jenkins/workspace/develop-test/vendor/codacy/coverage/src/Codacy/Coverage/Command/Clover.php(69): Codacy\Coverage\Util\CodacyApiClient->sendCoverage('a5b73dac5497864...', '{"total":44,"fi...')
#1 /var/lib/jenkins/workspace/develop-test/vendor/symfony/console/Command/Command.php(259): Codacy\Coverage\Command\Clover->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /var/lib/jenkins/workspace/develop-test/vendor/symfony/console/Application.php(844): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/lib/jenkins/workspace/develop-test/vendor/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCom in /var/lib/jenkins/workspace/develop-test/vendor/codacy/coverage/src/Codacy/Coverage/Util/CodacyApiClient.php on line 30
Any ideas?
Hi,
The grumphp project needs gitlib ~1.0 while Codacy coverage needs ~0.1
Would it be possible to update Codacy and use version ~1.0 of Gitlib ?
I can help you to rewrite ugly bin/codacycoverage by using symfony/console dependcies (this add requirements in composer.json)
This will be like this:
#!/usr/bin/env php
<?php
require 'vendor/autoload.php';
$app = new \Codacy\Coverage\Application();
$app->run();
And split clover
and phpunit
by dedicated \Codacy\Coverage\Command classes.
I can do this work, if you wanted.
7.3
Laravel / PHPUnit
Commands
php vendor/bin/phpunit --coverage-clover build/coverage/xml
php vendor/bin/codacycoverage clover build/coverage/xml
composer.json
"require-dev": {
"codacy/coverage": "^1.4",
},
phpunit.xml
<logging>
<log type="coverage-html" target="./reports" lowUpperBound="50" highLowerBound="80" />
</logging>
Hi, everybody.
I have a problem with using codacycoverage as global composer utility.
For example, I have 10 projects, and all of them has build/logs/clover.xml. All projects use codacy. Because I have composer I want install global utility:
composer global require codacy/coverage dev-master
Now, script in ~/.composer/vendor/bin/codacycoverage
. I'm go to a project dir
cd ~/Projects/Project1
export CODACY_PROJECT_TOKEN="v3ryl0ngt0k3n"
codacycoverage clover
PHP Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /Users/komnac/.composer/vendor/codacy/coverage/bin/codacycoverage on line 4
Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /Users/komnac/.composer/vendor/codacy/coverage/bin/codacycoverage on line 4
PHP Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.:/usr/local/Cellar/php55/5.5.24/lib/php') in /Users/komnac/.composer/vendor/codacy/coverage/bin/codacycoverage on line 4
Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.:/usr/local/Cellar/php55/5.5.24/lib/php') in /Users/komnac/.composer/vendor/codacy/coverage/bin/codacycoverage on line 4
It is bad, because I don't want install codacycoverage
for every project (some of them doesn't have composer). If my project on javascript, I don't want install javascript specific package, because I already have utility to send the Codacy results of code coverage (installed by composer).
There for using:
require 'vendor/autoload.php';
in https://github.com/codacy/php-codacy-coverage/blob/master/bin/codacycoverage#L4 wrong.
I know solution, that use something like this:
require_once __DIR__ . '/../../../autoload.php';
will be fix this problem.
The project API token is exported, but the codacy upload fails: https://travis-ci.org/razorpay/ec2-metadata/jobs/68203159#L194
Error: call to URL https://www.codacy.com/api/2.0/coverage/2b4fbcdbf29fd6359165fb6eadd5ae319457609e/php failed with status 404, response {"error":"not found"}, curl_error 0
I tried running it locally and got the same error.
Hello, everybody.
In my project I have a CI that use coverage files located in another place that codacycoverage
(build/logs/clover.xml). I want to specify to codacycoverage a path to a file, that it should be use.
Could you add option, that have a specific path to result file (in clover mode) or a dir (in phpunit mode)?
For example:
php vendor/bin/codacycoverage clover /logs/cover/clover.xml
php vendor/bin/codcycoverage phpunit /log/cover/xml
If option not specified use a default path.
Coverage received successfully, but not displaying in Codacy
Tried it on 7 and 5.6
Tried it on Mac and Linux
Coverage should display in the Codacy Dashboard and File page
Step 1 - Installed codacy/coverage (I preferred globally)
$ composer require global codacy/coverage
Step 2 - export token on terminal
$ export CODACY_PROJECT_TOKEN=<project_api_token>
Step 3 - Send clover xml file to Codacy
$ ~/.composer/vendor/bin/codacycoverage clover path/to/clover.xml -v
Terminal Output
Codacy Error's Message
PHP 7.2.10-0ubuntu1 (cli) (built: Sep 13 2018 13:38:55) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.10-0ubuntu1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.0beta2-dev, Copyright (c) 2002-2018, by Derick Rethans
Codeception 2.5.3
Linux bookra 4.18.0-15-generic #16-Ubuntu SMP Thu Feb 7 10:56:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Running
./bin/codacycoverage clover ./tmp/coverage.xml
works (coverage.xml exists). Running
./bin/codacycoverage phpunit ./tmp/coverage.xml
throws error
In Parser.php line 50:
Unable to load the xml file. Make sure path is properly set. Using: "/home/
patrick/Projects/Booka/tmp/coverage.xml/index.xml"
I would expect to have at least the same behaviour, EITHER filename OR directory. Otherwise the documentation (README.md) should state the difference.
I've integrated codacy coverage into my existing PHP project.
The builds fail on Travis with:
3.99s$ travis_retry php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
[RuntimeException]
Could not scan for classes inside "/home/travis/build/ottlinger/hornherzogen/vendor/codacy/coverage/src/" which does not appear to be a file nor a folder
upon build initialization.
Somehow the file structure does not seem to be valid for composer ....
https://travis-ci.org/ottlinger/hornherzogen/jobs/218432170
Use uname -a
if on Linux.
If this is an issue that involves integration with another system, include the exact version and OS of the other system, including any intermediate drivers or APIs i.e. if you connect to a PostgreSQL database, include both the version / OS of PostgreSQL and the JDBC driver version used to connect to the database.
Please describe the expected behavior of the issue, starting from the first action.
Hello, everybody.
Why are you store bin/phar/codacycoverage.phar
in git repo? If I want modify some of files, I need regenerate this phar file. It's not hard, but really duplicate your code and seem ugly.
I don't know projects, that use phar like you. Many projects has phar.builder script, that can generate phar in they repo, but doesn't store phar.
Why I need download 21Kb (your phar size) unusefull traffic, when install dependency from composer?
I have looked your documentation for word phar
(in this project and in http://docs.codacy.com) and have n't find any requirements or code example that use this phar.
Could you remove it from your repo?
The project description says:
Phar for uploading Scala code coverage to Codacy
but should be
Phar for uploading PHP code coverage to Codacy
Submitting a phpunit clover report from Travis CI with no unit tests will kill the script.
PHP Warning: Division by zero in /home/travis/build/bblue/ruby/vendor/codacy/coverage/src/Codacy/Coverage/Parser/CloverParser.php on line 28
Hello, everyone I am trying to do the integration, but ends up returning this error.
In CodacyApiClient.php line 54:
Error: Call to URL https://api.codacy.com/2.0/coverage/3c7760d2a5adc8a9c4453d8a208a35a630c13f93/php failed with status 404, response {"error": "not found"}, curl_error 0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.