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

Linter issues #4496

Open
6 of 60 tasks
imiric opened this issue Nov 4, 2021 · 11 comments · Fixed by grafana/xk6-browser#211 or grafana/xk6-browser#220
Open
6 of 60 tasks

Linter issues #4496

imiric opened this issue Nov 4, 2021 · 11 comments · Fixed by grafana/xk6-browser#211 or grafana/xk6-browser#220

Comments

@imiric
Copy link
Contributor

imiric commented Nov 4, 2021

Closing this issue should be done when all existing issues are fixed and we remove --new-from-rev from the CI job.

TODO:

@imiric
Copy link
Contributor Author

imiric commented Nov 5, 2021

Another issue is that wrong or missing comments on exported declarations aren't being checked. See grafana/xk6-browser#65 (comment).

So it seems that go vet isn't setup properly. Though we might want to run something more sophisticated like Staticcheck instead, which also includes this warning.

@inancgumus
Copy link
Member

@imiric Is this PR (#211) also closing this issue?

@imiric
Copy link
Contributor Author

imiric commented Feb 3, 2022

I think we should look into why go vet isn't working properly.

@inancgumus
Copy link
Member

inancgumus commented Feb 3, 2022

So maybe update the issue description and also change its name to "vet isn't working properly" since we fixed the linter errors? Or create another issue as you explained as "another issue" here :)

Another issue is that wrong or missing comments on exported declarations aren't being checked.

@imiric
Copy link
Contributor Author

imiric commented Feb 3, 2022

I would classify go vet under "linter issues", since we don't run it directly, but via golangci-lint.

Actually, I'm not sure the missing comments check was done by go vet, it seems to be from golint, which is now deprecated in favor of revive(?).

I'm not sure what the status is or why we're not getting those warnings, but we should look into it under this issue. I don't think we need a new one to track this. This comment should be enough to "expand the scope" of what needs to be done here.

@inancgumus
Copy link
Member

inancgumus commented Feb 3, 2022

But we still fixed the following and I think we better change the issue description and link it to that comment maybe:

The lint job in CI currently ignores errors that are already on main, which is a questionable practice carried over from k6. :)
There's not a lot of them so they're fixable, and we should change the job to run without --new-from-rev.

No? No big deal but can be confusing later on (doubt it :)).

@inancgumus inancgumus linked a pull request Feb 4, 2022 that will close this issue
inancgumus referenced this issue in grafana/xk6-browser Feb 4, 2022
This reverts commit 2a5a92c.

We're planning adding more linters, see: #216 and #58. So we've decided
to renable the --new-from-rev options. See the discussions:
- #216 (comment)
- #216 (comment)
imiric referenced this issue in grafana/xk6-browser Feb 4, 2022
As discussed in #216, this enables specific linters, but should be run
with --new-from-rev since there are a *lot* of old issues we should
gradually fix.

See #58
@imiric
Copy link
Contributor Author

imiric commented Feb 4, 2022

So grafana/xk6-browser#216 adds the missing linters, so we now get errors on missing/wrong comments via revive.

Considering that without --new-from-rev there are 1298 issues with that configuration, do we want to close this issue or keep it open?

I vote for keeping it open, as it will be a constant reminder we need to gradually fix all of these. The "Definition of Done", if you will, should be removing --new-from-rev from CI.

@inancgumus
Copy link
Member

inancgumus commented Feb 4, 2022

I vote for keeping it open, as it will be a constant reminder we need to gradually fix all of these.

Same. That's why I added a todo list to this issue :)

Next week, I'm planning to update the TODO list and add the linters as tasks. So we can track each week what we're accomplishing (as we agreed: one day per week schedule). Some of the tasks can be linterA part I, part II, ... style because some of them have a lot of warnings.

The "Definition of Done", if you will, should be removing --new-from-rev from CI.

I totally agree with you.

@inancgumus
Copy link
Member

inancgumus commented Feb 7, 2022

@imiric I updated the TODO list, here. Please mark the ones you already fixed.

@imiric
Copy link
Contributor Author

imiric commented Feb 7, 2022

I don't think I fixed any of them without --new-from-rev. The fixes in grafana/xk6-browser#216 were all with --new-from-rev.

@imiric
Copy link
Contributor Author

imiric commented Feb 25, 2022

Something we just noticed in grafana/xk6-browser#252 is that at least tparallel is not being triggered when t.Parallel() is missing. Running golangci-lint run --out-format=tab --new-from-rev=main ./... shows 0 errors after removing t.Parallel() from the subtest. It doesn't trigger when removing it from the main test either... 😕 Adding //nolint:tparallel to the subtest triggers the nolintlint linter, so it seems something is wonky with that specific integration.

Instead of wrestling with this specific issue, we might want to just switch to the GitHub Action and see if that fixes it. See #2397. Though it would still be a problem when running it locally... 😮‍💨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants