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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to another code formatter? #2218

Closed
vytas7 opened this issue Mar 23, 2024 · 5 comments 路 Fixed by #2230
Closed

Migrate to another code formatter? #2218

vytas7 opened this issue Mar 23, 2024 · 5 comments 路 Fixed by #2230

Comments

@vytas7
Copy link
Member

vytas7 commented Mar 23, 2024

While blue is awesome since it is better tuned for our needs out of the box, and I just 馃挋 blue, it seems that it is stuck on flake8 v4.x, and it hasn't been updated in two years.
@grantjenks @warsaw If you intend to carry on with blue, we'll likely try to keep it, but otherwise we might need to look for alternatives. "Back in Black", or maybe ruff?

@warsaw
Copy link
Contributor

warsaw commented Mar 23, 2024

Personally, I've made the move to ruff which covers almost all of blue's functionality with the one notable exception, it's handling of right hanging comments. I don't intend to maintain blue, but instead help ruff along to full blue parity.

@vytas7
Copy link
Member Author

vytas7 commented Mar 24, 2024

Alright, I see that @grantjenks has moved sortedcontainers to ruff as well, that sums it up I guess.

@CaselIT
Copy link
Member

CaselIT commented Mar 25, 2024

I usually use use black in other projects, but I have nothing against using ruff.

@vytas7 do you think it could make sense to try each and post here the commits so that we can look at what change they would introduce?

IIRC black can be configured to not convert ' to ", but that would mean that it would accept both ' and " for strings. Outside that not much changes should happen.

Don't know about what options ruff has, but I gather it's much more than just a code formatter, so it may have more config knobs to tune

@vytas7
Copy link
Member Author

vytas7 commented Mar 25, 2024

Yeah, I'll try to create a prototype with ruff. ruff is alluring not just for its brute speed, but it also has the potential to replace all other tools/plugins that we use (import sorting, etc). I'll need to figure out the required config flags though.

Ideally it should introduce zero code changes against blue (with an optimal configuration) as the only difference Barry mentioned doesn't apply to Falcon I think, even if we had aligned comments before, we had lost them to black which we used before blue.

@warsaw
Copy link
Contributor

warsaw commented Mar 25, 2024

You should be able to configure ruff to be compatible with black or blue, or anything in between. Like I mentioned earlier, the only thing lacking for me at the moment is right hanging comment line up, and there's an open ticket on that issue.

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

Successfully merging a pull request may close this issue.

3 participants