Skip to content

implement PSScriptAnalyzer suggestions, add PSCodeCode health report to GitHub #45

@iricigor

Description

@iricigor

In total there are about 40 warnings, and more than half should be easy to remove.

Invoke-ScriptAnalyzer -path . -Recurse  | group message | Select Count, Name | Sort Count -Descending
Count Name
----- ----
   10 '%' is an alias of 'ForEach-Object'. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.
    8 'cd' is an alias of 'Set-Location'. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.
    7 File 'EasyAzureFunction.psm1' uses Write-Host. Avoid using Write-Host because it might not work in all hosts, does not work when there is no host, and (prior to PS 5.0) cannot be suppressed, captured, or redirected. Instead, use Write-Output, Write-Verbose, or ...
    6 'Select' is an alias of 'Select-Object'. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.
    4 '?' is an alias of 'Where-Object'. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.
    1 Function 'New-AzureFunctionCode' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'.
    1 File 'EasyAzureFunction.Module.Tests.ps1' uses Write-Host. Avoid using Write-Host because it might not work in all hosts, does not work when there is no host, and (prior to PS 5.0) cannot be suppressed, captured, or redirected. Instead, use Write-Output, Write-...
    1 Do not use wildcard or $null in this field. Explicitly specify a list for AliasesToExport.
    1 Invoke-Expression is used. Please remove Invoke-Expression from script and find other options instead.
    1 Do not use wildcard or $null in this field. Explicitly specify a list for FunctionsToExport.
Invoke-ScriptAnalyzer -path . -Recurse  | group scriptname | Select Count, Name | Sort Count -Descending
Count Name
----- ----
   16 run.ps1
    7 EasyAzureFunction.psm1
    3 Convert-ParametersToHTML.ps1
    3 Get-Parameter.ps1
    2 New-AzureFunctionCode.Tests.ps1
    2 Get-Parameter.Tests.ps1
    2 EasyAzureFunction.psd1
    2 Convert-ParametersToRunner.ps1
    1 EasyAzureFunction.Module.Tests.ps1
    1 CreateExamples.ps1
    1 New-AzureFunctionCode.ps1

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationNo code update needed, just examples or md files

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions