-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
checks: Flake8 F841 fixes in the wxpython directory part 3 #4261
Conversation
@wenzeslaus or @echoix not sure about the pylint vs noqa |
W0612 is a Pylint equivalent of unused variable. |
Flake8 does not recognize the Pylint syntax, and vice versa. I've used the Flake8 syntax to suppress warnings. If you decide to use both linters, I need to add pylint syntax in addition to "noqa:". Since Ruff is an extension of Flake8, using "noqa:" should be no problem. So, the question is what linter is best for development, Ruff and/or Flake8 or Ruff and/or Flake8 and Pylint? |
They serve different purposes. Most notably, Pylint is able to do more complex checks, as it is not a pure static analyzer. It actually imports the files, and can use some information about the types of the variables that can't be known by only checking one file as text. It can also do multi-file analysis. On the other side, ruff reimplements (in rust, not Python), the most important and useful rules from multiple linters+popular plugins, and is real fast. But, it is static only and is (for now) only able to do single-file analysis. Flake8 checks only some rules. Flake8, (like Pylint), has different plugins available. Pylint does not fix issues, flake8 I'm not sure, but at least not with flake8 itself but another tool. Ruff has some rules that have fixes available. Then, about having both. I saw some two interesting issues but I don't seem to see the conclusion: You might want to check a bit more closely either on a search engine or following the links on what was done. Keep in mind that we are still stuck with a really old Pylint |
At this very point, if ignoring is needed and the choice needs to be made between ignoring with pylint and noqa, we need to go with noqa because this will satisfy the automated checks in the CI (while Pylint is only enforced for a handful of issues). (Given that these can't be combined right now as @echoix points out.) |
It seems okay to keep only Flake8 syntax not Pylint, but does it change if Pylint syntax can also be used with Flake8 syntax? I'm asking this since it is possible.
I tested it by adding and removing It worked as expected for both flake8 and pylint. Let me know if this changes to add Pylint syntaxes. |
If you are able to, try it! And if the version of Pylint we use doesn't complain, it's good! (We don't use Pylint v3.x yet) |
My comment was meant for the old Pylint in CI. I'm all for making it work with both, so whatever combo of |
…fo()` as suggested
Description
Flake8 F841 (local variable assigned to but never used) fixes in the
gui/wxpython/gpc
andgui/wxpython/gui_core
directory.Motivation and context
Changes require resolving a part of Flake8 warnings that are currently ignored. The issue title and number as follows.
How has this been tested?
g.gui.gpc: Briefly tested using GUI and worked fine
gui_core: N/A
Types of changes
# pylint: disable=W0612
with# noqa: F841
ingui_core/treeview.py
. Please let me know if you want to keep "# pylint". It looks a little odd, but adding# noqa:
to the end of code doesn't work. It must be the first line with multiline, like below.Checklist