From 0a53680343bdc8680c0847be9931ddc8f6a2f629 Mon Sep 17 00:00:00 2001 From: Trent Blackburn Date: Thu, 27 Aug 2026 15:28:21 -0400 Subject: [PATCH 1/2] fix: Correct the script analysis setting name in the README examples Both getting-started examples assigned $PSBPreference.Test.ScriptAnalysisEnabled. That setting does not exist -- the name appears nowhere in the module source. The real one is nested, $PSBPreference.Test.ScriptAnalysis.Enabled, which the README's own settings table has documented correctly all along. $PSBPreference is a plain hashtable, so assigning an unrecognized path adds a key nothing reads. No error, no warning. Anyone who copied the psake example to turn script analysis off has been running it on every build since; anyone who copied the Invoke-Build example to turn it on may never have run it at all. These are not incidental mentions. They are the two flagship "here is how you use PowerShellBuild" blocks, which is the first thing a new consumer copies. Same failure class as #178, where IB.tasks.ps1 read Test.CodeCoverage.OutputFormat while the setting is OutputFileFormat: a name that binds nothing and fails quietly. The drift test added in #186 does not catch this. It parses $PSBPreference references out of the README settings table rows only, so names inside fenced code examples go unchecked. Extending it to code fences is worth doing once #186 and the stacked signing documentation land, and is noted on the issue rather than done here, where it would conflict with both. A third occurrence in instructions/repository-specific.instructions.md is already fixed in #188. Closes #191 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01U1Jhu7fgTRJq7LK5MuKteE --- CHANGELOG.md | 10 ++++++++++ README.md | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0baa132..224c1b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed +- [**#191**](https://github.com/psake/PowerShellBuild/issues/191) + The README's psake and Invoke-Build examples assigned + `$PSBPreference.Test.ScriptAnalysisEnabled`, which is not a setting. The real + one is nested, `$PSBPreference.Test.ScriptAnalysis.Enabled`, as the README's + own settings table has always said. `$PSBPreference` is a plain hashtable, so + the unrecognized name added a key nothing reads and neither errored nor + warned. **Check your own build file**: if you copied either example, script + analysis has been running when you asked for it off, or skipped when you asked + for it on. Correcting the name is the whole fix; no module behavior changed. + - [**#124**](https://github.com/psake/PowerShellBuild/issues/124) The docs tree can hold documentation that is not generated help. A `README.md` at its root, a `CONTRIBUTING.md` beside the generated markdown, an `images/` or diff --git a/README.md b/README.md index fddd1e2..ee806ab 100644 --- a/README.md +++ b/README.md @@ -168,8 +168,8 @@ well. properties { # These settings overwrite values supplied from the PowerShellBuild # module and govern how those tasks are executed - $PSBPreference.Test.ScriptAnalysisEnabled = $false - $PSBPreference.Test.CodeCoverage.Enabled = $true + $PSBPreference.Test.ScriptAnalysis.Enabled = $false + $PSBPreference.Test.CodeCoverage.Enabled = $true } task default -depends Build @@ -195,8 +195,8 @@ Import-Module PowerShellBuild . PowerShellBuild.IB.Tasks # Overwrite build settings contained in PowerShellBuild -$PSBPreference.Test.ScriptAnalysisEnabled = $true -$PSBPreference.Test.CodeCoverage.Enabled = $false +$PSBPreference.Test.ScriptAnalysis.Enabled = $true +$PSBPreference.Test.CodeCoverage.Enabled = $false ``` ![Example](./media/ib_example.png) From 6e16c951df0855f6b2699f205a97890dc2f2a77c Mon Sep 17 00:00:00 2001 From: Trent Blackburn Date: Thu, 27 Aug 2026 16:33:12 -0400 Subject: [PATCH 2/2] docs: Correct the impact described in the changelog entry The entry claimed a consumer who copied either example was affected. Only the psake one was. It assigns $false to the dead name, so script analysis kept running when the consumer asked for it off -- real impact. The Invoke-Build example assigns $true, and Test.ScriptAnalysis.Enabled already defaults to $true (build.properties.ps1:66), so that assignment landed on a key nothing reads while the real setting stayed at the value the consumer wanted. Nothing was lost there. Telling Invoke-Build users to check their build file for analysis that never ran would create exactly the false belief this entry exists to dispel, and the changelog is the copy that ships. Caught in review of #192. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01U1Jhu7fgTRJq7LK5MuKteE --- CHANGELOG.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 224c1b4..b2cd9d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,9 +83,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). one is nested, `$PSBPreference.Test.ScriptAnalysis.Enabled`, as the README's own settings table has always said. `$PSBPreference` is a plain hashtable, so the unrecognized name added a key nothing reads and neither errored nor - warned. **Check your own build file**: if you copied either example, script - analysis has been running when you asked for it off, or skipped when you asked - for it on. Correcting the name is the whole fix; no module behavior changed. + warned. **Check your own build file if you copied the psake example**: it + assigned `$false`, so script analysis has been running on every build even + though you asked for it off. The Invoke-Build example assigned `$true`, which + is already the default, so that one did nothing either way. Correcting the + name is the whole fix; no module behavior changed. - [**#124**](https://github.com/psake/PowerShellBuild/issues/124) The docs tree can hold documentation that is not generated help. A `README.md`