42 "Y109": QCoreApplication.translate( |
42 "Y109": QCoreApplication.translate( |
43 "SimplifyChecker", |
43 "SimplifyChecker", |
44 '''Use "{0} in {1}" instead of "{2}"'''), |
44 '''Use "{0} in {1}" instead of "{2}"'''), |
45 "Y110": QCoreApplication.translate( |
45 "Y110": QCoreApplication.translate( |
46 "SimplifyChecker", |
46 "SimplifyChecker", |
47 '''Use "return any({0} for {1} in {2})"'''), |
47 '''Use "any({0} for {1} in {2})"'''), |
48 "Y111": QCoreApplication.translate( |
48 "Y111": QCoreApplication.translate( |
49 "SimplifyChecker", |
49 "SimplifyChecker", |
50 '''Use "return all({0} for {1} in {2})"'''), |
50 '''Use "all({0} for {1} in {2})"'''), |
51 "Y112": QCoreApplication.translate( |
51 "Y112": QCoreApplication.translate( |
52 "SimplifyChecker", |
52 "SimplifyChecker", |
53 '''Use "{0}" instead of "{1}"'''), |
53 '''Use "{0}" instead of "{1}"'''), |
54 "Y113": QCoreApplication.translate( |
54 "Y113": QCoreApplication.translate( |
55 "SimplifyChecker", |
55 "SimplifyChecker", |
77 "SimplifyChecker", |
77 "SimplifyChecker", |
78 '''Use "class {0}:" instead of "class {0}(object):"'''), |
78 '''Use "class {0}:" instead of "class {0}(object):"'''), |
79 "Y121": QCoreApplication.translate( |
79 "Y121": QCoreApplication.translate( |
80 "SimplifyChecker", |
80 "SimplifyChecker", |
81 '''Use "class {0}({1}):" instead of "class {0}({1}, object):"'''), |
81 '''Use "class {0}({1}):" instead of "class {0}({1}, object):"'''), |
|
82 "Y122": QCoreApplication.translate( |
|
83 "SimplifyChecker", |
|
84 '''Use "{0}.get({1})" instead of "if {1} in {0}: {0}[{1}]"'''), |
82 |
85 |
83 # Python-specifics not part of flake8-simplify |
86 # Python-specifics not part of flake8-simplify |
84 "Y181": QCoreApplication.translate( |
87 "Y181": QCoreApplication.translate( |
85 "SimplifyChecker", |
88 "SimplifyChecker", |
86 '''Use "{0}" instead of "{1}"'''), |
89 '''Use "{0}" instead of "{1}"'''), |
135 '''Use "True" instead of "... or True"'''), |
138 '''Use "True" instead of "... or True"'''), |
136 "Y224": QCoreApplication.translate( |
139 "Y224": QCoreApplication.translate( |
137 "SimplifyChecker", |
140 "SimplifyChecker", |
138 '''Use "False" instead of "... and False"'''), |
141 '''Use "False" instead of "... and False"'''), |
139 |
142 |
|
143 # Opinionated |
140 "Y301": QCoreApplication.translate( |
144 "Y301": QCoreApplication.translate( |
141 "SimplifyChecker", |
145 "SimplifyChecker", |
142 '''Use "{1} == {0}" instead of "{0} == {1}" (Yoda-condition)'''), |
146 '''Use "{1} == {0}" instead of "{0} == {1}" (Yoda-condition)'''), |
|
147 |
|
148 # General Code Style |
|
149 "Y401": QCoreApplication.translate( |
|
150 "SimplifyChecker", |
|
151 '''Use keyword-argument instead of magic boolean'''), |
|
152 "Y402": QCoreApplication.translate( |
|
153 "SimplifyChecker", |
|
154 '''Use keyword-argument instead of magic number'''), |
143 } |
155 } |
144 |
156 |
145 _simplifyMessagesSampleArgs = { |
157 _simplifyMessagesSampleArgs = { |
146 # Python-specifics |
158 # Python-specifics |
147 "Y101": ["foo"], |
159 "Y101": ["foo"], |
159 "Y117": ["with Foo() as foo, Bar() as bar:"], |
171 "Y117": ["with Foo() as foo, Bar() as bar:"], |
160 "Y118": ["foo", "bar_dict"], |
172 "Y118": ["foo", "bar_dict"], |
161 "Y119": ["Foo"], |
173 "Y119": ["Foo"], |
162 "Y120": ["Foo"], |
174 "Y120": ["Foo"], |
163 "Y121": ["FooBar", "Foo"], |
175 "Y121": ["FooBar", "Foo"], |
|
176 "Y122": ["bar_dict", "'foo'"], |
164 |
177 |
165 # Python-specifics not part of flake8-simplify |
178 # Python-specifics not part of flake8-simplify |
166 "Y181": ["foo += 42", "foo = foo + 42"], |
179 "Y181": ["foo += 42", "foo = foo + 42"], |
167 "Y182": ["super(Foo, self)"], |
180 "Y182": ["super(Foo, self)"], |
168 |
181 |