You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The ProvideVerboseMessage rule should be limited to functions that support ShouldProcess #181
A lot of functions don't need verbose messages, and having them output verbose messages will just create noise.
PowerShell itself has many cmdlets that don't write verbose messages, such as ForEach-Object, Test-Path, Get-ChildItem, etc.
I think that the $VerbosePreference variable will become useless if everyone followed this rule the way it is now because of all the noise that will be generated.
The functionality used to be all scripts/functions required Write-Verbose. This was changed in #113 to only functions that call the [CmdletBinding()] attribute per community rule OUT-04
Currently, the rule is "Information" level and applies to functions that have the CmdletBinding() attribute specified to reduce noise. This is a good practice since it gives debug information about the cmdlet actions.
There are a lot of functions that shouldn't have verbose messages (look at the PowerShell cmdlets that don't have verbose messages), but this rule encourages scripters to add them anyway without giving a hint about what to put in those messages.
So, new scripters will probably end up writing messages like:
write-verbose -message 'my function was called'
or
write-verbose -message "the value of some local variable that no one cares about is 5"
and so on.
Experienced scripters who do not want verbose messages, but must follow this rule (for whatever reason), will end up with code like this:
if ($false) {write-verbose -message 'because I have to'}
Activity
GoodOlClint commentedon May 19, 2015
The functionality used to be all scripts/functions required Write-Verbose. This was changed in #113 to only functions that call the [CmdletBinding()] attribute per community rule OUT-04
imfrancisd commentedon May 19, 2015
The link you provided states:
but the rule right now is:
Very different results.
raghushantha commentedon May 19, 2015
Francis.
Currently, the rule is "Information" level and applies to functions that have the CmdletBinding() attribute specified to reduce noise. This is a good practice since it gives debug information about the cmdlet actions.
In what scenarios are you seeing a lot of noise?
Thanks,
Raghu
imfrancisd commentedon May 19, 2015
There are a lot of functions that shouldn't have verbose messages (look at the PowerShell cmdlets that don't have verbose messages), but this rule encourages scripters to add them anyway without giving a hint about what to put in those messages.
So, new scripters will probably end up writing messages like:
or
and so on.
Experienced scripters who do not want verbose messages, but must follow this rule (for whatever reason), will end up with code like this:
or
and so on.
I think the way this rule is written right now will ultimately do more harm than good.
imfrancisd commentedon May 19, 2015
If the link that GoodOlClint provided is what this rule is supposed to enforce, then the rule misinterpreted the best practice.
quoctruong commentedon Jun 11, 2015
This is fixed by #238