Skip to content

Require two blank lines after toplevel def/class; issue #400#402

Closed
benesch wants to merge 2 commits intoPyCQA:masterfrom
benesch:master
Closed

Require two blank lines after toplevel def/class; issue #400#402
benesch wants to merge 2 commits intoPyCQA:masterfrom
benesch:master

Conversation

@benesch
Copy link
Contributor

@benesch benesch commented May 20, 2015

Here's my attempt to fix issue #400. Not sure what the backwards compatibility policy on this'll be, so I left it as enabled by default.

Copy link

Choose a reason for hiding this comment

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

Shouldn't that expect 2 blank lines after the def or class? Sure it's checking for the next logical line if before it there are two lines but only because the block above was a def or class.

Maybe also mention that it expects two lines after a method-level function or class (I know E302 doesn't mention that too but that may be improved too?).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm? I'm pretty sure the condition is right: it's looking for a non-indented line that's preceded by more or less than two blank lines where the preceding non-blank non-indented line was a function or class definition.

It doesn't actually expect two lines after a method-level function or class, since those are only supposed to have one separating blank line according to PEP 8.

Copy link

Choose a reason for hiding this comment

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

The condition is right but I find the message confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, agreed! I'll defer that to another diff, though.

@ArcTanSusan
Copy link
Contributor

This hasn't been worked on since August 2015 last year. For PyCon Sprints 2016, I've fixed the conflicts in this new branch and rebase-squashed both commits into 1 commit: #536

@IanLee1521 IanLee1521 added this to the 2.1 milestone Jun 25, 2016
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.

4 participants