mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
[refurb
] Implement print-empty-string
(FURB105
) (#7617)
## Summary Implement [`simplify-print`](https://github.com/dosisod/refurb/blob/master/refurb/checks/builtin/print.py) as `print-empty-string` (`FURB105`). Extends the original rule in that it also checks for multiple empty string positional arguments with an empty string separator. Related to #1348. ## Test Plan `cargo test`
This commit is contained in:
parent
865c89800e
commit
604cf521b5
8 changed files with 535 additions and 0 deletions
32
crates/ruff_linter/resources/test/fixtures/refurb/FURB105.py
vendored
Normal file
32
crates/ruff_linter/resources/test/fixtures/refurb/FURB105.py
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Errors.
|
||||
|
||||
print("")
|
||||
print("", sep=",")
|
||||
print("", end="bar")
|
||||
print("", sep=",", end="bar")
|
||||
print(sep="")
|
||||
print("", sep="")
|
||||
print("", "", sep="")
|
||||
print("", "", sep="", end="")
|
||||
print("", "", sep="", end="bar")
|
||||
print("", sep="", end="bar")
|
||||
print(sep="", end="bar")
|
||||
print("", "foo", sep="")
|
||||
print("foo", "", sep="")
|
||||
print("foo", "", "bar", sep="")
|
||||
print("", *args)
|
||||
print("", *args, sep="")
|
||||
|
||||
# OK.
|
||||
|
||||
print()
|
||||
print("foo")
|
||||
print("", "")
|
||||
print("", "foo")
|
||||
print("foo", "")
|
||||
print("", "", sep=",")
|
||||
print("", "foo", sep=",")
|
||||
print("foo", "", sep=",")
|
||||
print("foo", "", "bar", "", sep=",")
|
||||
print("", "", **kwargs)
|
||||
print("", **kwargs)
|
Loading…
Add table
Add a link
Reference in a new issue