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 numpy d410 #233

Merged
merged 11 commits into from Feb 27, 2017

Conversation

Projects
None yet
2 participants
@shacharoo
Copy link
Member

shacharoo commented Jan 27, 2017

No description provided.

@@ -34,6 +39,16 @@ def decorator(f):
return decorator


def pairwise(iterable, default_value):

This comment has been minimized.

@Nurdok

Nurdok Jan 28, 2017

Member

Move this to utils.py.

This comment has been minimized.

@shacharoo
@@ -486,8 +501,8 @@ def _check_section_underline(cls, section_name, context, indentation):

if not dash_line_found:
yield violations.D407(section_name)
if next_non_empty_line_offset == 0:
yield violations.D410(section_name)
if next_non_empty_line_offset > 0:

This comment has been minimized.

@Nurdok

Nurdok Jan 28, 2017

Member

next_non_empty_line_offset is a confusing name. How about something like blank_lines_after_header?

This comment has been minimized.

@shacharoo

shacharoo Jan 28, 2017

Member

Legit :^)

if leading_space(dash_line) > indentation:
yield violations.D215(section_name)

if next_non_empty_line_offset + 1 < len(context.following_lines):

This comment has been minimized.

@Nurdok

Nurdok Jan 28, 2017

Member

If I understand correctly, this means "if this is not the last section", right? Please add a comment to explain this.

This comment has been minimized.

@shacharoo

shacharoo Jan 28, 2017

Member

I changed some of the logic here. The method is a bit long, but I don't think there's a non-artificial way of splitting it to several ones. Tell me if you think I should split it anyways.

@@ -223,6 +223,8 @@ def to_rst(cls):
'Expected {0!r} dashes in section {1!r}, got {2!r}')
D410 = D4xx.create_error('D410', 'Missing blank line after section', '{0!r}')
D411 = D4xx.create_error('D411', 'Missing blank line before section', '{0!r}')
D412 = D4xx.create_error('D412', 'Section content should be in the line '

This comment has been minimized.

@Nurdok

Nurdok Jan 28, 2017

Member

I suggest making the description here clearer: "No blank lines allowed between a section header and its content".

This comment has been minimized.

@shacharoo
@@ -75,7 +90,7 @@ def no_blank_line_after_section():
Returns
-------
A whole lot of values.
A value of some sort.

This comment has been minimized.

@Nurdok

Nurdok Jan 28, 2017

Member

I think the "blank line after a section" should not be enforced for the last section of the docstring (as discussed in #230).

This comment has been minimized.

@Nurdok

Nurdok Feb 23, 2017

Member

@farmersez what did you end up doing?

This comment has been minimized.

@shacharoo

shacharoo Feb 23, 2017

Member

I split it to a different error code which is not raised by default in the numpy convention.

@@ -75,7 +90,7 @@ def no_blank_line_after_section():
Returns
-------
A whole lot of values.
A value of some sort.

This comment has been minimized.

@Nurdok

Nurdok Feb 23, 2017

Member

@farmersez what did you end up doing?

@Nurdok

Nurdok approved these changes Feb 27, 2017

@Nurdok Nurdok merged commit 07ada6a into PyCQA:master Feb 27, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@shacharoo shacharoo deleted the shacharoo:fix-numpy-D410 branch Feb 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment