-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix decorator + async false positive.
This also move the trigger on an async def from the def to the async.
- Loading branch information
1 parent
b667c5c
commit 0bf4c45
Showing
8 changed files
with
413 additions
and
410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 13 additions & 13 deletions
26
.../src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs | ||
--- | ||
E30.py:328:5: E301 [*] Expected 1 blank line, found 0 | ||
E30.py:335:5: E301 [*] Expected 1 blank line, found 0 | ||
| | ||
326 | def func1(): | ||
327 | pass | ||
328 | def func2(): | ||
333 | def func1(): | ||
334 | pass | ||
335 | def func2(): | ||
| ^^^ E301 | ||
329 | pass | ||
330 | # end | ||
336 | pass | ||
337 | # end | ||
| | ||
= help: Add missing blank line(s) | ||
|
||
ℹ Safe fix | ||
325 325 | | ||
326 326 | def func1(): | ||
327 327 | pass | ||
328 |+ | ||
328 329 | def func2(): | ||
329 330 | pass | ||
330 331 | # end | ||
332 332 | | ||
333 333 | def func1(): | ||
334 334 | pass | ||
335 |+ | ||
335 336 | def func2(): | ||
336 337 | pass | ||
337 338 | # end | ||
|
||
|
254 changes: 127 additions & 127 deletions
254
.../src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,187 +1,187 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs | ||
--- | ||
E30.py:346:1: E302 [*] Expected 2 blank lines, found 0 | ||
| | ||
344 | # E302 | ||
345 | """Main module.""" | ||
346 | def fn(): | ||
| ^^^ E302 | ||
347 | pass | ||
348 | # end | ||
| | ||
= help: Add missing blank line(s) | ||
|
||
ℹ Safe fix | ||
343 343 | | ||
344 344 | # E302 | ||
345 345 | """Main module.""" | ||
346 |+ | ||
347 |+ | ||
346 348 | def fn(): | ||
347 349 | pass | ||
348 350 | # end | ||
|
||
E30.py:353:1: E302 [*] Expected 2 blank lines, found 0 | ||
| | ||
351 | # E302 | ||
352 | import sys | ||
353 | def get_sys_path(): | ||
352 | """Main module.""" | ||
353 | def fn(): | ||
| ^^^ E302 | ||
354 | return sys.path | ||
354 | pass | ||
355 | # end | ||
| | ||
= help: Add missing blank line(s) | ||
|
||
ℹ Safe fix | ||
350 350 | | ||
351 351 | # E302 | ||
352 352 | import sys | ||
352 352 | """Main module.""" | ||
353 |+ | ||
354 |+ | ||
353 355 | def get_sys_path(): | ||
354 356 | return sys.path | ||
353 355 | def fn(): | ||
354 356 | pass | ||
355 357 | # end | ||
|
||
E30.py:362:1: E302 [*] Expected 2 blank lines, found 1 | ||
E30.py:360:1: E302 [*] Expected 2 blank lines, found 0 | ||
| | ||
360 | pass | ||
361 | | ||
362 | def b(): | ||
358 | # E302 | ||
359 | import sys | ||
360 | def get_sys_path(): | ||
| ^^^ E302 | ||
363 | pass | ||
364 | # end | ||
361 | return sys.path | ||
362 | # end | ||
| | ||
= help: Add missing blank line(s) | ||
|
||
ℹ Safe fix | ||
359 359 | def a(): | ||
360 360 | pass | ||
361 361 | | ||
362 |+ | ||
362 363 | def b(): | ||
363 364 | pass | ||
364 365 | # end | ||
|
||
E30.py:373:1: E302 [*] Expected 2 blank lines, found 1 | ||
| | ||
371 | # comment | ||
372 | | ||
373 | def b(): | ||
357 357 | | ||
358 358 | # E302 | ||
359 359 | import sys | ||
360 |+ | ||
361 |+ | ||
360 362 | def get_sys_path(): | ||
361 363 | return sys.path | ||
362 364 | # end | ||
|
||
E30.py:369:1: E302 [*] Expected 2 blank lines, found 1 | ||
| | ||
367 | pass | ||
368 | | ||
369 | def b(): | ||
| ^^^ E302 | ||
374 | pass | ||
375 | # end | ||
370 | pass | ||
371 | # end | ||
| | ||
= help: Add missing blank line(s) | ||
|
||
ℹ Safe fix | ||
370 370 | | ||
371 371 | # comment | ||
372 372 | | ||
373 |+ | ||
373 374 | def b(): | ||
374 375 | pass | ||
375 376 | # end | ||
|
||
E30.py:382:7: E302 [*] Expected 2 blank lines, found 1 | ||
| | ||
380 | pass | ||
381 | | ||
382 | async def b(): | ||
| ^^^ E302 | ||
383 | pass | ||
384 | # end | ||
366 366 | def a(): | ||
367 367 | pass | ||
368 368 | | ||
369 |+ | ||
369 370 | def b(): | ||
370 371 | pass | ||
371 372 | # end | ||
|
||
E30.py:380:1: E302 [*] Expected 2 blank lines, found 1 | ||
| | ||
378 | # comment | ||
379 | | ||
380 | def b(): | ||
| ^^^ E302 | ||
381 | pass | ||
382 | # end | ||
| | ||
= help: Add missing blank line(s) | ||
|
||
ℹ Safe fix | ||
379 379 | def a(): | ||
380 380 | pass | ||
381 381 | | ||
382 |+ | ||
382 383 | async def b(): | ||
383 384 | pass | ||
384 385 | # end | ||
|
||
E30.py:391:8: E302 [*] Expected 2 blank lines, found 1 | ||
| | ||
389 | pass | ||
390 | | ||
391 | async def x(y: int = 1): | ||
| ^^^ E302 | ||
392 | pass | ||
393 | # end | ||
377 377 | | ||
378 378 | # comment | ||
379 379 | | ||
380 |+ | ||
380 381 | def b(): | ||
381 382 | pass | ||
382 383 | # end | ||
|
||
E30.py:389:1: E302 [*] Expected 2 blank lines, found 1 | ||
| | ||
387 | pass | ||
388 | | ||
389 | async def b(): | ||
| ^^^^^ E302 | ||
390 | pass | ||
391 | # end | ||
| | ||
= help: Add missing blank line(s) | ||
|
||
ℹ Safe fix | ||
388 388 | async def x(): | ||
389 389 | pass | ||
390 390 | | ||
391 |+ | ||
391 392 | async def x(y: int = 1): | ||
392 393 | pass | ||
393 394 | # end | ||
|
||
E30.py:399:1: E302 [*] Expected 2 blank lines, found 0 | ||
| | ||
397 | def bar(): | ||
398 | pass | ||
399 | def baz(): pass | ||
| ^^^ E302 | ||
386 386 | def a(): | ||
387 387 | pass | ||
388 388 | | ||
389 |+ | ||
389 390 | async def b(): | ||
390 391 | pass | ||
391 392 | # end | ||
|
||
E30.py:398:1: E302 [*] Expected 2 blank lines, found 1 | ||
| | ||
396 | pass | ||
397 | | ||
398 | async def x(y: int = 1): | ||
| ^^^^^ E302 | ||
399 | pass | ||
400 | # end | ||
| | ||
= help: Add missing blank line(s) | ||
|
||
ℹ Safe fix | ||
396 396 | # E302 | ||
397 397 | def bar(): | ||
398 398 | pass | ||
399 |+ | ||
400 |+ | ||
399 401 | def baz(): pass | ||
400 402 | # end | ||
401 403 | | ||
|
||
E30.py:405:1: E302 [*] Expected 2 blank lines, found 0 | ||
| | ||
403 | # E302 | ||
404 | def bar(): pass | ||
405 | def baz(): | ||
395 395 | async def x(): | ||
396 396 | pass | ||
397 397 | | ||
398 |+ | ||
398 399 | async def x(y: int = 1): | ||
399 400 | pass | ||
400 401 | # end | ||
|
||
E30.py:406:1: E302 [*] Expected 2 blank lines, found 0 | ||
| | ||
404 | def bar(): | ||
405 | pass | ||
406 | def baz(): pass | ||
| ^^^ E302 | ||
406 | pass | ||
407 | # end | ||
| | ||
= help: Add missing blank line(s) | ||
|
||
ℹ Safe fix | ||
402 402 | | ||
403 403 | # E302 | ||
404 404 | def bar(): pass | ||
405 |+ | ||
404 404 | def bar(): | ||
405 405 | pass | ||
406 |+ | ||
405 407 | def baz(): | ||
406 408 | pass | ||
407 |+ | ||
406 408 | def baz(): pass | ||
407 409 | # end | ||
408 410 | | ||
|
||
E30.py:415:1: E302 [*] Expected 2 blank lines, found 0 | ||
E30.py:412:1: E302 [*] Expected 2 blank lines, found 0 | ||
| | ||
410 | # E302 | ||
411 | def bar(): pass | ||
412 | def baz(): | ||
| ^^^ E302 | ||
413 | pass | ||
414 | # end | ||
| | ||
414 | # comment | ||
415 | @decorator | ||
= help: Add missing blank line(s) | ||
|
||
ℹ Safe fix | ||
409 409 | | ||
410 410 | # E302 | ||
411 411 | def bar(): pass | ||
412 |+ | ||
413 |+ | ||
412 414 | def baz(): | ||
413 415 | pass | ||
414 416 | # end | ||
|
||
E30.py:422:1: E302 [*] Expected 2 blank lines, found 0 | ||
| | ||
421 | # comment | ||
422 | @decorator | ||
| ^ E302 | ||
416 | def g(): | ||
417 | pass | ||
423 | def g(): | ||
424 | pass | ||
| | ||
= help: Add missing blank line(s) | ||
|
||
ℹ Safe fix | ||
412 412 | pass | ||
413 413 | | ||
414 414 | # comment | ||
415 |+ | ||
416 |+ | ||
415 417 | @decorator | ||
416 418 | def g(): | ||
417 419 | pass | ||
419 419 | pass | ||
420 420 | | ||
421 421 | # comment | ||
422 |+ | ||
423 |+ | ||
422 424 | @decorator | ||
423 425 | def g(): | ||
424 426 | pass | ||
|
||
|
Oops, something went wrong.