32 "SimplifyChecker", |
32 "SimplifyChecker", |
33 '''Handle error-cases first'''), |
33 '''Handle error-cases first'''), |
34 "Y107": QCoreApplication.translate( |
34 "Y107": QCoreApplication.translate( |
35 "SimplifyChecker", |
35 "SimplifyChecker", |
36 '''Don't use return in try/except and finally'''), |
36 '''Don't use return in try/except and finally'''), |
37 "Y108": QCoreApplication.translate( |
37 "Y108a": QCoreApplication.translate( |
38 "SimplifyChecker", |
38 "SimplifyChecker", |
39 '''Use ternary operator "{0} = {1} if {2} else {3}"''' |
39 '''Use ternary operator instead of if-else-block'''), |
|
40 "Y108b": QCoreApplication.translate( |
|
41 "SimplifyChecker", |
|
42 '''Use ternary operator "{0} = {1} if {2} else {3}" ''' |
40 '''instead of if-else-block'''), |
43 '''instead of if-else-block'''), |
41 "Y109": QCoreApplication.translate( |
44 "Y109": QCoreApplication.translate( |
42 "SimplifyChecker", |
45 "SimplifyChecker", |
43 '''Use "{0} in {1}" instead of "{2}"'''), |
46 '''Use "{0} in {1}" instead of "{2}"'''), |
44 "Y110": QCoreApplication.translate( |
47 "Y110": QCoreApplication.translate( |
61 '''Use context handler for opening files'''), |
64 '''Use context handler for opening files'''), |
62 "Y116": QCoreApplication.translate( |
65 "Y116": QCoreApplication.translate( |
63 "SimplifyChecker", |
66 "SimplifyChecker", |
64 '''Use a dictionary lookup instead of 3+ if/elif-statements: ''' |
67 '''Use a dictionary lookup instead of 3+ if/elif-statements: ''' |
65 '''return {0}'''), |
68 '''return {0}'''), |
|
69 "Y117": QCoreApplication.translate( |
|
70 "SimplifyChecker", |
|
71 '''Use "{0}" instead of multiple with statements'''), |
|
72 "Y118": QCoreApplication.translate( |
|
73 "SimplifyChecker", |
|
74 '''Use "{0} in {1}" instead of "{0} in {1}.keys()"'''), |
|
75 "Y119": QCoreApplication.translate( |
|
76 "SimplifyChecker", |
|
77 '''Use a dataclass for "class {0}"'''), |
66 } |
78 } |
67 |
79 |
68 _simplifyMessagesSampleArgs = { |
80 _simplifyMessagesSampleArgs = { |
69 "Y101": ["foo"], |
81 "Y101": ["foo"], |
70 "Y103": ["foo != bar"], |
82 "Y103": ["foo != bar"], |
71 "Y104": ["iterable"], |
83 "Y104": ["iterable"], |
72 "Y105": ["Exception"], |
84 "Y105": ["Exception"], |
73 "Y108": ["foo", "bar", "condition", "baz"], |
85 "Y108b": ["foo", "bar", "condition", "baz"], |
74 "Y109": ["foo", "[1, 42]", "foo == 1 or foo == 42"], |
86 "Y109": ["foo", "[1, 42]", "foo == 1 or foo == 42"], |
75 "Y110": ["check", "foo", "iterable"], |
87 "Y110": ["check", "foo", "iterable"], |
76 "Y111": ["check", "foo", "iterable"], |
88 "Y111": ["check", "foo", "iterable"], |
77 "Y112": ["FOO", "foo"], |
89 "Y112": ["FOO", "foo"], |
78 "Y113": ["foo"], |
90 "Y113": ["foo"], |
79 "Y114": ["foo > 42", "bar < 42"], |
91 "Y114": ["foo > 42", "bar < 42"], |
80 "Y116": ["mapping.get(foo, 42)"] |
92 "Y116": ["mapping.get(foo, 42)"], |
|
93 "Y117": ["with Foo() as foo, Bar() as bar:"], |
|
94 "Y118": ["foo", "bar_dict"], |
|
95 "Y119": ["Foo"] |
81 } |
96 } |