mirror of https://github.com/astral-sh/ruff
Improve f-string-missing-placeholders documentation (#2800)
This commit is contained in:
parent
0e4d5eeea7
commit
4a12ebb9b1
|
|
@ -13,8 +13,13 @@ define_violation!(
|
|||
///
|
||||
/// ## Why is this bad?
|
||||
/// F-strings are a convenient way to format strings, but they are not
|
||||
/// necessary if there are no placeholder expressions to format. In this case,
|
||||
/// a regular string should be used instead.
|
||||
/// necessary if there are no placeholder expressions to format. In this
|
||||
/// case, a regular string should be used instead, as an f-string without
|
||||
/// placeholders can be confusing for readers, who may expect such a
|
||||
/// placeholder to be present.
|
||||
///
|
||||
/// An f-string without any placeholders could also indicate that the
|
||||
/// author forgot to add a placeholder expression.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
|
|
|||
|
|
@ -9,8 +9,13 @@ Checks for f-strings that do not contain any placeholder expressions.
|
|||
|
||||
## Why is this bad?
|
||||
F-strings are a convenient way to format strings, but they are not
|
||||
necessary if there are no placeholder expressions to format. In this case,
|
||||
a regular string should be used instead.
|
||||
necessary if there are no placeholder expressions to format. In this
|
||||
case, a regular string should be used instead, as an f-string without
|
||||
placeholders can be confusing for readers, who may expect such a
|
||||
placeholder to be present.
|
||||
|
||||
An f-string without any placeholders could also indicate that the
|
||||
author forgot to add a placeholder expression.
|
||||
|
||||
## Example
|
||||
```python
|
||||
|
|
|
|||
Loading…
Reference in New Issue