Docstrings with dictionary examples
I'm having false positives of P102 docstring does contain unindexed parameters because of this line:
{'description': '', 'extension': {}, 'time': �1N|�r�, 'tid': '\x03\xca1N|\xa9r\x99', 'serial': '\x03\xca1N|\xa9r\x99', 'user_name': '', 'size': 1042}
This line is used in the docstring to give some documentation of the motivation of some code decisions in the module.
This is somewhat similar to https://github.com/xZise/flake8-string-format/issues/7.
The issue with both #7 and this one is: How do I detect that this is legitimate? Both P102 and P103 are very false postive prone, because it always assumes that the string might get parsed by str.format later on.
To be honest I think both P102 and P103 should be treated as advisory. Now I don't actually know if flake8 supports that (mentioning it, but not causing it to fail), because I don't actually see a way to differentiate between legitimate and illegitimate uses.
I have same P102 issue with simpler code:
"""
This script could be called as:
$ find . -type f | xargs -I {} this_script.py {}
"""
I think doctrings shouldn't be processed as string literals because they might contain any text.
I'm not sure how this issue can be resolved without removing that error code completely. How should the plugin determine that this code is valid and the call to format isn't missing unintentionally?
As mentioned in #23 I finally understood why I originally implemented those codes: Python 2.6 did not support unindexed parameters and one reason for this plugin was to detect strings using those as seen in #10. Quoting me from the other ticket:
As Python 2.7 is not officially supported anymore I'm considering removing those two codes (
FMT102,FMT103).[...] My recommendation is to ignore those two codes for Flake8 for now actually.