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
allow-global-unused-variables
doesn't respect dummy-variables-rgx
#8174
Labels
Duplicate 🐫
Duplicate of an already existing issue
Comments
swirle13
added
the
Needs triage 📥
Just created, needs acknowledgment, triage, and proper labelling
label
Feb 2, 2023
I think this is a duplicate of #8013 |
Pierre-Sassoulas
added
Duplicate 🐫
Duplicate of an already existing issue
and removed
Needs triage 📥
Just created, needs acknowledgment, triage, and proper labelling
labels
Feb 2, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug description
Pylint will throw a warning,
unused-variable
, for any unused variables/functions whenallow-global-unused-variables
is enabled, even if the variable/function matchesdummy-variables-rgx
.The main use case for this is disallowing global variables but allowing unused top level functions. Specifically, I'm running into this issue in AWS Lambda functions, which always have an "unused" global function,
def lambda_handler(event, context):
. I'm running into this issue in a few different scenarios, and our team rules dictate we can't use any globally defined variables, but require top level functions for other packages to use, so this isn't specifically restricted to AWS Lambda code.I am aware of using
# pylint: disable=unused-variable
but the team has strict rules about what is left in the code, and we'd rather not have these in here. We'd prefer to be able to control what values do/don't trip theunused-variable
warning via our control file via a regex, whichdummy-variables-rgx
seemed to be the solution.I really wish there was a distinction between unused variables and unused functions, either by option or separate rule.
Configuration
No response
Command used
Pylint output
Expected behavior
I would expect any global variables that match the
dummy-variables-rgx
would be excluded from disallowed global variables.Pylint version
OS / Environment
macOS Monterey v12.6.3
zsh 5.8.1 (x86_64-apple-darwin21.0)
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: