8000 `wsl` v5 - a complete rewrite ✍️ by bombsimon · Pull Request #169 · bombsimon/wsl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

wsl v5 - a complete rewrite ✍️ #169

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

Open
wants to merge 106 commits into
base: main
Choose a base branch
from
Open

wsl v5 - a complete rewrite ✍️ #169

wants to merge 106 commits into from

Conversation

bombsimon
Copy link
Owner
@bombsimon bombsimon commented May 12, 2025

I never really liked how the code turned out. In fact, I really don't like it. It's hard to follow, huge scopes, weird names. When I did the initial diagnostic messages I barely knew about the AST and different types and I never tested the code on real big projects.

Back in 2023 I removed all the code and started from scratch, didn't really know what to expect. I did some POC starting with the wsl foundation and empty leading and trailing whitespaces. I then picked this up again sometime 2024 and did tiny pieces here and there. In 2025 I started to get back to this more regularly although still with a slow pace.

I'm now at a place where I think I've covered all use-cases and all configuration and intentions. I think the code is easier to maintain and hopefully it will be easier to change as well. From a user perspective, the important changes are:

  • Better diagnostics - they're now more homogeneous and hint if the whitespace is asked fore above or below the diagnostic (if not empty line) but still with a hint of what statement causing it
  • More control over checks - all the built-in types can now be turned on or off individually. Don't want checks for if statements? Turn them off! Only care about return and branch? Just enable those! Plus wsl specific checks that was previously unique bools like strict append. In fact, you can now disable all checks and get no diagnostics at all.
  • Less configuration in general - I got rid of old configuration not needed anymore such as error variable names and some mysterious defer hacks.
  • Some improvements - With the new way of splitting the code up new nodes previously not analyzed is added such as send or complex values assigned to declarations.

The only considerations left as of now is:

  • Is the diagnostic format good?
  • Should AllowAssignAndCallCuddle be kept and converted to CheckAssignExpr? (see e2fee7d)
  • Can I do more to ease the migration for golangci-lint users?

@coveralls
Copy link
coveralls commented May 12, 2025

Coverage Status

coverage: 85.224% (-8.4%) from 93.637%
when pulling 9c79499 on wsl-rewrite
into 4740984 on main.

@bombsimon
Copy link
Owner Author

@ldez Feel free to give input on this PR. I don't expect any feedback but you mentioned you had some thoughts and/or opinions and I gladly hear them all! Especially anything that affects golangci-lint and how wsl will be upgraded there. Also feel free to add your input on the diagnostics messages.

I'm not in a rush merging this so don't stress getting to this and again, I'm not expecting anything so this is more if you had any interest!

@ldez
Copy link
Contributor
ldez commented May 12, 2025

I will review it tomorrow.

@ldez
Copy link
Contributor
ldez commented May 14, 2025

I'm still on the topic, but this interrogating me on a larger topic of major versions of linters.
Sorry, I need a bit of time to evaluate some possibilities.

@bombsimon
Copy link
Owner Author

Sorry, I need a bit of time

No need to say sorry and no rush, I see you're active every day and with more important topics! If you feel this adds complex scope to golangci-lint I'm also fine freezing the version there to v4 (for now or undefined time).

Take your time and we'll see if/when you get to this!

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.

3 participants
0