Skip to content

build: add PSScriptAnalyzer clean-pass to build - #503

Open
HeyItsGilbert wants to merge 2 commits into
mainfrom
build/analyzer-clean-pass
Open

HeyItsGilbert wants to merge 2 commits into
mainfrom
build/analyzer-clean-pass

Conversation

@HeyItsGilbert

Copy link
Copy Markdown
Member

Closes #487.

What

Implements Phase 3d from #487: Invoke-psake Analyze now uses an explicit organization ruleset and completes with zero findings.

Structural

  • Added PSScriptAnalyzerSettings.psd1 at repo root — full default ruleset (IncludeDefaultRules), only two repo-wide exclusions (PSAvoidUsingWriteHost for console UX, PSUseToExportFieldsInManifest for the manifest's VariablesToExport = '*'). No Severity key — confirmed empirically that setting one silently drops ParseError-severity records with no trace of what was hidden.
  • Wired the settings file into psakeFile.ps1, and added a PrepareAnalysis task that puts the staged module on PSModulePath before analysis runs. Without it, every koan's using module PSKoans fails to resolve — which not only raises a ModuleNotFoundDuringParse error per file, but silently suppresses every other rule that needs symbol resolution (aliases, output types, etc.) for that file.

Koan false positives (113 → 0)

  • ~41 PSUseDeclaredVarsMoreThanAssignments false positives fixed with $script:, scoping BeforeAll/BeforeEach fixture variables so PSScriptAnalyzer's per-scriptblock analysis can see they're used by sibling It blocks (same root cause as the existing tests/*.Tests.ps1 fixes).
  • ~15 justified SuppressMessageAttribute annotations (each with a specific comment) for false positives that can't be fixed without altering an exercise: values consumed only by an unsolved __/____ blank, AD -Filter strings expanded by the ActiveDirectory provider (not PowerShell interpolation), values read only inside nested closures (Mock -MockWith, Select-Object calculated properties, ForEach-Object) PSScriptAnalyzer doesn't trace, switches used only as parameter-set discriminators, and zero-side-effect example functions flagged for ShouldProcess/SingularNouns on verb/name alone.
  • 42 lines of trailing whitespace trimmed (mechanical).
  • No koan blanks, exercise structure, or pedagogical content were touched.

Real bugs found along the way

  • AboutQueryingDatabases.Koans.ps1: Out-File - FilePath ... (stray space) broke positional binding and errored at runtime — fixed to -FilePath.
  • AddPesterAssertionOperator.ps1: replaced the alias Add-AssertionOperator with Add-ShouldOperator, and replaced the empty-catch registration guard with an explicit Get-ShouldOperator existence check (no more silently swallowing unexpected errors).
  • AboutLists.Koans.ps1: renamed the automatic-variable-shadowing $_ scriptblock parameter to $Item (no suppression attribute is discoverable on a bare, non-function scriptblock's own param() for this rule).

Production code (37 → 0)

  • Real fixes: correct [OutputType] on Invoke-Koan/New-KoanRunspace; Set-PSKoanSetting body wrapped in process {} so it actually honors its own already-declared ValueFromPipeline parameters.
  • Justified suppressions: ArgumentCompleter signature params (mirrors build.ps1's existing convention), values read only inside nested closures, parameter-set-discriminator switches, and zero-side-effect factory functions.

Verification

  • .\build.ps1 -Task Analyze → zero findings (confirmed twice, fresh process).
  • Full test suite: 729 passed / 6 failed / 8 skipped, identical before and after (the 6 failures are pre-existing, unrelated Register-Advice.Tests.ps1 $PROFILE-binding errors, environment-specific).

Implements Phase 3d analysis from #487.

- Add PSScriptAnalyzerSettings.psd1 at the repo root: runs the full
  PSScriptAnalyzer default ruleset (IncludeDefaultRules), with only two
  repo-wide exclusions (PSAvoidUsingWriteHost for the console UX,
  PSUseToExportFieldsInManifest for the manifest's VariablesToExport = '*').
  Deliberately omits a Severity key, since setting one silently drops
  ParseError-severity records with no way to see what was suppressed.

- Wire the settings file into psakeFile.ps1 via
  $PSBPreference.Test.ScriptAnalysis.SettingsPath, and add a
  PrepareAnalysis task that puts the staged module on PSModulePath before
  analysis runs. Without it, every koan's `using module PSKoans` fails to
  resolve, which both raises a ModuleNotFoundDuringParse error per file and
  silently suppresses every other rule that depends on symbol resolution
  (aliases, output types, etc.) for that file.

- Fix ~41 PSUseDeclaredVarsMoreThanAssignments false positives across koan
  files by scoping BeforeAll/BeforeEach fixture variables with $script:,
  mirroring the same fix already applied to tests/*.Tests.ps1. These are
  genuine cross-block Pester usages (BeforeAll -> sibling It) that
  PSScriptAnalyzer cannot trace across scriptblock boundaries.

- Add justified SuppressMessageAttribute annotations (each with a specific
  comment) for genuine false positives that can't be fixed without altering
  the exercise: values consumed only by an unsolved `__`/`____` blank,
  ActiveDirectory -Filter strings expanded by the AD provider rather than
  PowerShell interpolation, values read only inside nested closures
  (Mock -MockWith, Select-Object calculated properties, ForEach-Object)
  that PSScriptAnalyzer doesn't trace, switches used only as parameter-set
  discriminators, and zero-side-effect factory/example functions flagged
  for ShouldProcess/SingularNouns based on verb/name alone.

- Fix two real bugs found along the way:
  - AboutQueryingDatabases.Koans.ps1: `Out-File - FilePath ...` (stray
    space) was breaking positional parameter binding and erroring at
    runtime; corrected to `-FilePath`.
  - AddPesterAssertionOperator.ps1: replaced the alias `Add-AssertionOperator`
    with `Add-ShouldOperator`, and replaced the try/empty-catch registration
    guard with an explicit Get-ShouldOperator existence check.

- Real code fixes in Public/Private module functions: correct [OutputType]
  declarations on Invoke-Koan and New-KoanRunspace, and wrap
  Set-PSKoanSetting's body in a process {} block so it actually honors its
  own already-declared ValueFromPipeline parameters.

- Rename the automatic-variable-shadowing $_ scriptblock parameter to
  $Item in AboutLists.Koans.ps1 (both filters, for consistency); no
  suppression attribute is discoverable on a bare (non-function)
  scriptblock's own param block for this rule.

- Trim trailing whitespace (42 lines, mechanical) across several koan
  files.

No koan blanks, exercise structure, or pedagogical content were modified.
`.\build.ps1 -Task Analyze` now completes with zero findings; full test
suite unchanged at 729 passed / 6 pre-existing unrelated failures
(Register-Advice, environment-specific $PROFILE binding) / 8 skipped.
Copilot AI lite review requested due to automatic review settings September 19, 2026 23:05
@github-actions

github-actions Bot commented Sep 19, 2026

Copy link
Copy Markdown

Test Results

    4 files  ± 0    104 suites  ±0   2m 0s ⏱️ +3s
1 562 tests +18  1 538 ✅ +18  24 💤 ±0  0 ❌ ±0 
2 988 runs  +24  2 956 ✅ +24  32 💤 ±0  0 ❌ ±0 

Results for commit 4668ab7. ± Comparison against base commit b99ac78.

This pull request removes 222 and adds 240 tests. Note that renamed tests count towards both.
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Init/AddPesterAssertionOperator.ps1'; Length=755; Name='AddPesterAssertionOperator.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Init/RegisterArgumentCompleters.ps1'; Length=2613; Name='RegisterArgumentCompleters.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Private/Invoke-Koan.ps1'; Length=3119; Name='Invoke-Koan.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Private/Measure-Koan.ps1'; Length=2628; Name='Measure-Koan.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Private/New-KoanRunspace.ps1'; Length=1440; Name='New-KoanRunspace.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Private/New-PSKoanErrorRecord.ps1'; Length=3132; Name='New-PSKoanErrorRecord.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Public/Get-Blank.ps1'; Length=1871; Name='Get-Blank.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Public/Get-PSKoan.ps1'; Length=5445; Name='Get-PSKoan.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Public/Set-PSKoanSetting.ps1'; Length=3457; Name='Set-PSKoanSetting.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Public/Show-Karma.ps1'; Length=8914; Name='Show-Karma.ps1'}
…
/Users/runner/work/PSKoans/PSKoans/tests/Functions/Public/Set-PSKoanSetting.Tests.ps1 ‑ Set-PSKoanSetting.Settings file Exists.Setting values with -Name and -Value.should add a new setting via pipeline (PSCustomObject with Name/Value): Editor = code-insiders
/Users/runner/work/PSKoans/PSKoans/tests/Functions/Public/Set-PSKoanSetting.Tests.ps1 ‑ Set-PSKoanSetting.Settings file Exists.Setting values with -Name and -Value.should add a new setting via pipeline (PSCustomObject with Name/Value): LibraryFolder = TestDrive:/PSKoans
/Users/runner/work/PSKoans/PSKoans/tests/Functions/Public/Set-PSKoanSetting.Tests.ps1 ‑ Set-PSKoanSetting.Settings file Exists.Setting values with -Name and -Value.should add a new setting via pipeline (PSCustomObject with Name/Value): TestSetting1 = TestValue1
/Users/runner/work/PSKoans/PSKoans/tests/Functions/Public/Set-PSKoanSetting.Tests.ps1 ‑ Set-PSKoanSetting.Settings file Exists.Setting values with -Settings Hashtable.should add or overwrite multiple new settings via pipeline (hashtable)
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Init/AddPesterAssertionOperator.ps1'; Length=1065; Name='AddPesterAssertionOperator.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Init/RegisterArgumentCompleters.ps1'; Length=3899; Name='RegisterArgumentCompleters.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Private/Invoke-Koan.ps1'; Length=3166; Name='Invoke-Koan.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Private/Measure-Koan.ps1'; Length=2960; Name='Measure-Koan.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Private/New-KoanRunspace.ps1'; Length=1747; Name='New-KoanRunspace.ps1'}
/Users/runner/work/PSKoans/PSKoans/tests/ModuleValidation.Tests.ps1 ‑ Static Analysis: Module & Repository Files.Repository Code.has exactly one line feed at EOF in IO.FileInfo{FullName='/Users/runner/work/PSKoans/PSKoans/Output/PSKoans/0.67.0/Private/New-PSKoanErrorRecord.ps1'; Length=3374; Name='New-PSKoanErrorRecord.ps1'}
…

♻️ This comment has been updated with latest results.

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 review overview

🟡 Changes recommended

Two moderate findings and one nit remain regarding regression coverage, output metadata, and suppression justification.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds an explicit PSScriptAnalyzer ruleset and staged-module preparation so Invoke-psake Analyze reaches zero findings, with analyzer cleanup and runtime fixes across tests, production code, and koans.

Changes:

  • Adds analyzer settings and build integration.
  • Scopes fixtures and documents justified suppressions.
  • Fixes pipeline handling, output metadata, assertion registration, and koan syntax.
  • Removes incidental whitespace and analyzer findings.
File Summary
tests/​ModuleValidation.Tests.ps1 Scopes module fixture data.
tests/​KoanValidation.Tests.ps1 Scopes koan fixture data.
tests/​Functions/​Public/​Update-PSKoan.Tests.ps1 Scopes test file data.
tests/​Functions/​Public/​Show-Karma.Tests.ps1 Scopes editor fixture data.
tests/​Functions/​Public/​Show-Advice.Tests.ps1 Scopes advice fixtures.
tests/​Functions/​Public/​Set-PSKoanSetting.Tests.ps1 Scopes configuration paths.
tests/​Functions/​Public/​Reset-PSKoan.Tests.ps1 Scopes default parameters.
tests/​Functions/​Public/​Move-PSKoanLibrary.Tests.ps1 Scopes the old location.
tests/​Functions/​Public/​Get-PSKoanSetting.Tests.ps1 Scopes separator data.
tests/​Functions/​Public/​Get-PSKoanLocation.Tests.ps1 Scopes result fixtures.
tests/​Functions/​Public/​Get-Karma.Tests.ps1 Scopes shared results and locations.
tests/​Functions/​Private/​Update-PSKoanFile.Tests.ps1 Scopes user path data.
tests/​Functions/​Private/​New-KoanRunspace.Tests.ps1 Removes an unused declaration.
tests/​Functions/​Private/​Get-KoanIt.Tests.ps1 Scopes default parameters.
tests/​Functions/​Private/​Get-KoanAttribute.Tests.ps1 Scopes file path data.
tests/​Functions/​Private/​Assert-UnblockedFile.Tests.ps1 Scopes default parameters.
PSScriptAnalyzerSettings.psd1 Defines analyzer rules and exclusions.
PSKoans/​Public/​Show-Karma.ps1 Documents parameter-set suppressions.
PSKoans/​Public/​Set-PSKoanSetting.ps1 Adds pipeline processing and suppressions.
PSKoans/​Public/​Get-PSKoan.ps1 Documents analyzer exceptions.
PSKoans/​Public/​Get-Blank.ps1 Documents intentional pipeline behavior.
PSKoans/​Private/​New-PSKoanErrorRecord.ps1 Documents non-mutating behavior.
PSKoans/​Private/​New-KoanRunspace.ps1 Adds output metadata and suppression.
PSKoans/​Private/​Measure-Koan.ps1 Documents dynamic variable usage.
PSKoans/​Private/​Invoke-Koan.ps1 Adds output metadata for emitted results.
PSKoans/​Koans/​Modules/​dbatools/​AboutQueryingDatabases.Koans.ps1 Fixes Out-File parameter syntax.
PSKoans/​Koans/​Modules/​dbatools/​AboutNewDatabases.Koans.ps1 Removes trailing whitespace.
PSKoans/​Koans/​Modules/​dbatools/​AboutBackupDatabases.Koans.ps1 Removes trailing whitespace.
PSKoans/​Koans/​Modules/​ActiveDirectory/​Introduction/​AboutFiltering.Koans.ps1 Documents provider-expanded variables.
PSKoans/​Koans/​Katas/​SortingCharacters.Koans.ps1 Scopes fixtures and documents stub parameters.
PSKoans/​Koans/​Katas/​ProcessingStrings.Koans.ps1 Scopes fixtures and documents stub parameters.
PSKoans/​Koans/​Introduction/​AboutStrings.Koans.ps1 Documents intentional unused values.
PSKoans/​Koans/​Introduction/​AboutNumbers.Koans.ps1 Scopes shared fixtures.
PSKoans/​Koans/​Introduction/​AboutGetMember.Koans.ps1 Scopes shared fixtures.
PSKoans/​Koans/​Foundations/​AboutVariables.Koans.ps1 Documents blank-variable usage.
PSKoans/​Koans/​Foundations/​AboutOrderOfOperations.Koans.ps1 Documents pedagogical exceptions.
PSKoans/​Koans/​Foundations/​AboutFunctionsAndScriptBlocks.Koans.ps1 Documents example-function naming.
PSKoans/​Koans/​Foundations/​AboutConditionals.Koans.ps1 Documents side-effect-free examples.
PSKoans/​Koans/​Constructs and Patterns/​AboutXml.Koans.ps1 Scopes the XML path fixture.
PSKoans/​Koans/​Constructs and Patterns/​AboutStringBuilder.Koans.ps1 Scopes the builder fixture.
PSKoans/​Koans/​Constructs and Patterns/​AboutSplatting.Koans.ps1 Scopes the module path fixture.
PSKoans/​Koans/​Constructs and Patterns/​AboutRegularExpressions.Koans.ps1 Adds suppressions and scopes fixtures.
PSKoans/​Koans/​Constructs and Patterns/​AboutRedirection.Koans.ps1 Scopes redirection fixtures.
PSKoans/​Koans/​Constructs and Patterns/​AboutPSObjects.Koans.ps1 Scopes the object fixture.
PSKoans/​Koans/​Constructs and Patterns/​AboutLists.Koans.ps1 Renames a shadowing parameter.
PSKoans/​Koans/​Constructs and Patterns/​AboutErrorHandling.Koans.ps1 Scopes the error fixture.
PSKoans/​Koans/​Constructs and Patterns/​AboutEnumerations.Koans.ps1 Documents enumeration exceptions.
PSKoans/​Koans/​Constructs and Patterns/​AboutBitwiseOperations.Koans.ps1 Adds function output metadata.
PSKoans/​Koans/​Cmdlets 2/​AboutCsvCmdlets.Koans.ps1 Scopes CSV fixtures and removes dead setup.
PSKoans/​Koans/​Cmdlets 1/​AboutSortObject.Koans.ps1 Scopes sorting fixtures.
PSKoans/​Koans/​Cmdlets 1/​AboutPSProviders.Koans.ps1 Documents blank usage and scopes fixtures.
PSKoans/​Koans/​Cmdlets 1/​AboutNewObject.Koans.ps1 Documents intentional constructor usage.
PSKoans/​Koans/​Cmdlets 1/​AboutModules.Koans.ps1 Documents scaffolding and scopes fixtures.
PSKoans/​Koans/​Cmdlets 1/​AboutMeasureObject.Koans.ps1 Scopes measurement fixtures.
PSKoans/​Koans/​Cmdlets 1/​AboutGroupObject.Koans.ps1 Scopes the file fixture.
PSKoans/​Init/​RegisterArgumentCompleters.ps1 Adds completer suppressions.
PSKoans/​Init/​AddPesterAssertionOperator.ps1 Uses explicit assertion-operator detection.
psakeFile.ps1 Configures analysis and staged-module preparation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread PSKoans/Public/Set-PSKoanSetting.ps1
Comment thread PSKoans/Init/RegisterArgumentCompleters.ps1 Outdated
- RegisterArgumentCompleters.ps1: replace generic "false positive"
  suppression justifications with the actual reason -- Command,
  Parameter, CommandAst, and FakeBoundParams are required positional
  slots in the host-supplied Register-ArgumentCompleter callback
  signature that these completers don't use.
- Set-PSKoanSetting.ps1: add regression tests piping supported input
  forms (PSCustomObject with Name/Value, hashtable for Settings) as
  requested. Writing the hashtable-pipe test surfaced a real binding
  bug: DefaultParameterSetName 'Single' made pipeline binding prefer
  the ValueFromPipelineByPropertyName 'Single' set as a tiebreaker,
  which a bare hashtable can never satisfy, so piped hashtables
  silently failed to bind. Fixed by changing the default parameter
  set to 'Multiple'.

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 review overview

🟡 Changes recommended

The pinned analysis runner cannot enforce the promised zero-findings gate, and two behavior or metadata regressions remain.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (2)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Test no longer invokes ConvertFrom-Csv

PSKoans/​Koans/​Cmdlets 2/​AboutCsvCmdlets.Koans.ps1:238

Removing the assignment also removes this test's only ConvertFrom-Csv call, so the test now checks only that its fixture is a string and no longer exercises the behavior named by the test. Keep an invocation here (discarding its result if necessary) so this koan still demonstrates that ConvertFrom-Csv accepts string data.

Medium severity EndInvoke output type conflicts with collection metadata

PSKoans/​Private/​Invoke-Koan.ps1:21

EndInvoke() returns a collection internally, but line 88 writes that collection to PowerShell's success stream, which enumerates it. Callers therefore receive the contained Pester result objects rather than a PSDataCollection; declaring the collection type gives consumers inaccurate command metadata. Keep the emitted item type and suppress the analyzer false positive with this runtime behavior documented.

Comment thread psakeFile.ps1
$PSBPreference.Test.OutputFormat = 'JUnitXml'
$PSBPreference.Test.ScriptAnalysis.Enabled = $true
$PSBPreference.Test.ScriptAnalysis.SettingsPath = Join-Path $PSScriptRoot 'PSScriptAnalyzerSettings.psd1'
$PSBPreference.Test.ScriptAnalysis.FailBuildOnSeverityLevel = 'Error'
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.

Add PSScriptAnalyzer clean pass to PSKoans build

2 participants