allow-global-unused-variables
doesn't respect dummy-variables-rgx
#8174
Labels
Duplicate 🐫
Duplicate of an already existing issue
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: