Repository navigation
Exclude trailing inline comments from comment runs - #2255
Merged
Christoph Bergmeister (bergmeister) merged 1 commit intoOct 27, 2026
Conversation
Add a regression test for standalone comments following trailing inline comments.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Christoph Bergmeister (bergmeister)
requested a review
from a team
as a code owner
October 27, 2026 17:01
Christoph Bergmeister (bergmeister)
marked this pull request as draft
October 27, 2026 17:12
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues in this focused fix and regression test, though build and runtime tests were not run.
No open issues 🎉
What changed in this PR
This PR fixes comment-run detection in the indentation formatter so trailing inline comments do not affect the indentation of following standalone comments.
Changes:
- Stop backward comment-run scanning when a comment has preceding code on the same line.
- Add a regression test confirming that the inline comment remains unchanged while the standalone comment is correctly indented.
| File | Description |
|---|---|
| Tests/Rules/UseConsistentIndentation.tests.ps1 | Adds regression coverage for standalone comments following an inline comment. |
| Rules/UseConsistentIndentation.cs | Detects preceding same-line code and excludes inline comments from comment runs. |
Review effort: Balanced
Christoph Bergmeister (bergmeister)
marked this pull request as ready for review
October 27, 2026 17:25
Christoph Bergmeister (bergmeister)
removed this pull request from stack #2256
October 27, 2026 17:25
Christoph Bergmeister (bergmeister)
merged commit Oct 27, 2026
91e54c2
into
copilot/fix-psuseconsistentindentation-issue
8 checks passed
Christoph Bergmeister (bergmeister)
deleted the
copilot/fix-trailing-comment-run
branch
October 27, 2026 17:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Exclude trailing inline comments from comment-run detection so following standalone comments retain the correct indentation. Add a regression test for the case.
Local build could not run: the required .NET 8 SDK is unavailable, and package restore from the configured Azure feed returned 401.
PR Checklist