Plugins/CheckerPlugins/CodeStyleChecker/pycodestyle.py

changeset 5303
83ab5275f255
parent 5290
174dae2b91c3
child 5389
9b1c800daff3
equal deleted inserted replaced
5299:1ecd89554ddb 5303:83ab5275f255
266 Use blank lines in functions, sparingly, to indicate logical sections. 266 Use blank lines in functions, sparingly, to indicate logical sections.
267 267
268 Okay: def a():\n pass\n\n\ndef b():\n pass 268 Okay: def a():\n pass\n\n\ndef b():\n pass
269 Okay: def a():\n pass\n\n\nasync def b():\n pass 269 Okay: def a():\n pass\n\n\nasync def b():\n pass
270 Okay: def a():\n pass\n\n\n# Foo\n# Bar\n\ndef b():\n pass 270 Okay: def a():\n pass\n\n\n# Foo\n# Bar\n\ndef b():\n pass
271 Okay: default = 1\nfoo = 1
272 Okay: classify = 1\nfoo = 1
271 273
272 E301: class Foo:\n b = 0\n def bar():\n pass 274 E301: class Foo:\n b = 0\n def bar():\n pass
273 E302: def a():\n pass\n\ndef b(n):\n pass 275 E302: def a():\n pass\n\ndef b(n):\n pass
274 E302: def a():\n pass\n\nasync def b(n):\n pass 276 E302: def a():\n pass\n\nasync def b(n):\n pass
275 E303: def a():\n pass\n\n\n\ndef b(n):\n pass 277 E303: def a():\n pass\n\n\n\ndef b(n):\n pass
303 else: 305 else:
304 yield 0, "E301 expected 1 blank line, found 0" 306 yield 0, "E301 expected 1 blank line, found 0"
305 elif blank_before != 2: 307 elif blank_before != 2:
306 yield 0, "E302 expected 2 blank lines, found %d", blank_before 308 yield 0, "E302 expected 2 blank lines, found %d", blank_before
307 elif (logical_line and not indent_level and blank_before != 2 and 309 elif (logical_line and not indent_level and blank_before != 2 and
308 previous_unindented_logical_line.startswith(('def', 'class'))): 310 previous_unindented_logical_line.startswith(('def ', 'class '))):
309 yield 0, "E305 expected 2 blank lines after " \ 311 yield 0, "E305 expected 2 blank lines after " \
310 "class or function definition, found %d", blank_before 312 "class or function definition, found %d", blank_before
311 313
312 314
313 def extraneous_whitespace(logical_line): 315 def extraneous_whitespace(logical_line):

eric ide

mercurial