-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Clean up golangci-lint config #7194
fix: Clean up golangci-lint config #7194
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7194 +/- ##
=======================================
Coverage 58.99% 58.99%
=======================================
Files 367 367
Lines 38847 38847
=======================================
Hits 22918 22918
Misses 14467 14467
Partials 1462 1462 ☔ View full report in Codecov by Sentry. |
Why use |
|
This PR breaks
which runs
Correct me if I'm wrong but is this PR created because you were not aware of the If this PR merge, we now have to run |
@kaovilai I did not intend to change I removed
So, removed the script for both semantic and performance. Since No no, my intention was to clean up config file for Added to PR description a note about removal of scripts. |
Just in github actions because it's covered by golangci-lint? or also locally on dev machine for lint formatting. Is the expectation that |
@tiger oh no, |
So now we run |
@kaovilai that's right! |
@reasonerjt @sseago as you have time can please weigh in on linting :) |
4274fb8
to
e86f210
Compare
@mmorel-35 could you please review? |
|
||
Use `lint-all` to run the linter against the entire code base. | ||
You can run `make lint-fix` to fix fixable issues found by `make lint`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would link fixable issues table here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is not such table
here https://golangci-lint.run/usage/linters/ shows all linters (but this is related only for last release) and those that have ✅ in AutoFix column, are the ones that can be fixable
@$(MAKE) shell CMD="-c 'hack/lint.sh'" | ||
endif | ||
|
||
local-lint: | ||
lint-fix: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn’t it more common to use make fmt
or make format
instead ?
You can also define a make verify
and reuse it as a prerequisite for lint and fmt targets , wdyt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since its inside an if
, I think we will write less code by being explicit here instead of writing a new command verify-config
and adding it to the 2 lint commands
From what I am familiar (example https://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v4/Makefile#L55) fmt
command is commonly used to call go fmt
. Since golangci-lint
does more than that, and the non fix command already contains lint
in its name, I think lint-fix
would make more sense here
7147fc8
to
66c51fb
Compare
66c51fb
to
1ed55dd
Compare
One thing that's not clear to me is whether the difference in file list for gofmt matters. I'm not quite sure how the new approach in this PR generates the file list for gofmt, but the prior approach explicitly omitted autogenerated files:
On the other hand, the old gofmt script in
So the new approach in this PR is definitely an improvement -- assuming the right files are being selected for gofmt. |
@sseago did some tests and only files that are not excluded explicitly in the config file, are files under But since those files are generated files (have comments in their headers telling it), the linter tool will exclude them by default. References https://github.com/golangci/golangci-lint/blob/v1.57.2/.golangci.reference.yml#L2835-L2837 https://github.com/golangci/golangci-lint/blob/v1.57.2/.golangci.reference.yml#L2845-L2855 |
@mateusoliveira43 Please rebase and resolve the conflicts, Thank you ! |
Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
explicitly exclude pkg/plugin/generated Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
remove update fmt script, make lint-fix does that job now Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
Explicity add .go/* to exclude dirs Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
1b0133b
to
180f6d2
Compare
@shubham-pampattiwar done |
Note that the prior error I reported with |
Please add a summary of your change
Clean up of
golangci-lint
config file:config verify
command to CI to avoid this in the futuregolangci-lint
doc linkAlso:
golangci-lint
already does that)This PR would also change golangci-lint config file to default name and add golangci-lint github action, which was already done in 884bcbe and rebased on top of it.
Does your change fix a particular issue?
Related to #6023
Please indicate you've done the following:
/kind changelog-not-required
as a comment on this pull request.site/content/docs/main
.