Open papadeltasierra opened 1 year ago
This doesn't seem to happen with
$private:aa='sdf'
get-childitem $aa
So might be an easy improvement if you want to make that. But as the rule generally can result in lots of false positives due to it being limited to current scope, effort to such enhancements will be limited by the maintainers.
I get the same violation in this script for all parameters, despite them being used in the functions. Is this the same issue, or a different one with the same output?
param
(
$Summary,
$Description,
$Type,
$IssueComponent,
$LinkUrl,
$LinkTitle
)
function CreateIssue
{
$body = @{
fields = @{
project = @{
key = $Env:JIRA_PROJECT_KEY
}
summary = $Summary
description = $Description
issuetype = @{
name = $Type
}
labels = @('created-from-github')
}
}
if (-not [string]::IsNullOrWhiteSpace($IssueComponent))
{
$body.fields += @{
components = @(@{
name = $IssueComponent
})
}
}
$bodyJson = $body | ConvertTo-Json -Depth 9
$response = Invoke-JiraApiPost 'issue' $bodyJson
Write-Information "Jira issue created with the key $($response.key)." -InformationAction Continue
$response.key
}
function AddLink
{
param($issueKey)
$bodyJson = @{
object = @{
url = $LinkUrl
title = $LinkTitle
}
} | ConvertTo-Json -Depth 3
Invoke-JiraApiPost "issue/$issueKey/remotelink" $bodyJson
}
$issueKey = CreateIssue
AddLink $issueKey
Set-GitHubOutput 'issue-key' $issueKey
Set-GitHubOutput 'issue-url' "$($Env:JIRA_BASE_URL )/browse/$issueKey"
Before submitting a bug report:
Steps to reproduce
Run the analyzer against this script.
Expected behavior
Expect no errors because
$private:var1
and the use in the last line of$var1
are the same variable and$var1
is private to the script, as required.Actual behavior
If an unexpected error was thrown then please report the full error details using e.g.
$error[0] | Select-Object *
Environment data