mirror of
https://github.com/astral-sh/ruff
synced 2026-01-22 14:00:51 -05:00
Allow second line as 'first line' for punctuation (#741)
This commit is contained in:
@@ -697,7 +697,7 @@ pub fn ends_with_period(checker: &mut Checker, definition: &Definition) {
|
||||
..
|
||||
} = &docstring.node
|
||||
{
|
||||
if let Some(string) = string.lines().next() {
|
||||
if let Some(string) = string.trim().lines().next() {
|
||||
if !string.ends_with('.') {
|
||||
checker.add_check(Check::new(
|
||||
CheckKind::EndsInPeriod,
|
||||
@@ -807,7 +807,7 @@ pub fn ends_with_punctuation(checker: &mut Checker, definition: &Definition) {
|
||||
..
|
||||
} = &docstring.node
|
||||
{
|
||||
if let Some(string) = string.lines().next() {
|
||||
if let Some(string) = string.trim().lines().next() {
|
||||
if !(string.ends_with('.') || string.ends_with('!') || string.ends_with('?')) {
|
||||
checker.add_check(Check::new(
|
||||
CheckKind::EndsInPunctuation,
|
||||
|
||||
@@ -2,30 +2,6 @@
|
||||
source: src/linter.rs
|
||||
expression: checks
|
||||
---
|
||||
- kind: EndsInPeriod
|
||||
location:
|
||||
row: 124
|
||||
column: 4
|
||||
end_location:
|
||||
row: 126
|
||||
column: 7
|
||||
fix: ~
|
||||
- kind: EndsInPeriod
|
||||
location:
|
||||
row: 283
|
||||
column: 4
|
||||
end_location:
|
||||
row: 283
|
||||
column: 33
|
||||
fix: ~
|
||||
- kind: EndsInPeriod
|
||||
location:
|
||||
row: 288
|
||||
column: 4
|
||||
end_location:
|
||||
row: 288
|
||||
column: 37
|
||||
fix: ~
|
||||
- kind: EndsInPeriod
|
||||
location:
|
||||
row: 350
|
||||
|
||||
@@ -2,30 +2,6 @@
|
||||
source: src/linter.rs
|
||||
expression: checks
|
||||
---
|
||||
- kind: EndsInPunctuation
|
||||
location:
|
||||
row: 124
|
||||
column: 4
|
||||
end_location:
|
||||
row: 126
|
||||
column: 7
|
||||
fix: ~
|
||||
- kind: EndsInPunctuation
|
||||
location:
|
||||
row: 283
|
||||
column: 4
|
||||
end_location:
|
||||
row: 283
|
||||
column: 33
|
||||
fix: ~
|
||||
- kind: EndsInPunctuation
|
||||
location:
|
||||
row: 288
|
||||
column: 4
|
||||
end_location:
|
||||
row: 288
|
||||
column: 37
|
||||
fix: ~
|
||||
- kind: EndsInPunctuation
|
||||
location:
|
||||
row: 350
|
||||
|
||||
Reference in New Issue
Block a user