FR: Modify Files as a Formatter
adam-grant-hendry opened this issue · 4 comments
Would it be possible to expand pydocstyle
to allow it to modify files in place? Perhaps an additional -w
or --write
option that could be passed on the command line to enable pydocstyle
to act as a formatter?
That is non-trivial to put it mildly. Especially with an underspecified request as this one.
That’s fine, I just wanted to gain sentiment on the issue. I felt the request was fairly self explanatory, so fleshing out implementation details could wait until a consensus was achieved.
Not exactly. Take for example the line-length limit on the first line of a docstring - how would pydocstyle autofix that without rewriting the line? It would need to understand the language and sentiment to be able to do so. Or at least, that's one possible interpretation of what you're asking which is far more than needs to write back out valid python. How would it autofix missing parameter documentation? Add the param to the list and use Loren Ipsum or TODO? That fixes the lint error without improving anything. There's a lot this tool catches that it can't really fix without a huge engineering investment
Take for example the line-length limit on the first line of a docstring - how would pydocstyle autofix that without rewriting the line?
Personally, I would say let plyint
be opinionated and rewrite it as it sees fit, ala black
How would it autofix missing parameter documentation? Add the param to the list and use Loren Ipsum or TODO?
Yes, add it and then putty a placeholder string like __param_description__
. If a parameter description then has nothing but this placeholder text, let pylint
issue a warning that there’s no description or type.
These things have answers, but the question is whether there is enough desire to implement them. Right now, it sounds like there isn’t enough consensus, so I’ll close the issue.