Skip to content
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

chore: setup golangci-lint with a basic configuration #262

Merged
merged 6 commits into from
Nov 12, 2024

Conversation

G-Rath
Copy link
Collaborator

@G-Rath G-Rath commented Nov 5, 2024

This is a first step towards having a robust linting configuration based off what we have in osv-scanner; currently, I've had to disable everything and then manually re-enable specific rules due to the linter throwing many type errors about something - I'm guessing it probably relates to the protobuffer stuff, even though I have been able to get that compiled locally.

Regardless this should serve as a good starting point by having linting running and enforcing some lints, along with a commented out list of all the linters that we want to look at getting enabled to match the osv-scanner configuration. I created this list by running go run github.com/golangci/golangci-lint/cmd/[email protected] linters, then manually commenting out each linter that has violations until everything was happy.

The idea is eventually when all the kinks are worked out we should be able to completely replace this configuration with the one from osv-scanner, meaning we shouldn't need to worry about e.g. enable vs presets.

I will follow this PR up with more that tackle the individual rules, acknowledging there will be some that we probably want to discuss so I'll first try to weed out the ones that should be no-brainers to get enabled.

Relates to #158

.golangci.yaml Outdated
@@ -0,0 +1,92 @@
# todo: this should match the configuration of osv-scanner for the most part
Copy link
Collaborator

Choose a reason for hiding this comment

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

Create an issue for TODOs and link to the issue in the comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking it'd be covered by #158 but I'm happy to have a dedicated ticket for it: #274

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks! Can you change the todos in this doc to the format # TODO(#274): in that case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done! and I've made a note to check if there's a lint for that 😄

.golangci.yaml Show resolved Hide resolved
@G-Rath G-Rath mentioned this pull request Nov 6, 2024
46 tasks
@G-Rath G-Rath requested a review from erikvarga November 7, 2024 18:47
@copybara-service copybara-service bot merged commit 4d135f3 into google:main Nov 12, 2024
6 of 7 checks passed
@G-Rath G-Rath deleted the setup-linting branch November 14, 2024 19:30
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.

2 participants