-
Notifications
You must be signed in to change notification settings - Fork 938
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
[Feature] new lint rule to require that each block must end with # or #. (HashtagDot) or a new line. #11698
Comments
Hi, thanks for the suggestion! Unfortunately, I think very few of our users would want to switch this rule on, essentially for the same reasons explained to you by the pylint maintainers in pylint-dev/pylint#9684. As such, I think this probably wouldn't be worth the maintenance burden for us, unfortunately. So we'll decline this one :-) |
Sure, but I don't think issues from a different project should be relavent here. The purpose of this issue is to let python and other language developers know of this idea and to create a discussion around it, discussion to identify whether this feature could be useful or not and why, and the decision around it is for the project developers to choose. |
I have some experience with creating proposal for lints, I have also contributed to rust lint previously and my proposal was completed and merged. |
Hi! We use issues from other projects (pylint, flake8, black, etc.) to help inform our design decisions here because we want to have cohesion between various tools in the Python ecosystem. However, regardless of the issue in pylint, I think that this rule would not be used by most of our users and is antithetical to general Python design principles. It is currently out of scope for what we'd want to include in Ruff. Maybe once we have support for plugins, it'd make sense there. I have no problem with discussion continuing around this idea. Anyone is welcome to comment in this issue. |
Hello,
Please create a new lint rule to require that each block must end with # or #. or a new line.
This would work as a curly braces blocks found in C style languages.
Also, this could also be used to reformat python code by code editor to fix any indentation issues.
Users can also use a different word symbol or use a new line for this purpose. (#., #, #/, newline, etc). The user has the option to select the keyword they would like to have for the project. The difference between this proposal (:\n code_block \n#.) and curly braces ({}) in C languages is that curly braces are also indentation insensitive while this proposal is indentation sensitive just like indentation style languages.
There could also be a configurable threshold limit for block lines for which the
code_block_ending_marker
rule is activated and would apply (example: block_lines > 1 lines by default).Users can also use new line instead of # or #. by configuring
code_block_ending_marker_word
if it fits their project development.Example:
There are cases where strict block guarantees is required. Also, when copying python code sometimes spacing is not aligned correctly and having code with this style with editor support, editor would fix incorrect spacing easily.
OR
would be aligned correctly by the editor to:
OR
Thank you,
The text was updated successfully, but these errors were encountered: