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

Add checker for unnecessary ellipsis #5460

Closed
mbyrnepr2 opened this issue Dec 3, 2021 · 4 comments · Fixed by #5470
Closed

Add checker for unnecessary ellipsis #5460

mbyrnepr2 opened this issue Dec 3, 2021 · 4 comments · Fixed by #5470
Labels
Checkers Related to a checker Enhancement ✨ Improvement to a component
Milestone

Comments

@mbyrnepr2
Copy link
Member

Current problem

Add a checker for unnecessary ellipsis.

def my_function():
    """docstring & elipses"""
    ...  # nothing emitted

def my_second_function():
    """docstring & pass"""
    pass  # pylint emits: `my_test.py:7:4: W0107: Unnecessary pass statement (unnecessary-pass)`

Desired solution

Emit a warning for this scenario, similar to when a docstring is immediately followed by pass.

Additional context

No response

@mbyrnepr2 mbyrnepr2 added Enhancement ✨ Improvement to a component Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Dec 3, 2021
@Pierre-Sassoulas Pierre-Sassoulas added Checkers Related to a checker and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Dec 3, 2021
@Pierre-Sassoulas
Copy link
Member

If we implement this the documentation should specify that it's not required when using black.

mbyrnepr2 added a commit to mbyrnepr2/pylint that referenced this issue Dec 4, 2021
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.13.0 milestone Dec 4, 2021
mbyrnepr2 added a commit to mbyrnepr2/pylint that referenced this issue Dec 7, 2021
@mbyrnepr2
Copy link
Member Author

@Pierre-Sassoulas. Thank you for checking this. I don't understand the above comment about how it relates to black, perhaps I am missing something obvious here. Thanks!

@Pierre-Sassoulas
Copy link
Member

Ho sorry I made a mistake and it was not very clear. We have a section in the doc where we tell user what message can be disabled when using other linter. I thought black removed unnecessary ellipsis when in fact it does not: I just checked. So this is useful even when using black.

@Pierre-Sassoulas
Copy link
Member

My confusion come from the fact that autoflake is removing unecessary pass (not unnecessary ellipsis).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Checkers Related to a checker Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants