Skip to content

Commit 9be6481

Browse files
🪲 [Fix]: Resolve PSScriptAnalyzer findings in examples and tests
- Drop the unused child-page variable in the Pages example - Splat Connect-Confluence in the integration test to stay within the line-length limit - Suppress PSAvoidUsingConvertToSecureStringWithPlainText (the API token is a CI environment secret)
1 parent f86f527 commit 9be6481

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

examples/Pages.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Get-ConfluencePage -PageId $page.id
2222
Set-ConfluencePage -PageId $page.id -Body '<p>Updated content</p>'
2323

2424
# Add a child page, then list children and descendants
25-
$child = New-ConfluencePage -SpaceId $space.id -Title 'Details' -ParentId $page.id -Body '<p>Nested</p>'
25+
New-ConfluencePage -SpaceId $space.id -Title 'Details' -ParentId $page.id -Body '<p>Nested</p>'
2626
Get-ConfluencePageChild -PageId $page.id
2727
Get-ConfluenceDescendant -PageId $page.id
2828

tests/Confluence.Tests.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '',
22
Justification = 'Pester test cases assign variables that are used in other scopes.')]
3+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '',
4+
Justification = 'The API token is supplied as a CI environment secret and must be converted to a SecureString for Connect-Confluence.')]
35
[CmdletBinding()]
46
param()
57

@@ -70,7 +72,14 @@ Describe 'Confluence' {
7072
Context 'Integration' -Skip:([string]::IsNullOrEmpty($env:CONFLUENCE_API_TOKEN)) {
7173
BeforeAll {
7274
$secureToken = ConvertTo-SecureString -String $env:CONFLUENCE_API_TOKEN -AsPlainText -Force
73-
Connect-Confluence -ApiBaseUri $env:CONFLUENCE_API_BASE_URI -Username $env:CONFLUENCE_USERNAME -Token $secureToken -SpaceKey $env:CONFLUENCE_SPACE_KEY -Name 'ci'
75+
$connectParams = @{
76+
ApiBaseUri = $env:CONFLUENCE_API_BASE_URI
77+
Username = $env:CONFLUENCE_USERNAME
78+
Token = $secureToken
79+
SpaceKey = $env:CONFLUENCE_SPACE_KEY
80+
Name = 'ci'
81+
}
82+
Connect-Confluence @connectParams
7483
}
7584

7685
AfterAll {

0 commit comments

Comments
 (0)