How to suppress errors found by pyflakes in Spyder 4
See original GitHub issueProblem Description
This is from a post I made at the “Spyder” Google Groups. Carlos recommended I open an issue here. The post is as follows:
I just updated to Spyder 4. Nice job developers-- many of the new features (code folding,…) are very useful.
On much of my existing code files that work fine, pyflakes now identifies errors. They appear as red circles in the left margin of the editor. The error message is “Undefined name 'funcname” (pyflakes E)". The errors are because the imports of functions “funcname” are done in an exec statement; I know, I know, using exec like this isn’t good form, but I do have my reasons, and this post is about pyflakes more generally than just this specific type of error.
Here are my questions:
-
In the past, other linters or code analysis tools have similarly flagged these same lines for errors, for the same reason. I have been suppressing those error notifications/messages successfully by adding " # analysis:ignore " to the end of the line. Is there a similar way to suppress the pyflakes errors (" # analysis:ignore " does not work)? This sort of solution is really what I need, otherwise I will want to turn pyflakes off. I tried " # NOQA" but it apparently doesn’t work. I did some searching around for info on this but came up empty.
-
Is there a pyflakes config file somewhere, in which I can suppress this particular error wherever it occurs?
-
Is there a way to just turn pyflakes off? I could not find it in Preferences.
Secondary question:
- When I hover my mouse over the red circle, a pop-up box appears, not adjacent to the red circle but some distance away to the right, showing the error message. The pop-up also has a red X in the corner as if I could click it to suppress the error. As soon as I move my mouse off the red circle, towards pop-up in order to attempt to click the red X, the pop-up disappears (because it is not directly adjacent to the red circle in the left margin). So… I can never actually get my mouse over the red X. Is this the intended behavior? Is the red X meant to enable clicking to suppress the error, or not? Only curious about this; these are such common errors that I doubt I would ever click each pop-up.
## Versions
Python 3.6.7 64-bit | Qt 5.9.7 | PyQt5 5.9.2 | Windows 10
* Spyder version: 4
* Python version: 3.6.7
* Operating System name/version: Windows 10
About my Qt, PyQt, and dependencies, I already rolled back to Spyder 3 so in order to get them for Spyder 4 I will need to reestablish a new conda env; if this is truly necessary I can do it.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:19 (11 by maintainers)
Top GitHub Comments
Sorry for the long time it took us to fix this. It’ll be available since our 5.1.0 version, to be released at the end of July.
Please see PR #15927 for the inline comments we will support on that version to skip linting messages.
We’re also considering to add support for Pylint, but as an advanced linter because it usually requires a config file to be usable (it lints way too many stuff).