Fix PSReviewUnusedParameter code scanning alerts#2208
Merged
aholstrup1 merged 2 commits intomainfrom Apr 10, 2026
Merged
Conversation
- Remove unused MajorMinorVersion, BuildNumber, RevisionNumber params from Build-AppsInWorkspace (versioning handled by Update-AppJsonProperties) - Suppress buildMode warning in Compile.ps1 (required by workflow binding) - Add file-level SuppressMessageAttribute in test files for mock params - Fix unused runtime param in e2eTestHelper by adding it to app.json
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces PowerShell code scanning noise by fixing or intentionally suppressing PSReviewUnusedParameter findings across production scripts, helper modules, and Pester tests—keeping the action/module APIs aligned with real usage.
Changes:
- Removed unused version-stamping parameters from
Build-AppsInWorkspaceand stopped splatting them from the compile action. - Fixed
CreateNewAppInFolderto actually persist the providedruntimeinto generatedapp.json. - Added targeted
SuppressMessageAttributesuppressions for parameters that must exist (workflow-provided) and for Pester mock/callback signatures.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/DownloadProjectDependencies.Test.ps1 | Adds file-level suppression for unused mock parameters (Pester signature parity). |
| Tests/CompileFromWorkspace.Test.ps1 | Adds file-level suppression for unused mock parameters while preserving the UTF-8 BOM. |
| e2eTests/e2eTestHelper.psm1 | Writes runtime into generated app.json to match the function’s parameter contract. |
| Actions/CompileApps/Compile.ps1 | Suppresses the workflow-provided-but-currently-unused buildMode parameter and removes unused build splat keys. |
| Actions/.Modules/CompileFromWorkspace.psm1 | Removes unused Build-AppsInWorkspace parameters and updates comment-based help accordingly. |
…ock alerts - Scope baseSettings variable to script level in AL-Go-Helper.Test.ps1 so PSScriptAnalyzer sees it used across BeforeEach/It blocks - Replace empty catch block in CompileFromWorkspace.psm1 with OutputDebug logging for unparseable .NET runtime versions
mazhelez
approved these changes
Apr 10, 2026
spetersenms
approved these changes
Apr 10, 2026
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.
Addresses open PSScriptAnalyzer code scanning alerts
Approach
The alerts fall into distinct categories, each handled differently:
Production code - true fixes:
Build-AppsInWorkspace: RemovedMajorMinorVersion,BuildNumber, andRevisionNumberparameters. These were accepted but never used - version stamping is handled byUpdate-AppJsonPropertieswhich is called separately before compilation. Also removed the corresponding entries from the\splatting inCompile.ps1.e2eTestHelper.psm1: The\parameter was accepted byCreateNewAppInFolderbut never written into the generatedapp.json. Addedruntimeto the output - this is a bug fix.CompileFromWorkspace.psm1: Replaced an empty catch block (for unparseable .NET runtime versions) with anOutputDebugcall that logs the version string and error.Production code - suppressed:
Compile.ps1:\is passed by the action YAML workflow and cannot be removed without updating the action definition. It may also be needed for future incremental build support (see existing TODO). Added a targetedSuppressMessageAttribute.Test files - fixed:
AL-Go-Helper.Test.ps1:\was assigned inBeforeEachbut PSScriptAnalyzer flagged it as unused since usage was in separateItblocks. Scoped it to\so the cross-block usage is explicit.Test files - suppressed:
CompileFromWorkspace.Test.ps1andDownloadProjectDependencies.Test.ps1: All 57 alerts are Pester mock scriptblock parameters that must match the mocked function's signature for positional binding. Added file-levelSuppressMessageAttributewith justification.