Skip to content

Conversation

@ofalvai
Copy link
Contributor

@ofalvai ofalvai commented Sep 16, 2022

Use the standard linters and config we use in other step repos.

This PR drops errcheck and golint in favor of golangci-lint through the check internal step.

Comment on lines +1 to +26
run:
skip-dirs:
- .*/mocks

issues:
# https://github.com/golangci/golangci-lint/issues/2439
exclude-use-default: false

linters:
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- revive

linters-settings:
revive:
severity: error
rules:
- name: exported
arguments:
- checkPrivateReceivers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these repo specific settings needed because the global one was producing issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lpusok had the idea to keep enforcing comments for exported types and functions. This is disabled by default, this is the part that enables it explicitly. I think this lint rule only makes sense in library repos, I wouldn't enforce it in step repos.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we need the run, issues, linters section too just to be able to use linters-settings?

By the way I have a beef with this rule because at the moment I do not think it is useful. Most of our stuff simply receive this to please the linting gods (you are the exception because I remember in previous cache PRs you left some actual description for the exported functions):

// [type-name] ...

I am happy to have it as it is too but if it were to me then I would simply remove this rule. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we need the run, issues, linters section too just to be able to use linters-settings?

The run and issues sections are needed to make it work in our repo, the linters section is not strictly needed, but I thought it's a good idea to explicitly define the enabled linters that are enabled by default anyway. But I'm happy to remove it if you don't find it useful!

By the way I have a beef with this rule because at the moment I do not think it is useful. Most of our stuff simply receive this to please the linting gods

I too find it sometimes annoying, but it also made me add meaningful comments on a few occasions when I forgot to do it on my own 😁 Let's go with it for now and I'll raise this on the next eng sync to discuss.

@ofalvai ofalvai merged commit 8b6caac into master Sep 21, 2022
@ofalvai ofalvai deleted the standard-linters branch September 21, 2022 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants