Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSFT_xPackageResource.psm1: Fix Script Analyzer Issues #487

Closed
mhendric opened this issue Jan 27, 2019 · 1 comment · Fixed by #534
Closed

MSFT_xPackageResource.psm1: Fix Script Analyzer Issues #487

mhendric opened this issue Jan 27, 2019 · 1 comment · Fixed by #534
Assignees
Labels
enhancement The issue is an enhancement request. in progress The issue is being actively worked on by someone.

Comments

@mhendric
Copy link
Contributor

Details of the scenario you tried and the problem that is occurring

There's a number of script analyzer issues getting reported in MSFT_xPackageResource.psm1. These should be fixed.

Verbose logs showing the problem

[00:04:18]     Context MSFT_xPackageResource.psm1
[00:04:18]       [+] Should pass all error-level PS Script Analyzer rules 86ms
[00:04:21]       [+] Should pass all required PS Script Analyzer rules 3.42s
[00:04:22] Flagged PSSA rule(s) did not pass.
[00:04:22] The following PSScriptAnalyzer rule 'PSDSCUseVerboseMessageInDSCResource' errors need to be fixed:
[00:04:22] MSFT_xPackageResource.psm1 (Line 20): There is no call to Write-Verbose in DSC function 'Get-TargetResource'. If you are using Write-Verbose in a helper function, suppress this rule application.
[00:04:22] For instructions on how to run PSScriptAnalyzer on your own machine, please go to https://github.com/powershell/PSScriptAnalyzer
[00:04:22] Common Tests - Flagged Script Analyzer Rules will not fail unless you opt-in.
[00:04:22] To opt-in, create a '.MetaTestOptIn.json' at the root
[00:04:22] of the repo in the following format:
[00:04:22] [
[00:04:22]      "Common Tests - Flagged Script Analyzer Rules"
[00:04:22] ]
[00:04:22]       [+] Should pass all flagged PS Script Analyzer rules 686ms
[00:04:22]       [+] Should pass any recently-added, error-level PS Script Analyzer rules 58ms
[00:04:25]       [+] Should not suppress any required PS Script Analyzer rules 2.55s
[00:04:26] Custom DSC Resource Kit PSSA rule(s) did not pass.
[00:04:26] The following PSScriptAnalyzer rule 'DscResource.AnalyzerRules\Measure-ParameterBlockMandatoryNamedArgument' errors need to be fixed:
[00:04:26] MSFT_xPackageResource.psm1 (Line 1262): Mandatory parameters must use the correct format [Parameter(Mandatory = $true)] for the mandatory attribute. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1487): Mandatory parameters must use the correct format [Parameter(Mandatory = $true)] for the mandatory attribute. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1524): Mandatory parameters must use the correct format [Parameter(Mandatory = $true)] for the mandatory attribute. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] The following PSScriptAnalyzer rule 'DscResource.AnalyzerRules\Measure-ParameterBlockParameterAttribute' errors need to be fixed:
[00:04:26] MSFT_xPackageResource.psm1 (Line 41): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 44): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 48): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 51): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 54): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 176): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 195): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 198): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 203): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 207): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 210): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 213): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 217): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 220): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 223): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 226): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 229): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 233): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 236): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 239): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 242): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 691): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 710): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 713): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 718): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 722): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 725): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 728): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 732): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 735): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 738): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 741): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 744): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 748): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 751): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 754): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 757): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 961): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 964): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 967): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1010): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1013): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1016): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1019): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1023): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1026): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1029): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1169): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1216): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1219): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1222): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1225): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1266): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1307): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] MSFT_xPackageResource.psm1 (Line 1310): A [Parameter()] attribute must be the first attribute of each parameter and be on its own line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:26] For instructions on how to run PSScriptAnalyzer on your own machine, please go to https://github.com/powershell/PSScriptAnalyzer
[00:04:26] Common Tests - Custom Script Analyzer Rules will not fail unless you opt-in.
[00:04:26] To opt-in, create a '.MetaTestOptIn.json' at the root
[00:04:26] of the repo in the following format:
[00:04:26] [
[00:04:26]      "Common Tests - Custom Script Analyzer Rules"
[00:04:26] ]
[00:04:26]       [+] Should pass all custom DSC Resource Kit PSSA rules 846ms

Version of the DSC module that was used ('dev' if using current dev branch)

dev

@mhendric mhendric added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Jan 27, 2019
@mhendric
Copy link
Contributor Author

mhendric commented Feb 5, 2019

I got this one.

@mhendric mhendric added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. in progress The issue is being actively worked on by someone.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant