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

golangci-lint: enable it for all issues not just new #3712

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

mstoykov
Copy link
Collaborator

What?

Just call golangci-lint over the whole project not just the "new" parts.

Why?

As now all lint issues are fixed we can enable without that option.

Unfortunately the option only looks at code at and around the places that was changed and if any of it has new lint errors it will trigger.

That does mean that if you update golangci-lint - it won't showcase new lint errors it triggers.

Also won't work if you add a bunch of code to the end an already somewhat long function. As the lint error will be at the beginning of the function.

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

#769

As now all lint issues are fixed we can enable without that option.

Unfortunately the option only looks at code at and around the places
that was changed and if any of it has new lint errors it will trigger.

That does mean that if you update golangci-lint - it won't showcase new
lint errors it triggers.

Also won't work if you add a bunch of code to the end an already
somewhat long function. As the lint error will be at the beginning of
the function.

Closes #769
@mstoykov mstoykov added the ci label Apr 25, 2024
@mstoykov mstoykov requested a review from a team as a code owner April 25, 2024 08:43
@mstoykov mstoykov requested review from oleiade and olegbespalov and removed request for a team April 25, 2024 08:43
Copy link
Collaborator

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

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

🤞

@olegbespalov
Copy link
Collaborator

As part of this PR, we might consider adding (increasing default) timeout option, see https://github.com/grafana/k6/actions/runs/8831719518/job/24247507781?pr=3713

run golangci-lint
  Running [/home/runner/golangci-lint-1.57.2-linux-amd64/golangci-lint run --out-format=github-actions --config=/home/runner/work/k6/k6/./.github/actions/lint//.golangci.yml] in [] ...
  level=error msg="Timeout exceeded: try increasing it by passing --timeout option"
  
  Error: golangci-lint exit with code 4

I believe this could happen more often if we increase the scope of scanning 🤔

@mstoykov
Copy link
Collaborator Author

It has been happening for a while now.

We can do it, but I expect that this chanage actaully makes this checks faster as actually they have to do less work.

Again it runs all the linters, just then skips any report that isn't on lines that are in hte "diff"/"patch" that is between the current code and the previous version that is given.

@mstoykov mstoykov merged commit 1020b30 into master Apr 25, 2024
21 checks passed
@mstoykov mstoykov deleted the golangCIEverythingAllTheTime branch April 25, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants