Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Consider uppercase docstring prefixes at D300. #176

Merged
merged 1 commit into from
Mar 2, 2016

Conversation

toroettg
Copy link
Contributor

While PEP 257 suggests to use lowercase literals, Python allows uppercase literals as string prefixes.

Unlike D301 and 302, error code D300 is not reported if uppercase docstring prefixes are being used (e.g., R'''...'''). The current implementation of D300 also causes a false positive for uppercase literals with double quotes (e.g., R"""Sum\\mary."""), and detects the quotes incorrectly for a ur'''...''' docstring prefix.

This proposes a more robust implementation for D300 and adds some uppercase tests for D301 and D302, which they already pass.

EDIT: For the sake of simplicity, the D302 uppercase literal test will be included in another PR.

@toroettg toroettg force-pushed the D300UppercaseStringprefix branch from 3f89104 to 34aa554 Compare February 28, 2016 16:51
@sigmavirus24
Copy link
Member

This looks good to me. Seems reasonable too.

@@ -4,6 +4,12 @@ Release Notes
**pydocstyle** version numbers follow the
`Semantic Versioning <http://semver.org/>`_ specification.

x.x.x - unknown date
Copy link
Member

Choose a reason for hiding this comment

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

Instead write "Current Development Version".

@Nurdok
Copy link
Member

Nurdok commented Mar 1, 2016

Looks good. Just fix the small comment I made in the docs and I'll merge this.

@toroettg toroettg force-pushed the D300UppercaseStringprefix branch from 34aa554 to a29eeeb Compare March 2, 2016 19:12
@toroettg
Copy link
Contributor Author

toroettg commented Mar 2, 2016

Gladly done!

@sigmavirus24
Copy link
Member

Still looks good to me. I think @Nurdok wanted that entire line replaced with "Current development version" but ¯\_(ツ)_/¯

@Nurdok
Copy link
Member

Nurdok commented Mar 2, 2016

That is what I meant, but I'll just change this manually right after this merge.
Thanks, @toroettg!

Nurdok added a commit that referenced this pull request Mar 2, 2016
Consider uppercase docstring prefixes at D300.
@Nurdok Nurdok merged commit b790ec8 into PyCQA:master Mar 2, 2016
@toroettg toroettg deleted the D300UppercaseStringprefix branch March 3, 2016 07:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants