-
Notifications
You must be signed in to change notification settings - Fork 399
Adds a rule to check if HelpMessage parameter attribute is non-null and non-empty. #443
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
kapilmb
commented
Feb 9, 2016
Review status: 0 of 9 files reviewed at latest revision, 5 unresolved discussions. RuleDocumentation/AvoidNullOrEmptyHelpMessageAttribute.md, line 20 [r1] (raw file): RuleDocumentation/AvoidNullOrEmptyHelpMessageAttribute.md, line 33 [r1] (raw file): Rules/AvoidNullOrEmptyHelpMessageAttribute.cs, line 24 [r1] (raw file): Rules/AvoidNullOrEmptyHelpMessageAttribute.cs, line 30 [r1] (raw file): Rules/AvoidNullOrEmptyHelpMessageAttribute.cs, line 43 [r1] (raw file): Comments from the review on Reviewable.io |
Rules/AvoidNullOrEmptyHelpMessageAttribute.cs, line 60 [r1] (raw file): Comments from the review on Reviewable.io |
Rules/AvoidNullOrEmptyHelpMessageAttribute.cs, line 60 [r1] (raw file): Comments from the review on Reviewable.io |
Review status: 0 of 9 files reviewed at latest revision, 4 unresolved discussions. Rules/AvoidNullOrEmptyHelpMessageAttribute.cs, line 24 [r1] (raw file): Rules/AvoidNullOrEmptyHelpMessageAttribute.cs, line 30 [r1] (raw file): Rules/AvoidNullOrEmptyHelpMessageAttribute.cs, line 43 [r1] (raw file): Comments from the review on Reviewable.io |
Reviewed 9 of 9 files at r1. RuleDocumentation/AvoidNullOrEmptyHelpMessageAttribute.md, line 2 [r1] (raw file): Rules/AvoidNullOrEmptyHelpMessageAttribute.cs, line 85 [r1] (raw file): Comments from the review on Reviewable.io |
Review status: 5 of 9 files reviewed at latest revision, 4 unresolved discussions. RuleDocumentation/AvoidNullOrEmptyHelpMessageAttribute.md, line 2 [r1] (raw file): Rules/AvoidNullOrEmptyHelpMessageAttribute.cs, line 85 [r1] (raw file): Comments from the review on Reviewable.io |
With all due respect, why are we even writing this rule? |
Reviewed 4 of 4 files at r2. Comments from the review on Reviewable.io |
Review status: 8 of 9 files reviewed at latest revision, 4 unresolved discussions. Comments from the review on Reviewable.io |
Reviewed 1 of 1 files at r3. Comments from the review on Reviewable.io |
Hi June. This rule does not encourage to use the attribute, but ensures that when it is used, the value is set to something useful. Absence of HelpMessage attribute does not trigger the rule. It is possible that in the future PowerShell runtime can use the value in a more meaningful way. Thanks, |
Thanks. What harm does an empty HelpMessage attribute cause? Remember that we don't check for any help for parameters. |
Empty value results in a obscure interpreter error. function Test-EmptyHelpMessage Test-EmptyHelpMessage
|
Got it. Thanks. |
…Empty Adds a rule to check if HelpMessage parameter attribute is non-null and non-empty.
Also @juneb, regarding your blog post, I know people who have used the !? feature with mandatory parameters before. HelpMessage can be very useful metadata for tools built on top of PowerShell because it can provide a brief description of what is expected in a mandatory parameter, which could be displayed as part of Intellisense for that parameter. Parameter help will likely be much more descriptive than HelpMessage. I'm pretty sure some PowerShell tools have used this information in the past, but it's been long enough that I can't say for sure. For the tools I managed, if they weren't doing it already, it was something that was on the list of enhancements to add. |