Skip to content

Commit

Permalink
fix(require-description-complete-sentence): regression with heading…
Browse files Browse the repository at this point in the history
… exempting; fixes #1220
  • Loading branch information
brettz9 committed Jun 7, 2024
1 parent e9e4440 commit 97bc2a8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/rules/requireDescriptionCompleteSentence.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ const validateDescription = (
return false;
}

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

const paragraphs = extractParagraphs(descriptionNoHeadings).filter(Boolean);

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

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

if (
!/(?:[.?!|]|```)\s*$/u.test(paragraphNoAbbreviations) &&
!paragraphNoAbbreviations.startsWith('#')
) {
if (!/(?:[.?!|]|```)\s*$/u.test(paragraphNoAbbreviations)) {
report('Sentences must end with a period.', fix, tag);
return true;
}
Expand Down

0 comments on commit 97bc2a8

Please sign in to comment.