Comments (12)
We can add an API by extending the MessageDefinition
class with a doc_url
attribute for this purpose. Two possibilities, one it's a plugin with a custom url:
msgs = {
'E9999': ('description',
'message-symbol',
'Message ....',
{'doc_url': 'https://custom_url/...'}),
}
Here the doc_url
is going to be https://custom_url/...
. Second possibilitie the standard case, where nothing is defined like in all checkers and plugin at the moment:
msgs = {
'E4999': ('description',
'message-symbol',
'Message ....',
}
Here we use the hardcoded version "https://pylint.readthedocs.io/en/latest/user_guide/messages" + what is done in https://github.com/microsoft/vscode-pylint/pull/298/files#diff-6946ea5cbaa105f584c64a7a929c675768847c8e05c86ce965ca8daa18f0ac73R140-R145. (We could even treat plugin/builtin checkers differently).
Then we create a merge request in vscode-pylint
where we get the MessageDefinition from the MessageStore (with a default to current behavior in pylint-vscode when has_attr(message_definition, "doc_url")
is False
so older pylint versions do not crash).
Everything fall into place when we release a version of pylint with the new API.
from pylint.
I don't think we want to provide a link to our own documentation in pylint message from the CLI. This would be very verbose and I don't think a lot of person are checking the full message description in the CLI anyway. But in the vs-code pylint plugin we (actually @DudeNr33) hard-coded the url and I think this is bringing a lot of value to users (microsoft/vscode-pylint#298). Making it dynamic would be very nice for pylint plugin integrated in IDE. Reopening for discussion let me know what you think @DanielNoord :)
from pylint.
@Pierre-Sassoulas Thanks for the hint, I just now realized that this was actually what I was talking about (I am using vscode with pylint-extension). I assumed this was part of pylint.
If there is a way to solve it so the extension shows the correct link I would be very happy. Thanks!
from pylint.
It could definitely work but we're not even sure whether the extension would be open to such version dependent functionality.
To me it seems like we can easily make poor api decisions because we just don't really know what sort of edge cases we would need to account for. Since this is the first request for such a feature I would wait to see if there is more demand and whether those demands fall within the proposed api.
from pylint.
Will the plugin be part of the main codebase? Or are you hosting it yourself?
from pylint.
No, it is a custom plugin only intended for use within our company. The html docs will be hosted on our own internal server.
from pylint.
Then I don't really know how your base URL would work. Are you hosting the pylint
docs yourself as well?
from pylint.
No, only the docs for my plugin.
from pylint.
Then I don't think you can link anywhere. The documentation for each message is autogenerated in our CI/doc build and then uploaded to readthedocs
. You can do the same (it's just a make
file the in the docs directory) and then host those files somewhere.
There is no way for the publicly available pylint
docs to know it should host information about your private plugin.
from pylint.
I thought a solution could be to provide custom URLs directly to the msg-dict:
msgs = {
'E9999': ('description',
'message-symbol',
'Message ....',
{'custom_url': 'https://custom_url/...'}),
}
Which would mean that the class ExtraMessageOptions
would need an extra property custum_url
or sth. similiar.
from pylint.
Can't you put the URL in the message then?
from pylint.
I mean it would be nice, but I don't really see how it could be so. The VS Code plugin hardcodes the domain currently and doesn't have access to the pylint
source code. I'm not quite sure how we will propagate this information and how the plugin should infer that that data is available.
from pylint.
Related Issues (20)
- Pylint does not discover a NoReturn method in certain cases to avoid "inconsistent-return-statements" HOT 3
- False positive for `use-yield-from` for generators yielding from iterators
- pylint crashing with `concurrent.futures.process.BrokenProcessPool` HOT 3
- E0606: detect validation done in external function HOT 6
- Crash ``Building error when trying to create ast representation of module 'aws_cp.__init__'`` HOT 1
- Crash ``Building error when trying to create ast representation of module 'aws_cp.aws'``
- Crash ``Building error when trying to create ast representation of module 'aws_cp.app'``
- pylint cannot find third-party packages in virtual environment HOT 3
- False Positive W0143-comparison-with-callable when using derived property descriptors
- Documentation about `class-const` needs to be updated.
- PEP 695: Type Parameter Syntax HOT 1
- pylint not finding the tox.ini config HOT 12
- [not-an-iterable] FP for attribute used in comprehension but guarded in if test HOT 2
- PyTest FixtureRequest
- Feature Request: Have multiple types for a naming-style HOT 2
- Support disabling possibly-used-before-assignment in-line for specific variables HOT 2
- `@overload` causes `missing-param-doc` despite parameter being documented HOT 1
- False positive unnecessary-negation for float comparison HOT 2
- Import error with Python 3.11 HOT 7
- Pylint is not smart enough when analyzes functions returning coroutine. HOT 5
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.