-
Notifications
You must be signed in to change notification settings - Fork 4k
Add StaticAnalysis rule to fail cmdlets not using approved verbs #3089
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
Conversation
@shahabhijeet any other comments? |
|
||
#region ApprovedVerbs | ||
private static readonly List<string> ApprovedVerbs = new List<string> | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather can we dynamically get this list. Because when the list of approved verbs change, we will have to update this list manually.
How about hydrating the list as below
PowerShell ps = PowerShell.Create();
ps.AddCommand("get-verb");
var cmdletResult = ps.Invoke();
foreach (PSObject result in cmdletResult)
{
Console.WriteLine(result.Members["Verb"].Value.ToString());
}
On demand run here: http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-demand/1254/ LGTM once the on-demand run passes. |
@cormacpayne Looks like the on-demand run fails due to the new test. See the log for the on-demand run |
Edit: on-demand here: http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-demand/1267/ |
@markcowl @shahabhijeet adding a "Do Not Merge" tag on this PR. Previously, the test Now, the test |
c5b65cf
to
a3d9c68
Compare
@markcowl @shahabhijeet would you guys mind taking a look at this PR? |
on demand run here: http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-demand/1316/ LGTM once the build succeeds |
Description
Fix for issue #3004
This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThrough
parameter.Cmdlet Parameter Guidelines