globality-corp / flake8-logging-format

Flake8 extension to validate (lack of) logging format strings
Apache License 2.0
134 stars 21 forks source link

support for Twisted logging linting? #13

Open glyph opened 5 years ago

glyph commented 5 years ago

Twisted's logger is quite similar in the syntax it supports (and given that it always uses format strings, and all kwargs go to fill it out, this might be even easier)?

We'd really love to have a linter that could address both of these. Would you consider adding support for https://twistedmatrix.com/documents/18.9.0/api/twisted.logger.html ? We've been discussing ways to catch and remove f-strings, .format calls, etc, and this is super close.

jessemyers commented 5 years ago

We'd happily accept a PR along those lines. Lacking that, if you can write a (failing) unit test, I can likely update the AST traversal accordingly.

tobixx commented 1 year ago

As this is the only twisted related issue I would like to add a false-positive: The

G010 [*] Logging statement uses `warn` instead of `warning`

If the logger is twisted.logger.Logger this is not the case, as there is only warn: https://docs.twisted.org/en/latest/api/twisted.logger.Logger.html#warn