Consider uppercase docstring prefixes at D300. #176

Merged
merged 1 commit into from Mar 2, 2016

Projects

None yet

3 participants

@toroettg
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.

@sigmavirus24
Member

This looks good to me. Seems reasonable too.

@Nurdok Nurdok commented on an outdated diff Mar 1, 2016
docs/release_notes.rst
@@ -4,6 +4,12 @@ Release Notes
**pydocstyle** version numbers follow the
`Semantic Versioning <http://semver.org/>`_ specification.
+x.x.x - unknown date
@Nurdok
Nurdok Mar 1, 2016 Member

Instead write "Current Development Version".

@Nurdok
Member
Nurdok commented Mar 1, 2016

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

@toroettg
Contributor
toroettg commented Mar 2, 2016

Gladly done!

@sigmavirus24
Member

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

@Nurdok
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 Nurdok merged commit b790ec8 into PyCQA:master Mar 2, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@toroettg toroettg deleted the toroettg:D300UppercaseStringprefix branch Mar 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment