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: Fix PSSA Issues #131

Closed
kwirkykat opened this issue May 17, 2016 · 6 comments
Closed

MSFT_xPackageResource: Fix PSSA Issues #131

kwirkykat opened this issue May 17, 2016 · 6 comments
Assignees

Comments

@kwirkykat
Copy link
Contributor

kwirkykat commented May 17, 2016

The PowerShell Script Analyzer issues in MSFT_xPackageResource need to be fixed.
This is the current result of running Invoke-ScriptAnalyzer:
image
image

@kwirkykat
Copy link
Contributor Author

The error here is fixed in #123

@kwirkykat kwirkykat self-assigned this Jun 17, 2016
@kwirkykat
Copy link
Contributor Author

This is part of #160

@PlagueHO
Copy link
Member

PlagueHO commented Aug 9, 2016

I'll work on this one if you like, because I need to get a fix through for #52.

@PlagueHO
Copy link
Member

PlagueHO commented Aug 9, 2016

I'm working through these and am finding that there is some contention over whether or not the PSUseShouldProcessForStateChangingFunction warning should actually be used:
PowerShell/PSScriptAnalyzer#283

My feeling is that this warning:

  1. doesn't make a lot of sense when it is reported in Unit/Integration test code.
  2. isn't helpful in the context of DSC Resources
  3. is often a false positive

Therefore I would propose that this warning is simply suppressed when it occurs in any Unit or Integration tests in any of these modules.

@kwirkykat
Copy link
Contributor Author

kwirkykat commented Aug 9, 2016

@PlagueHO Yes agreed on that rule. Just posted the PSSA rule severity list for DSC Resource Kit.
That should help with what rules are allowed to be suppressed/not suppressed.

Haven't implemented this list in tests yet though.
There has been a lot of update to this file since I submitted this issue. This is now the current output of PSSA after #192 is merged:
image

^Note in this case it would be approved to suppress the PSSA rule 'PSAvoidGlobalVars'

@PlagueHO
Copy link
Member

PlagueHO commented Aug 9, 2016

@kwirkykat - oh nice! Good idea on the PSSA List.

As for the remaining rules, those are the only ones I've fixed. I noted the suppression of the PSAvoidGlobalVars one too. I'll submit my PR sometime today/tonight.

Thanks for getting back to me so quick. I'll also get some other PRs through for the warnings on the other resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants