Skip to content

Commit

Permalink
Update docs, fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
dosisod committed Nov 21, 2023
1 parent 0c22af3 commit aab9676
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions docs/checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -2159,4 +2159,25 @@ Good:
from hashlib import sha512

h = sha512(b"data")
```

## FURB183: `use-str-func`

Categories: `readability`

If you want to stringify a single value without concatenating anything, use
the `str()` function instead.

Bad:

```python
nums = [123, 456]
num = f"{num[0]}")
```

Good:

```python
nums = [123, 456]
num = str(num[0])
```
2 changes: 1 addition & 1 deletion refurb/checks/readability/use_str_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from mypy.nodes import CallExpr, ListExpr, MemberExpr, NameExpr, StrExpr

from refurb.checks.common import stringify
from refurb.error import Error
from refurb.checks.string.use_fstring_fmt import CONVERSIONS as FURB_119_FUNCS
from refurb.error import Error


@dataclass
Expand Down

0 comments on commit aab9676

Please sign in to comment.