Fix New-ModuleManifest formatting issues (#27633)#27717
Open
eevaal wants to merge 1 commit into
Open
Conversation
- Fix PSAvoidTrailingWhitespace: Remove trailing whitespace on wrapped array lines - Fix PSUseConsistentIndentation: Use 4-space consistent indentation instead of column alignment - In QuoteNames: Check line length before appending comma-space separator - In QuoteModules: Replace 15-space column alignment with 4-space indentation Fixes PowerShell#27633 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates New-ModuleManifest’s manifest-value formatting to address PSScriptAnalyzer formatting rules, but it also introduces a large set of additional new tooling/scripts, tests, docs, and a new UNIX syslog tracing implementation that are not described in the PR metadata.
Changes:
- Adjust
New-ModuleManifestlist formatting to avoid trailing whitespace on wrapped lines and use a 4-space continuation indent. - Add new UNIX syslog tracing provider implementation (plus generated event-resource support).
- Add multiple new installer/helper scripts and new/updated test and documentation assets.
Reviewed changes
Copilot reviewed 1 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tools/ResxGen/ResxGen.ps1 |
Adds a PowerShell entrypoint script to generate resx/code from an ETW manifest. |
tools/installpsh-suse.sh |
Adds SUSE install helper script. |
tools/installpsh-redhat.sh |
Adds RedHat install helper script. |
tools/installpsh-osx.sh |
Adds macOS install helper script. |
tools/installpsh-gentoo.sh |
Adds Gentoo install helper script. |
tools/installpsh-debian.sh |
Adds Debian-based install helper script. |
tools/installpsh-amazonlinux.sh |
Adds Amazon Linux install helper script. |
tools/install-powershell.sh |
Adds/updates top-level installer dispatcher script (includes commit pinning). |
tools/generate-icns.sh |
Adds helper script for generating .icns from an SVG on macOS. |
tools/debug.sh |
Adds a helper script for launching LLDB with SOS plugin. |
test/tools/Modules/HelpersHostCS/HelpersHostCS.psm1 |
Adds a C#-backed test host module used by tests. |
test/shebang/script.ps1 |
Adds a shebang PowerShell script used for shebang-related testing. |
test/powershell/Modules/Microsoft.PowerShell.Security/GetCredential.Tests.ps1 |
Adds Pester coverage for Get-Credential behavior using a test host. |
test/powershell/Host/assets/Read-Host.Output.expect |
Adds an expect script asset for Read-Host behavior verification. |
src/System.Management.Automation/utils/tracing/SysLogProvider.cs |
Adds a UNIX syslog logging provider implementation. |
src/System.Management.Automation/utils/tracing/PSSysLogProvider.cs |
Adds a syslog-backed LogProvider implementation for UNIX. |
src/System.Management.Automation/utils/tracing/PSEtwLogProvider.cs |
Adds/updates the ETW-backed LogProvider implementation for non-UNIX. |
src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs |
Updates wrapping/indent logic to avoid trailing whitespace and column-aligned continuation indentation. |
src/System.Management.Automation/CoreCLR/EventResource.cs |
Adds generated event-resource mapping for UNIX builds. |
docs/testing-guidelines/WritingPesterTests.md |
Adds Pester authoring guidance documentation. |
docs/testing-guidelines/testing-guidelines.md |
Adds/updates general testing guidelines documentation. |
Comment on lines
+588
to
592
| string quotedString = QuoteName(name); | ||
|
|
||
| if (first) | ||
| { | ||
| first = false; |
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.
Summary
Fixes the PSScriptAnalyzer violations reported in issue #27633.
Changes
This PR addresses two formatting issues in
New-ModuleManifest:Modified Methods
QuoteNames(IEnumerable names, StreamWriter streamWriter)
quotedStringdeclaration to the beginning for better flownewOffset) BEFORE appending the comma-space separator", "when NOT wrapping to avoid trailing whitespace","(no space), then newline, then 4 spaces for indentation4 + quotedString.Lengthon wrapped linesQuoteModules(IEnumerable moduleSpecs, StreamWriter streamWriter)
", "to","to avoid trailing whitespaceExpected Output
Before
After
Testing
These changes ensure that the output of
New-ModuleManifestcomplies with PSScriptAnalyzer rules:PSAvoidTrailingWhitespace- No trailing whitespace on any linePSUseConsistentIndentation- Consistent 4-space indentation for continuation linesRelated Issue
Fixes #27633