Allow second line as 'first line' for punctuation (#741)

This commit is contained in:
Charlie Marsh
2022-11-14 13:07:27 -05:00
committed by GitHub
parent 502d3316f9
commit d170388b7b
3 changed files with 2 additions and 50 deletions

View File

@@ -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,

View File

@@ -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

View File

@@ -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