Skip to content

Commit fbc9fca

Browse files
committed
fix(require-description-complete-sentence): regression with heading exempting; fixes #1220
1 parent e9e4440 commit fbc9fca

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/rules/requireDescriptionCompleteSentence.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ const validateDescription = (
112112
return false;
113113
}
114114

115-
const paragraphs = extractParagraphs(description).filter(Boolean);
115+
const descriptionNoHeadings = description.replaceAll(/^\s*#[^\n]*(\n|$)/gm, '');
116+
117+
const paragraphs = extractParagraphs(descriptionNoHeadings).filter(Boolean);
116118

117119
return paragraphs.some((paragraph, parIdx) => {
118120
const sentences = extractSentences(paragraph, abbreviationsRegex);
@@ -192,10 +194,7 @@ const validateDescription = (
192194

193195
const paragraphNoAbbreviations = paragraph.replace(abbreviationsRegex, '');
194196

195-
if (
196-
!/(?:[.?!|]|```)\s*$/u.test(paragraphNoAbbreviations) &&
197-
!paragraphNoAbbreviations.startsWith('#')
198-
) {
197+
if (!/(?:[.?!|]|```)\s*$/u.test(paragraphNoAbbreviations)) {
199198
report('Sentences must end with a period.', fix, tag);
200199
return true;
201200
}

0 commit comments

Comments
 (0)