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

Disable some rule in format #8206

Closed
yasirroni opened this issue Oct 25, 2023 · 7 comments
Closed

Disable some rule in format #8206

yasirroni opened this issue Oct 25, 2023 · 7 comments

Comments

@yasirroni
Copy link

I'm using ruff 0.1.1. With the newest feature, we can use ruff format . As autopep8 user, I don't want to implement all ruff format. Just some of it. For example, I want something like 'quote-style = "none"` to not implement that rule.

That is because I use single quote for variable and word, but double quote for sentence and paragraphs.

Thank you.

@MichaReiser
Copy link
Member

Thanks for the feedback.

I close this as a duplicate. Would you mind upvoting (reacting) to this issue #7525 that asks for a new option to skip string normalization

@yasirroni yasirroni changed the title Disbale some rule in format Disable some rule in format Oct 25, 2023
@yasirroni
Copy link
Author

Thanks @MichaReiser for pointing that issue. But that is just one of it. I love ruff previous fix that support which rule to use and which is not. I would like that the formatter follow or at least provide some functionality when user don't want to implement specific format. Thus, not only skipping string normalization, but any formatter.

@MichaReiser MichaReiser reopened this Oct 25, 2023
@MichaReiser
Copy link
Member

Oh I see and can understand that it is unlikely that we agree with all decisions the formatter makes for us.

For now, we don't plan to add as granular configuration options as YAPF. We may want to consider implementing different code styles eventually discussion. Also see this comment from @charliermarsh that gives some more context.

@yasirroni
Copy link
Author

yasirroni commented Oct 25, 2023

Thanks @MichaReiser, I've finished read that discussion and comment. But, my concern is far more simple than that. I just, not ready, to follow all rule or implement all format. Just let me choose which one while transitioning from ruff check to ruff format.

This world should not be black and white. Committing to one fully. Just, just, let me chose which formatter (not library, like one that is already implemented that is to sort import or not), that I want ruff to implement.

And this should be easy to maintain and or test, because, just "ignore formatting x".

More like,

If not rule this: continue to next rule

@MichaReiser MichaReiser reopened this Oct 25, 2023
@MichaReiser
Copy link
Member

Implementing partial formatting, e.g. based on the type of node isn't trivial because the formatting rules depend on each other. The formatting of binary expressions makes assumptions about how the operands will format. This knowledge is required to ensure that the formatted code doesn't contain any syntax errors.

@yasirroni
Copy link
Author

I see. So, each format is already designed to depend on each other, thus implementing and testing just one rule at a time is not trivial task. Thanks for clarifying. But, I hope this kind of functionality will come. If it indeed implemented by ruff, I can be sure that every sane person will use ruff, at least some of its rule and did not need to worry to be forced to use all format or rule. Thank you.

@MichaReiser
Copy link
Member

You're welcome

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