Skip to content

STY: Reword first lines of example.py docstrings #246

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

Merged
merged 2 commits into from
Nov 27, 2019

Conversation

justinludwig
Copy link
Contributor

Running doc/example.py through pydocstyle
using the "numpy" conventions turns up the following violations for the
module docstring:

  • D205: 1 blank line required between summary line and description
    (found 0)
  • D400: First line should end with a period (not 'd')
  • D404: First word of the docstring should not be This
  • D415: First line should end with a period, question mark, or
    exclamation point (not 'd')

And the following violation for the foo() function docstring:

  • D401: First line should be in imperative mood; try rephrasing (found
    'A')

This change slightly rewords the first line of both docstrings to better
model how docstrings should begin:

  1. It reformats the module docstring to place the first sentence on its
    own line, and remove the superflous "This is the" introduction.
  2. It rewords the foo() function docstring to rephrase the first line
    as a command (following the PEP 257 convention).

After this change, pydocstyle finds no violations.

Running doc/example.py through [pydocstyle](http://www.pydocstyle.org/)
using the "numpy" conventions turns up the following violations for the
module docstring:

* D205: 1 blank line required between summary line and description
  (found 0)
* D400: First line should end with a period (not 'd')
* D404: First word of the docstring should not be `This`
* D415: First line should end with a period, question mark, or
  exclamation point (not 'd')

And the following violation for the `foo()` function docstring:

* D401: First line should be in imperative mood; try rephrasing (found
  'A')

This change slightly rewords the first line of both docstrings to better
model how docstrings should begin:

1. It reformats the module docstring to place the first sentence on its
own line, and remove the superflous "This is the" introduction.
2. It rewords the `foo()` function docstring to rephrase the first line
as a command (following the PEP 257 convention).

After this change, pydocstyle finds no violations.
@larsoner
Copy link
Collaborator

@justinludwig it might be useful to add a check to Travis that it complies. Do you want to try adding it here? If not, okay for me to push some commits to your branch?

@justinludwig
Copy link
Contributor Author

it might be useful to add a check to Travis that it complies. Do you want to try adding it here?

Sure, I'll try adding that.

@justinludwig justinludwig force-pushed the first-lines-of-example-docstrings branch from ef59e2c to f5e506f Compare November 24, 2019 20:08
@justinludwig justinludwig force-pushed the first-lines-of-example-docstrings branch from f5e506f to 7aa0595 Compare November 24, 2019 20:10
@justinludwig
Copy link
Contributor Author

it might be useful to add a check to Travis that it complies. Do you want to try adding it here?

I added a line to the travis script to run pydocstyle on the example.py file -- @larsoner is that what you had in mind?

@larsoner
Copy link
Collaborator

Yep, eventually we should probably do the whole numpydoc module but this is a good start. Thanks @justinludwig

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

Successfully merging this pull request may close these issues.

2 participants