Skip to content

Commit 3db9a47

Browse files
committed
fix(Publish-PSBuildModule, Test-PSBuildPester): ✨ Improve parameter handling and suppress warnings
* Added suppression attributes for unused parameters in `Publish-PSBuildModule` and `Test-PSBuildPester`. * Enhanced `CmdletBinding` attribute casing for consistency. * Refined parameter validation logic for better clarity and maintainability.
1 parent 348cc5d commit 3db9a47

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

PowerShellBuild/Public/Publish-PSBuildModule.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
function Publish-PSBuildModule {
2+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(
3+
'PSReviewUnusedParameter',
4+
'',
5+
Justification = 'Both Credential and NuGetApiKey are used just not via explicit variable call.'
6+
)]
27
<#
38
.SYNOPSIS
49
Publishes a module to the defined PowerShell repository.
@@ -28,6 +33,7 @@ function Publish-PSBuildModule {
2833
Publish version 0.1.0 of the module at path .\Output\0.1.0\MyModule to the PSGallery repository using an API key and a PowerShell credential.
2934
#>
3035
[CmdletBinding(DefaultParameterSetName = 'ApiKey')]
36+
[CmdletBinding(DefaultParameterSetName = 'ApiKey')]
3137
param(
3238
[parameter(Mandatory)]
3339
[ValidateScript({

PowerShellBuild/Public/Test-PSBuildPester.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
function Test-PSBuildPester {
2+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(
3+
'PSReviewUnusedParameter',
4+
'CodeCoverageThreshold',
5+
Justification = 'Used inside a foreach method call.'
6+
)]
27
<#
38
.SYNOPSIS
49
Execute Pester tests for module.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ Install-Module -Name psake -RequiredVersion 4.8.0 -Repository PSGallery
2525
> [how to dot source tasks using PowerShell aliases](https://github.com/nightroman/Invoke-Build/blob/master/Tasks/Import/README.md#example-2-import-from-a-module-with-tasks)
2626
> example.
2727
28+
<!-- markdownlint-disable no-inline-html -->
2829
<p align="center">
2930
<img src="media/psaketaskmodule-256x256.png" alt="Logo">
3031
</p>
32+
<!-- markdownlint-enable no-inline-html -->
3133

3234
## Status - Work in progress
3335

@@ -209,3 +211,5 @@ $PSBPreference.Test.CodeCoverage.Enabled = $false
209211
[psgallery]: https://www.powershellgallery.com/packages/PowerShellBuild
210212
[license-badge]: https://img.shields.io/github/license/psake/PowerShellBuild.svg
211213
[license]: https://raw.githubusercontent.com/psake/PowerShellBuild/main/LICENSE
214+
215+
<!-- spell-checker:ignore PSGALLERY psaketaskmodule -->

0 commit comments

Comments
 (0)