Skip to content

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

Description

@tablackburn

Both of the README's getting-started examples — the psake one and the Invoke-Build one — assign $PSBPreference.Test.ScriptAnalysisEnabled. That setting 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. The real setting is nested:

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

So the README contradicts its own settings table sixty lines above it.

Why it matters

$PSBPreference is a plain hashtable. Assigning an unrecognized path adds a key that nothing reads — no error, no warning. A consumer who copied the psake example to turn script analysis off has been running it on every build since, and a consumer who copied the Invoke-Build example to turn it on may not be running it at all.

These are not incidental mentions. They are the two flagship "here is how you use PowerShellBuild" blocks, which is what a new consumer copies first.

Related

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 silently.

The drift test added in #186 does not catch this. It parses $PSBPreference.* out of the README settings table rows only, so setting names appearing in fenced code examples are unchecked. Extending it to code fences would close that gap and is worth doing once #186 lands.

A third occurrence in instructions/repository-specific.instructions.md:303 is already fixed in #188.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions