diff -r 6244c89dbc3f -r b189ca1f5d53 src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/translations.py --- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/translations.py Thu Nov 30 17:48:55 2023 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/translations.py Fri Dec 01 16:19:15 2023 +0100 @@ -12,46 +12,85 @@ from PyQt6.QtCore import QCoreApplication _loggingMessages = { - ## Logging format + ## Logging "L101": QCoreApplication.translate( "LoggingChecker", - "logging statement uses string.format()", + "use logging.getLogger() to instantiate loggers", ), "L102": QCoreApplication.translate( "LoggingChecker", - "logging statement uses '%'", # __IGNORE_WARNING_M601__ + "use '__name__' with getLogger()", ), "L103": QCoreApplication.translate( "LoggingChecker", - "logging statement uses '+'", + "extra key {0} clashes with LogRecord attribute", ), "L104": QCoreApplication.translate( "LoggingChecker", - "logging statement uses f-string", + "avoid exception() outside of exception handlers", + ), + "L105": QCoreApplication.translate( + "LoggingChecker", + ".exception(...) should be used instead of .error(..., exc_info=True)", + ), + "L106": QCoreApplication.translate( + "LoggingChecker", + "redundant exc_info argument for exception() should be removed", + ), + "L107": QCoreApplication.translate( + "LoggingChecker", + "use error() instead of exception() with exc_info=False", + ), + "L108": QCoreApplication.translate( + "LoggingChecker", + "warn() is deprecated, use warning() instead", + ), + "L109": QCoreApplication.translate( + "LoggingChecker", + "WARN is undocumented, use WARNING instead", ), "L110": QCoreApplication.translate( "LoggingChecker", - "logging statement uses 'warn' instead of 'warning'", + "exception() does not take an exception", ), - "L121": QCoreApplication.translate( + "L111a": QCoreApplication.translate( + "LoggingChecker", + "avoid pre-formatting log messages using f-string", + ), + "L111b": QCoreApplication.translate( "LoggingChecker", - "logging statement uses an extra field that clashes with a LogRecord field:" - " {0}", + "avoid pre-formatting log messages using string.format()", ), - "L130": QCoreApplication.translate( + "L111c": QCoreApplication.translate( + "LoggingChecker", + "avoid pre-formatting log messages using '%'", # noqa: M601 + ), + "L111d": QCoreApplication.translate( "LoggingChecker", - "logging statement uses exception in arguments", + "avoid pre-formatting log messages using '+'", ), - "L131": QCoreApplication.translate( + "L112": QCoreApplication.translate( + "LoggingChecker", + "formatting error: {0} {1} placeholder(s) but {2} argument(s)", + ), + "L113a": QCoreApplication.translate( "LoggingChecker", - "logging: .exception(...) should be used instead of .error(..., exc_info=True)", + "formatting error: missing key(s): {0}", ), - "L132": QCoreApplication.translate( + "L113b": QCoreApplication.translate( "LoggingChecker", - "logging statement has redundant exc_info", + "formatting error: unreferenced key(s): {0}", + ), + "L114": QCoreApplication.translate( + "LoggingChecker", + "avoid exc_info=True outside of exception handlers", ), } _loggingMessagesSampleArgs = { - "L121": ["pathname"], + ## Logging + "L103": ["'pathname'"], + "L112": [3, "'%'", 2], # noqa: M601 + "L113a": ["'foo', 'bar'"], + "L113b": ["'foo', 'bar'"], }