★ wanayoo — archive 1999 https://github.com/PowerShell/PSScriptAnalyzer/pull/585Nouvelle recherche | Portail wanayoo
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

Suppress External Rules #585

Merged

Conversation

@charlieschmidt
Copy link
Contributor

charlieschmidt commented Jul 22, 2016 •

External/custom rules can now be suppressed with the same DiagnosticRecord decoration on functions.


This change is Reviewable

@kapilmb

This comment has been minimized.

Copy link

kapilmb commented on fec8d79 Jul 21, 2016

Awesome changes! Some comments though -

I think you can move your additions to the foreach loop instead of the try-catch block. This will be functionally identical to your changes but will allow the custom rules to run in parallel through the GetExternalRecord method.

…, rather than 1-by-1 to continue to take advantage of the runspacepool stuff.

New SupressRule() function that takes a single DiagnosticRecord and list of suppressions - bounces the RuleName of the record against that list.
@charlieschmidt

This comment has been minimized.

Copy link
Owner Author

charlieschmidt commented on cd22077 Jul 21, 2016

@kapilmb - indeed, no rejiggering of GetExternalRecord needed, just a new SuppressRule variant that takes a single rule and list of suppressions.

This comment has been minimized.

Copy link

kapilmb replied Jul 22, 2016

@charlieschmidt If you would like to have these changes propagated upstream, please send a pull request. But, before you send a PR, please add a few test cases to validate the functionality. Thanks!

This comment has been minimized.

Copy link
Owner Author

charlieschmidt replied Jul 22, 2016

Yeah, looking at the test stuff now, looks like yall use pester, which is new to me so far, but no time like the present (especially since the module repository I manage at work is.... not small)

This comment has been minimized.

Copy link

kapilmb replied Jul 22, 2016

No worries. Maybe I can write a few test cases to validate the functionality. I just created a new branch (https://github.com/PowerShell/PSScriptAnalyzer/tree/ExternalRuleSuppression). So, if you can send a PR on the branch, I can add the test cases to the branch before merging into development

This comment has been minimized.

Copy link

kapilmb replied Jul 22, 2016

Or if you can suggest a better workflow to have it merged while I add the test cases please let me know.

@msftclas
Copy link

msftclas commented Jul 22, 2016

Hi @charlieschmidt, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@msftclas
Copy link

msftclas commented Jul 22, 2016

@charlieschmidt, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, MSBOT;

@msftclas msftclas added cla-signed and removed cla-required labels Jul 22, 2016
@charlieschmidt
Copy link
Contributor Author

charlieschmidt commented Jul 22, 2016

Pull request created. Pester was new to me, to to test I just created a sub C# app that used the scriptanalyzer app, along with my psm1 custom rules and a dummy ps1 with the various cases. But I'll take a stab at some pester stuff too, gotta learn it here anyway and have put it off long enough

@kapilmb
Copy link

kapilmb commented Jul 22, 2016

@charlieschmidt Thanks for the pull request. I'll add the test cases.

@charlieschmidt
Copy link
Contributor Author

charlieschmidt commented Jul 22, 2016

Hey unrelatedly, I've got a powershell rule that does comment help validation against parameters - so that if you're missing .PARAMETER for one of your params (static and dynamic) it throws the alert. ANy interested in a C# port of it to include in the builtins?

@kapilmb
Copy link

kapilmb commented Jul 22, 2016

Why don't you send a PR against the development branch for the new rule? We can go from there.

@kapilmb
Copy link

kapilmb commented Jul 22, 2016

I think we need a way to utilize PowerShell based built-in rules. But, right now we only have C# based built-in rules. So, yes - will be very interested in the C# port. Thanks!

@charlieschmidt
Copy link
Contributor Author

charlieschmidt commented Jul 22, 2016

Yeah, powershell built ins - at least a couple examples - would go a long way. I had to read the C# and figure out how to make it powershell for my custom rules. Could probably be done "easily" in another module that gets pulled with it, or a submodule that contains them and then hardcode that module into the scriptengine.

I'll port to C# in a branch in my repo and include the ps version as well

@kapilmb kapilmb merged commit bbfd1d9 into PowerShell:ExternalRuleSuppression Jul 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.