golangci-lint-action icon indicating copy to clipboard operation
golangci-lint-action copied to clipboard

Configure output for sonar

Open gessnerfl opened this issue 2 years ago • 5 comments

I try to configure golangci-lint-action to provide output in checkstyle format as required by SonarCloud (https://docs.sonarqube.org/latest/analysis/external-issues/). Therefore I added the following configuration to the project:

output:
  format: github-actions,checkstyle:golangci-lint-report.json

It seems that the configuration is not working as the output format is passed as CLI parameter to the action. I tried to explicitly set the output format as args in the with configuration part of the action but this results in the error:

Error: Failed to run: Error: please, don't change out-format for golangci-lint: it can be broken in a future, Error: please, don't change out-format for golangci-lint: it can be broken in a future

I tried to configure both output formats (github action + checkstyle) to get the github annotations and in addition the checkstyle report for Sonar.

How can I adopt the output format?

gessnerfl avatar Apr 30 '22 19:04 gessnerfl

Provided PR #475 as a proposal to support additional output formats in the GH action

gessnerfl avatar May 22 '22 19:05 gessnerfl

Any ideas when this feature can be introduced @gessnerfl ?

AFMiziara avatar Jul 27 '22 17:07 AFMiziara

@AFMiziara : I'm using my fork of this action at the moment and it is working fine. I have no idea if it will be included into the official action as I also wait for a response.

gessnerfl avatar Jul 27 '22 19:07 gessnerfl

Much needed! Going to use fork for now.

buger avatar Sep 03 '22 10:09 buger

same here - would be nice if we can use the this github action in combination with the sonar github action. can we somehow help to drive this forward? maybe rebase the fork for easier merging?

MatthiasWinzeler avatar Sep 15 '22 14:09 MatthiasWinzeler

Any update on this? :)

mariamihai avatar Nov 29 '22 20:11 mariamihai

The only requirement here is to keep github-actions as format.

My suggestion is to parse the flag --out-format value to add github-actions (and clean it if needed). There is no new option for the GHA, and all supported format can be used.

ldez avatar Jun 09 '23 11:06 ldez

Judging from your requirements something like https://github.com/golangci/golangci-lint-action/compare/master...jrehwaldt:golangci-lint-action:support-out-format-args-overwrite ? I can make this a PR, refine it or you can go with #613 if that already suits your needs already.

jrehwaldt avatar Jun 09 '23 12:06 jrehwaldt

the PR https://github.com/golangci/golangci-lint-action/pull/613 will fix the problem

ldez avatar Jun 09 '23 12:06 ldez

Your branch seem better :thinking:

ldez avatar Jun 09 '23 12:06 ldez

@jrehwaldt can you open a PR?

ldez avatar Jun 09 '23 12:06 ldez

@jrehwaldt can you open a PR?

Check out #769.

jrehwaldt avatar Jun 12 '23 07:06 jrehwaldt