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
About pylint configuration #102
Comments
No. :) ... the intention must be "improve the code" .. disabling messages for all files means: we do not want to improve the code / even in new files (new development). Engines and Plugins are special and need a different treatment.
It will not help for existing files, except we add documentation to existing functions, but this is a hard job and includes the risk to fail.
Engines and Plugins have name injections and need their own .pylintrc file where e.g. things names like
For me a line on the top of a python file like::
indicates, that this file is much improvable.
It will help to maintain .. by example: this is an example for a usefull module-doc-string of an engine: searxng/searx/engines/google_videos.py Lines 5 to 20 in b1da97d
On the long term we can include such doc-strings into the docs-build, but ATM we only have rare useful doc-strings. I haven't found one for the request & response function. But here is an example where such a doc-string is needed to understand why a http header is added: searxng/searx/engines/wolframalpha_api.py Lines 44 to 46 in b1da97d
We will always have situations that an automated Lint process cannot capture from a technical point of view. Here, we have to think about workarounds. Adding "pylint-dissable" remarks might be annoying sometimes, but it is one workaround, that is available everywhere. Over all: For me, the .pylintrc file is the "holly grail". This file defines the quality I strive for. For me improving code-quality is an ongoing process. Comments disabling some pylint messages are a warning sign that something can be improved here. The improvable code could remain over a long time. If there comes a day this code needs to be touched for some other reasons (e.g. a bugfix) I will also fix the lacks reported by pylint. Since I can't lint only a hunk of a file, I first lint the whole file (adding comments to disable some linter messages). After this, I implement my new code in this file. This assures that my new code is conform to my "holly grail". |
For me it works (edit to BTW, I was looking here for anything I can improve, but don't see what can be improved. What do you think, is there anything left we can improve to to get this issue closed? .. do you miss something? |
My bad, it works without So why add |
We have engines tagged with Since 7b235a1 (see line 591) this should no longer bee needed .. I will send a PR which cleans up this. |
Another point: what about
Do we need pylint to require documentation? If it makes sense to add documentation to a function we can add it without pylint especially since:
|
Since 7b235a1 (see line 591) it is no longer needed to disable 'undefined-variable' for names defined in:: PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES Suggested-by: @dalf searxng#102 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
androp no longer needed (see line 591 in 7b235a1):: # pylint: disable=undefined-variable Suggested-by: @dalf searxng#102 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
IMO engines are always very special and I would enforce developers to document the engine. We have done this already for some engines: From this point of view I think it is good to raise a pylint messages when an engine is not documented (for historical or whatever reason) but tagged with a For those engine files not tagged the by
Where we disable |
Why when in most of the cases there is no documentation to add? What will happen:
and we go back to the review. |
I have a different opinion, I think there is always something to document about the engine and how it works.
By example: if I develop a complete new engine module and want to have a strict pylint test ... Lines 604 to 607 in 9ef7f38
I tag the file by Lines 19 to 29 in 9ef7f38
If do not want to have a strict pylint test I leave the file untagged. This file will then be tested with additional Lines 609 to 613 in 9ef7f38
If I have tagged my engine by by |
My opinion:
I'm just talking about the docstring rules for the engines, not the whole pylint configuration. But I understand this is not your opinion. |
OK, that is an argument I can understand .. I reopen this issue and will send a PR which cleans up the |
Suggested-by: @dalf searxng#102 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Suggested-by: @dalf searxng#102 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Suggested-by: @dalf searxng#102 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Here a command to get some statistics:
$ git grep "pylint: disable=" | cut -f2 -d\# | cut -f2 -d\= | tr , '\n' | sed 's/^ *//' | sort | uniq -c | sort -nr
cut -f2 -d\#
: the comment at the end of line (can be broken)cut -f2 -d\=
: afterpylint: disable=
tr , '\n'
: split coma separated values into multi linessed 's/^ *//'
: trim spacesResult:
.pylintrc to update (?)
missing-function-docstring
: 17 occurrences forsearx.engines.*
. Currently the pattern# pylint: disable=missing-function-docstring
at the top of the file doesn't help in my opinion. Documentation about therequest
andresponse
functions doesn't help. But documentation about custom functions can help. It is only my opinion.unused-import
: all related to import_fetch_supported_languages, supported_languages_url
: I would disabledunused-import
forsearx.engines.*
or find a way to tell pylint that_fetch_supported_languages
,supported_languages_url
are actually used.global-statement
: do we really need a reminder about global variable usage?actual issue:
invalid-name
is actually not required insearx.engines.*
(7 occurrences / 9).no-member
: related to preferences.py (see constructor)assigning-non-slot
: all related torequest.something =
, actually it should beg.something =
.manage
script issue:undefined-variable
is not required since there is PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES, but for some reason it is ignored: it is a bug.The text was updated successfully, but these errors were encountered: