Skip to content

Commit 5f029da

Browse files
🩹 [Patch]: Refactor SuppressMessage attributes for consistency and readability in module export functions
1 parent 520f181 commit 5f029da

File tree

4 files changed

+7
-24
lines changed

4 files changed

+7
-24
lines changed

‎scripts/helpers/Build/Get-PSModuleAliasesToExport.ps1‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@
1010
Get-PSModuleAliasesToExport -SourceFolderPath 'C:\MyModule\src\MyModule'
1111
#>
1212
[CmdletBinding()]
13-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
14-
'PSAvoidUsingWriteHost', '', Scope = 'Function',
15-
Justification = 'Want to just write to the console, not the pipeline.'
16-
)]
17-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
18-
'PSAvoidLongLines', '', Scope = 'Function',
19-
Justification = 'Contains long links.'
20-
)]
13+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Scope = 'Function', Justification = 'Want to just write to the console, not the pipeline.')]
14+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Scope = 'Function', Justification = 'Contains long links.')]
2115
param(
2216
# Path to the folder where the module source code is located.
2317
[Parameter(Mandatory)]

‎scripts/helpers/Build/Get-PSModuleClassesToExport.ps1‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
.NOTES
1818
Inspired by [about_Classes | Exporting classes with type accelerators](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_classes?view=powershell-7.4#exporting-classes-with-type-accelerators)
1919
#>
20-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
21-
'PSAvoidLongLines', '', Scope = 'Function',
22-
Justification = 'Contains long links.'
23-
)]
20+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Scope = 'Function', Justification = 'Contains long links.')]
2421
[CmdletBinding()]
2522
param (
2623
# The path to the module root folder.

‎scripts/helpers/Build/Get-PSModuleCmdletsToExport.ps1‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@
1010
Get-PSModuleCmdletsToExport -SourceFolderPath 'C:\MyModule\src\MyModule'
1111
#>
1212
[CmdletBinding()]
13-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
14-
'PSAvoidUsingWriteHost', '', Scope = 'Function',
15-
Justification = 'Want to just write to the console, not the pipeline.'
16-
)]
17-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
18-
'PSAvoidLongLines', '', Scope = 'Function',
19-
Justification = 'Contains long links.'
20-
)]
13+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Scope = 'Function', Justification = 'Want to just write to the console, not the pipeline.')]
14+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Scope = 'Function', Justification = 'Contains long links.')]
2115
param(
2216
# Path to the folder where the module source code is located.
2317
[Parameter(Mandatory)]

‎scripts/helpers/Build/Get-PSModuleFunctionsToExport.ps1‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010
Get-PSModuleFunctionsToExport -SourceFolderPath 'C:\MyModule\src\MyModule'
1111
#>
1212
[CmdletBinding()]
13-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
14-
'PSAvoidUsingWriteHost', '', Scope = 'Function',
15-
Justification = 'Want to just write to the console, not the pipeline.'
16-
)]
13+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Scope = 'Function', Justification = 'Want to just write to the console, not the pipeline.')]
14+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Scope = 'Function', Justification = 'Contains long links.')]
1715
[OutputType([array])]
1816
param(
1917
# Path to the folder where the module source code is located.

0 commit comments

Comments
 (0)