mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-02 04:48:07 +00:00
Improve documentation for PLE1300 (#6430)
This commit is contained in:
parent
c7703e205d
commit
d33618062e
1 changed files with 3 additions and 2 deletions
|
|
@ -19,8 +19,7 @@ use crate::checkers::ast::Checker;
|
|||
/// Checks for unsupported format types in format strings.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// The format string is not checked at compile time, so it is easy to
|
||||
/// introduce bugs by mistyping the format string.
|
||||
/// An invalid format string character will result in an error at runtime.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
|
|
@ -41,6 +40,7 @@ impl Violation for BadStringFormatCharacter {
|
|||
}
|
||||
}
|
||||
|
||||
/// PLE1300
|
||||
/// Ex) `"{:z}".format("1")`
|
||||
pub(crate) fn call(checker: &mut Checker, string: &str, range: TextRange) {
|
||||
if let Ok(format_string) = FormatString::from_str(string) {
|
||||
|
|
@ -64,6 +64,7 @@ pub(crate) fn call(checker: &mut Checker, string: &str, range: TextRange) {
|
|||
}
|
||||
}
|
||||
|
||||
/// PLE1300
|
||||
/// Ex) `"%z" % "1"`
|
||||
pub(crate) fn percent(checker: &mut Checker, expr: &Expr) {
|
||||
// Grab each string segment (in case there's an implicit concatenation).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue