Skip to content

Commit

Permalink
🔧 Configure PSScriptAnalyzer for the project #5
Browse files Browse the repository at this point in the history
- Added the following settings files to the root folder:
  + `PSScriptAnalyzerSettings.psd1`
  + `PSScriptAnalyzerSettings.desktop-3.0-windows.psd1`
- Enabled `PSUseCompatibleCmdlets` and `PSUseCompatibleSyntax` rules to
  ensure the scripts are compatible with the target PowerShell version
  + `PSScriptAnalyzerSettings.psd1`: PowerShell 2.0 or higher
  + `...desktop-3.0-windows.psd1`: PowerShell 3.0 to 5.0 desktop version

Fixes [#5](#5)
  • Loading branch information
chriskyfung committed Nov 14, 2023
1 parent 130d6b0 commit fe1c919
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
22 changes: 22 additions & 0 deletions PSScriptAnalyzerSettings.desktop-3.0-windows.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@{
Severity = @('Error', 'Warning')
Rules = @{
PSUseCompatibleCmdlets = @{
Compatibility = @(
'desktop-3.0-windows'
'desktop-4.0-windows'
'desktop-5.1.14393.206-windows'
)
}
PSUseCompatibleSyntax = @{
TargetedVersions = @(
'6.0'
'5.1'
'4.0'
'3.0'
'2.0'
)
}
}
ExcludeRules = @('PSAvoidUsingWriteHost')
}
24 changes: 24 additions & 0 deletions PSScriptAnalyzerSettings.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@{
Severity = @('Error', 'Warning')
Rules = @{
PSUseCompatibleCmdlets = @{
Compatibility = @(
'desktop-2.0-windows'
'desktop-3.0-windows'
'desktop-4.0-windows'
'desktop-5.1.14393.206-windows'
'core-6.1.0-windows'
)
}
PSUseCompatibleSyntax = @{
TargetedVersions = @(
'6.0'
'5.1'
'4.0'
'3.0'
'2.0'
)
}
}
ExcludeRules = @('PSAvoidUsingWriteHost')
}

0 comments on commit fe1c919

Please sign in to comment.