pydocstyle icon indicating copy to clipboard operation
pydocstyle copied to clipboard

Add error D303 when an f-string is used as a docstring

Open lordmauve opened this issue 4 years ago • 13 comments

Emit a new error code D303 when an f-string is found where a docstring is expected.

Fixes #368.

lordmauve avatar Jul 17 '19 17:07 lordmauve

Tests are green locally under 3.5-3.7 except for the stemming issue that #379 addresses.

lordmauve avatar Jul 17 '19 17:07 lordmauve

Thanks a lot, @lordmauve! I rely on this change in https://github.com/wemake-services/wemake-python-styleguide/issues/579

sobolevn avatar Jul 28 '19 11:07 sobolevn

@Nurdok friendly ping. What are the steps to get this merged?

Some of my users rely on this fix: https://github.com/wemake-services/wemake-python-styleguide/issues/579

sobolevn avatar Nov 19 '19 18:11 sobolevn

Grr, I suck at git, trying to get this rebased and mergable... I don't know where 14a59e6 came from.

lordmauve avatar Nov 20 '19 14:11 lordmauve

Ok, I think that's clean

lordmauve avatar Nov 20 '19 14:11 lordmauve

Tests are now failing because mypy returns an error when it sees fstrings under Python 3.5, even though the file won't be imported under Python 3.5, and it appears impossible to tell mypy to ignore this. Looking for a workaround.

lordmauve avatar Nov 20 '19 15:11 lordmauve

# type: ignore to the rescue!

sobolevn avatar Nov 20 '19 15:11 sobolevn

That does not work; mypy continues to parse the file and raise the error.

lordmauve avatar Nov 20 '19 16:11 lordmauve

Sorry for the long delays in response - I've been on back-to-back family vacation and business trips. I'll to catch up as soon as I can.

Nurdok avatar Nov 21 '19 10:11 Nurdok

@lordmauve any updates on this?

samj1912 avatar Mar 07 '20 16:03 samj1912

Closing this as it has been inactive for a while. Please feel free to re-open if this is still relevant.

samj1912 avatar Aug 29 '20 22:08 samj1912

@Nurdok please take a look when you have time - I make the code more resilient to fstrings in case people ignore it even after the warnings.

samj1912 avatar Sep 06 '20 18:09 samj1912

@Nurdok will you have a chance to look at this? It LGTM but waiting on your review.

samj1912 avatar Sep 25 '20 13:09 samj1912