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

Support Suggested Fixes (--fix) #1000

Open
StevenACoffman opened this issue Jun 11, 2024 · 2 comments
Open

Support Suggested Fixes (--fix) #1000

StevenACoffman opened this issue Jun 11, 2024 · 2 comments

Comments

@StevenACoffman
Copy link

Since Revive (and golint) was originally authored, Go analysis has added stable SuggestedFix support for linters.

I would like revive to provide suggested fixes with a --fix argument, such that they can be automatically applied as in this example:
https://github.com/golang/tools/blob/54dc8c5edb561003330ec7e649333181bbd0a9bd/go/analysis/internal/checker/checker.go#L316

BTW, there is ongoing work in golangci-lint to support applying multiline suggested fixes golangci/golangci-lint#1779 and it would be nice if revive had such available when that landed.

@mgechev
Copy link
Owner

mgechev commented Jun 11, 2024

Hey @StevenACoffman, thanks for the feature request. It'll be a trade-off between performance/complexity and DX. We're currently running rules concurrently over the project and we'll have to modify this logic which will be a performance regression.

I'm leaning towards skipping this feature, but I'll keep the feature request open for longer to collect more feedback on the trade-offs.

@StevenACoffman
Copy link
Author

StevenACoffman commented Jun 11, 2024

Fair enough. We have really enjoyed gofumpt and similar tools that avoid needless code review nit discussions.

Some of the rules in revive are similarly straightforwardly inarguable (and can be obviously fixed in an automated fashion), and we may pull them out into their own "autofixer" utility (renew perhaps?) if that's ok.

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

No branches or pull requests

2 participants