Repository navigation
Fix false-positive Write-Log warnings in built-in cmdlet rule - #2303
Open
S.H Jeong (z0rimo) wants to merge 1 commit into
Open
S.H Jeong (z0rimo) wants to merge 1 commit into
S.H Jeong (z0rimo) wants to merge 1 commit into
Conversation
S.H Jeong (z0rimo)
requested review from
a team and
Christoph Bergmeister (bergmeister)
as code owners
November 18, 2026 06:59
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the PowerShell 6.1 profile-data correction addressing false positives for user-defined Write-Log functions.
No open issues 🎉
What changed in this PR
Fixes #2146 by correcting PowerShell 6.1 command profiles so PSAvoidOverwritingBuiltInCmdlets no longer flags user-defined Write-Log functions. The fix updates profile data without changing rule logic.
Changes:
- Remove stale
Write-Logentries from all four PowerShell 6.1 profiles. - Add regression tests for explicit profiles and default settings, confirming that
Get-ChildItemoverrides still produce warnings.
| File | Description |
|---|---|
| Tests/Rules/AvoidOverwritingBuiltInCmdlets.tests.ps1 | Add regression coverage for Write-Log and genuine built-in overrides. |
| Engine/Settings/core-6.1.0-windows.json | Remove the stale Windows Write-Log entry. |
| Engine/Settings/core-6.1.0-macos.json | Remove the stale macOS Write-Log entry. |
| Engine/Settings/core-6.1.0-linux.json | Remove the stale Linux Write-Log entry. |
| Engine/Settings/core-6.1.0-linux-arm.json | Remove the stale Linux ARM Write-Log entry. |
Review effort: Balanced
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
Fixes #2146.
PSAvoidOverwritingBuiltInCmdletsincorrectly reports user-definedWrite-Logfunctions as overwriting a built-in PowerShell command.The four PowerShell 6.1 command profiles contain a stale
Write-Logentry exported byPSDesiredStateConfiguration. This originates from a historical DSC issue where internal helper functions were unintentionally exported (PowerShell/PowerShell#7209).Changes:
Write-Logentry from the Windows, Linux, Linux ARM, and macOScore-6.1.0-*profiles.Get-ChildItemcontinue to produce warnings.The change is limited to the affected JSON entries and regression tests. No C# rule logic or unrelated compatibility data is modified.
Validation:
Expected 1, but got 2) and passed afterward.AvoidOverwritingBuiltInCmdlets: 12 passed.UseCompatibleCommands: 200 passed.UseCompatibleCmdlets: 14 passed.AvoidUsingAlias: 11 passed, 1 skipped.git diff --checkpassed.Testing notes:
The repository pins .NET SDK 8.0.419, which was unavailable locally. The build and tests were run using SDK 10 against a scratchpad copy. SHA256 checks confirmed that the modified source files matched the tested copy and that the JSON files matched the built module's Settings files.
The broader
AllCompatibilityRules.Tests.ps1suite was not completed locally due to its execution time and CPU usage. CI validation is pending.PR Checklist
.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.