pydocstyle icon indicating copy to clipboard operation
pydocstyle copied to clipboard

Introduce convention class

Open Mr-Pepe opened this issue 4 years ago • 1 comments

This PR implements the first step towards using the specified convention to assume the style of docstrings and not rely on figuring out whether a docstring uses NumPy or Google style (#459).

This PR introduces a new class Convention that holds the error codes to check. It also keeps the name of the convention to use. I imagine that an instance of this class should be passed to the ConventionChecker. Convention-specific checks like _check_numpy_sections and _check_google_sections can then be executed based on the specified convention. This would eventually solve #459.

I added tests for the code I added and all existing tests still pass.

Mr-Pepe avatar Apr 14 '22 20:04 Mr-Pepe

Is there any interest in moving this forward?

Mr-Pepe avatar May 15 '22 20:05 Mr-Pepe

@adamjstewart / @Pierre-Sassoulas would you like to review this?

sambhav avatar Jan 08 '23 17:01 sambhav

On vacation this week but will review next week.

adamjstewart avatar Jan 08 '23 18:01 adamjstewart

Rebased on top of master and addressed feedback

Mr-Pepe avatar Jan 15 '23 14:01 Mr-Pepe

We should add a test case for #459. All of our tests are passing but #459 is still broken.

adamjstewart avatar Jan 15 '23 17:01 adamjstewart

I'm actually surprised that this PR fixed #459 for you because it is not supposed to, as outlined in the PR description. I did not touch anything regarding how docstrings are treated or how checks are executed so there must have been something else going on during your tests. This PR only formalizes the concept of conventions a bit.

Mr-Pepe avatar Jan 15 '23 19:01 Mr-Pepe

Gotcha, yeah I have no idea why things were working before the rebase, maybe because the branch was old? I'm fine with formalizing the concept and then fixing #459 in a separate PR. Thanks for your work on this!

adamjstewart avatar Jan 15 '23 20:01 adamjstewart