pylint-bot / pylint-unofficial

UNOFFICIAL playground for pylint github migration
0 stars 0 forks source link

Way to analyze docstring and comments #42

Open pylint-bot opened 11 years ago

pylint-bot commented 11 years ago

Originally reported by: BitBucket: mitar, GitHub: @mitar?


It would be great if there would be a way to access docstrings and comments in their native context. For example, here are some checks I would like to do:


pylint-bot commented 11 years ago

Original comment by Sylvain Thénault (BitBucket: sthenault, GitHub: @sthenault?):


did you take a look at the "raw checker" concept, which are designed for such task where you need low level information not present at the AST level (eg the "format" checker) ?

pylint-bot commented 11 years ago

Original comment by BitBucket: mitar, GitHub: @mitar?:


I did that, but it seems a lot of work. So probably I am not the only one to try to analyze comments as well and I think pylint should have some help for that. And I had some issues getting the whole code to process almost manually.

Here is my current code (not using raw):

https://github.com/wlanslovenija/nodewatcher/blob/development/nodelint.py#L104

So what I would propose is that along with current storing of docstrings, a docstring_raw or something would be stored, which would have """ and all empty lines before and after the docstring.

And same for comments. They could be added to the parse tree as comment (comment content) or comment_raw for including all space before and after the comment, including #.