mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 13:33:50 +00:00
Preserve yield parentheses (#6766)
This commit is contained in:
parent
b52cc84df6
commit
ccac9681e1
6 changed files with 121 additions and 16 deletions
|
@ -71,6 +71,38 @@ def foo():
|
|||
test, # comment 4
|
||||
1
|
||||
)
|
||||
|
||||
yield ("Cache key will cause errors if used with memcached: %r " "(longer than %s)" % (
|
||||
key,
|
||||
MEMCACHE_MAX_KEY_LENGTH,
|
||||
)
|
||||
)
|
||||
|
||||
yield "Cache key will cause errors if used with memcached: %r " "(longer than %s)" % (
|
||||
key,
|
||||
MEMCACHE_MAX_KEY_LENGTH,
|
||||
)
|
||||
|
||||
|
||||
yield ("Unnecessary")
|
||||
|
||||
|
||||
yield (
|
||||
"# * Make sure each ForeignKey and OneToOneField has `on_delete` set "
|
||||
"to the desired behavior"
|
||||
)
|
||||
yield (
|
||||
"# * Remove `managed = False` lines if you wish to allow "
|
||||
"Django to create, modify, and delete the table"
|
||||
)
|
||||
yield (
|
||||
"# Feel free to rename the models, but don't rename db_table values or "
|
||||
"field names."
|
||||
)
|
||||
|
||||
yield "# * Make sure each ForeignKey and OneToOneField has `on_delete` set " "to the desired behavior"
|
||||
yield "# * Remove `managed = False` lines if you wish to allow " "Django to create, modify, and delete the table"
|
||||
yield "# Feel free to rename the models, but don't rename db_table values or " "field names."
|
||||
```
|
||||
|
||||
## Output
|
||||
|
@ -110,7 +142,7 @@ def foo():
|
|||
|
||||
for e in l:
|
||||
# comment
|
||||
yield e # Too many parentheses
|
||||
yield (e) # Too many parentheses
|
||||
# comment
|
||||
|
||||
for ridiculouslylongelementnameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee in l:
|
||||
|
@ -135,6 +167,51 @@ def foo():
|
|||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
yield (
|
||||
"Cache key will cause errors if used with memcached: %r "
|
||||
"(longer than %s)"
|
||||
% (
|
||||
key,
|
||||
MEMCACHE_MAX_KEY_LENGTH,
|
||||
)
|
||||
)
|
||||
|
||||
yield "Cache key will cause errors if used with memcached: %r " "(longer than %s)" % (
|
||||
key,
|
||||
MEMCACHE_MAX_KEY_LENGTH,
|
||||
)
|
||||
|
||||
|
||||
yield ("Unnecessary")
|
||||
|
||||
|
||||
yield (
|
||||
"# * Make sure each ForeignKey and OneToOneField has `on_delete` set "
|
||||
"to the desired behavior"
|
||||
)
|
||||
yield (
|
||||
"# * Remove `managed = False` lines if you wish to allow "
|
||||
"Django to create, modify, and delete the table"
|
||||
)
|
||||
yield (
|
||||
"# Feel free to rename the models, but don't rename db_table values or "
|
||||
"field names."
|
||||
)
|
||||
|
||||
yield (
|
||||
"# * Make sure each ForeignKey and OneToOneField has `on_delete` set "
|
||||
"to the desired behavior"
|
||||
)
|
||||
yield (
|
||||
"# * Remove `managed = False` lines if you wish to allow "
|
||||
"Django to create, modify, and delete the table"
|
||||
)
|
||||
yield (
|
||||
"# Feel free to rename the models, but don't rename db_table values or "
|
||||
"field names."
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue