diff --git a/JiraPS/JiraPS.psm1 b/JiraPS/JiraPS.psm1 index 4ab37388..9c45c76a 100644 --- a/JiraPS/JiraPS.psm1 +++ b/JiraPS/JiraPS.psm1 @@ -1,4 +1,4 @@ -#region Dependencies +#region Dependencies # Load the ConfluencePS namespace from C# # if (!("" -as [Type])) { # Add-Type -Path (Join-Path $PSScriptRoot JiraPS.Types.cs) -ReferencedAssemblies Microsoft.CSharp, Microsoft.PowerShell.Commands.Utility, System.Management.Automation diff --git a/JiraPS/Private/ConvertFrom-Json.ps1 b/JiraPS/Private/ConvertFrom-Json.ps1 index 251c6785..5824483b 100644 --- a/JiraPS/Private/ConvertFrom-Json.ps1 +++ b/JiraPS/Private/ConvertFrom-Json.ps1 @@ -7,6 +7,7 @@ if ($PSVersionTable.PSVersion.Major -lt 6) { ConvertFrom-Json implementation does not allow for overriding JSON maxlength. The default limit is easy to exceed with large issue lists. #> + [System.Diagnostics.CodeAnalysis.SuppressMessage('PSAvoidOverwritingBuiltInCmdlets', '')] [CmdletBinding()] param( [Parameter( Mandatory, ValueFromPipeline )] diff --git a/JiraPS/Private/Invoke-WebRequest.ps1 b/JiraPS/Private/Invoke-WebRequest.ps1 index 9393d2f9..19af887f 100644 --- a/JiraPS/Private/Invoke-WebRequest.ps1 +++ b/JiraPS/Private/Invoke-WebRequest.ps1 @@ -7,6 +7,7 @@ function Invoke-WebRequest { Cmdlet #> [CmdletBinding(HelpUri = 'https://go.microsoft.com/fwlink/?LinkID=217035')] + [System.Diagnostics.CodeAnalysis.SuppressMessage('PSAvoidOverwritingBuiltInCmdlets', '')] # TODO: fix this [Diagnostics.CodeAnalysis.SuppressMessageAttribute( "PSAvoidUsingConvertToSecureStringWithPlainText", "", @@ -129,7 +130,7 @@ Content-Type: application/octet-stream $PSBoundParameters['OutBuffer'] = 1 } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Microsoft.PowerShell.Utility\Invoke-WebRequest', [System.Management.Automation.CommandTypes]::Cmdlet) - $scriptCmd = {& $wrappedCmd @PSBoundParameters } + $scriptCmd = { & $wrappedCmd @PSBoundParameters } $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } @@ -169,6 +170,7 @@ if ($PSVersionTable.PSVersion.Major -ge 6) { .ForwardHelpCategory Cmdlet #> + [System.Diagnostics.CodeAnalysis.SuppressMessage('PSAvoidOverwritingBuiltInCmdlets', '')] # TODO: fix this [CmdletBinding(DefaultParameterSetName = 'StandardMethod', HelpUri = 'https://go.microsoft.com/fwlink/?LinkID=217035')] param( [switch] @@ -316,7 +318,7 @@ if ($PSVersionTable.PSVersion.Major -ge 6) { $PSBoundParameters['OutBuffer'] = 1 } $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Microsoft.PowerShell.Utility\Invoke-WebRequest', [System.Management.Automation.CommandTypes]::Cmdlet) - $scriptCmd = {& $wrappedCmd @PSBoundParameters } + $scriptCmd = { & $wrappedCmd @PSBoundParameters } $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) $steppablePipeline.Begin($PSCmdlet) } diff --git a/JiraPS/Private/Resolve-JiraError.ps1 b/JiraPS/Private/Resolve-JiraError.ps1 index b87bfda2..2752b5ad 100644 --- a/JiraPS/Private/Resolve-JiraError.ps1 +++ b/JiraPS/Private/Resolve-JiraError.ps1 @@ -1,4 +1,4 @@ -function Resolve-JiraError { +function Resolve-JiraError { [CmdletBinding()] param( [Parameter( ValueFromPipeline )] @@ -44,7 +44,7 @@ } } elseif ($i.errors) { - $keys = (Get-Member -InputObject $i.errors | Where-Object -FilterScript {$_.MemberType -eq 'NoteProperty'}).Name + $keys = (Get-Member -InputObject $i.errors | Where-Object -FilterScript { $_.MemberType -eq 'NoteProperty' }).Name foreach ($k in $keys) { if ($WriteError) { $exception = ([System.ArgumentException]"Server responded with Error") diff --git a/JiraPS/Private/Resolve-JiraIssueObject.ps1 b/JiraPS/Private/Resolve-JiraIssueObject.ps1 index 03050755..89104579 100644 --- a/JiraPS/Private/Resolve-JiraIssueObject.ps1 +++ b/JiraPS/Private/Resolve-JiraIssueObject.ps1 @@ -33,19 +33,21 @@ function Resolve-JiraIssueObject { $Credential = [System.Management.Automation.PSCredential]::Empty ) - # As we are not able to use proper type casting in the parameters, this is a workaround - # to extract the data from a JiraPS.Issue object - # This shall be removed once we have custom classes for the module - if ("JiraPS.Issue" -in $InputObject.PSObject.TypeNames -and $InputObject.RestURL) { - Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Using `$InputObject as object" - return $InputObject - } - elseif ("JiraPS.Issue" -in $InputObject.PSObject.TypeNames -and $InputObject.Key) { - Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Resolve Issue to object" - return (Get-JiraIssue -Key $InputObject.Key -Credential $Credential -ErrorAction Stop) - } - else { - Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Resolve Issue to object" - return (Get-JiraIssue -Key $InputObject.ToString() -Credential $Credential -ErrorAction Stop) + process { + # As we are not able to use proper type casting in the parameters, this is a workaround + # to extract the data from a JiraPS.Issue object + # This shall be removed once we have custom classes for the module + if ("JiraPS.Issue" -in $InputObject.PSObject.TypeNames -and $InputObject.RestURL) { + Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Using `$InputObject as object" + return $InputObject + } + elseif ("JiraPS.Issue" -in $InputObject.PSObject.TypeNames -and $InputObject.Key) { + Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Resolve Issue to object" + return (Get-JiraIssue -Key $InputObject.Key -Credential $Credential -ErrorAction Stop) + } + else { + Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Resolve Issue to object" + return (Get-JiraIssue -Key $InputObject.ToString() -Credential $Credential -ErrorAction Stop) + } } } diff --git a/JiraPS/Private/Resolve-JiraUser.ps1 b/JiraPS/Private/Resolve-JiraUser.ps1 index e5ae4a44..7b37f972 100644 --- a/JiraPS/Private/Resolve-JiraUser.ps1 +++ b/JiraPS/Private/Resolve-JiraUser.ps1 @@ -36,15 +36,17 @@ function Resolve-JiraUser { $Credential = [System.Management.Automation.PSCredential]::Empty ) - # As we are not able to use proper type casting in the parameters, this is a workaround - # to extract the data from a JiraPS.Issue object - # This shall be removed once we have custom classes for the module - if ("JiraPS.User" -in $InputObject.PSObject.TypeNames) { - Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Using `$InputObject as object" - return $InputObject - } - else { - Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Resolve User to object" - return (Get-JiraUser -UserName $InputObject -Exact:$Exact -Credential $Credential -ErrorAction Stop) + process { + # As we are not able to use proper type casting in the parameters, this is a workaround + # to extract the data from a JiraPS.Issue object + # This shall be removed once we have custom classes for the module + if ("JiraPS.User" -in $InputObject.PSObject.TypeNames) { + Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Using `$InputObject as object" + return $InputObject + } + else { + Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Resolve User to object" + return (Get-JiraUser -UserName $InputObject -Exact:$Exact -Credential $Credential -ErrorAction Stop) + } } } diff --git a/JiraPS/Private/Set-TlsLevel.ps1 b/JiraPS/Private/Set-TlsLevel.ps1 index 66290537..f30b3244 100644 --- a/JiraPS/Private/Set-TlsLevel.ps1 +++ b/JiraPS/Private/Set-TlsLevel.ps1 @@ -10,16 +10,14 @@ function Set-TlsLevel { ) begin { - switch ($PSCmdlet.ParameterSetName) { - "Set" { - $Script:OriginalTlsSettings = [Net.ServicePointManager]::SecurityProtocol + if ($Tls12) { + $Script:OriginalTlsSettings = [Net.ServicePointManager]::SecurityProtocol - [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 - } - "Revert" { - if ($Script:OriginalTlsSettings) { - [Net.ServicePointManager]::SecurityProtocol = $Script:OriginalTlsSettings - } + [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 + } + if ($Revert) { + if ($Script:OriginalTlsSettings) { + [Net.ServicePointManager]::SecurityProtocol = $Script:OriginalTlsSettings } } } diff --git a/JiraPS/Private/ThrowError.ps1 b/JiraPS/Private/ThrowError.ps1 index 621c4f61..e952d6ca 100644 --- a/JiraPS/Private/ThrowError.ps1 +++ b/JiraPS/Private/ThrowError.ps1 @@ -6,6 +6,7 @@ function ThrowError { Thanks to Jaykul: https://github.com/PoshCode/Configuration/blob/master/Source/Metadata.psm1 #> + [System.Diagnostics.CodeAnalysis.SuppressMessage('PSAvoidOverwritingBuiltInCmdlets', '')] # TODO: fix this param ( [Parameter()] diff --git a/JiraPS/Public/Add-JiraFilterPermission.ps1 b/JiraPS/Public/Add-JiraFilterPermission.ps1 index 74dc3de4..7f084968 100644 --- a/JiraPS/Public/Add-JiraFilterPermission.ps1 +++ b/JiraPS/Public/Add-JiraFilterPermission.ps1 @@ -1,4 +1,4 @@ -function Add-JiraFilterPermission { +function Add-JiraFilterPermission { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( SupportsShouldProcess, DefaultParameterSetName = 'ByInputObject' )] # [OutputType( [JiraPS.FilterPermission] )] diff --git a/JiraPS/Public/Add-JiraIssueWatcher.ps1 b/JiraPS/Public/Add-JiraIssueWatcher.ps1 index fb930288..4dfbd6d4 100644 --- a/JiraPS/Public/Add-JiraIssueWatcher.ps1 +++ b/JiraPS/Public/Add-JiraIssueWatcher.ps1 @@ -1,4 +1,4 @@ -function Add-JiraIssueWatcher { +function Add-JiraIssueWatcher { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( SupportsShouldProcess )] param( diff --git a/JiraPS/Public/Get-JiraField.ps1 b/JiraPS/Public/Get-JiraField.ps1 index aee0a8ba..589440e6 100644 --- a/JiraPS/Public/Get-JiraField.ps1 +++ b/JiraPS/Public/Get-JiraField.ps1 @@ -1,4 +1,4 @@ -function Get-JiraField { +function Get-JiraField { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( DefaultParameterSetName = '_All' )] param( @@ -43,7 +43,7 @@ $allFields = Get-JiraField -Credential $Credential - Write-Output ($allFields | Where-Object -FilterScript {($_.Id -eq $_field) -or ($_.Name -like $_field)}) + Write-Output ($allFields | Where-Object -FilterScript { ($_.Id -eq $_field) -or ($_.Name -like $_field) }) } } } diff --git a/JiraPS/Public/Get-JiraFilter.ps1 b/JiraPS/Public/Get-JiraFilter.ps1 index c5f586b5..4a447ae5 100644 --- a/JiraPS/Public/Get-JiraFilter.ps1 +++ b/JiraPS/Public/Get-JiraFilter.ps1 @@ -1,4 +1,4 @@ -function Get-JiraFilter { +function Get-JiraFilter { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding(DefaultParameterSetName = 'ByFilterID')] param( diff --git a/JiraPS/Public/Get-JiraIssueCreateMetadata.ps1 b/JiraPS/Public/Get-JiraIssueCreateMetadata.ps1 index 13ef53cc..54e9c82e 100644 --- a/JiraPS/Public/Get-JiraIssueCreateMetadata.ps1 +++ b/JiraPS/Public/Get-JiraIssueCreateMetadata.ps1 @@ -1,5 +1,6 @@ function Get-JiraIssueCreateMetadata { # .ExternalHelp ..\JiraPS-help.xml + [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseSingularNouns', '')] [CmdletBinding()] param( [Parameter( Mandatory )] diff --git a/JiraPS/Public/Get-JiraIssueEditMetadata.ps1 b/JiraPS/Public/Get-JiraIssueEditMetadata.ps1 index e25c90f2..38d3a12b 100644 --- a/JiraPS/Public/Get-JiraIssueEditMetadata.ps1 +++ b/JiraPS/Public/Get-JiraIssueEditMetadata.ps1 @@ -1,5 +1,6 @@ function Get-JiraIssueEditMetadata { # .ExternalHelp ..\JiraPS-help.xml + [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseSingularNouns', '')] [CmdletBinding()] param( [Parameter( Mandatory )] diff --git a/JiraPS/Public/Get-JiraIssueType.ps1 b/JiraPS/Public/Get-JiraIssueType.ps1 index f5fd9ef5..fc1ea8a8 100644 --- a/JiraPS/Public/Get-JiraIssueType.ps1 +++ b/JiraPS/Public/Get-JiraIssueType.ps1 @@ -1,4 +1,4 @@ -function Get-JiraIssueType { +function Get-JiraIssueType { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( DefaultParameterSetName = '_All' )] param( @@ -43,8 +43,8 @@ $allIssueTypes = Get-JiraIssueType -Credential $Credential - Write-Output ($allIssueTypes | Where-Object -FilterScript {$_.Id -eq $_issueType}) - Write-Output ($allIssueTypes | Where-Object -FilterScript {$_.Name -like $_issueType}) + Write-Output ($allIssueTypes | Where-Object -FilterScript { $_.Id -eq $_issueType }) + Write-Output ($allIssueTypes | Where-Object -FilterScript { $_.Name -like $_issueType }) } } } diff --git a/JiraPS/Public/Get-JiraIssueWatcher.ps1 b/JiraPS/Public/Get-JiraIssueWatcher.ps1 index e6c0f97a..f3284246 100644 --- a/JiraPS/Public/Get-JiraIssueWatcher.ps1 +++ b/JiraPS/Public/Get-JiraIssueWatcher.ps1 @@ -1,4 +1,4 @@ -function Get-JiraIssueWatcher { +function Get-JiraIssueWatcher { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding()] param( diff --git a/JiraPS/Public/Get-JiraVersion.ps1 b/JiraPS/Public/Get-JiraVersion.ps1 index 3b95dacf..223bd5e3 100644 --- a/JiraPS/Public/Get-JiraVersion.ps1 +++ b/JiraPS/Public/Get-JiraVersion.ps1 @@ -1,4 +1,4 @@ -function Get-JiraVersion { +function Get-JiraVersion { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( SupportsPaging, DefaultParameterSetName = 'byId' )] param( @@ -109,7 +109,7 @@ $result | Where-Object { $__ = $_.Name Write-DebugMessage ($__ | Out-String) - $Name | Foreach-Object { + $Name | ForEach-Object { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Matching $_ against $($__)" $__ -like $_ } diff --git a/JiraPS/Public/Move-JiraVersion.ps1 b/JiraPS/Public/Move-JiraVersion.ps1 index 185acc8a..8bdcd5ec 100644 --- a/JiraPS/Public/Move-JiraVersion.ps1 +++ b/JiraPS/Public/Move-JiraVersion.ps1 @@ -1,4 +1,4 @@ -function Move-JiraVersion { +function Move-JiraVersion { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( DefaultParameterSetName = 'ByAfter' )] param( @@ -95,7 +95,8 @@ if ($Version.Id) { $versionId = $Version.Id - } else { + } + else { $versionId = $Version } diff --git a/JiraPS/Public/New-JiraGroup.ps1 b/JiraPS/Public/New-JiraGroup.ps1 index 9a0a46c9..c00809ce 100644 --- a/JiraPS/Public/New-JiraGroup.ps1 +++ b/JiraPS/Public/New-JiraGroup.ps1 @@ -1,4 +1,4 @@ -function New-JiraGroup { +function New-JiraGroup { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( SupportsShouldProcess )] param( diff --git a/JiraPS/Public/New-JiraVersion.ps1 b/JiraPS/Public/New-JiraVersion.ps1 index a1edba90..689d5c3a 100644 --- a/JiraPS/Public/New-JiraVersion.ps1 +++ b/JiraPS/Public/New-JiraVersion.ps1 @@ -1,4 +1,4 @@ -function New-JiraVersion { +function New-JiraVersion { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( SupportsShouldProcess, DefaultParameterSetName = 'byObject' )] param( @@ -35,18 +35,18 @@ [ValidateNotNullOrEmpty()] [ValidateScript( { - $Input = $_ + $_input = $_ switch ($true) { - {"JiraPS.Project" -in $Input.PSObject.TypeNames} { return $true } - {$Input -is [String]} { return $true} + { "JiraPS.Project" -in $_input.PSObject.TypeNames } { return $true } + { $_input -is [String] } { return $true } Default { $exception = ([System.ArgumentException]"Invalid Type for Parameter") #fix code highlighting] $errorId = 'ParameterType.NotJiraProject' $errorCategory = 'InvalidArgument' - $errorTarget = $Input + $errorTarget = $_input $errorItem = New-Object -TypeName System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $errorTarget - $errorItem.ErrorDetails = "Wrong object type provided for Project. Expected [JiraPS.Project] or [String], but was $($Input.GetType().Name)" + $errorItem.ErrorDetails = "Wrong object type provided for Project. Expected [JiraPS.Project] or [String], but was $($_input.GetType().Name)" $PSCmdlet.ThrowTerminatingError($errorItem) <# #ToDo:CustomClass diff --git a/JiraPS/Public/Remove-JiraFilterPermission.ps1 b/JiraPS/Public/Remove-JiraFilterPermission.ps1 index d07d5573..1dbb7824 100644 --- a/JiraPS/Public/Remove-JiraFilterPermission.ps1 +++ b/JiraPS/Public/Remove-JiraFilterPermission.ps1 @@ -1,4 +1,4 @@ -function Remove-JiraFilterPermission { +function Remove-JiraFilterPermission { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( SupportsShouldProcess, DefaultParameterSetName = 'ByFilterId' )] param( diff --git a/JiraPS/Public/Remove-JiraGroup.ps1 b/JiraPS/Public/Remove-JiraGroup.ps1 index ae04ea30..1e4bc423 100644 --- a/JiraPS/Public/Remove-JiraGroup.ps1 +++ b/JiraPS/Public/Remove-JiraGroup.ps1 @@ -1,4 +1,4 @@ -function Remove-JiraGroup { +function Remove-JiraGroup { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( SupportsShouldProcess, ConfirmImpact = 'High' )] param( diff --git a/JiraPS/Public/Remove-JiraIssueLink.ps1 b/JiraPS/Public/Remove-JiraIssueLink.ps1 index 7ba42e24..7dc19e5b 100644 --- a/JiraPS/Public/Remove-JiraIssueLink.ps1 +++ b/JiraPS/Public/Remove-JiraIssueLink.ps1 @@ -6,18 +6,18 @@ function Remove-JiraIssueLink { [ValidateNotNullOrEmpty()] [ValidateScript( { - $Input = $_ - $objectProperties = $Input | Get-Member -MemberType *Property + $_input = $_ + $objectProperties = $_input | Get-Member -MemberType *Property switch ($true) { - {("JiraPS.Issue" -in $Input.PSObject.TypeNames) -and ("issueLinks" -in $objectProperties.Name)} { return $true } - {("JiraPS.IssueLink" -in $Input.PSObject.TypeNames) -and ("Id" -in $objectProperties.Name)} { return $true } + { ("JiraPS.Issue" -in $_input.PSObject.TypeNames) -and ("issueLinks" -in $objectProperties.Name) } { return $true } + { ("JiraPS.IssueLink" -in $_input.PSObject.TypeNames) -and ("Id" -in $objectProperties.Name) } { return $true } default { $exception = ([System.ArgumentException]"Invalid Type for Parameter") #fix code highlighting] $errorId = 'ParameterType.NotJiraIssue' $errorCategory = 'InvalidArgument' - $errorTarget = $Input + $errorTarget = $_input $errorItem = New-Object -TypeName System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $errorTarget - $errorItem.ErrorDetails = "Wrong object type provided for Issue. Expected [JiraPS.Issue], [JiraPS.IssueLink] or [String], but was $($Input.GetType().Name)" + $errorItem.ErrorDetails = "Wrong object type provided for Issue. Expected [JiraPS.Issue], [JiraPS.IssueLink] or [String], but was $($_input.GetType().Name)" $PSCmdlet.ThrowTerminatingError($errorItem) <# #ToDo:CustomClass diff --git a/JiraPS/Public/Remove-JiraIssueWatcher.ps1 b/JiraPS/Public/Remove-JiraIssueWatcher.ps1 index 1d8ff434..3461a8a0 100644 --- a/JiraPS/Public/Remove-JiraIssueWatcher.ps1 +++ b/JiraPS/Public/Remove-JiraIssueWatcher.ps1 @@ -1,4 +1,4 @@ -function Remove-JiraIssueWatcher { +function Remove-JiraIssueWatcher { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( SupportsShouldProcess )] param( diff --git a/JiraPS/Public/Remove-JiraVersion.ps1 b/JiraPS/Public/Remove-JiraVersion.ps1 index 8974c16b..dacea0da 100644 --- a/JiraPS/Public/Remove-JiraVersion.ps1 +++ b/JiraPS/Public/Remove-JiraVersion.ps1 @@ -1,4 +1,4 @@ -function Remove-JiraVersion { +function Remove-JiraVersion { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( ConfirmImpact = 'High', SupportsShouldProcess )] param( diff --git a/JiraPS/Public/Set-JiraIssueLabel.ps1 b/JiraPS/Public/Set-JiraIssueLabel.ps1 index 343c9a8a..3bb3a538 100644 --- a/JiraPS/Public/Set-JiraIssueLabel.ps1 +++ b/JiraPS/Public/Set-JiraIssueLabel.ps1 @@ -1,4 +1,4 @@ -function Set-JiraIssueLabel { +function Set-JiraIssueLabel { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( SupportsShouldProcess, DefaultParameterSetName = 'ReplaceLabels' )] param( @@ -69,7 +69,7 @@ # Find the proper object for the Issue $issueObj = Resolve-JiraIssueObject -InputObject $_issue -Credential $Credential - $labels = [System.Collections.ArrayList]@($issueObj.labels | Where-Object {$_}) + $labels = [System.Collections.ArrayList]@($issueObj.labels | Where-Object { $_ }) # As of JIRA 6.4, the Add and Remove verbs in the REST API for # updating issues do not support arrays of parameters - you diff --git a/JiraPS/Public/Set-JiraVersion.ps1 b/JiraPS/Public/Set-JiraVersion.ps1 index 18c104ce..58c94ced 100644 --- a/JiraPS/Public/Set-JiraVersion.ps1 +++ b/JiraPS/Public/Set-JiraVersion.ps1 @@ -1,4 +1,4 @@ -function Set-JiraVersion { +function Set-JiraVersion { # .ExternalHelp ..\JiraPS-help.xml [CmdletBinding( SupportsShouldProcess )] param( diff --git a/Tests/Build.Tests.ps1 b/Tests/Build.Tests.ps1 index b00c8ba6..be0fc3f0 100644 --- a/Tests/Build.Tests.ps1 +++ b/Tests/Build.Tests.ps1 @@ -1,5 +1,5 @@ #requires -modules BuildHelpers -#requires -modules Configuration +#requires -modules Metadata #requires -modules Pester Describe "Validation of build environment" -Tag Unit { @@ -44,7 +44,7 @@ Describe "Validation of build environment" -Tag Unit { Context "CHANGELOG" { foreach ($line in (Get-Content $changelogFile)) { - if ($line -match "(?:##|\)\s*\[(?(\d+\.?){1,2})\]") { + if ($line -match "(?:##|\)\s*\[(?(\d+\.?){1,2})(\-(?(?:alpha|beta|rc)\d*))?\]") { $changelogVersion = $matches.Version break } @@ -55,12 +55,12 @@ Describe "Validation of build environment" -Tag Unit { } It "has a valid version in the changelog" { - $changelogVersion | Should -Not -BeNullOrEmpty + $changelogVersion | Should -Not -BeNullOrEmpty [Version]($changelogVersion) | Should -BeOfType [Version] } It "has a version changelog that matches the manifest version" { - Configuration\Get-Metadata -Path $env:BHManifestToTest -PropertyName ModuleVersion | Should -BeLike "$changelogVersion*" + Metadata\Get-Metadata -Path $env:BHManifestToTest -PropertyName ModuleVersion | Should -BeLike "$changelogVersion*" } } } diff --git a/Tests/Help.Tests.ps1 b/Tests/Help.Tests.ps1 index e66be072..4c18d9d3 100644 --- a/Tests/Help.Tests.ps1 +++ b/Tests/Help.Tests.ps1 @@ -45,6 +45,7 @@ Describe "Help tests" -Tag Documentation { 'OutVariable' 'OutBuffer' 'PipelineVariable' + 'ProgressAction' 'WhatIf' 'Confirm' ) diff --git a/Tests/JiraPS.Tests.ps1 b/Tests/JiraPS.Tests.ps1 index 810f341f..8c64f132 100644 --- a/Tests/JiraPS.Tests.ps1 +++ b/Tests/JiraPS.Tests.ps1 @@ -1,4 +1,5 @@ #requires -modules BuildHelpers +#requires -modules Metadata #requires -modules Pester Describe "General project validation" -Tag Unit { @@ -53,16 +54,16 @@ Describe "General project validation" -Tag Unit { } It "module uses the correct root module" { - Get-Metadata -Path $env:BHManifestToTest -PropertyName RootModule | Should -Be 'JiraPS.psm1' + Metadata\Get-Metadata -Path $env:BHManifestToTest -PropertyName RootModule | Should -Be 'JiraPS.psm1' } It "module uses the correct guid" { - Get-Metadata -Path $env:BHManifestToTest -PropertyName Guid | Should -Be '4bf3eb15-037e-43b7-9e47-20a30436324f' + Metadata\Get-Metadata -Path $env:BHManifestToTest -PropertyName Guid | Should -Be '4bf3eb15-037e-43b7-9e47-20a30436324f' } It "module uses a valid version" { - [Version](Get-Metadata -Path $env:BHManifestToTest -PropertyName ModuleVersion) | Should -Not -BeNullOrEmpty - [Version](Get-Metadata -Path $env:BHManifestToTest -PropertyName ModuleVersion) | Should -BeOfType [Version] + [Version](Metadata\Get-Metadata -Path $env:BHManifestToTest -PropertyName ModuleVersion) | Should -Not -BeNullOrEmpty + [Version](Metadata\Get-Metadata -Path $env:BHManifestToTest -PropertyName ModuleVersion) | Should -BeOfType [Version] } It "module uses the previous server config when loaded" { diff --git a/Tools/build.requirements.psd1 b/Tools/build.requirements.psd1 index 6419f276..9f6f8301 100644 --- a/Tools/build.requirements.psd1 +++ b/Tools/build.requirements.psd1 @@ -1,7 +1,7 @@ @( @{ ModuleName = "InvokeBuild"; RequiredVersion = "5.11.2" } @{ ModuleName = "BuildHelpers"; RequiredVersion = "2.0.16" } - @{ ModuleName = "Configuration"; RequiredVersion = "1.6.0" } + @{ ModuleName = "Metadata"; RequiredVersion = "1.5.7" } @{ ModuleName = "Pester"; RequiredVersion = "4.6.0" } @{ ModuleName = "platyPS"; RequiredVersion = "0.14.2" } @{ ModuleName = "PSScriptAnalyzer"; RequiredVersion = "1.22.0" }