-
Notifications
You must be signed in to change notification settings - Fork 25
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
A systematic way to generate rules, and possible enhancements #35
Comments
Thanks for opening the issue. Yes, it's been an ongoing process for me to add the rules and implement language detection functionality. While I've thought about it many times, I never got around to making my own pydoc parser. Really cool that you did, though! Seems to be working pretty well from reviewing the rules in #34 (thanks again for that btw). I'm definitely interesting in implementing language features. Adding them to my To-Do. What's your plan with your tool? You'll keep maintaining it for Vermin rules generation? It would be interesting to try to find and fix possible border case scenarios with different wordings for the same things. That HTML output viewer is really neat and makes for easy overview. |
Unfortunately, I cannot detect this because the information is lost since every string is unicode in py3. The AST of
|
|
Unfortunately, I cannot detect those underscores either. AST of
|
Do you consider introducing dependency to @gousaiyang and I are working on a Python backport compiler project (we call it For |
(I'm assuming that question was for @gousaiyang?) That's a cool project, @JarryShaw :) |
Proposed in #35. Ref: https://www.python.org/dev/peps/pep-0448/
As for my tool, rule generation is mostly a one-time thing (i.e. we will not go over the whole process of rule generation of Python up to version 3.8 again, we just fix errors if we find some). When a new feature release of Python come out (e.g. Python 3.9), I will just run my tool against Python 3.9 documentation and filter only changes in 3.9 and process them, which will be much less work than this time. And I will try to improve and fix bugs in my tool. |
Sounds great. 👍 |
Nah… I’m just proposing a possible solution to resolve the cases that |
Which cases are you referring to? I have already implemented detection of f-strings, positional-only arguments, and assignment expressions, if that's what you meant? :) |
Cases as @gousaiyang was talking about and you found them unsupportable due to loss of information:
Since I used to implement |
It's a good idea to maybe supplement with another parser but I'm afraid it would hit performance a lot as well as adding complexity. The reason for using Python's |
I'm going to close this issue now. If you guys come up with anything concrete, you can open a new issue. Thanks! |
Hello! Recently my friend (@JarryShaw) and I found that a lot of rules are missing in vermin. So I wrote a small tool to parse Python documentation to find
New in version ...
andChanged in version ...
indicators. Then the information can be extracted and turned into vermin rules in a semi-automated fashion (with manual inspection).Based on our result, I am adding a lot of rules in PR #34
Also, we find that these language features could also be detected, if you are interested in implementing them:
TarFile
object can be used as a context manager in a with statement)b"%x" % val
)__getattr__
and__dir__
module attributes (PEP 562)yield from
u
prefix on string123_456
)If you are interested in finding rules systematically, you can possibly refer to our results to get more information.
Note: some drawbacks of parsing the documentation:
The text was updated successfully, but these errors were encountered: