Pylint warning only shows up on Jenkins - python

When I run pylint locally, I don't see the warning. I really would not expect to see the warning at all. This occurs on at least 2 different versions of jenkins, currently running the latest version 1.576. The warning is shown in the UI using the Violations plug-in version 0.7.11 which is the latest.
This is the line of code that is tagged in the warning:
request.context.__parent__ = report # pylint: disable=W0201
And the warning it gives is 5 copies of W0201
This Warning was also disabled above in the code here:
#pylint: disable=R0901, R0904, R0914, W0201
Neither approach seems to have any effect.

Perhaps the pylintrc file is different between the machines/users.
Try copying your local ~/.pylintrc to your jenkins home folder.
Details for this are in here:
How do I disable a Pylint warning?

Related

Pylint warning typing final

I was using pylint --list-msgs and one of the warnings I got was this one:
:using-final-decorator-in-unsupported-version (W2602): *typing.final is not supported by all versions included in the py-version setting* Used when the py-version set by the user is lower than 3.8 and pylint encounters a ``typing.final`` decorator.
I couldn't understand this warning because my version in .pylintrc and in the project is: 3.11, the only reference to typing in the project is this: from typing import TypedDict
I hope first is not receive this warning, because the project don't have reference with this warning, and if possible, understand the reason for the warning
When you launch pylint --list-msgs pylint is displaying a list of all its messages, it's going to always be the same for everyone and is not related to your code. Here's the doc for this message if you want more detail about it : https://pylint.readthedocs.io/en/latest/user_guide/messages/warning/using-final-decorator-in-unsupported-version.html

Pylint considers "timeout-methods" option as unrecognised

Versions:
Python: 3.10.4
Pylint: 2.15.3
Visual Studio Code: 1.72.2
The .pylintrc file was generated using
pylint --generate-rcfile
command.
It has the following option configured:
[METHOD_ARGS]
# List of qualified names (i.e., library.method) which require a timeout
# parameter e.g. 'requests.api.get,requests.api.post'
timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request
However I see an error which sounds:
Unrecognized option found: timeout-methods Pylint(E0015:unrecognized-option)
The documentation states that option timeout-methods is supported: https://pylint.pycqa.org/en/latest/user_guide/configuration/all-options.html#timeout-methods.
So I am lost why do I have that error displayed by pylint in visual studio code.
As the comments under the original code showed, the pylint version bundled in the VS Code extension and the one that was used to generate the .pylintrc file differ.
Normally, the VS Code Pylint extension should use the pylint version installed in the Python environment that you configured to use for your project, and only falls back to the bundled version if no other pylint version was found. See also the extension docs for details.
Check the following:
Make sure that you configured the correct Python environment for your project. See Select a Python interpreter in the docs.
Make sure that you have installed pylint in the Python environment you have configured for your project, and are not accidentally using a pylint installation from your global Python environment. After configuring the Python interpreter (see step 1), once you open a new terminal in VS Code this environment should be activated by default. Run pip list | grep pylint (macOS/Linux) or pip list | findstr pylint (Windows) to check if pylint is installed.
If both 1 & 2 are fulfilled and you still have problems, check if pylint.importStrategy is maybe set to useBundled in your VS Code settings.json, and remove it or set it to fromEnvironment.
pylint 2.15 take this option into account correctly. But it was released only 2 month ago. Your error must come from the pylint version included in visual studio code that might lag a little behind and do not handle it yet.

VSCode: Linting not working on Python 2.7

System: Win x64 10.0.18363
VSCode: 1.43.2
Python: 2.7.10 32-bit
My linter just stopped working on VSCode around the time I installed flake8. I have no clue what is wrong because the linter is running it just does not print any problems. Everytime I run the linter it shows me:
C:\Python27\python.exe -m pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text "c:\ Correct Path (removed for privacy reasons)"
cwd: c:\ Correct Path (removed for privacy reasons)
(first 2 lines printed again)
##########Linting Output - pylint##########
Nothing ever gets outputted. When I switch to Python 3.8 it works perfectly and shows me all the errors as it should. It has the exact same output with just different path for Python 3.8. My settings.json include the following:
"python.pythonPath": "C:\\Python27\\python.exe",
"python.linting.pylintEnabled": true,
"python.linting.pylintUseMinimalCheckers": true,
"python.linting.enabled": true,
"python.linting.mypyEnabled": false,
I tried every settings I could, but there is no difference. I tried over 5 linters and they all do the same thing. I just get no output whatsoever on my console anymore and I don't know why. It was working before so I know it is not any path issues.
The only hint I have, is that if I go to developer tools, there is an error on line 173 of console.ts
Error Python Extension: 2020-03-29 21:56:02: stderr jediProxy Error (stderr) completion.py:586: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
jedi.api.names(
for the code:
(console as any)[entry.severity].apply(console, consoleArgs);
// underlined red is -> 'apply(console, consoleArgs);'
I tried googling this error, but I was not getting anything that was on my particular problem. Any help would be great.
EDIT
I found a temporary solution after a few hours. It is to simply turn off Jedi. You have to go to settings and find Python: Jedi Enabled and turn it off. I say it is temporary as I would prefer to have Jedi on so I will not answer my question just yet. This seems like a new bug so I hope this helps others.
It should be a Jedi version issue, I solve it by specifying the version.
pip install jedi==0.15.2

how to disable a nosetest plugin

I don't want a coverage report so I uninstalled 'pip uninstall coverage' plugin. However I still get an error saying:
nose.plugins.cover: ERROR: Coverage not available: unable to import coverage module
How do I disable the calling of this plugin, or any other plugin for that matter. Is there a list of enabled plugins that I can edit, or some api I can call to disable it?
Thanks.
Check your ~/.noserc file, it is likely, you have there entries related to uninstalled plugin.
I am able to reproduce your problem if I have in the ~/.noserc:
[nosetests]
with-coverage=1
but it happens also, if I have there
[nosetests]
with-coverage=0
If I remove it, the problem is resolved.
The file can be also located in your working directory.

Overriding --errors-only=yes specified in rcfile

I use paver to run pylint as a task. In my rcfile(pylintrc) I have configured pylint to report only errors by setting errors-only=yes.
But I like to run paver pylint task with a verbose option to get it to report non-errors as well. How can I run pylint overriding the errors-only=yes setting?
Running with --errors-only=no gives an exception indicating that the --errors-only cannot be given a value. --enable=all also does not work.
This is an unexpected restriction that deserve an issue on the pylint's tracker (https://bitbucket.org/logilab/pylint/issues).
Though to get it works properly in your case, I would use a custom rc file for the task that wouldn't be used in my daily usage, eg pylint --rcfile=task.pylinrc ...

Categories

Resources