microsoft / vscode-pylint

Linting support for python using the pylint library.
https://marketplace.visualstudio.com/items?itemName=ms-python.pylint
MIT License
70 stars 34 forks source link

[Feature Request] new lint rule to require a comment #. at end each code block. #564

Closed EdSaleh closed 3 months ago

EdSaleh commented 3 months ago

Create a new rule to require that each block must end with # or #. 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.

Example:

import string
def atbash(sequence: str) -> str:
    """
    Example
    """
    output = ""
    for i in sequence:
        extract = ord(i)
        if 65 <= extract <= 90:
            output += chr(155 - extract)
        #.
        elif 97 <= extract <= 122:
            output += chr(219 - extract)
        #.
        else:
            output += i
        #.
    #.
    return output
#.
karthiknadig commented 3 months ago

This is just a wrapper around pylint for VS Code, please file this feature request on https://github.com/pylint-dev/pylint/issues

Pierre-Sassoulas commented 3 months ago

(pylint maintainer here), you should create your custom pylint plugin for that, enforcing a kind of 'end' keyword to make python look like pascal or ada is going to not be pythonic enough / too controversial for pylint core.