Skip to content

SA1629: accept exclamation and question marks - #4298

Merged
AArnott merged 3 commits into
masterfrom
aarnott-fix-sa1629-punctuation
Oct 14, 2026
Merged

AArnott merged 3 commits into
masterfrom
aarnott-fix-sa1629-punctuation

Conversation

@AArnott

@AArnott AArnott commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

SA1629 currently flags documentation ending in ! or ?, even though both are valid sentence-ending punctuation. This adds those marks alongside periods, including before optional closing quotes or a parenthesis, while keeping punctuation-free text as a violation.

The new regression test fails on master with diagnostics for both punctuation endings. The complete SA1629 suite passes on the C# 6 and C# 15 test projects. The analyzer change adds only a few character comparisons at the end of existing documentation text, with no additional allocations or broader analysis cost. Updated the English, Czech, Russian, and Simplified Chinese rule documentation.

Fixes #2724

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@AArnott
AArnott marked this pull request as ready for review October 14, 2026 02:09
Copilot AI balanced review requested due to automatic review settings October 14, 2026 02:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The regression test omits the exact reported placement and documented quoted and parenthesized endings.

1 open finding
What changed in this PR

Broadens SA1629 to accept exclamation and question marks as valid sentence endings.

Changes:

  • Extends punctuation validation without added allocations.
  • Adds regression and negative tests.
  • Updates all localized rule documentation.
File Description
src/​.../​SA1629DocumentationTextMustEndWithAPeriod.cs Accepts ., !, and ?.
test/​.../​SA1629UnitTests.cs Adds punctuation regression tests.
documentation/​SA1629.md Updates English behavior documentation.
documentation/​cs-cz/​SA1629.md Updates Czech documentation.
documentation/​ru-ru/​SA1629.md Updates Russian documentation.
documentation/​zh-cn/​SA1629.md Updates Chinese documentation.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 02:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Included and inline XML paths lack regression coverage, and diagnostic metadata still describes period-only behavior.

1 open finding
1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Low severity Update SA1629 descriptions for accepted ! and ? punctuation

src/​StyleCop.Analyzers/​DocumentationRules/​SA1629DocumentationTextMustEndWithAPeriod.cs:233

The analyzer's SA1629Description resource and class XML documentation still define any section not ending with a period as a violation. This condition now accepts What? and Done!, so the user-visible descriptor description contradicts the implementation. Please update those descriptions, including the existing localized resource values, to mention all accepted punctuation; the rule title and period-adding code fix can remain unchanged.

🧠 Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 02:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The targeted implementation is consistent across analysis paths, adequately tested, and fully documented.

0 open findings

1 resolved since last review
Files not reviewed (1)
  • src/StyleCop.Analyzers/Lightup/.generated/Microsoft.CodeAnalysis.ResxSourceGenerator.CSharp/Microsoft.CodeAnalysis.ResxSourceGenerator.CSharp.CSharpResxGenerator/DocumentationResources.Designer.cs: Generated file

🧠 Review effort: Balanced

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.60%. Comparing base (ed09d10) to head (2412ccd).
⚠️ Report is 18 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4298   +/-   ##
=======================================
  Coverage   97.60%   97.60%           
=======================================
  Files        1296     1296           
  Lines      140096   140188   +92     
  Branches     4633     4633           
=======================================
+ Hits       136741   136833   +92     
  Misses       2155     2155           
  Partials     1200     1200           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This was referenced Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SA1629 should accept more punctuation

2 participants