gofr icon indicating copy to clipboard operation
gofr copied to clipboard

CI: enable disabled linters and remove exclusions from .golangci.yml

Open ccoVeille opened this issue 8 months ago • 3 comments

This is a follow up of the golangci-lint migration to v2 that was done with:

  • #1645
  • #1708

The migration revealed that:

  • examples folder was not linted
  • some packages have no godoc comment
  • many function has no godoc comment to explain what they do
  • embedded structs are calling the methods of embedded field, instead of the methods struct
  • some if/else chains could be updated to use switch
  • some presets are enabled

All of these are excluded in the .golangci.yml file and taggued with a TODO comment.

This issue is about removing exclusions one by one.

Please note that many of the things that need to be fixed can be done by removing the exclusions and use golangci-lint run -fix

Also, please note that you must run golangci-lint in each folder that contains a go.mod file. Otherwise you will only lint the main module and not the submodules.

ccoVeille avatar May 16 '25 18:05 ccoVeille

hey @ccoVeille I would like work on this task but will like to abstract the complete task into tiny ones and solve it! Need your comments :)

Asp-irin avatar May 25 '25 16:05 Asp-irin

Sure, that the best way to do it.

You could start by adding godoc comments to methods, variabled and comments

So here it would be about removing these two, then run golangci-lint locally and fix what is reported

    staticcheck: 
       checks:  
         - -ST1000 # TODO remove this line and fix reported errors 
     
   exclusions: 
     rules: 
       - linters: 
           - revive 
         text: "exported (.+) should have comment" # TODO fix errors reported by this and remove this line

ccoVeille avatar May 25 '25 16:05 ccoVeille

I am a Gofr-SOC participant. Please assign this to me.

Tushar15082002 avatar Jul 23 '25 11:07 Tushar15082002