Skip to content

docs: Correct the script analysis setting name in the README examples - #192

Merged
tablackburn merged 3 commits into
mainfrom
bugfix/191-readme-scriptanalysis-setting-name
Aug 27, 2026
Merged

docs: Correct the script analysis setting name in the README examples#192
tablackburn merged 3 commits into
mainfrom
bugfix/191-readme-scriptanalysis-setting-name

Conversation

@tablackburn

Copy link
Copy Markdown
Contributor

Closes #191

The defect

Both of the README's getting-started examples assign a setting that does not exist.

README.md:171      $PSBPreference.Test.ScriptAnalysisEnabled = $false   # psake example
README.md:198  $PSBPreference.Test.ScriptAnalysisEnabled = $true        # Invoke-Build example

ScriptAnalysisEnabled appears nowhere in the module source — I grepped the whole repository. The real setting is nested:

PowerShellBuild/build.properties.ps1:64   ScriptAnalysis = @{ Enabled = $true; ... }
README.md:108                             | $PSBPreference.Test.ScriptAnalysis.Enabled | `$true` | ...

The README has been contradicting its own settings table sixty lines above it.

Why this is worse than a typo

$PSBPreference is a plain hashtable. Assigning an unrecognized path adds a key nothing reads — no error, no warning, no hint that the line did nothing.

So a consumer who copied the psake example to turn script analysis off has been running it on every build since. One who copied the Invoke-Build example to turn it on may never have run it at all. Neither has any way to notice.

And these are not incidental mentions. They are the two flagship "here is how you use PowerShellBuild" blocks — 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 change

Two lines, plus realigning the = on the assignment under each so the blocks still read cleanly. No module code touched — the setting was always correct, only the documentation of it was wrong.

A CHANGELOG entry under Fixed because this is user-facing in effect: anyone who copied either example has a dead line in their build file right now and needs to be told to look.

Not fixed here: the test gap

The drift test added in #186 does not catch this. It parses $PSBPreference.* references out of the README settings table rows only, so setting names inside fenced code examples are unchecked.

Extending that regex to code fences would close the gap and catch this class permanently. I deliberately left it out of this PR: tests/IBTasks.tests.ps1 is modified by #186 and again by the signing-documentation PR stacked on top of it, and a third concurrent edit to the same file would conflict with both. It is recorded on #191 as the follow-up, to be done once that stack lands.

Verification

  • grep -rn "ScriptAnalysisEnabled" across the repository now returns nothing outside Output/.
  • A third occurrence in instructions/repository-specific.instructions.md:303 is already fixed in docs: Correct dead paths and stale claims in repository instructions #188, so the two PRs together clear it everywhere.
  • Full suite: 483 passed, 0 failed, 3 skipped, unchanged from baseline as expected for a documentation-only edit.

🤖 Generated with Claude Code

https://claude.ai/code/session_01U1Jhu7fgTRJq7LK5MuKteE

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U1Jhu7fgTRJq7LK5MuKteE
Copilot AI lite review requested due to automatic review settings August 27, 2026 19:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

Test Results

    4 files  ±0    760 suites  ±0   2m 31s ⏱️ +12s
  485 tests ±0    482 ✅ ±0   3 💤 ±0  0 ❌ ±0 
1 944 runs  ±0  1 877 ✅ ±0  67 💤 ±0  0 ❌ ±0 

Results for commit 6e16c95. ± Comparison against base commit a64ebc8.

♻️ This comment has been updated with latest results.

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U1Jhu7fgTRJq7LK5MuKteE
@tablackburn tablackburn changed the title fix: Correct the script analysis setting name in the README examples docs: Correct the script analysis setting name in the README examples Aug 27, 2026
…iptanalysis-setting-name

# Conflicts:
#	CHANGELOG.md
@tablackburn
tablackburn merged commit 39cb303 into main Aug 27, 2026
6 checks passed
@tablackburn
tablackburn deleted the bugfix/191-readme-scriptanalysis-setting-name branch August 27, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

README examples assign a setting that does not exist: $PSBPreference.Test.ScriptAnalysisEnabled

2 participants