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

New D210 check for white spaces. #95

Merged
merged 2 commits into from Jan 19, 2015

Conversation

Projects
None yet
2 participants
@jirikuncar
Copy link
Contributor

commented Jan 12, 2015

This is a proposal for checking whitespaces in docstrings.

  • number
  • error message
@Nurdok

This comment has been minimized.

Copy link
Member

commented Jan 13, 2015

First of all, thank you so much for investing in this. It's greatly appreciated.

I'm currently on my phone, so I only skimmed the changes, but I have a few issues:

  • Why did you choose the D290 error code? Always use the next available one in the appropriate category.
  • The check name should be more specific. The entire D2xx category is about whitespace issues, so it's not enough to call it that.
@Nurdok

This comment has been minimized.

Copy link
Member

commented Jan 13, 2015

You should also update the README file with the new error.

@jirikuncar

This comment has been minimized.

Copy link
Contributor Author

commented Jan 13, 2015

  • number

Why did you choose the D290 error code? Always use the next available one in the appropriate category.

I'm not sure about the number and error message. Do you have any proposal?

@jirikuncar jirikuncar force-pushed the jirikuncar:D290-whitespaces branch from e9765f5 to dbb7716 Jan 13, 2015

@jirikuncar

This comment has been minimized.

Copy link
Contributor Author

commented Jan 13, 2015

@Nurdok based on README, I've changed the error code to 210. Is it ok?

@jirikuncar jirikuncar changed the title New D290 check for white spaces. New D210 check for white spaces. Jan 13, 2015

@Nurdok

This comment has been minimized.

Copy link
Member

commented Jan 17, 2015

D210 is okay, but please also address my other comments.

@jirikuncar

This comment has been minimized.

Copy link
Contributor Author

commented Jan 17, 2015

Can you please provide the message?

pep257.py Outdated
lines = eval(docstring).split('\n')
if lines[0].startswith(' ') or \
len(lines) == 1 and lines[0].endswith(' '):
return Error(

This comment has been minimized.

Copy link
@Nurdok

Nurdok Jan 17, 2015

Member

Put the line break in the string.

return Error('D210: White spaces around docstring should '
             'be trimmed.')
@@ -76,7 +76,8 @@ def test_ignore_list():
no blank line after one-liner is bad. Also this - \"\"\"
return foo
"""
expected_error_codes = set(('D100', 'D400', 'D401', 'D205', 'D209'))
expected_error_codes = set((
'D100', 'D400', 'D401', 'D205', 'D209', 'D210'))

This comment has been minimized.

Copy link
@Nurdok

Nurdok Jan 17, 2015

Member

Break the line as part of the list:

expected_error_codes = set(('D100', 'D400', 'D401', 'D205', 'D209',
                            'D210'))
pep257.py Outdated
@@ -778,6 +778,17 @@ def check_newline_after_last_paragraph(self, definition, docstring):
'quotes on separate line')

@check_for(Definition)
def check_whitespaces(self, definition, docstring):

This comment has been minimized.

Copy link
@Nurdok

Nurdok Jan 17, 2015

Member

Give the check a more specific name, like check_surrounding_whitespaces.

pep257.py Outdated
@@ -778,6 +778,17 @@ def check_newline_after_last_paragraph(self, definition, docstring):
'quotes on separate line')

@check_for(Definition)
def check_whitespaces(self, definition, docstring):
"""D210: White spaces around doctring should be trimmed."""

This comment has been minimized.

Copy link
@Nurdok

Nurdok Jan 17, 2015

Member

Change the message to "D210: No whitespaces allowed surrounding docstring text."

@jirikuncar jirikuncar force-pushed the jirikuncar:D290-whitespaces branch 2 times, most recently from f9b497a to 4f07e0a Jan 19, 2015

@jirikuncar

This comment has been minimized.

Copy link
Contributor Author

commented Jan 19, 2015

@Nurdok thanks for your comments and time. :shipit:

@jirikuncar jirikuncar force-pushed the jirikuncar:D290-whitespaces branch from 4f07e0a to 96d5839 Jan 19, 2015

pep257.py Outdated
@@ -778,6 +778,16 @@ def check_newline_after_last_paragraph(self, definition, docstring):
'quotes on separate line')

@check_for(Definition)
def check_surrounding_whitespaces(self, definition, docstring):
"""D210: White spaces around doctring should be trimmed."""

This comment has been minimized.

Copy link
@Nurdok

Nurdok Jan 19, 2015

Member

You should update the error message here as well (you updated only the README) and in the tests.

This comment has been minimized.

Copy link
@jirikuncar

jirikuncar Jan 19, 2015

Author Contributor

Ups. Sorry about it :(

@Nurdok

This comment has been minimized.

Copy link
Member

commented Jan 19, 2015

I left one more comment in the actual code - but notice that the build is now failing on your branch. Make sure your tests pass.

@jirikuncar jirikuncar force-pushed the jirikuncar:D290-whitespaces branch from 96d5839 to 7dad478 Jan 19, 2015

@jirikuncar

This comment has been minimized.

Copy link
Contributor Author

commented Jan 19, 2015

@Nurdok please note that I've also added sudo: false to .travis.yml in order to use container based infrastructure (see http://docs.travis-ci.com/user/workers/container-based-infrastructure/).

pep257.py Outdated
lines = eval(docstring).split('\n')
if lines[0].startswith(' ') or \
len(lines) == 1 and lines[0].endswith(' '):
return Error("D210: No whitespaces allowed "

This comment has been minimized.

Copy link
@Nurdok

Nurdok Jan 19, 2015

Member

This indentation looks wrong.

This comment has been minimized.

Copy link
@jirikuncar

jirikuncar Jan 19, 2015

Author Contributor

Aaaah, broken :autoindent :(

@jirikuncar jirikuncar force-pushed the jirikuncar:D290-whitespaces branch from 3e38a8b to dcd60de Jan 19, 2015

jirikuncar added some commits Jan 12, 2015

New D210 check for surrounding whitespaces.
Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
Reviewed-by: Amir Rachum <nurdok@gmail.com>
Travis: usage of container-based infrastructure
Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
@jirikuncar

This comment has been minimized.

Copy link
Contributor Author

commented Jan 19, 2015

@Nurdok sorry for so many iterations. Please let me know when you release it on PyPI so I can remove it from my package https://github.com/jirikuncar/invenio-kwalitee/blob/master/invenio_kwalitee/kwalitee.py#L82-L93. Thanks

Nurdok added a commit that referenced this pull request Jan 19, 2015

Merge pull request #95 from jirikuncar/D290-whitespaces
New D210 check for white spaces.

@Nurdok Nurdok merged commit 8307b73 into PyCQA:master Jan 19, 2015

1 check passed

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

This comment has been minimized.

Copy link
Member

commented Jan 19, 2015

@jirikuncar Merged. It will probably take a few weeks before I make another release. In any case, thank you so much for investing the time and effort into this. I really can't thank you enough!

@jirikuncar jirikuncar deleted the jirikuncar:D290-whitespaces branch Jan 19, 2015

@Nurdok Nurdok added this to the Next Release milestone Mar 14, 2015

@Nurdok Nurdok added this to the Next Release milestone Mar 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.