Comments (3)
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) ?
from pylint.
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 #
.
from pylint.
Closing this one. This can be done currently using the TokenChecker concept. It's a bit of work, yes, but it works. While do want to include the comments at some point into the AST, by bringing a new parser, they will be definitely cleaned up, since the plan is to use them for pragma disables, type comments or just general introspection of the code through the AST. Thus they won't contain the empty lines or spaces before them, this is far more suited to be in the current TokenChecker than in the AST (and they are there right now, by implementing the process_tokens).
from pylint.
Related Issues (20)
- Crash: Fatal error while checking 'models.py' HOT 1
- ``astroid.exceptions.AstroidError thrown when typing NoReturn is imported`` HOT 1
- Detect useless f-strings HOT 7
- E1520 recommends an invalid combination of `@singledispatch` and `@staticmethod`
- Detect possible simplifications using walrus HOT 1
- False positive `deprecated-class` when the class is imported in a guarded import block
- AstroidError HOT 5
- Pylint doesn't run in parallel if -j=0 is specified HOT 5
- Erroneous `not-an-iterable` when inheriting from `NamedTuple` HOT 3
- Add a specifier for alerts that are linked to a library HOT 36
- Crash from typing import Optional HOT 2
- "no-member" not triggered for C-extension member but "--unsafe-load-any-extension=y"
- Crash ``'FunctionDef' object has no attribute 'ancestors'`` HOT 3
- Pylint 3.1.0 test failure with pytest 7 HOT 1
- pylint 3.1.0 test failure with pytest 8.1.1 HOT 4
- false negative "too-many-arguments" HOT 5
- pylint Crash with AstroidError "StatementMissing: Statement not found on" HOT 2
- False positive unsubscriptable-object HOT 6
- Pylint crash on a simple program HOT 1
- Invalid no-name-in-module error when using lazy_loader HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylint.