83 '''Use "class {0}({1}):" instead of "class {0}({1}, object):"''', |
83 '''Use "class {0}({1}):" instead of "class {0}({1}, object):"''', |
84 ), |
84 ), |
85 "Y122": QCoreApplication.translate( |
85 "Y122": QCoreApplication.translate( |
86 "SimplifyChecker", '''Use "{0}.get({1})" instead of "if {1} in {0}: {0}[{1}]"''' |
86 "SimplifyChecker", '''Use "{0}.get({1})" instead of "if {1} in {0}: {0}[{1}]"''' |
87 ), |
87 ), |
|
88 "Y123": QCoreApplication.translate( |
|
89 "SimplifyChecker", '''Use "{0} = {1}.get({2}, {3})" instead of an if-block''' |
|
90 ), |
88 # Python-specifics not part of flake8-simplify |
91 # Python-specifics not part of flake8-simplify |
89 "Y181": QCoreApplication.translate( |
92 "Y181": QCoreApplication.translate( |
90 "SimplifyChecker", '''Use "{0}" instead of "{1}"''' |
93 "SimplifyChecker", '''Use "{0}" instead of "{1}"''' |
91 ), |
94 ), |
92 "Y182": QCoreApplication.translate( |
95 "Y182": QCoreApplication.translate( |
148 "Y401": QCoreApplication.translate( |
151 "Y401": QCoreApplication.translate( |
149 "SimplifyChecker", """Use keyword-argument instead of magic boolean""" |
152 "SimplifyChecker", """Use keyword-argument instead of magic boolean""" |
150 ), |
153 ), |
151 "Y402": QCoreApplication.translate( |
154 "Y402": QCoreApplication.translate( |
152 "SimplifyChecker", """Use keyword-argument instead of magic number""" |
155 "SimplifyChecker", """Use keyword-argument instead of magic number""" |
|
156 ), |
|
157 |
|
158 "Y901": QCoreApplication.translate( |
|
159 "SimplifyChecker", '''Use "{0}" instead of "{1}"''' |
|
160 ), |
|
161 "Y904": QCoreApplication.translate( |
|
162 "SimplifyChecker", """Initialize dictionary "{0}" directly""" |
|
163 ), |
|
164 "Y905": QCoreApplication.translate( |
|
165 "SimplifyChecker", '''Use "{0}" instead of "{1}"''' |
|
166 ), |
|
167 "Y906": QCoreApplication.translate( |
|
168 "SimplifyChecker", '''Use "{0}" instead of "{1}"''' |
|
169 ), |
|
170 "Y907": QCoreApplication.translate( |
|
171 "SimplifyChecker", '''Use "Optional[{0}]" instead of "{1}"''' |
|
172 ), |
|
173 "Y909": QCoreApplication.translate( |
|
174 "SimplifyChecker", '''Remove reflexive assignment "{0}"''' |
153 ), |
175 ), |
154 } |
176 } |
155 |
177 |
156 _simplifyMessagesSampleArgs = { |
178 _simplifyMessagesSampleArgs = { |
157 # Python-specifics |
179 # Python-specifics |
171 "Y118": ["foo", "bar_dict"], |
193 "Y118": ["foo", "bar_dict"], |
172 "Y119": ["Foo"], |
194 "Y119": ["Foo"], |
173 "Y120": ["Foo"], |
195 "Y120": ["Foo"], |
174 "Y121": ["FooBar", "Foo"], |
196 "Y121": ["FooBar", "Foo"], |
175 "Y122": ["bar_dict", "'foo'"], |
197 "Y122": ["bar_dict", "'foo'"], |
|
198 "Y123": ["foo", "fooDict", "bar", "default"], |
|
199 "Y124": ["foo", "bar"], |
176 # Python-specifics not part of flake8-simplify |
200 # Python-specifics not part of flake8-simplify |
177 "Y181": ["foo += 42", "foo = foo + 42"], |
201 "Y181": ["foo += 42", "foo = foo + 42"], |
178 "Y182": ["super()"], |
202 "Y182": ["super()"], |
179 # Comparations |
203 # Comparations |
180 "Y201": ["foo", "bar"], |
204 "Y201": ["foo", "bar"], |
191 "Y221": ["foo"], |
215 "Y221": ["foo"], |
192 "Y222": ["foo"], |
216 "Y222": ["foo"], |
193 # Opinionated |
217 # Opinionated |
194 "Y301": ["42", "foo"], |
218 "Y301": ["42", "foo"], |
195 # General Code Style |
219 # General Code Style |
|
220 |
|
221 # Additional checks |
|
222 "Y901": ["foo == bar", "bool(foo == bar)"], |
|
223 "Y904": ["foo"], |
|
224 "Y905": [ |
|
225 """["de", "com", "net", "org"]""", """domains = "de com net org".split()""" |
|
226 ], |
|
227 "Y906": ["os.path.join(a, b, c)", "os.path.join(a,os.path.join(b,c))"], |
|
228 "Y907": ["int", "Union[int, None]"], |
|
229 "Y909": ["foo = foo"], |
196 } |
230 } |