-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[FEATURE REQUEST] Incorporate lint for log messages in __virtual__ #57730
Comments
Support was added for this in saltstack/salt-pylint#37. However, I ran into a couple of obstacles trying to add it. Salt's dunders blow up the checkE.g. salt/salt/modules/linux_service.py Lines 18 to 56 in b95213e
Log message in missing import blocks aren't foundsalt/salt/returners/appoptics_return.py Lines 83 to 108 in b95213e
If I add: log.info('foo') at the top of
|
Opened saltstack/salt-pylint#42, which hopefully will help move this forward. This is blocked until that's fixed. |
Is your feature request related to a problem? Please describe.
Community contributors (and maybe Salt devs, too) add well-meaning logs to
__virtual__
methods, typically to highlight that a module could not be loaded. However, these messages will show up very frequently in the logs, which is especially problematic if the logs are errors (see, e.g. #57723). The supported solution is to return a tuple(False, 'the log message')
from__virtual__
.Describe the solution you'd like
Use pylint to detect use of
logging
in__virtual__
methods. Enforce this via CI and inpre-commit
.Describe alternatives you've considered
Status quo.
The text was updated successfully, but these errors were encountered: