GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Exclude trailing inline comments from comment runs by bergmeister · Pull Request #2255 · PowerShell/PSScriptAnalyzer

Conversation

@bergmeister

@bergmeister Christoph Bergmeister (bergmeister) commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

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

  • PR has a meaningful title
  • Summarized changes
  • Change is not breaking
  • Existing source file copyright headers are unchanged
  • Added a regression test
  • This PR is ready to merge and is not Work in Progress.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bergmeister
Exclude trailing inline comments from comment runs
00e9728
Add a regression test for standalone comments following trailing inline comments.\n\nCo-authored-by: Copilot <[email protected]>
@bergmeister
Christoph Bergmeister (bergmeister) requested a review from a team as a code owner October 27, 2026 17:01
@bergmeister
Christoph Bergmeister (bergmeister) added this pull request to stack #2256 October 27, 2026 17:11
@bergmeister
Christoph Bergmeister (bergmeister) marked this pull request as draft October 27, 2026 17:12
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 27, 2026 17:19
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 27, 2026 17:20
View session
Copilot AI reviewed Oct 27, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟢 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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bergmeister
Christoph Bergmeister (bergmeister) marked this pull request as ready for review October 27, 2026 17:25
@bergmeister
Christoph Bergmeister (bergmeister) removed this pull request from stack #2256 October 27, 2026 17:25
@bergmeister
Christoph Bergmeister (bergmeister) merged commit 91e54c2 into copilot/fix-psuseconsistentindentation-issue Oct 27, 2026
8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bergmeister
Christoph Bergmeister (bergmeister) deleted the copilot/fix-trailing-comment-run branch October 27, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@bergmeister
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.