Skip to content

Commit e405ca8

Browse files
committed
feat: add support for verbose output if PRE_COMMIT_PWSH_VERBOSE environment variable is set in PSScriptAnalyzer-wrapper.ps1
1 parent 9faf37c commit e405ca8

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

PSScriptAnalyzer-wrapper.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/usr/bin/env pwsh
2-
31
# Copyright © 2023 Mohamed El Morabity
2+
# Copyright © 2024 Ophios GmbH
43
# SPDX-License-Identifier: GPL-3.0-or-later
54

5+
[CmdletBinding()]
66
Param(
77
# Analyze options
88
[Parameter(Mandatory = $true, ParameterSetName = 'Check', Position = 0)]
@@ -37,9 +37,13 @@ Param(
3737
[String]$Settings
3838
)
3939

40-
Set-StrictMode -Version Latest
40+
if ([Environment]::GetEnvironmentVariable('PRE_COMMIT_PWSH_VERBOSE')) {
41+
$VerbosePreference = 'Continue'
42+
}
4143
$ErrorActionPreference = 'Stop'
4244

45+
Set-StrictMode -Version Latest
46+
4347
# Install PSScriptAnalyzer if not available
4448
if (-not (Get-InstalledModule PSScriptAnalyzer -ErrorAction SilentlyContinue)) {
4549
Install-Module -Name PSScriptAnalyzer -Scope CurrentUser -Force -AllowClobber

0 commit comments

Comments
 (0)