codacy / codacy-coverage-reporter

Multi-language coverage reporter for Codacy
https://www.codacy.com
Other
131 stars 94 forks source link

[TS-264] Glob report only uploads first file #455

Closed veimox closed 1 year ago

veimox commented 1 year ago

Issue

I am using #444 to define a glob in order to find all my reports with a one liner. The glob seems to work as expected but it only uploads the first file found with the glob.

Expected behaviour

Upload all reports found in the glob

Logs

bash <(curl -Ls https://raw.githubusercontent.com/codacy/codacy-coverage-reporter/master/get.sh) report -r coverage/**/*.{xml,info}

2023-02-24 12:59:58.016+0100  info [ConfigurationRules] API base URL: https://api.codacy.com  - (ConfigurationRules.scala:81)
2023-02-24 13:00:21.711+0100  info [CommitUUIDProvider] Can't find or validate commit SHA-1 hash from any supported CI/CD provider.  - (CommitUUIDProvider.scala:96)
2023-02-24 13:00:21.711+0100  info [CommitUUIDProvider] Trying to get commit SHA-1 hash from local Git directory  - (CommitUUIDProvider.scala:97)
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2023-02-24 13:00:21.782+0100  info [CommitUUIDProvider] 
Commit SHA-1 hash not provided, using latest commit of local Git directory: <redacted>
2023-02-24 13:00:24.335+0100  info [ReportRules] Parsing coverage data from: <redacted>/coverage/<redacted>/clover.xml ...  - (ReportRules.scala:37)
2023-02-24 13:00:24.347+0100  info [ReportRules] Coverage parser used is com.codacy.parsers.implementation.CloverParser$@1dd45077  - (ReportRules.scala:42)
2023-02-24 13:00:24.352+0100  info [ReportRules] Generated coverage report: /var/folders/vp/g3p8zm8160n76l93mmktgf11fswfs3/T/codacy-coverage-3606035632101131184.json (6.24 kB)  - (ReportRules.scala:301)
2023-02-24 13:00:24.352+0100  info [ReportRules] Uploading coverage data...  - (ReportRules.scala:302)
2023-02-24 13:00:24.724+0100  info [ReportRules] Coverage data uploaded. Coverage received successfully.  - (ReportRules.scala:177)
2023-02-24 13:00:24.724+0100  info [CodacyCoverageReporter] All coverage data uploaded.  - (CodacyCoverageReporter.scala:22)

How to reproduce

Unfortunately I cannot share the repo.

Others

We added a test case for finding the files but we did not verify that we are actually uploading all the files in sendFilesReportForCommit. I am not a Scala dev but it seems to me like we are exiting the loop as soon as we upload the first file.

github-actions[bot] commented 1 year ago

Internal ticket created : TS-264

DMarinhoCodacy commented 1 year ago

Hello @veimox

Thanks for reporting this.

Only upload the first file because you should use something like "report -r file1 -r file2 -r file3" and you're just using -r in the first file but not in the other ones. Check our documentation: https://docs.codacy.com/coverage-reporter/uploading-coverage-in-advanced-scenarios/#multiple-reports-once

Kind regards, David Marinho