From c31ee791bbc54b4c074a4fa04cc8c48472211f9a Mon Sep 17 00:00:00 2001 From: Marco Blessing Date: Tue, 28 Jun 2022 09:41:53 +0200 Subject: [PATCH] Update issue templates (#57) * Update issue templates * debug PSScriptAnalyzer --- .github/ISSUE_TEMPLATE/default.md | 12 +++++++ tools/DroneIO.psm1 | 57 ++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/default.md diff --git a/.github/ISSUE_TEMPLATE/default.md b/.github/ISSUE_TEMPLATE/default.md new file mode 100644 index 0000000..c458e70 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/default.md @@ -0,0 +1,12 @@ +--- +name: Default +about: Use this template if nothing seems to work. +title: ":question: " +labels: question +assignees: '' + +--- + +#### :grey_question: Simply ask your question here: :grey_question: + + diff --git a/tools/DroneIO.psm1 b/tools/DroneIO.psm1 index 4d7a579..2d42f52 100644 --- a/tools/DroneIO.psm1 +++ b/tools/DroneIO.psm1 @@ -33,35 +33,35 @@ function Invoke-InstallDependencies { $ErrorActionPreference = 'Stop' try { $ParamsPSScript = @{ - Name = 'PSScriptAnalyzer' - Scope = 'CurrentUser' - RequiredVersion = '1.20.0' - Force = $true + Name = 'PSScriptAnalyzer' + Scope = 'CurrentUser' + RequiredVersion = '1.20.0' + Force = $true SkipPublisherCheck = $true - AllowClobber = $true - Verbose = $VerbosePreference + AllowClobber = $true + Verbose = $VerbosePreference } Install-Module @ParamsPSScript $ParamsPester = @{ - Name = 'Pester' - Scope = 'CurrentUser' - RequiredVersion = '5.3.3' - Force = $true + Name = 'Pester' + Scope = 'CurrentUser' + RequiredVersion = '5.3.3' + Force = $true SkipPublisherCheck = $true - AllowClobber = $true - Verbose = $VerbosePreference + AllowClobber = $true + Verbose = $VerbosePreference } Install-Module @ParamsPester $ParamsPosh = @{ - Name = 'posh-git' - Scope = 'CurrentUser' - RequiredVersion = '1.1.0' - Force = $true + Name = 'posh-git' + Scope = 'CurrentUser' + RequiredVersion = '1.1.0' + Force = $true SkipPublisherCheck = $true - AllowClobber = $true - Verbose = $VerbosePreference + AllowClobber = $true + Verbose = $VerbosePreference #ErrorAction = 'Stop' } Install-Module @ParamsPosh @@ -96,8 +96,27 @@ function Invoke-Linter { Recurse = $true Settings = './tools/PSScriptAnalyzerSettings.psd1' ReportSummary = $true + ErrorAction = 'Stop' + } + try { + $AnalyzerResults = Invoke-ScriptAnalyzer @AnalyzerSettings + if ( $AnalyzerResults ) { + $AnalyzerResults | Sort-Object -Property @( + "ScriptName", + "Line" + ) | Format-Table @( + "Severity", + "ScriptName", + "Line", + "RuleName", + "Message" + ) -AutoSize | Out-String | Write-Verbose -Verbose + } + } + catch { + Write-Error -Message 'PSScriptAnalyzer failer' + Write-Error -Message $_.Exception.Message -ErrorAction 'Stop' } - Invoke-ScriptAnalyzer @AnalyzerSettings } }