|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2023 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 |
|
7 """ |
|
8 Module implementing message translations for the code style plugin messages |
|
9 (logging part). |
|
10 """ |
|
11 |
|
12 from PyQt6.QtCore import QCoreApplication |
|
13 |
|
14 _loggingMessages = { |
|
15 ## Logging format |
|
16 "L101": QCoreApplication.translate( |
|
17 "LoggingChecker", |
|
18 "logging statement uses string.format()", |
|
19 ), |
|
20 "L102": QCoreApplication.translate( |
|
21 "LoggingChecker", |
|
22 "logging statement uses '%'", # __IGNORE_WARNING_M601__ |
|
23 ), |
|
24 "L103": QCoreApplication.translate( |
|
25 "LoggingChecker", |
|
26 "logging statement uses '+'", |
|
27 ), |
|
28 "L104": QCoreApplication.translate( |
|
29 "LoggingChecker", |
|
30 "logging statement uses f-string", |
|
31 ), |
|
32 "L110": QCoreApplication.translate( |
|
33 "LoggingChecker", |
|
34 "logging statement uses 'warn' instead of 'warning'", |
|
35 ), |
|
36 "L121": QCoreApplication.translate( |
|
37 "LoggingChecker", |
|
38 "logging statement uses an extra field that clashes with a LogRecord field: {0}" |
|
39 ), |
|
40 "L130": QCoreApplication.translate( |
|
41 "LoggingChecker", |
|
42 "logging statement uses exception in arguments" |
|
43 ), |
|
44 "L131": QCoreApplication.translate( |
|
45 "LoggingChecker", |
|
46 "logging: .exception(...) should be used instead of .error(..., exc_info=True)" |
|
47 ), |
|
48 "L132": QCoreApplication.translate( |
|
49 "LoggingChecker", |
|
50 "logging statement has redundant exc_info" |
|
51 ), |
|
52 } |
|
53 |
|
54 _loggingMessagesSampleArgs = { |
|
55 "L121": ["pathname"] |
|
56 } |