-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Placeholder Docstrings To Reduce PyLint Messages #2750
Comments
I found a bug in the script. Will resolve and add another comment. |
I personally do not agree with the practice of adding meaningless docstrings to avoid errors. It might be more effective to focus on adding actually useful docstrings by using agent framework. I do agree with the following measures to improve code quality:
|
I'm using ast to read the python files. And astor to write the python code with the placeholder docstrings. I've found a bug in astor. It can't correctly parse the following docstring.
Now I'm curious. Is there some C code somewhere reading the \x00 as an end-of-string? astor prints that comment as
|
With the help of this bash command I tried to find any .py file with that character not being the end-of-file character: |
That command finds no files. The file (or one of them) causing issues with astor is opendevin/runtime/docker/process.py. It's the existing docstring for parser_docker_exec_output. P.S. Thanks for indulging my eccentricity on this topic. |
No worries 😀 Edit: nvm, just read the comment fully lol |
Ohhhh lol... I'm sorry, I should've read your above post more closely, I was reading it as if it found the actual hex value 0 somehow. |
Sadly, I have verified that changing the existing docstring to \x00 avoids the issue. And, of course, it makes no sense to alter the original comment to use \x00 - that looks stupid. If anyone wants to follow the excitement over on the astor project, the issue is at berkerpeksag/astor#225. |
What problem or use case are you trying to solve?
Running PyLint on the OpenDevin codebase produces 713 messages. 234 of these messages are related to missing docstrings. It is possible, even easy, to configure PyLint to ignore these messages. However, doing so won't nudge the code base towards better documentation. Once all placeholder docstrings are in place, future code (pull requests) can be rejected if docstring are not present.
Having a large number of PyLint messages make it hard to find important messages. For example, this message might be important enough to fix since when check is True a CalledProcessError exception will be raised when the sub-process returns a non-zero exit code.
If the community is willing, I'd be happy to work on resolving the mundane PyLint messages.
Does this seem valuable?
Describe the UX of the solution you'd like
Run the attached python script. Spot check the changes. Push to GitHub. This set of changes should be isolated from other changes so that formatting and logic commits are separated.
Please consider running "isort ." to organize the python import into the suggested order.
Please consider running "black --target-version py310 ." afterwards so that the code conforms to a coding style.
After the above steps, there should be 471 PyLint messages, down from 713.
Do you have thoughts on the technical implementation?
I wrote a python script that uses the Abstract Syntax Tree of Python to add placeholder docstrings where they are missing.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: