mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 22:01:47 +00:00
Enable autofix for over- and under-indented docstrings (#451)
This commit is contained in:
parent
f832f88c75
commit
36fe8b76d4
6 changed files with 230 additions and 91 deletions
|
@ -32,3 +32,11 @@ pub fn indentation<'a>(checker: &'a mut Checker, docstring: &Expr) -> &'a str {
|
|||
end_location: Location::new(range.location.row(), range.location.column()),
|
||||
})
|
||||
}
|
||||
|
||||
/// Replace any non-whitespace characters from an indentation string.
|
||||
pub fn clean(indentation: &str) -> String {
|
||||
indentation
|
||||
.chars()
|
||||
.map(|char| if char.is_whitespace() { char } else { ' ' })
|
||||
.collect()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue