-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Similar to #61.
I recently ran into an issue using Codacy Coverage Reporter GitHub Action where codacy-coverage-reporter was failing with a "Can't guess the report language" error. I use Codacy on several projects and had not experienced this before. Here are the relevant parts of the log:
2022-06-25 06:19:38.548Z info [ConfigurationRules] API base URL: https://api.codacy.com/ - (ConfigurationRules.scala:79)
[32](https://github.com/jhildenbiddle/mergedeep/runs/7052111013?check_suite_focus=true#step:6:33)
2022-06-25 06:19:38.663Z info [CommitUUIDProvider] CI/CD provider GitHub Actions found Commit UUID c215d24a954cb2e7a657606c910a1598e4697b1f - (CommitUUIDProvider.scala:132)
[33](https://github.com/jhildenbiddle/mergedeep/runs/7052111013?check_suite_focus=true#step:6:34)
2022-06-25 06:19:38.663Z info [ReportRules] Parsing coverage data from: /home/runner/work/mergedeep/mergedeep/coverage/lcov.info ... - (ReportRules.scala:37)
[34](https://github.com/jhildenbiddle/mergedeep/runs/7052111013?check_suite_focus=true#step:6:35)
2022-06-25 06:19:38.668Z info [ReportRules] Coverage parser used is com.codacy.parsers.implementation.LCOVParser$@51e6bdbd - (ReportRules.scala:42)
[35](https://github.com/jhildenbiddle/mergedeep/runs/7052111013?check_suite_focus=true#step:6:36)
2022-06-25 06:19:38.669Z info [ReportRules] Generated coverage report: /tmp/codacy-coverage-11970218897261936170.json (1.53 kB) - (ReportRules.scala:255)
[36](https://github.com/jhildenbiddle/mergedeep/runs/7052111013?check_suite_focus=true#step:6:37)
2022-06-25 06:19:38.669Z info [ReportRules] Uploading coverage data... - (ReportRules.scala:256)
[37](https://github.com/jhildenbiddle/mergedeep/runs/7052111013?check_suite_focus=true#step:6:38)
2022-06-25 06:19:38.669Z error [CodacyCoverageReporter] Can't guess the report language - (CodacyCoverageReporter.scala:25)
I eventually realized that the difference between this project and previous projects is the use of .cjs
instead of .js
as the file extension for my source files. This was done to differentiate between CommonJS modules (.cjs
), ES modules (.mjs
), and standard Javascript files (.js
). I was able to resolve the coverage reporter issue by forcing the language to "Javascript":
- name: Report code coverage
uses: codacy/[email protected]
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/lcov.info
language: Javascript
This allowed codacy-coverage-reporter to complete without error, but none of the .cjs
files were processed by Codacy despite the coverage report containing information for them.
Looking at the source linked in the docs, it appears that at least part of the issue is the missing .cjs
association in Language.scala
:
Hopefully a small update there can resolve the issue, but I know it's rarely that easy. :)