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_xRemoteFile.psm1: Fix Custom DSC Resource Kit PSSA rule violations #490

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

MSFT_xRemoteFile.psm1: Fix Custom DSC Resource Kit PSSA rule violations #490

mhendric opened this issue Jan 27, 2019 · 1 comment · Fixed by #545
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_xRemoteFile.psm1. These should be fixed.

Verbose logs showing the problem

[00:04:39]     Context MSFT_xRemoteFile.psm1
[00:04:39]       [+] Should pass all error-level PS Script Analyzer rules 99ms
[00:04:40] Required PSSA rule(s) did not pass.
[00:04:40] The following PSScriptAnalyzer rule 'PSAvoidUsingCmdletAliases' errors need to be fixed:
[00:04:40] MSFT_xRemoteFile.psm1 (Line 166): '%' 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.
[00:04:40] The following PSScriptAnalyzer rule 'PSPossibleIncorrectComparisonWithNull' errors need to be fixed:
[00:04:40] MSFT_xRemoteFile.psm1 (Line 207): $null should be on the left side of equality comparisons.
[00:04:40] MSFT_xRemoteFile.psm1 (Line 315): $null should be on the left side of equality comparisons.
[00:04:40] MSFT_xRemoteFile.psm1 (Line 347): $null should be on the left side of equality comparisons.
[00:04:40] MSFT_xRemoteFile.psm1 (Line 428): $null should be on the left side of equality comparisons.
[00:04:40] For instructions on how to run PSScriptAnalyzer on your own machine, please go to https://github.com/powershell/PSScriptAnalyzer
[00:04:40] Common Tests - Required Script Analyzer Rules will not fail unless you opt-in.
[00:04:40] To opt-in, create a '.MetaTestOptIn.json' at the root
[00:04:40] of the repo in the following format:
[00:04:40] [
[00:04:40]      "Common Tests - Required Script Analyzer Rules"
[00:04:40] ]
[00:04:40]       [+] Should pass all required PS Script Analyzer rules 1.65s
[00:04:41]       [+] Should pass all flagged PS Script Analyzer rules 235ms
[00:04:41]       [+] Should pass any recently-added, error-level PS Script Analyzer rules 60ms
[00:04:42]       [+] Should not suppress any required PS Script Analyzer rules 934ms
[00:04:43] Custom DSC Resource Kit PSSA rule(s) did not pass.
[00:04:43] The following PSScriptAnalyzer rule 'DscResource.AnalyzerRules\Measure-IfStatement' errors need to be fixed:
[00:04:43] MSFT_xRemoteFile.psm1 (Line 156): Opening brace on if-statements should be followed by a new line. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#one-newline-after-opening-brace
[00:04:43] MSFT_xRemoteFile.psm1 (Line 167): If-statements should not have the open brace on the same line as the statement. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#one-newline-before-braces
[00:04:43] MSFT_xRemoteFile.psm1 (Line 177): If-statements should not have the open brace on the same line as the statement. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#one-newline-before-braces
[00:04:43] MSFT_xRemoteFile.psm1 (Line 310): If-statements should not have the open brace on the same line as the statement. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#one-newline-before-braces
[00:04:43] The following PSScriptAnalyzer rule 'DscResource.AnalyzerRules\Measure-ParameterBlockMandatoryNamedArgument' errors need to be fixed:
[00:04:43] MSFT_xRemoteFile.psm1 (Line 121): Non-mandatory parameters must use the correct format [Parameter()] for the parameter attribute. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 285): Non-mandatory parameters must use the correct format [Parameter()] for the parameter attribute. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] The following PSScriptAnalyzer rule 'DscResource.AnalyzerRules\Measure-ParameterBlockParameterAttribute' errors need to be fixed:
[00:04:43] MSFT_xRemoteFile.psm1 (Line 31): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 36): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 102): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 107): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 112): 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:43] MSFT_xRemoteFile.psm1 (Line 115): 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:43] MSFT_xRemoteFile.psm1 (Line 118): 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:43] MSFT_xRemoteFile.psm1 (Line 121): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 125): 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:43] MSFT_xRemoteFile.psm1 (Line 128): 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:43] MSFT_xRemoteFile.psm1 (Line 131): 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:43] MSFT_xRemoteFile.psm1 (Line 266): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 271): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 276): 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:43] MSFT_xRemoteFile.psm1 (Line 279): 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:43] MSFT_xRemoteFile.psm1 (Line 282): 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:43] MSFT_xRemoteFile.psm1 (Line 285): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 289): 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:43] MSFT_xRemoteFile.psm1 (Line 292): 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:43] MSFT_xRemoteFile.psm1 (Line 295): 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:43] MSFT_xRemoteFile.psm1 (Line 390): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 394): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 419): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 423): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 440): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 481): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 502): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 507): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 544): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 549): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 554): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 580): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] MSFT_xRemoteFile.psm1 (Line 585): The [Parameter()] attribute must start with an upper case 'P'. See https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-parameter-block
[00:04:43] For instructions on how to run PSScriptAnalyzer on your own machine, please go to https://github.com/powershell/PSScriptAnalyzer
[00:04:43] Common Tests - Custom Script Analyzer Rules will not fail unless you opt-in.
[00:04:43] To opt-in, create a '.MetaTestOptIn.json' at the root
[00:04:43] of the repo in the following format:
[00:04:43] [
[00:04:43]      "Common Tests - Custom Script Analyzer Rules"
[00:04:43] ]
[00:04:43]       [+] Should pass all custom DSC Resource Kit PSSA rules 854ms

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
@PlagueHO PlagueHO self-assigned this Feb 10, 2019
@PlagueHO PlagueHO 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 10, 2019
@PlagueHO
Copy link
Member

Grabbing this one.

@mhendric mhendric changed the title MSFT_xRemoteFile.psm1: Fix Script Analzyer Issues MSFT_xRemoteFile.psm1: Fix Custom DSC Resource Kit PSSA rule violations Feb 12, 2019
mhendric added a commit that referenced this issue Feb 13, 2019
Fix PSSA violations in xRemoteFile - Fixes #490
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.

2 participants