Golangci-lint issues missing

Hi,
I don’t want to raise new thread therefore will reuse this one if that is ok?
I have similar issue:

  • monorepo with multiple projects inside.
  • each project is setup in sonarcloud and each of them contains separate properties file
  • each sonarcloud scan is invoked on github action
  • on each github action two tasks are executed: golangci-lint and sonar scan

golangci-lint produces report of issues discovered

golangci-lint run --new-from-rev=${{ github.event.pull_request.base.sha }} --whole-files --out-format checkstyle > projectName.report.out

and pass it to sonarcloud:
Sonarcloud task detects it and imports it:

INFO: Sensor Import of GolangCI-Lint issues [go]
INFO: Importing /github/workspace/projectRepo/projectName.report.out
INFO: Sensor Import of GolangCI-Lint issues [go] (done) | time=70ms

This report contains those errors:

<?xml version="1.0" encoding="UTF-8"?>

<checkstyle version="5.0">
  <file name="internal/kubernetes/policy_recommendation_resolver.go">
    <error column="77" line="102" message="mnd: Magic number: 100, in &lt;argument&gt; detected" severity="error" source="gomnd">
    </error>
  </file>
  <file name="internal/kubernetes/policy_recommendation_resolver_test.go">
    <error column="0" line="21" message="Function &#39;TestPolicyRecommendationResolver_Resolve&#39; is too long (1199 &gt; 160)" severity="error" source="funlen">
    </error>
  </file>
  <file name="internal/kubernetes/pod_memory_recommendation_resolver.go">
    <error column="0" line="21" message="line is 189 characters" severity="error" source="lll">
    </error>
    <error column="2" line="36" message="return statements should not be cuddled if block has more than two lines" severity="error" source="wsl">
    </error>
  </file>
</checkstyle>

However on the sonarcloud PR report none of those errors appears :confused:

Any help or advise would be appreciated.

Hey @vbortkevic

I hope Sylvain was able to explain what’s going on in his comment here:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.