-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
print statement is highlighted by pylint #722
Comments
This is PyLint message. Extension simply outputs what PyLint produces. In 2.7 the message should appear according to PyLint docs:
However, it should not appear in 3+ then. You can suppress the message in pylintrc file. |
But it seems, that according to pylint, this message should be printed only if print is used as the statement, while it marks as an error while using print as a function. Moreover, I couldn't reproduce this with system pylint (which is installed on the same machine, as the affected VS Code):
And if I replace print() with a statement, only "Missing module docstring (missing-docstring)" notification will stay. So this is possible only if the module uses it's own pylint, which is different version from the system one. It seems, that it's my fault about reporting problem for python3 - pylint just hadn't re-read the file after changing Python version. So this problem is referenced only to python2. |
@noonedeadpunk run pylint with these arguments
|
@zerkms Yep, you're right, enabling "E" raises "print statement used". Most likely, that vscode-python used other list of enabled modules before update, as this problem appeared only after module update. And it's pretty irritating, as all of projects are highlighted due to "print statement used". But it seems, that the problem should be addressed to the pylint. |
@noonedeadpunk if you report it to the pylink could you please post a link here |
@zerkms it seems, that this actual problem with pylint started some time ago, but only now it started to annoy in vscode. Probably you know if --enable=E (or probably some other option) was added by default with the module update? So, |
I personally use |
Actually, something is really became wrong with pylint after module upgrade. I suppose, that the point is in the default flags for pylint. So, when I enabled all flags locally for file, which were kindly provided by @zerkms I recieved the following result (which is absolutely correct, except print statement error, which is seemed to be really pylint problem, when -E(--error-mode) flag is used): But if I will remove this pylint options string, all other notifications will be suppressed. If I will remove print() statement, pylint won't display suppressed problems at all. |
In this update, PyLint also stopped highlighting missing docstrings for me. Not sure if it's related or not. |
I've been experiencing a similar issue since the latest update to 2018.1. All print statements trigger As the screenshots show, pylint within VSCode and running pylint from the CLI give me different outputs. Happy to provide more detail if it's helpful |
The message comes straight from from pylint. It flags both statement and the function in 2.7. It does not flag function in 3+ but does flag the statement. I found that
So far I see if I disable the warning in pylintrc it does go away. It also does not appear in Python 3+ (in 2018.1 you'd have to reopen the file after changing interpreters or edit and save the document) |
This change is by design since many people don't care about whitespace or styling. In many editors these kind of reports are off by default. There is a setting though:
You can set it to false and the arguments you mentioned won't be passed to pylint. |
* Basic tokenizer * Fixed property names * Tests, round I * Tests, round II * tokenizer test * Remove temorary change * Fix merge issue * Merge conflict * Merge conflict * Completion test * Fix last line * Fix javascript math * Make test await for results * Add license headers * Rename definitions to types * License headers * Fix typo in completion details (typo) * Fix hover test * Russian translations * Update to better translation * Fix typo * #70 How to get all parameter info when filling in a function param list * Fix #70 How to get all parameter info when filling in a function param list * Clean up * Clean imports * CR feedback * Trim whitespace for test stability * More tests * Better handle no-parameters documentation * Better handle ellipsis and Python3 * #385 Auto-Indentation doesn't work after comment * #141 Auto indentation broken when return keyword involved * Undo changes * #627 Docstrings for builtin methods are not parsed correctly * reStructuredText converter * Fix: period is not an operator * Minor fixes * Restructure * Tests * Tests * Code heuristics * Baselines * HTML handling * Lists * State machine * Baselines * Squash * no message * Whitespace difference * Update Jedi to 0.11.1 * Enable Travis * Test fixes * Undo change * Jedi 0.11 with parser * Undo changes * Undo changes * Test fixes * Re-lint when interpreter changes * Re-lint on linter config change * Run linting command * Encapsulate jupiter * Handle promise * More tests * Tests * Use service * Linter provider tests * Move methods to documents manager
18be595 further improves this |
I'm pretty sure the old behaviour was to use the workspace .pylintrc? If not, is that possible somehow? Personally I don't care what is/isn't highlighted, as long as it is exactly equal to the things which are going to fail the linting step in my CI pipeline. |
@robhaswell See #788, it seems to be a bug. |
Forgive me, but is this resolved? I see the labels "closed-verified fixed" and "closed-fixed" had been added. Can you explain how you go about resolving this issue? |
@adgedenkers It's actually pylint bug and is caused by -E flag (pylint-dev/pylint#1869). But vscode-python has changed the way to launch pylint since the update "by design". In order to get old way of pylint you may set |
why not just disable the E1601 errors in settings? {
"python.linting.pylintArgs":
[
"–disable-msg=E1601"
]
} |
It's looking like Pylint won't be fixing this before our next release, so we will probably have to add an explicit disablement of that checker. |
If people want to help us test our fix, please install the insiders build of the extension and make sure you have Pylint 1.8 installed. |
I'm re-opening the issue as you get an extraneous error from Pylint about |
In case we have to list every
You will notice that |
So... is the only solution to have a I've tried the custom setting but it's not working. |
I think this is a good thing @MatthieuScarset. It's no different to other per-project configuration being present (e.g. The only problem is that this doesn't work as of the latest release. |
@MatthieuScarset @robhaswell We have some fixes rolling out in the next release to strengthen our detection of custom settings and thus turning off our simpler rules. And as for this specific problem, we are literally meeting about this specific bug in less than an hour to come up with a solution (if we can), so we just ask people be patient as we are actively working on this and aiming to release this week (assuming no more showstopping bugs crop up 😉 ). |
Due to a bug in Pylint where specifying `E` as enabled checks flips on `--py3k`, we need to explicitly list all `E` checkers to explicitly avoid (at least) print-statement which throws false-positives for folks not porting to Python 3. Closes microsoft#722 by partially reverting microsoft#954
Environment data
VS Code version: 1.19.3
Python Extension version: 2018.1
Python Version: 2.7, 3.5
OS and version: OS independent
Actual behavior
pylint marks print statement and print() function are marked as error on both python 2.7 and python 3.5. This behavior appeared just after module upgrade to 2018.1
Expected behavior
pylint shouldn't mark error if using print() function on any python version and print statement on python 2.7
Steps to reproduce:
print("Hello, world!")
Logs
Output from
Python
output panelOutput from
Console window
(Help->Developer Tools menu)The text was updated successfully, but these errors were encountered: