GithubHelp home page GithubHelp logo

codacy / codacy-coverage-reporter Goto Github PK

View Code? Open in Web Editor NEW
130.0 21.0 94.0 7.95 MB

Multi-language coverage reporter for Codacy

Home Page: https://www.codacy.com

License: Other

Scala 95.31% Shell 4.55% Dockerfile 0.13%
codacy-coverage-reporter codacy coverage reporter coverage-report coverage-reports

codacy-coverage-reporter's Introduction

Codacy Coverage Reporter

Codacy Badge Build Status Maven Central

Multi-language coverage reporter for Codacy https://www.codacy.com

Setup

Follow the instructions on how to add coverage to your repository.

If necessary, see alternative ways of running Codacy Coverage Reporter for other ways of running Codacy Coverage Reporter, such as by installing the binary manually or using a CircleCI Orb or the Codacy Coverage Reporter GitHub Action.

For a complete list of commands and options, run the Codacy Coverage Reporter with the flag --help. For example:

$ bash <(curl -Ls https://coverage.codacy.com/get.sh) report --help
     ______          __
    / ____/___  ____/ /___ ________  __
   / /   / __ \/ __  / __ `/ ___/ / / /
  / /___/ /_/ / /_/ / /_/ / /__/ /_/ /
  \____/\____/\__,_/\__,_/\___/\__, /
                              /____/

  Codacy Coverage Reporter

 --> Using codacy reporter codacy-coverage-reporter-linux from cache
Command: report
Usage: codacy-coverage-reporter report 
  --project-token | -t  <your project API token>
  --api-token | -a  <your account API token>
  --organization-provider  <the project organization provider> (manual, gh, bb, ghe, bbe, gl, gle)
  --username | -u  <the project owner name>
  --project-name | -p  <your project name>
  --codacy-api-base-url  <the base URL for the Codacy API>
  --commit-uuid  <your commit SHA-1 hash>
  --http-timeout  <Sets a specified read timeout value, in milliseconds, to be used when interacting with Codacy API. By default, the value is 10 seconds>
  --skip | -s  <skip if token isn't defined>
  --sleep-time <Sets a specified time, in milliseconds, to be used when waiting between retries. By default, the value is 10 seconds>
  --num-retries <Sets a number of retries in case of failure. By default, the value is 3 times>
  --language | -l  <language associated with your coverage report>
  --coverage-reports | -r  <your project coverage file name (supports globs)>
  --partial  <if the report is partial>
  --prefix  <the project path prefix>
  --force-coverage-parser  <your coverage parser>
        Available parsers are: opencover,clover,lcov,phpunit,jacoco,dotcover,cobertura,go


 --> Succeeded!

What is Codacy?

Codacy 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, GitLab, and Bitbucket
  • Auto-comments on Commits and Pull Requests
  • Integrations with Slack and Jira
  • 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.

codacy-coverage-reporter's People

Contributors

afsmeira avatar andreatp avatar bmbferreira avatar caxaria avatar codacy-vrhpires avatar cschroed-usgs avatar dmarinhocodacy avatar dreigada avatar gjsduarte avatar h314to avatar hjrocha avatar igfcoimbra avatar jeremiemv avatar josemiguelmelo avatar ljmf00 avatar lolgab avatar lucassklp avatar lventura-codacy avatar machadoit avatar mrfyda avatar nicklem avatar omaluhacodacy avatar pedrobpereira avatar pedrocodacy avatar pedrorijo91 avatar prcr avatar ritagrilo avatar rtfpessoa avatar rubencodacy avatar stefanvacareanu7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codacy-coverage-reporter's Issues

Debug mode enable shows token

When running from the command line I see the debug output of the tool where my token is visible. Can I disable debug mode?

error log: No Parser for java

Hi, When I run the command codacy-coverage-reporter -l Java -r coverage.xml,

the output is confused:

2015-11-17 09:29:24,219 [info]  com.codacy Parsing coverage data...
2015-11-17 09:29:24,255 [error] com.codacy no parser for Java

And also, could I get the doc about the content of coverage.xml? It seems that there is no explanation about how to use..

From source setup and build.sbt versions differ, consider 1.0.7

1.0.4 vs 1.0.5

README.md:

2- Run the command sbt assembly. This will produce a .jar that you can run in the codacy-coverage-reporter/target/codacy-coverage-reporter-assembly-1.0.4.jar

~/git/codacy/java-project$ java -cp ../codacy-coverage-reporter/target/codacy-coverage-reporter-assembly-1.0.4.jar com.codacy.CodacyCoverageReporter -l Java -r jacoco.xml

VS

build.sbt:

version := "1.0.5"

the trustAnchors parameter must be non-empty

When running the coverage reporter version 6.0.0 on circle-ci as follows:

            . venv/bin/activate
            coverage xml -o coverage/coverage.xml
            java -jar ~/.cache/jars/codacy-coverage-reporter-6.0.0-assembly.jar report -l Python -r coverage/coverage.xml
            yarn report-coverage-codacy
            java -jar ~/.cache/jars/codacy-coverage-reporter-6.0.0-assembly.jar final

now fails with:

18:27:43.235 [main] INFO com.codacy.rules.ReportRules - Uploading coverage data...
Exception in thread "main" javax.net.ssl.SSLException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:133)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259)
	at java.base/sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1314)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:408)
	at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
	at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.setNewClient(AbstractDelegateHttpsURLConnection.java:100)
	at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.setNewClient(AbstractDelegateHttpsURLConnection.java:80)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:723)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1602)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509)
	at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:329)
	at scalaj.http.HttpRequest.scalaj$http$HttpRequest$$doConnection(Http.scala:367)
	at scalaj.http.HttpRequest.exec(Http.scala:343)
	at scalaj.http.HttpRequest.asString(Http.scala:491)
	at com.codacy.api.client.CodacyClient.post(CodacyClient.scala:72)
	at com.codacy.api.service.CoverageServices.sendReport(CoverageServices.scala:20)
	at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2.apply(ReportRules.scala:62)
	at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2.apply(ReportRules.scala:47)
	at cats.syntax.EitherOps$.flatMap$extension(either.scala:148)
	at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1.apply(ReportRules.scala:47)
	at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1.apply(ReportRules.scala:40)
	at cats.syntax.EitherOps$.flatMap$extension(either.scala:148)
	at com.codacy.rules.ReportRules.withCommitUUID(ReportRules.scala:124)
	at com.codacy.rules.ReportRules.coverageWithTokenAndCommit(ReportRules.scala:40)
	at com.codacy.rules.ReportRules.codacyCoverage(ReportRules.scala:30)
	at com.codacy.CodacyCoverageReporter$.run(CodacyCoverageReporter.scala:22)
	at com.codacy.configuration.parser.ConfigurationParsingApp.run(ConfigurationParser.scala:13)
	at com.codacy.configuration.parser.ConfigurationParsingApp.run(ConfigurationParser.scala:11)
	at caseapp.CommandAppWithPreCommand$$anonfun$main$1.apply(CommandAppWithPreCommand.scala:97)
	at caseapp.CommandAppWithPreCommand$$anonfun$main$1.apply(CommandAppWithPreCommand.scala:82)
	at scala.Option.foreach(Option.scala:257)
	at caseapp.CommandAppWithPreCommand.main(CommandAppWithPreCommand.scala:82)
	at com.codacy.CodacyCoverageReporter.main(CodacyCoverageReporter.scala)
Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
	at java.base/sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:89)
	at java.base/sun.security.validator.Validator.getInstance(Validator.java:181)
	at java.base/sun.security.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:308)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrustedInit(X509TrustManagerImpl.java:176)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:188)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:129)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:626)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:461)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:361)
	at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:448)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:425)
	at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:178)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152)
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
	... 30 more
Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
	at java.base/java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:200)
	at java.base/java.security.cert.PKIXParameters.<init>(PKIXParameters.java:120)
	at java.base/java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:104)
	at java.base/sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:86)
	... 46 more
Exited with code 1

gz#7669

Java 9 Support

Operating System

Travis CI / Trusty
Ubuntu 14.04.5 LTS

JDK

Oracle JDK9
Java(TM) SE Runtime Environment (build 9.0.1+11)

Expected Behavior

Codacy coverage reporter supports Java 9

Actual Behavior

Codacy coverage reporter does crash with Java 9.

5:37:31,873 %PARSER_ERROR[coloredLevel] com.codacy Parsing coverage data... 
2018-03-16 15:37:32,166 %PARSER_ERROR[coloredLevel] com.codacy Uploading coverage data... 
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/MimetypesFileTypeMap
	at rapture.mime.MimeTypes$.<init>(mime.scala:1544)
	at rapture.mime.MimeTypes$.<clinit>(mime.scala)
	at rapture.net.PostType$$anon$14.contentType(net.scala:132)
	at rapture.net.PostType$$anon$14.contentType(net.scala:131)
	at rapture.net.HttpSupport$$anon$1$$anonfun$doHttp$1.apply(http.scala:159)
	at rapture.net.HttpSupport$$anon$1$$anonfun$doHttp$1.apply(http.scala:131)
	at rapture.core.ThrowExceptionsMode.wrap(modes.scala:199)
	at rapture.net.HttpSupport$$anon$1.doHttp(http.scala:131)
	at rapture.net.HttpSupport$Capability$$anonfun$httpPost$1.apply(http.scala:78)
	at rapture.net.HttpSupport$Capability$$anonfun$httpPost$1.apply(http.scala:78)
	at rapture.core.ThrowExceptionsMode.wrap(modes.scala:199)
	at rapture.net.HttpSupport$Capability.httpPost(http.scala:78)
	at com.codacy.api.client.CodacyClient.post(CodacyClient.scala:56)
	at com.codacy.api.service.CoverageServices.sendReport(CoverageServices.scala:20)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2$$anonfun$apply$3.apply(CodacyCoverageReporter.scala:150)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2$$anonfun$apply$3.apply(CodacyCoverageReporter.scala:136)
	at com.codacy.CodacyCoverageReporter$.com$codacy$CodacyCoverageReporter$$transform(CodacyCoverageReporter.scala:186)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2.apply(CodacyCoverageReporter.scala:135)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2.apply(CodacyCoverageReporter.scala:135)
	at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:42)
	at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:40)
	at scala.Option.map(Option.scala:146)
	at com.codacy.parsers.CoverageParserFactory$.withCoverageReport(CoverageParser.scala:39)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1.apply(CodacyCoverageReporter.scala:135)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1.apply(CodacyCoverageReporter.scala:129)
	at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1$$anonfun$apply$2.apply(FileHelper.scala:21)
	at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1$$anonfun$apply$2.apply(FileHelper.scala:19)
	at scala.Option.map(Option.scala:146)
	at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1.apply(FileHelper.scala:19)
	at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1.apply(FileHelper.scala:18)
	at com.codacy.api.helpers.FileHelper$$anonfun$withCommit$2.apply(FileHelper.scala:34)
	at com.codacy.api.helpers.FileHelper$$anonfun$withCommit$2.apply(FileHelper.scala:33)
	at scala.Option.map(Option.scala:146)
	at com.codacy.api.helpers.FileHelper$.withCommit(FileHelper.scala:33)
	at com.codacy.api.helpers.FileHelper$.withTokenAndCommit(FileHelper.scala:18)
	at com.codacy.CodacyCoverageReporter$.coverageWithTokenAndCommit(CodacyCoverageReporter.scala:129)
	at com.codacy.CodacyCoverageReporter$.codacyCoverage(CodacyCoverageReporter.scala:162)
	at com.codacy.CodacyCoverageReporter$.main(CodacyCoverageReporter.scala:89)
	at com.codacy.CodacyCoverageReporter.main(CodacyCoverageReporter.scala)
Caused by: java.lang.ClassNotFoundException: javax.activation.MimetypesFileTypeMap
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
	... 39 more

Reproducible Test Case

travis.yml

dist: trusty
language: java
jdk:
  - oraclejdk9

# Upload test coverage to codacy
env:
  global:
    CODACY_PROJECT_TOKEN=[your-token]

before_install:
  - sudo apt-get install jq
  - wget -O ~/codacy-coverage-reporter-assembly-latest.jar $(curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r .assets[0].browser_download_url)

after_success:
  - java -jar ~/codacy-coverage-reporter-assembly-latest.jar -l Java -r build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml

Code for Travis provided in documentation doesn't work anymore

In the documentation, you wrote :
wget -O ~/codacy-coverage-reporter-assembly-latest.jar $(curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r .assets[0].browser_download_url)

But it doesn't seem to work anymore.

Travis builds are failing because of rate-limits on api.github.com

We are using travis to make our builds.
Travis.yml has the typical instructions to download latest codacy reporter. See: https://github.com/rshivane/JInsight/blob/master/.travis.yml#L47

Of late our builds are failing because of rate limits on api.github.com. See the X-RateLimit headers from the curl output below.

Build passes when we retry the build after sometime (after the rate limit reset occurs).

The install/usage instructions need to use a more reliable mechanism.

0.17s$ wget -O ~/.codacy/reporter/codacy-reporter-latest.jar $(curl -v https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r .assets[0].browser_download_url)
* Hostname was NOT found in DNS cache
*   Trying 192.30.253.117...
* Connected to api.github.com (192.30.253.117) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Server key exchange (12):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSL connection using ECDHE-RSA-AES128-GCM-SHA256
* Server certificate:
* 	 subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=*.github.com
* 	 start date: 2017-01-18 00:00:00 GMT
* 	 expire date: 2020-04-17 12:00:00 GMT
* 	 subjectAltName: api.github.com matched
* 	 issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
* 	 SSL certificate verify ok.
> GET /repos/codacy/codacy-coverage-reporter/releases/latest HTTP/1.1
> User-Agent: curl/7.35.0
> Host: api.github.com
> Accept: */*
> 
< HTTP/1.1 403 Forbidden
* Server GitHub.com is not blacklisted
< Server: GitHub.com
< Date: Thu, 15 Mar 2018 11:56:41 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 258
< Status: 403 Forbidden
< X-RateLimit-Limit: 60
< X-RateLimit-Remaining: 0
< X-RateLimit-Reset: 1521115871
< X-GitHub-Media-Type: github.v3; format=json
< Access-Control-Expose-Headers: ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
< Access-Control-Allow-Origin: *
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< X-Frame-Options: deny
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Content-Security-Policy: default-src 'none'
< X-Runtime-rack: 0.011464
< X-GitHub-Request-Id: 8EC0:5064:E00A50:1D9E488:5AAA5F79
< 
{ [data not shown]
* Connection #0 to host api.github.com left intact
--2018-03-15 11:56:41--  http://null/
Resolving null (null)... failed: Name or service not known.
wget: unable to resolve host address ‘null’

Remove jpm from setup instructions or pressure to fix

curl http://www.jpm4j.org/install/script > installjpm.sh
sudo sh installjpm.sh
sudo jpm -te install com.codacy:codacy-coverage-reporter:assembly
Using settings file: ~/.jpm/settings.json
# default
# home=/var/jpm, bin=/usr/local/bin
# home=/var/jpm, bin=/usr/local/bin
# install com.codacy:codacy-coverage-reporter:assembly
# coordinate com.codacy:codacy-coverage-reporter:assembly
# -> {jsonrpc:"2.0",method:"getRevisionByCoordinate",params:["com.codacy:codacy-coverage-reporter:assembly"],id:1468032023592}
# Sentx 
# Error 
# <- http://repo.jpm4j.org/jsonrpc/2.0/jpm
# ERROR: [URLClient.send] http://repo.jpm4j.org/jsonrpc/2.0/jpm
java.lang.Exception: http://repo.jpm4j.org/jsonrpc/2.0/jpm
    at aQute.rest.urlclient.URLClient.send(URLClient.java:162)
    at aQute.rest.urlclient.URLClient.put(URLClient.java:179)
    at aQute.jsonrpc.proxy.JSONRPCProxy.invokeSync(JSONRPCProxy.java:91)
    at aQute.jsonrpc.proxy.JSONRPCProxy.invoke(JSONRPCProxy.java:63)
    at com.sun.proxy.$Proxy5.getRevisionByCoordinate(Unknown Source)
    at aQute.jpm.lib.JustAnotherPackageManager.getCandidateAsync(JustAnotherPackageManager.java:942)
    at aQute.jpm.lib.JustAnotherPackageManager.getCandidate(JustAnotherPackageManager.java:903)
    at aQute.jpm.main.Main._install(Main.java:472)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at aQute.lib.getopt.CommandLine.execute(CommandLine.java:149)
    at aQute.jpm.main.Main._jpm(Main.java:366)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at aQute.lib.getopt.CommandLine.execute(CommandLine.java:149)
    at aQute.jpm.main.Main.run(Main.java:797)
    at aQute.jpm.main.Main.main(Main.java:118)
Caused by: java.lang.Exception: Failed request 405:HTTP method PUT is not supported by this URL <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 405 </title>
</head>
<body>
<h2>HTTP ERROR: 405</h2>
<p>Problem accessing /jsonrpc/2.0/jpm. Reason:
<pre>    HTTP method PUT is not supported by this URL</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>
    at aQute.rest.urlclient.URLClient.send(URLClient.java:130)
    ... 20 more
Error
  0. [URLClient.send] http://repo.jpm4j.org/jsonrpc/2.0/jpm

You could also just navigate to http://jpm4j.org/ or http://repo.jpm4j.org and see the 405

Also doubt your other product will build if you commit there, https://github.com/codacy/codacy-api-java/blob/fix/docs/circle.yml

Do coverage data on Codacy for Csharp

Hi!
Getting troubles with CSharp coverage upload. Uploads with no errors, but no coverage data on Codacy.

Operating System

macOS 10.14.3 (18D109)

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

$java -version

java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

Expected Behavior

  1. Upload Csharp coverage xml
  2. See coverage on Codacy

Actual Behavior

  1. Coverage uploads sucessfully
  2. No coverage data on codacy

Reproducible Test Case

$ java -jar codacy-coverage-reporter-4.0.5-assembly.jar report -l csharp -r coverage.cobertura.xml --force-language --commit-uuid "c0b6bb9"
03/14 11:26:52 INFO  c.c.rules.ConfigurationRules:101 - Using API base URL: https://api.codacy.com
03/14 11:26:52 INFO  com.codacy.rules.ReportRules:48 - Parsing coverage data from: <PATH> ...
03/14 11:26:53 INFO  com.codacy.rules.ReportRules:81 - Generated report: <PATH> (1.33 kB)
03/14 11:26:53 INFO  com.codacy.rules.ReportRules:82 - Uploading coverage data...
03/14 11:26:53 INFO  c.c.CodacyCoverageReporter$:31 - Coverage data uploaded. Coverage received successfully.

coverage-example.zip

NoClassDefFoundError thrown when running CodacyCoverageReporter

Hello,

Whenever I run CodacyCoverageReporter I get the following error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Product
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
	at java.lang.Class.getMethod0(Class.java:3018)
	at java.lang.Class.getMethod(Class.java:1784)
	at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: scala.Product
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 19 more

It happens when I run it manually from my laptop or also during automated builds in CI job, as you can see here (search for java.lang.NoClassDefFoundError: scala/Product).

The odd thing about it is that, regardless of this issue, apparently the coverage info seems to be uploaded.

Can not install jpm

Scala Version (2.10.x / etc)

2.12.1

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

MacOS 10.12.2

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Expected Behavior

This command should install jpm into my machine:

curl https://www.jpm4j.org/install/script | sh

Actual Behavior

curl: (60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

I tried -k but there was another error:

curl -k https://www.jpm4j.org/install/script | sh
Error
  0. [JustAnotherPackageManager.<init>] Failed java.lang.IllegalArgumentException: Could not create directory /Library/Java/PackageManager

Specify if multi-modules are supported

This is not a issue with the code but with the documentation (mainly the README.md)

It doesn't say anywhere if the product support multi module projects and if it does, how to configure it.

With multi-module projects I mean project with hierarchies. For example on Maven it is easy and common to have a pom project on the root of the repo and several sub modules/projects on different folders. Each module has its own jacoco.xml file, so... does codacy-coverage-reporter support to add several jacoco.xml files? does it only support one? It isn't specify anywhere (or at least I was not able to find it). I think it should be explicitly said on the README.md

Java 8 Required?

Build on travis-ci for OWASP dependency-check fails to post results to Codacy due to the use Java 8 APIs within the codacy-coverage-reporter (or one of its dependencies). The README indicates that Java 7 can be used.

java.time.format.DateTimeFormat was added in Java 1.8.

JDK

OpenJDK 1.7.0_80

Expected Behavior

  1. Code coverage results would get posted to dependency-check on Codacy (here) given the configured .travis.yml

Actual Behavior

The codacy-coverage-reporter fails with the following exception:

2017-05-27 16:25:36,899 %PARSER_ERROR[coloredLevel] com.codacy Parsing coverage data... 
Exception in thread "main" java.lang.NoClassDefFoundError: java/time/format/DateTimeFormatter
	at play.api.libs.json.DefaultWrites$class.$init$(Writes.scala:302)
	at play.api.libs.json.Writes$.<init>(Writes.scala:86)
	at play.api.libs.json.Writes$.<clinit>(Writes.scala)
	at rapture.json.jsonBackends.play.PlayAst$.fromDouble(ast.scala:154)
	at rapture.json.Serializers$$anonfun$intSerializer$1.apply(serializers.scala:37)
	at rapture.json.Serializers$$anonfun$intSerializer$1.apply(serializers.scala:37)
	at rapture.json.BasicJsonSerializer.serialize(serializers.scala:28)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2$$anonfun$apply$3$$anon$3.serialize(CodacyCoverageReporter.scala:142)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2$$anonfun$apply$3$$anon$3.serialize(CodacyCoverageReporter.scala:142)
	at rapture.json.Json$.apply(json.scala:102)
	at com.codacy.api.helpers.FileHelper$.writeJsonToFile(FileHelper.scala:49)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2$$anonfun$apply$3.apply(CodacyCoverageReporter.scala:142)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2$$anonfun$apply$3.apply(CodacyCoverageReporter.scala:135)
	at com.codacy.CodacyCoverageReporter$.com$codacy$CodacyCoverageReporter$$transform(CodacyCoverageReporter.scala:185)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2.apply(CodacyCoverageReporter.scala:134)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$2.apply(CodacyCoverageReporter.scala:134)
	at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:42)
	at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:40)
	at scala.Option.map(Option.scala:146)
	at com.codacy.parsers.CoverageParserFactory$.withCoverageReport(CoverageParser.scala:39)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1.apply(CodacyCoverageReporter.scala:134)
	at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1.apply(CodacyCoverageReporter.scala:128)
	at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1$$anonfun$apply$2.apply(FileHelper.scala:21)
	at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1$$anonfun$apply$2.apply(FileHelper.scala:19)
	at scala.Option.map(Option.scala:146)
	at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1.apply(FileHelper.scala:19)
	at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1.apply(FileHelper.scala:18)
	at com.codacy.api.helpers.FileHelper$$anonfun$withCommit$2.apply(FileHelper.scala:34)
	at com.codacy.api.helpers.FileHelper$$anonfun$withCommit$2.apply(FileHelper.scala:33)
	at scala.Option.map(Option.scala:146)
	at com.codacy.api.helpers.FileHelper$.withCommit(FileHelper.scala:33)
	at com.codacy.api.helpers.FileHelper$.withTokenAndCommit(FileHelper.scala:18)
	at com.codacy.CodacyCoverageReporter$.coverageWithTokenAndCommit(CodacyCoverageReporter.scala:128)
	at com.codacy.CodacyCoverageReporter$.codacyCoverage(CodacyCoverageReporter.scala:161)
	at com.codacy.CodacyCoverageReporter$.main(CodacyCoverageReporter.scala:88)
	at com.codacy.CodacyCoverageReporter.main(CodacyCoverageReporter.scala)
Caused by: java.lang.ClassNotFoundException: java.time.format.DateTimeFormatter
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	... 36 more

Reproducible Test Case

The failing project can be found on github here.

To view the stack trace described above you must go to the travis build that looks like a success found here, scroll to the bottom and then click on the after_success button.

HTTPS always

The jpm4j install instruction tells users to run curl http://www.jpm4j.org/install/script | sh. However the jpm4j site supports SSL so the instruction should be changed to curl https://www.jpm4j.org/install/script | sh especially since linux users will probably be executing the script as su.

Problem using codacy-coverage-reporter with travis

From today I have a problem with using codacy-coverage-reporter with travis. When it tries to install the reporter
sudo jpm install com.codacy:codacy-coverage-reporter:assembly
it fails with error
Error
0. [URLClient.send] http://repo.jpm4j.org/jsonrpc/2.0/jpm
It worked few month before without any problems but from today it fails. I also tried to execute that jpm install locally on my computer - fails for me with the same error. Maybe jpm4j is down.

Example build: https://travis-ci.org/zalando/nakadi/builds/111450149

No asset attached to latest release

We have a script which pulls the latest codacy plugin as part of a cicd flow. This uses the latest release, pulling it from your github release. The latest release has no attached jar file so our CICD flow breaks.

Expected Behavior

https://github.com/codacy/codacy-coverage-reporter/releases/tag/4.0.3 has a downloadable asset.

https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest has a browser_download_url in the assets array field.

Actual Behavior

https://github.com/codacy/codacy-coverage-reporter/releases/tag/4.0.3 has no asset attached, as similar releases do.

Better error log message

Scala Version (2.10.x / etc)

N/A

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

Ubuntu 16.04

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

1.8.0_131

Library Dependencies

N/A

Actual Behavior

I'm getting the error message:

com.codacy Failed to upload report: not found

Expected Behavior

This error message could be improved in several ways. Firstly, I'm not 100% sure whether "not found" is referring to the JaCoCo report file, my Codacy account, a 404 http response in trying to find the Codacy upload endpoint, etc..

As far as I can tell, I've pointed it at a valid file that exists. If it said something like "file not found at /user/abc/project/target/report/jacoco.xml" then I'd have a better idea whether the tool is somehow looking at the wrong path. I've run ls in my Travis build and it seems to indicate the file is present

$ ls aggregate/target/site/jacoco-aggregate/jacoco.xml
aggregate/target/site/jacoco-aggregate/jacoco.xml

Reproducible Test Case

I have setup Codacy for https://github.com/jtablesaw/tablesaw

You can see the com.codacy Failed to upload report: not found message on recent Travis builds such as https://travis-ci.org/jtablesaw/tablesaw/builds/272714268?utm_source=github_status&utm_medium=notification

unrecognized report format for golang cover report

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

Linux a0e5ba9dfaea 4.4.0-144-generic #170~14.04.1-Ubuntu SMP Mon Mar 18 15:02:05 UTC 2019 x86_64 GNU/Linux

Expected Behavior

  1. codacy-coverage-reporter parses report and uploads to codacy

Actual Behavior

  1. codacy-coverage-reporter errors with ERROR com.codacy.CodacyCoverageReporter$ - Could not parse report, unrecognized report format (tried: Cobertura, Jacoco)

Reproducible Test Case

go test -p 1 -coverprofile=coverage.out -race ./...
codacy-coverage-reporter report -l Go -r coverage.out

Question: Aggregated coverage for maven multi module project

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

Linux 4.14.33-51.34.amzn1.x86_64 #1 x86_64 GNU/Linux

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

Oracle 10.0.1

Expected Behavior

Aggregated coverage report for multi module project is uploaded

Actual Behavior

I think I'm only seeing the coverage report of the very last module that runs in the build. Is there a specific JaCoCo file I should upload in the case of a multi module project (as opposed to the jacoco file of each module).

Travis CI command fails due to jq filter issue

Ubuntu 16.04 ; jq-1.5-1-a5b5cbe

Expected Behavior

  1. run wget -O ~/codacy-coverage-reporter-assembly-latest.jar $(curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r .assets[0].browser_download_url) (from https://github.com/codacy/codacy-coverage-reporter#travis-ci)
  2. binery URI is correctly fetched and parsed (and later downloaded).

Actual Behavior

https://travis-ci.org/iotaledger/iri/jobs/441689304#L1874

test $TRAVIS_PULL_REQUEST = "false" && test $TRAVIS_JDK_VERSION = "oraclejdk8" && wget -O codacy-coverage-reporter-assembly-latest.jar $(curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r .assets[0].browser_download_url)
--2018-10-15 14:32:11--  http://null/

this is due to bad jq parsing:
working command:

test $TRAVIS_PULL_REQUEST = "false" && test $TRAVIS_JDK_VERSION = "oraclejdk8" && wget -O codacy-coverage-reporter-assembly-latest.jar $(curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets[0].browser_download_url')

(notice the '...')

Reproducible Test Case

test the two commands:

curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r .assets[0].browser_download_url

vs.

curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets[0].browser_download_url'

outputs:

➜  ~ curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r .assets[0].browser_download_url
zsh: no matches found: .assets[0].browser_download_url
(23) Failed writing body
➜  ~ curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets[0].browser_download_url'
https://github.com/codacy/codacy-coverage-reporter/releases/download/4.0.3/codacy-coverage-reporter-4.0.3-assembly.jar

Unable to upload report due to conversion error from XML report to JSON

Scala Version (2.10.x / etc)

None

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

MacOS 10.12.6

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

1.8.0_72, vendor: Oracle Corporation

Expected Behavior

mvn com.gavinmogan:codacy-maven-plugin:coverage -DcoverageReportFile=target/site/jacoco/jacoco.xml -DprojectToken=myProjectToken -DapiToken=myApiToken

Should upload my codacy report

Actual Behavior

Failed to execute goal com.gavinmogan:codacy-maven-plugin:1.0.3:coverage (default-cli) on project service-discovery-server: Execution default-cli of goal com.gavinmogan:codacy-maven-plugin:1.0.3:coverage failed: null -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.gavinmogan:codacy-maven-plugin:1.0.3:coverage (default-cli) on project service-discovery-server: Execution default-cli of goal com.gavinmogan:codacy-maven-plugin:1.0.3:coverage failed: null
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal com.gavinmogan:codacy-maven-plugin:1.0.3:coverage failed: null
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	... 19 more
Caused by: scala.MatchError: null
	at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:253)
	at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:251)
	at scala.PartialFunction$Unlifted.applyOrElse(PartialFunction.scala:233)
	at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
	at play.api.libs.functional.FunctionalBuilder$CanBuild3$$anonfun$apply$8.apply(Products.scala:76)
	at play.api.libs.functional.FunctionalBuilder$CanBuild3$$anonfun$apply$8.apply(Products.scala:76)
	at play.api.libs.json.OFormat$$anon$5$$anonfun$inmap$2.apply(Format.scala:32)
	at play.api.libs.json.OFormat$$anon$5$$anonfun$inmap$2.apply(Format.scala:32)
	at play.api.libs.json.OFormat$$anon$1.writes(Format.scala:42)
	at play.api.libs.json.OFormat$$anon$1.writes(Format.scala:38)
	at play.api.libs.json.Json$.toJson(Json.scala:108)
	at play.api.libs.json.Json.toJson(Json.scala)
	at com.gavinmogan.CodacyCoverageReporterMojo.postReport(CodacyCoverageReporterMojo.java:147)
	at com.gavinmogan.CodacyCoverageReporterMojo.execute(CodacyCoverageReporterMojo.java:130)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
	... 20 more

Report fails with message "[error] com.codacy no parser for Java"

Currently, installation of jpm is failing due to some certificate problem:

$curl https://www.jpm4j.org/install/script | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (77) error setting certificate verify locations:
  CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none

After managing to install jpm manually and after installing the package com.codacy:codacy-coverage-reporter:assembly, the reporter is failing with the following message:

$ codacy-coverage-reporter -l Java -r coverage.xml
2016-05-27 17:27:57,669 [info]  com.codacy Parsing coverage data... 
2016-05-27 17:27:57,689 [error] com.codacy no parser for Java

Using plugin with gradle

Just wanted this code to be added to readme.md. It will be very helpful for others

configurations { codacy }
repositories {
    maven { url "https://jitpack.io" }
    maven { url "http://dl.bintray.com/typesafe/maven-releases" }
}
dependencies {
    codacy 'com.github.codacy:codacy-coverage-reporter:-SNAPSHOT'
}
task sendCoverageToCodacy(type: JavaExec, dependsOn: jacocoTestReport) {
    main = "com.codacy.CodacyCoverageReporter"
    classpath = configurations.codacy
    args = [
            "-l",
            "Java",
            "-r",
            "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
    ]
}

It is impossible to use jpm to install codacy-coverage-reporter

According to Codacy documentation, Codacy needs to be installed using jpm by the following command.
jpm install com.codacy:codacy-coverage-reporter:assembly

However, when I run it, here is the output I get:
Error 0. [URLClient.send] http://repo.jpm4j.org/jsonrpc/2.0/jpm

If I run jpm in debug mode, here is the output I get:

# Using settings file: ~/.jpm/settings.json
# global or in settings
# home=/Library/Java/PackageManager, bin=/usr/local/bin
# home=/Library/Java/PackageManager, bin=/usr/local/bin
# install com.codacy:codacy-coverage-reporter:assembly
# coordinate com.codacy:codacy-coverage-reporter:assembly
# -> {jsonrpc:"2.0",method:"getRevisionByCoordinate",params:["com.codacy:codacy-coverage-reporter:assembly"],id:1492357168028}
# Sentx 
# <- http://repo.jpm4j.org/jsonrpc/2.0/jpm
# ERROR: [URLClient.send] http://repo.jpm4j.org/jsonrpc/2.0/jpm
java.lang.Exception: http://repo.jpm4j.org/jsonrpc/2.0/jpm
	at aQute.rest.urlclient.URLClient.send(URLClient.java:162)
	at aQute.rest.urlclient.URLClient.put(URLClient.java:179)
	at aQute.jsonrpc.proxy.JSONRPCProxy.invokeSync(JSONRPCProxy.java:91)
	at aQute.jsonrpc.proxy.JSONRPCProxy.invoke(JSONRPCProxy.java:63)
	at com.sun.proxy.$Proxy5.getRevisionByCoordinate(Unknown Source)
	at aQute.jpm.lib.JustAnotherPackageManager.getCandidateAsync(JustAnotherPackageManager.java:942)
	at aQute.jpm.lib.JustAnotherPackageManager.getCandidate(JustAnotherPackageManager.java:903)
	at aQute.jpm.main.Main._install(Main.java:472)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at aQute.lib.getopt.CommandLine.execute(CommandLine.java:149)
	at aQute.jpm.main.Main._jpm(Main.java:366)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at aQute.lib.getopt.CommandLine.execute(CommandLine.java:149)
	at aQute.jpm.main.Main.run(Main.java:797)
	at aQute.jpm.main.Main.main(Main.java:118)
Caused by: java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:209)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:704)
	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:675)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1535)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
	at aQute.rest.urlclient.URLClient.send(URLClient.java:118)
	... 20 more
Error
  0. [URLClient.send] http://repo.jpm4j.org/jsonrpc/2.0/jpm

Of course this is clearly a jpm issue, not codacy, but since jpm is the only documented way to install codacy coverage reporter (according to its documentation), this issue makes it impossible to have it installed. By the way, I need it in a CI job.

What do you have to say in this case?
Any alternative way to install codacy-coverage-reporter?

Thanks.

Exception in thread "main" java.lang.ArithmeticException: / by zero

I receive this exception when I run the jar to upload my coverage report. I would provide the jacoco xml file, but it is for a private repository. Let me know if you need it and we can work something out.

2017-05-05 22:12:15,479 [info]  com.codacy Parsing coverage data...
Exception in thread "main" java.lang.ArithmeticException: / by zero
        at com.codacy.parsers.implementation.JacocoParser.com$codacy$parsers$implementation$JacocoParser$$lineCoverage(JacocoParser.scala:47)
        at com.codacy.parsers.implementation.JacocoParser$$anonfun$5$$anonfun$apply$1.apply(JacocoParser.scala:32)
        at com.codacy.parsers.implementation.JacocoParser$$anonfun$5$$anonfun$apply$1.apply(JacocoParser.scala:30)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.Iterator$class.foreach(Iterator.scala:742)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1194)
        at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.AbstractTraversable.map(Traversable.scala:104)
        at com.codacy.parsers.implementation.JacocoParser$$anonfun$5.apply(JacocoParser.scala:29)
        at com.codacy.parsers.implementation.JacocoParser$$anonfun$5.apply(JacocoParser.scala:27)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:252)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:252)
        at scala.collection.Iterator$class.foreach(Iterator.scala:742)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1194)
        at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
        at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:252)
        at scala.collection.AbstractTraversable.flatMap(Traversable.scala:104)
        at com.codacy.parsers.implementation.JacocoParser.generateReport(JacocoParser.scala:26)
        at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:35)
        at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:34)
        at scala.Option.map(Option.scala:146)
        at com.codacy.parsers.CoverageParserFactory$.withCoverageReport(CoverageParser.scala:33)
        at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1.apply(CodacyCoverageReporter.scala:123)
        at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1.apply(CodacyCoverageReporter.scala:117)
        at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1$$anonfun$apply$2.apply(FileHelper.scala:19)
        at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1$$anonfun$apply$2.apply(FileHelper.scala:17)
        at scala.Option.map(Option.scala:146)
        at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1.apply(FileHelper.scala:17)
        at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1.apply(FileHelper.scala:16)
        at com.codacy.api.helpers.FileHelper$$anonfun$withCommit$2.apply(FileHelper.scala:32)
        at com.codacy.api.helpers.FileHelper$$anonfun$withCommit$2.apply(FileHelper.scala:31)
        at scala.Option.map(Option.scala:146)
        at com.codacy.api.helpers.FileHelper$.withCommit(FileHelper.scala:31)
        at com.codacy.api.helpers.FileHelper$.withTokenAndCommit(FileHelper.scala:16)
        at com.codacy.CodacyCoverageReporter$.coverageWithTokenAndCommit(CodacyCoverageReporter.scala:117)
        at com.codacy.CodacyCoverageReporter$.codacyCoverage(CodacyCoverageReporter.scala:149)
        at com.codacy.CodacyCoverageReporter$.main(CodacyCoverageReporter.scala:80)
        at com.codacy.CodacyCoverageReporter.main(CodacyCoverageReporter.scala)

Here's my system info

Codacy jar: codacy-coverage-reporter-1.0.13-assembly.jar
Java version: 1.7.0_80, vendor: Oracle Corporation
OS name: "mac os x", version: "10.12.4", arch: "x86_64", family: "mac"

JPM install fails

Not sure whether this is something you can/need to fix or if it's on JPM's side, however...

All my projects suddenly fail to report, like this one, because jpm install throws an error:

$ curl -sL https://github.com/jpm4j/jpm4j.installers/raw/master/dist/biz.aQute.jpm.run.jar >jpm4j.jar
before_install.3
$ java -jar jpm4j.jar -u init
Home dir      /home/travis/jpm
Bin  dir      /home/travis/jpm/bin
$ ~/jpm/bin/jpm install com.codacy:codacy-coverage-reporter:assembly
Error
  0. [URLClient.send] http://repo.jpm4j.org/jsonrpc/2.0/jpm

[Java] Fail to parse Jacoco report

Are you looking for help?

Yes

Scala Version

Scala code runner version 2.11.5 -- Copyright 2002-2013, LAMP/EPFL

Operating System

macOS 10.12.4

Darwin <user> 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

JDK

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

codacy-coverage-reporter-assembly.jar

2.0.0

Expected Behavior

  1. Set the commitUID and projectToken before running the reporter
  2. Run java -cp codacy-coverage-reporter-assembly.jar com.codacy.CodacyCoverageReporter --debug -l Java -r ./test-output/site/jacoco/report.xml
  3. Get the result in codacy-coverage.json

FYI: ./test-output/site/jacoco/report.xml

Actual Behavior

codacy-coverage.json

{"total":0,"fileReports":[]}

DEBUG log

16:26:08,335 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback-test.xml] at [jar:file:/Users/gaoce/Projects/GitHub/Processing.R/scripts/codacy-coverage-reporter-assembly.jar!/logback-test.xml]
16:26:08,351 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@13b6d03 - URL [jar:file:/Users/gaoce/Projects/GitHub/Processing.R/scripts/codacy-coverage-reporter-assembly.jar!/logback-test.xml] is not of type file
16:26:08,396 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
16:26:08,396 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
16:26:08,402 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
16:26:08,409 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
16:26:08,436 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@f5f2bb7 - There is no conversion class registered for conversion word [coloredLevel]
16:26:08,436 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@f5f2bb7 - [coloredLevel] is not a valid conversion word
16:26:08,464 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [play] to INFO
16:26:08,464 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [application] to DEBUG
16:26:08,464 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
16:26:08,464 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
16:26:08,464 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
16:26:08,465 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@73035e27 - Registering current configuration as safe fallback point

2017-06-04 16:26:08,741 %PARSER_ERROR[coloredLevel] com.codacy Config(Java,false, <mock>,./test-output/site/jacoco/report.xml,https://api.codacy.com,,true,Some(651cf1223cda083573e741ad582b12e323e1f5aa))
2017-06-04 16:26:08,795 %PARSER_ERROR[coloredLevel] com.codacy Project token:<mock>
2017-06-04 16:26:08,795 %PARSER_ERROR[coloredLevel] com.codacy Parsing coverage data...
2017-06-04 16:26:09,052 %PARSER_ERROR[coloredLevel] com.codacy Saving parsed report to /Users/gaoce/Projects/GitHub/Processing.R/./test-output/site/jacoco/codacy-coverage.json
2017-06-04 16:26:09,052 %PARSER_ERROR[coloredLevel] com.codacy CoverageReport(0,List())
2017-06-04 16:26:09,218 %PARSER_ERROR[coloredLevel] com.codacy Uploading coverage data...
2017-06-04 16:26:11,667 %PARSER_ERROR[coloredLevel] com.codacy Coverage data uploaded. RequestSuccess(Coverage received successfully.)

Reproducible Test Case

https://github.com/gaocegege/Processing.R

You could get my report in xml format here: https://pastebin.com/86b40S0L

Support for AWS CodeBuild (from CodePipeline)

Are you looking for help?

I would love for AWS CodeBuild environment variables related to CI commit hash be picked up. The relevant variable here is CODEBUILD_RESOLVED_SOURCE_VERSION. The fact that there is no git directory here is a known bug documented at https://forums.aws.amazon.com/thread.jspa?threadID=244197.

Scala Version (2.10.x / etc)

n/a

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

n/a

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

n/a

Library Dependencies

AWS CodeBuild

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. AWS CodeBuild runs a build triggered by CodePipeline
  2. The CodacyCoverageReporter class detects the correct env variable
  3. Do not need to use "--commitUUID" flag

Actual Behavior

Environment variable is not currently picked up, upload to Codacy fails in the pipeline.

Reproducible Test Case

I have a private repo I am testing this on.

6.0.1 - Could not find or load main class com.codacy.CodacyCoverageReporter

Using the following line to run codacy and upload coverage reports

curl -Ls -o codacy-coverage-reporter "$(curl -Ls https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets | map({name, browser_download_url} | select(.name | contains("codacy-coverage-reporter-linux"))) | .[0].browser_download_url')"
chmod +x codacy-coverage-reporter
./codacy-coverage-reporter report -l Java -r build/reports/jacoco/test/jacocoTestReport.xml

It gives me an error with the latest version 6.0.1

Error: Could not find or load main class com.codacy.CodacyCoverageReporter
Caused by: java.lang.ClassNotFoundException: com.codacy.CodacyCoverageReporter
Exited with code 1

If I pin it back to 6.0.0, it works without issue.

Reporting CodeCoverage with Circle CI

I am getting the following error when I am trying to report codacy code coverage feature language is java

sudo codacy-coverage-reporter -l Java -r /home/ubuntu/lcd/api/target/surefire-reports/cobertura/coverage.xml -t $CODACY_PROJECT_TOKEN
2015-11-20 04:06:58,887 [info]  com.codacy Parsing coverage data... 
2015-11-20 04:06:59,506 [info]  com.codacy Uploading coverage data... 

2015-11-20 04:07:00,639 [error] com.codacy Failed to upload report: Not Found sudo codacy-coverage-reporter -l Java -r /home/ubuntu/lcd/api/target/surefire-reports/cobertura/coverage.xml -t $CODACY_PROJECT_TOKEN returned exit code 1

Java 10 Support

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

Linux 4.14.33-51.34.amzn1.x86_64 #1 x86_64 GNU/Linux

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

Oracle 10.0.1

Expected Behavior

Coverage is uploaded.

Actual Behavior

Error

+ java -jar /var/lib/jenkins/codacy-coverage-upload.jar report -l Java -r target/site/jacoco/jacoco.xml --project-token ****
05/17 12:19:03 �[34mINFO �[0;39m �[36mc.c.rules.ConfigurationRules:101�[0;39m - Using API base URL: https://api.codacy.com 
05/17 12:19:04 �[34mINFO �[0;39m �[36mcom.codacy.rules.ReportRules:126�[0;39m - Commit UUID not provided, using latest commit of current directory:
51c7627635fd1a206497fdcd9ce0a1b6a9f98a4a Thu May 17 12:18:18 UTC 2018 
05/17 12:19:04 �[34mINFO �[0;39m �[36mcom.codacy.rules.ReportRules:48�[0;39m - Parsing coverage data from: /var/lib/jenkins/workspace/develop/target/site/jacoco/jacoco.xml ... 
05/17 12:19:04 �[34mINFO �[0;39m �[36mcom.codacy.rules.ReportRules:81�[0;39m - Generated report: /var/lib/jenkins/workspace/develop-TWQKWG6PRI3VSESCKN2SUW6A3XK226GXMW4GBFX5WTAVCECU3GRA/target/site/jacoco/codacy-coverage.json (0.15 kB) 
05/17 12:19:04 �[34mINFO �[0;39m �[36mcom.codacy.rules.ReportRules:82�[0;39m - Uploading coverage data... 
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/MimetypesFileTypeMap
	at rapture.mime.MimeTypes$.<init>(mime.scala:1544)
	at rapture.mime.MimeTypes$.<clinit>(mime.scala)
	at rapture.net.PostType$$anon$14.contentType(net.scala:132)
	at rapture.net.PostType$$anon$14.contentType(net.scala:131)
	at rapture.net.HttpSupport$$anon$1$$anonfun$doHttp$1.apply(http.scala:159)
	at rapture.net.HttpSupport$$anon$1$$anonfun$doHttp$1.apply(http.scala:131)
	at rapture.core.ThrowExceptionsMode.wrap(modes.scala:199)
	at rapture.net.HttpSupport$$anon$1.doHttp(http.scala:131)
	at rapture.net.HttpSupport$Capability$$anonfun$httpPost$1.apply(http.scala:78)
	at rapture.net.HttpSupport$Capability$$anonfun$httpPost$1.apply(http.scala:78)
	at rapture.core.ThrowExceptionsMode.wrap(modes.scala:199)
	at rapture.net.HttpSupport$Capability.httpPost(http.scala:78)
	at com.codacy.api.client.CodacyClient.post(CodacyClient.scala:59)
	at com.codacy.api.service.CoverageServices.sendReport(CoverageServices.scala:21)
	at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1$$anonfun$apply$2.apply(ReportRules.scala:65)
	at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1$$anonfun$apply$2.apply(ReportRules.scala:50)
	at com.codacy.rules.ReportRules.com$codacy$rules$ReportRules$$transform(ReportRules.scala:99)
	at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1.apply(ReportRules.scala:50)
	at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1.apply(ReportRules.scala:50)
	at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:42)
	at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:40)
	at scala.Option.map(Option.scala:146)
	at com.codacy.parsers.CoverageParserFactory$.withCoverageReport(CoverageParser.scala:39)
	at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1.apply(ReportRules.scala:50)
	at com.codacy.rules.ReportRules$$anonfun$coverageWithTokenAndCommit$1.apply(ReportRules.scala:45)
	at cats.syntax.EitherOps$.flatMap$extension(either.scala:148)
	at com.codacy.rules.ReportRules.withCommitUUID(ReportRules.scala:131)
	at com.codacy.rules.ReportRules.coverageWithTokenAndCommit(ReportRules.scala:45)
	at com.codacy.rules.ReportRules.codacyCoverage(ReportRules.scala:35)
	at com.codacy.CodacyCoverageReporter$.run(CodacyCoverageReporter.scala:21)
	at com.codacy.configuration.parser.ConfigurationParsingApp.run(ConfigurationParser.scala:13)
	at com.codacy.configuration.parser.ConfigurationParsingApp.run(ConfigurationParser.scala:11)
	at caseapp.CommandAppWithPreCommand$$anonfun$main$1.apply(CommandAppWithPreCommand.scala:97)
	at caseapp.CommandAppWithPreCommand$$anonfun$main$1.apply(CommandAppWithPreCommand.scala:82)
	at scala.Option.foreach(Option.scala:257)
	at caseapp.CommandAppWithPreCommand.main(CommandAppWithPreCommand.scala:82)
	at com.codacy.CodacyCoverageReporter.main(CodacyCoverageReporter.scala)
Caused by: java.lang.ClassNotFoundException: javax.activation.MimetypesFileTypeMap
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
	... 37 more

Parser Error but Coverage received successfully

After running

java -cp ~/Downloads/codacy-coverage-reporter-2.0.2-assembly.jar com.codacy.CodacyCoverageReporter -l Java -r ./app/build/reports/coverage/debug/report.xml

The log result is
.
.
.

2018-02-07 11:32:06,355 %PARSER_ERROR[coloredLevel] com.codacy Parsing coverage data...
2018-02-07 11:32:06,641 %PARSER_ERROR[coloredLevel] com.codacy Uploading coverage data...
2018-02-07 11:32:08,649 %PARSER_ERROR[coloredLevel] com.codacy Coverage data uploaded. RequestSuccess(Coverage received successfully.)

Which is not clear, if error how is it received successfully?

Error with the gradle task

Setup

MacOS 10.10

JDK OpenJDK 1.8.0_152

Gradle 4.4

Library Dependencies

Jacoco

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. Use the gradle task to send coverage

Actual Behavior

Got an error, seems like the link for the dependency does not provide the codacy plugin so it's trying the other one. Did you move something since the date of the solution? Is there a new dependency link I should use?

> Task :sendCoverageToCodacy FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sendCoverageToCodacy'.
> Could not resolve all files for configuration ':codacy'.
   > Could not resolve com.github.codacy:codacy-coverage-reporter:4.0.1.
     Required by:
         project :
      > Skipped due to earlier error
      > Could not resolve com.github.codacy:codacy-coverage-reporter:4.0.1.
         > Could not get resource 'https://jitpack.io/com/github/codacy/codacy-coverage-reporter/4.0.1/codacy-coverage-reporter-4.0.1.pom'.
            > Could not GET 'https://jitpack.io/com/github/codacy/codacy-coverage-reporter/4.0.1/codacy-coverage-reporter-4.0.1.pom'.
               > Connect to 172.25.175.88:80 [/172.25.175.88] failed: connect timed out

Reproducible Test Case

Try the gradle task from #39.
The other one is even worse and fail from the start.

Thanks

Connectivity issues on Travis CI: "failed and exited with 6"

No sure who is to blame, but I just want to make sure you know: the provided snippet for Travis CI causes random build failures like this:

curl: (6) Could not resolve host: null
The command "curl -sSL --retry 3 -o ~/codacy-coverage-reporter.jar $(curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r .assets[0].browser_download_url)" failed and exited with 6 during .

It seems that curl was not able to download the jar from GitHub, so there might be a connectivity problem. Maybe it'd be better to host the jar somewhere else or reach out to the Travis CI team to find out what's going on...

The provided coverage report generated an empty result

I have generated test coverage (Cobertura, C#)

I execute the command in powershell
java -jar $reporterTool report -l CSharp -r "$testFile" -t $token

The response is :
11/02 10:00:11 ?[34mINFO ?[0;39m ?[36mcom.codacy.rules.ReportRules:48?[0;39m - Parsing coverage data from: C:\Users\user\source\repos\test\test-results\Tests.xml ...
11/02 10:00:14 ?[1;31mERROR?[0;39m ?[36mc.c.CodacyCoverageReporter$:28?[0;39m - The provided coverage report generated an empty result

Send reports from many origins

Hello, is there a way to send partial reports from diferent origins? look at the examples:
On host 1:
codacy-coverage-reporter report -l Java -r report1.xml --partial
On host 2:
codacy-coverage-reporter report -l Java -r report2.xml --partial

codacy-coverage-reporter prints wrong version

When running with --help flag, it prints

codacy-coverage-reporter 1.0.0
Usage: codacy-coverage-reporter [options]

  -l <value> | --language <value>
        foo is an integer property
  -t <value> | --projectToken <value>
        your project API token
  -r <value> | --coverageReport <value>
        your project API token
  --codacyApiBaseUrl <value>
        the base URL for the Codacy API
  --prefix <value>
        the project path prefix
  --help
        prints this usage text

When the actual version is 1.0.4
This version should be fetched from the pom or something. This way you have to manually change in every release

https://github.com/codacy/codacy-coverage-reporter/blob/master/src/main/scala/com/codacy/CodacyCoverageReporter.scala#L65

Unknown argument

I'm trying to run the report like this:

codacy-coverage-reporter -l Java -r target/surefire-reports/*.xml

The output I'm getting is:

Error: Unknown argument 'target/surefire-reports/TEST-com.carsaver.adf.ValidatorTest.xml'
Error: Unknown argument 'target/surefire-reports/TEST-com.carsaver.adf.exception.ValidatorExceptionTest.xml'

Am I doing something wrong? JaCoCo produces multiple XML files.

Issue with setting up coverage with CircleCI

We are trying to set up codacy with CircleCI and are running into issues because CircleCI does not advise turning on the setting "pass-secrets-to-builds-from-forked-pull-requests" (https://circleci.com/docs/2.0/oss/#pass-secrets-to-builds-from-forked-pull-requests). This setting is necessary to be enabled else the env variable 'CODACY_PROJECT_TOKEN' won't be accessible in the commits and PRs.

So, is it advisable to turn on the above setting and if not, is there any other way the env variable (CODACY_PROJECT_TOKEN) can be accessed?

No parser for Java.

When I run the coverage reporter, I get:

export CODACY_PROJECT_TOKEN="<redacted>"; codacy-coverage-reporter -l Java -r coverage.xml
> 2016-08-05 19:00:09,319 [info]  com.codacy Parsing coverage data... 
> 2016-08-05 19:00:09,339 [error] com.codacy no parser for Java

This is after following the install method listed in the README.

NoSuchMethodError running codacy gradle task

Description

When following the instructions to add codacy coverage support as described in https://github.com/codacy/codacy-coverage-reporter#setup a NoSuchMethodError exception occurs while running the codacy gradle task related to the netty-http-pipelining library used by the coverage plugin:

:graphql-consumer:uploadCoverageToCodacy
2016-07-22 12:16:45,767 [info]  com.codacy Parsing coverage data... 
2016-07-22 12:16:46,072 [info]  com.codacy Uploading coverage data... 
Exception in thread "main" java.lang.NoSuchMethodError: org.jboss.netty.handler.codec.http.HttpRequest.setHeader(Ljava/lang/String;Ljava/lang/Object;)V
        at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.construct(NettyAsyncHttpProvider.java:704)
        at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.buildRequest(NettyAsyncHttpProvider.java:657)
        at com.ning.http.client.providers.netty.NettyConnectListener$Builder.build(NettyConnectListener.java:145)
        at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.doConnect(NettyAsyncHttpProvider.java:1071)
        at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:940)
        at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:499)
        at play.api.libs.ws.ning.NingWSClient.executeRequest(NingWS.scala:42)
        at play.api.libs.ws.ning.NingWSRequest.execute(NingWS.scala:246)
        at play.api.libs.ws.ning.NingWSRequestHolder.execute(NingWS.scala:405)
        at play.api.libs.ws.WSRequestHolder$class.post(WS.scala:532)
        at play.api.libs.ws.ning.NingWSRequestHolder.post(NingWS.scala:361)
        at com.codacy.api.client.CodacyClient$$anonfun$post$1.apply(CodacyClient.scala:59)
        at com.codacy.api.client.CodacyClient$$anonfun$post$1.apply(CodacyClient.scala:53)
        at com.codacy.api.client.CodacyClient.withWSClient(CodacyClient.scala:108)
        at com.codacy.api.client.CodacyClient.post(CodacyClient.scala:53)
        at com.codacy.api.service.CoverageServices.sendReport(CoverageServices.scala:14)
        at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1$$anonfun$apply$2.apply(CodacyCoverageReporter.scala:111)
        at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1$$anonfun$apply$2.apply(CodacyCoverageReporter.scala:98)
        at com.codacy.CodacyCoverageReporter$.com$codacy$CodacyCoverageReporter$$transform(CodacyCoverageReporter.scala:138)
        at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1.apply(CodacyCoverageReporter.scala:97)
        at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1$$anonfun$apply$1.apply(CodacyCoverageReporter.scala:97)
        at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:36)
        at com.codacy.parsers.CoverageParserFactory$$anonfun$withCoverageReport$1.apply(CoverageParser.scala:34)
        at scala.Option.map(Option.scala:146)
        at com.codacy.parsers.CoverageParserFactory$.withCoverageReport(CoverageParser.scala:33)
        at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1.apply(CodacyCoverageReporter.scala:97)
        at com.codacy.CodacyCoverageReporter$$anonfun$coverageWithTokenAndCommit$1.apply(CodacyCoverageReporter.scala:89)
        at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1$$anonfun$apply$2.apply(FileHelper.scala:19)
        at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1$$anonfun$apply$2.apply(FileHelper.scala:17)
        at scala.Option.map(Option.scala:146)
        at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1.apply(FileHelper.scala:17)
        at com.codacy.api.helpers.FileHelper$$anonfun$withTokenAndCommit$1.apply(FileHelper.scala:16)
        at com.codacy.api.helpers.FileHelper$$anonfun$withCommit$2.apply(FileHelper.scala:32)
        at com.codacy.api.helpers.FileHelper$$anonfun$withCommit$2.apply(FileHelper.scala:31)
        at scala.Option.map(Option.scala:146)
        at com.codacy.api.helpers.FileHelper$.withCommit(FileHelper.scala:31)
        at com.codacy.api.helpers.FileHelper$.withTokenAndCommit(FileHelper.scala:16)
        at com.codacy.CodacyCoverageReporter$.coverageWithTokenAndCommit(CodacyCoverageReporter.scala:89)
        at com.codacy.CodacyCoverageReporter$.codacyCoverage(CodacyCoverageReporter.scala:122)
        at com.codacy.CodacyCoverageReporter$.main(CodacyCoverageReporter.scala:55)
        at com.codacy.CodacyCoverageReporter.main(CodacyCoverageReporter.scala)
> Building 67% > :graphql-consumer:uploadCoverageToCodacy

See also: engagingspaces/vertx-graphql-service-discovery#1

Reproducer:

Checkout the code in branch https://github.com/engagingspaces/vertx-graphql-service-discovery/tree/issue-1/codacy-code-coverage and perform a gradle clean build uploadCoverageToCodacy.

--partial flag id beign ignored

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment (build 12.0.2+10)
OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. I provide several jacoco.xml files with the --partial flag
  2. I provide a final jacoco.xml file with a final parameter at the end
  3. Code coverage should be summed up and displayed in codacy portal

Actual Behavior

As previously detected in #88, maven multi module with jacoco shows only the code coverage from the last added module, the one with the "final".

Reproducible Test Case

That's my current travis config:

language: java
cache:
  directories:
    - $HOME/.m2

services:
  - xvfb

before_install:
  - sudo apt-get install jq
  - wget -O ~/codacy-coverage-reporter-assembly-latest.jar $(curl https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r .assets[0].browser_download_url)

after_success:
  - mvn clean verify jacoco:report coveralls:report -B
  - ls target/site/
  - ls inventarios-service/target/
  - ls inventarios-desktop-testing-api/target/
  - java -jar ~/codacy-coverage-reporter-assembly-latest.jar report -l Java -r inventarios-service/target/site/jacoco/jacoco.xml --partial
  - java -jar ~/codacy-coverage-reporter-assembly-latest.jar report -l Java -r inventarios-restservice/target/site/jacoco/jacoco.xml --partial
  - java -jar ~/codacy-coverage-reporter-assembly-latest.jar report -l Java -r inventarios-desktop/target/site/jacoco/jacoco.xml --partial
  - java -jar ~/codacy-coverage-reporter-assembly-latest.jar report -l Java -r inventarios-desktop-testing-api/target/site/jacoco/jacoco.xml final

jdk:
  - openjdk12

You can check the project at https://github.com/javatlacati/Inventarios and my latest comit was 072b790eb13d09932b397169ccd9a96dc2fe2922

Integrate Java and Python Coverage Report

Hello,
I have a project that part is writed in python and the other part is write in java.
I can generate the coverage.xml of these two parts separatly.
My questions is, how can i integrate these two coverage in codacy.
thanks in advance.
best regards,
André Luiz

Invalid markup format on README

There are numerous places on the README where ** is present. I'm guessing that you wrote the README using a different flavor of markup syntax?

Throws STDOUT warning on AppVeyor and WIndows 10 64

Scala Version (2.10.x / etc)

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

Windows 10 x64

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

Library Dependencies

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.

Expected Behavior

  1. Generating a report should not throw warnings or errors
  2. java -jar codacy-coverage-reporter-4.0.5-assembly.jar final --project-token "TOKEN" --commit-uuid "COMMITID"

Actual Behavior

Exception thrown when generating report:

java -jar codacy-coverage-reporter-4.0.5-assembly.jar final --project-token "TOKEN" --commit-uuid "COMMITID"

...
22:35:38,345 |-INFO in ch.qos.logback.core.ConsoleAppender[STDOUT] - Enabling JANSI WindowsAnsiOutputStream for the console.
22:35:38,345 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - Failed to create WindowsAnsiOutputStream. Falling back on the default stream. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type org.fusesource.jansi.WindowsAnsiOutputStream
	at ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type org.fusesource.jansi.WindowsAnsiOutputStream
	at 	at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:69)
	at 	at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:40)
	at 	at ch.qos.logback.core.ConsoleAppender.getTargetStreamForWindows(ConsoleAppender.java:88)
	at 	at ch.qos.logback.core.ConsoleAppender.start(ConsoleAppender.java:79)
	at 	at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:90)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:309)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:193)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:179)
	at 	at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:165)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
	at 	at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
	at 	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
	at 	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
	at 	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at 	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
	at 	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
	at 	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
	at 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
	at 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
	at 	at org.log4s.package$.getLogger(package.scala:8)
	at 	at com.codacy.helpers.LoggerHelper$.getLogger(LoggerHelper.scala:18)
	at 	at com.codacy.helpers.LoggerHelper$.logger(LoggerHelper.scala:11)
	at 	at com.codacy.rules.ConfigurationRules.<init>(ConfigurationRules.scala:16)
	at 	at com.codacy.di.Components.configRules$lzycompute(Components.scala:14)
	at 	at com.codacy.di.Components.configRules(Components.scala:14)
	at 	at com.codacy.di.Components.validatedConfig$lzycompute(Components.scala:12)
	at 	at com.codacy.di.Components.validatedConfig(Components.scala:12)
	at 	at com.codacy.CodacyCoverageReporter$.run(CodacyCoverageReporter.scala:13)
	at 	at com.codacy.configuration.parser.ConfigurationParsingApp.run(ConfigurationParser.scala:13)
	at 	at com.codacy.configuration.parser.ConfigurationParsingApp.run(ConfigurationParser.scala:11)
	at 	at caseapp.CommandAppWithPreCommand$$anonfun$main$1.apply(CommandAppWithPreCommand.scala:97)
	at 	at caseapp.CommandAppWithPreCommand$$anonfun$main$1.apply(CommandAppWithPreCommand.scala:82)
	at 	at scala.Option.foreach(Option.scala:257)
	at 	at caseapp.CommandAppWithPreCommand.main(CommandAppWithPreCommand.scala:82)
	at 	at com.codacy.CodacyCoverageReporter.main(CodacyCoverageReporter.scala)
Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.WindowsAnsiOutputStream
	at 	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at 	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
	at 	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at 	at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:56)
	at 	... 37 common frames omitted
22:35:38,346 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO

Reproducible Test Case

On Windows 10 x64:
java -jar codacy-coverage-reporter-4.0.5-assembly.jar final --project-token "TOKEN" --commit-uuid "COMMITID"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.