Skip to content
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

Pylint 3.2 #1328

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Pylint 3.2 #1328

wants to merge 3 commits into from

Conversation

alecandido
Copy link
Member

With Pylint 3.2 the E0606 error is being raised in a few places, i.e.:

Emitted when a local variable is accessed before its assignment took place in both branches of an if/else switch.

As it was found in #1282 (comment).
The current solution has been to block Pylint updates, but this is not great.

I tried to fix the error in a few places, by various mechanisms, but there is a common source for this: the raise_error function.

Unfortunately, Pylint is not being able to detect that the raise_error function is just raising an error, and so the respective branches in the various ifs will never return.
I tried to tell it through the typing.NoReturn hint (better called Never, but only from py3.11 on...), but it didn't work.

The simple option is to keep applying fixes like the one showcased here for the few missing cases, and just upgrade Pylint.
The other two, more drastic, options are:

  • give up on raise_error, and just stick to the built-in raise
  • consider using a different linter, like ruff

Both of them are feasible, but both of them would require non-negligible effort (the first is spread throughout the whole codebase, and dependent packages - though we are already considering removing in other places because of #1117 - and the second requires workflows upgrades, and possibly further lints to fix).

@alecandido alecandido mentioned this pull request May 19, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant