Azure / Azure/azure-quickstart-templates
Fix ScriptAnalyzer warnings in azure-quickstart-templates/Deploy-AzureResourceGroup.ps
- Dominant language
- Bicep
- Stars
- 14.9k
- Forks
- 16.2k
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 6
Description
### Issue Details
This script contains, some are easily fixable:
```PowerShell
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSAvoidTrailingWhitespace Information Deploy-Azu 39 Line has trailing whitespace
reResource
Group.ps1
PSAvoidTrailingWhitespace Information Deploy-Azu 103 Line has trailing whitespace
reResource
Group.ps1
PSAvoidTrailingWhitespace Information Deploy-Azu 113 Line has trailing whitespace
reResource
Group.ps1
PSAvoidTrailingWhitespace Information Deploy-Azu 115 Line has trailing whitespace
reResource
Group.ps1
PSAvoidTrailingWhitespace Information Deploy-Azu 122 Line has trailing whitespace
reResource
Group.ps1
PSUseLiteralInitializerForHashtable Warning Deploy-Azu 35 Use literal initializer, @{{}}, for creating a hashtable as
reResource they are case-insensitive by default
Group.ps1
PSUseLiteralInitializerForHashtable Warning Deploy-Azu 36 Use literal initializer, @{{}}, for creating a hashtable as
reResource they are case-insensitive by default
Group.ps1
PSAvoidUsingWriteHost Warning Deploy-Azu 51 File 'Deploy-AzureResourceGroup.ps1' uses Write-Host. Avoid
reResource using Write-Host because it might not work in all hosts, doe
Group.ps1 s not work when there is no host, and (prior to PS 5.0) cann
ot be suppressed, captured, or redirected. Instead, use Writ
e-Output, Write-Verbose, or Write-Information.
PSPossibleIncorrectComparisonWithNu Warning Deploy-Azu 65 $null should be on the left side of equality comparisons.
ll reResource
Group.ps1
PSPossibleIncorrectComparisonWithNu Warning Deploy-Azu 72 $null should be on the left side of equality comparisons.
ll reResource
Group.ps1
PSPossibleIncorrectComparisonWithNu Warning Deploy-Azu 97 $null should be on the left side of equality comparisons.
ll reResource
Group.ps1
PSPossibleIncorrectComparisonWithNu Warning Deploy-Azu 106 $null should be on the left side of equality comparisons.
ll reResource
Group.ps1
PSPossibleIncorrectComparisonWithNu Warning Deploy-Azu 129 $null should be on the left side of equality comparisons.
ll reResource
Group.ps1
PSPossibleIncorrectComparisonWithNu Warning Deploy-Azu 147 $null should be on the left side of equality comparisons.
ll reResource
Group.ps1
PSAvoidUsingEmptyCatchBlock Warning Deploy-Azu 24 Empty catch block is used. Please use Write-Error or throw s
reResource tatements in catch blocks.
Group.ps1
```
### Repro steps
1. Invoke-ScriptAnalyzer .\Deploy-AzureResourceGroup.ps1
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with azure-quickstart-templates/Deploy-AzureResourceGroup.ps1 and run Invoke-ScriptAnalyzer on it to reproduce the listed findings. Review the reported lines for trailing whitespace, hashtable initialization, Write-Host, null comparisons, and the empty catch block. Done means the listed ScriptAnalyzer warnings and information findings are resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- cloud, devops
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100