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

fix: Ignore pass multiple lines after docstring with flag #177

Merged
merged 5 commits into from Oct 23, 2022

Conversation

DenverCoder1
Copy link
Contributor

@DenverCoder1 DenverCoder1 commented Oct 21, 2022

Fixes #176

  • Updates useless_pass_line_numbers to ignore pass after a docstring when --ignore-pass-after-docstring is used, even if there are empty lines between the docstring and the pass.

Example where pass will be ignored by --ignore-pass-after-docstring when it was not previously:

class MyException(Exception):
    """Example class

    This is an example docstring for the class.
    """

    pass

Copy link
Collaborator

@fsouza fsouza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should support any number of blank lines between the docstring and pass? 🤔

@DenverCoder1
Copy link
Contributor Author

I wonder if we should support any number of blank lines between the docstring and pass?

I'm not sure if it's necessary since there aren't any style guides or formatters I know of that would support more than one blank line after a docstring. I can think about it and see if it would be simple enough to implement.

@DenverCoder1
Copy link
Contributor Author

DenverCoder1 commented Oct 23, 2022

I wonder if we should support any number of blank lines between the docstring and pass?

This is supported now by instead storing the previous non-empty line to check (instead of the previous two lines).

@DenverCoder1 DenverCoder1 changed the title fix: Ignore pass two lines after docstring with flag fix: Ignore pass multiple lines after docstring with flag Oct 23, 2022
Copy link
Collaborator

@fsouza fsouza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@fsouza fsouza merged commit 92a0261 into PyCQA:main Oct 23, 2022
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

Successfully merging this pull request may close these issues.

--ignore-pass-after-docstring does not ignore pass when a newline comes in between
2 participants