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

Enable testifylint and tenv linters in golangci-lint #32842

Closed
TheFox0x7 opened this issue Dec 14, 2024 · 5 comments · Fixed by #32852
Closed

Enable testifylint and tenv linters in golangci-lint #32842

TheFox0x7 opened this issue Dec 14, 2024 · 5 comments · Fixed by #32852
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@TheFox0x7
Copy link
Contributor

Feature Description

I have contributed this change to Forgejo and I would like to upstream it to Gitea.

Let me know what's the best/recommended way to do this as it did end up large and not pleasant to look through.

I have a few more things that I want to upstream, but I'll have to see first how the codebases differ - maybe they aren't needed.

Screenshots

No response

@TheFox0x7 TheFox0x7 added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Dec 14, 2024
@silverwind
Copy link
Member

silverwind commented Dec 14, 2024

One question: Why remove skip-dirs? As far as I'm aware, it may increase linting performance by not having golangci-lint crawl into node_modules etc. I'm not totally sure it works because it may need golang/go#42965, but I figured at least it can not hurt.

Edit: It seems we already removed skip-dirs in gitea, so might be okay. I don't recall the detail why it was done.

@silverwind
Copy link
Member

silverwind commented Dec 14, 2024

Also, I'm not sure whether the massive refactor for https://github.com/Antonboom/testifylint#require-error is really justified. It may be more useful being able to see "all errors" instead of just the first.

@TheFox0x7
Copy link
Contributor Author

I think it just was dead config. golangci-lint v1.57 changed run.skip-xxx to issues.exclude-xxx. You moved it in e6d3f9f

As for the require error, I do see your point, and it does make the change a lot smaller (3183 issues are from that). Though it does make sense in places there it's just if !assert.NoError(t, err) { return } as it serves basically the same purpose as far as I can tell. Another case being test setup, where if it failed, it doesn't make much sense to run the test in the first place.

I can not port that part for now which would make the PR a lot smaller and port require to setups/returns in smaller chunks when adding tests etc. That would make it more manageable and easier to backport if needed.

@silverwind
Copy link
Member

silverwind commented Dec 15, 2024

I think it just was dead config. golangci-lint v1.57 changed run.skip-xxx to issues.exclude-xxx. You moved it in e6d3f9f

Ah yes, we migrated to issues.exclude-dirs already in e6d3f9f.

I can not port that part for now

Yeah I would suggest disabling require-error in your port, it's too much churn for questionable benefit. I guess with that rule disabled, the diff will be pretty managable in size, right?

@TheFox0x7
Copy link
Contributor Author

Yeah it's a lot smaller without it. I'll submit it then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants