This issue is a great example of why issue #193 should be approved and implemented.
Today if you run Invoke-ScriptAnalyzer on a moderate sized module recursively with the -Verbose switch, you get 38 verbose output messages per file in your module. For one of my modules that has 58 files (I put each function in its own file if the module is only small-to-medium in size), this results in 2204 verbose messages being sent to the console. These 2204 verbose messages are nothing but noise to me.
For each of the files that are processed, I get one verbose message that indicates a file is being analyzed and then I get 37 messages (one for each rule, so that will only grow over time) indicating that a rule is being processed for that file. Those should be progress messages, not verbose messages, and so they should be output using WriteProgress, not WriteVerbose. Verbose should be reserved for non-progress messages that provide some additional detail about what is happening behind the scenes -- some small amount of information that would be useful for the invoker to know if they want the additional detail, but that they don't see regularly. This is exactly why the PSProvideVerboseMessage rule needs to go away -- it encourages users to wrongly add verbose message output where there shouldn't be any.
The reason why I invoked Invoke-ScriptAnalyzer with -Verbose in the first place is because I wanted to see if it was writing a verbose message to the output stream when a rule is found but suppressed. It is not doing this, but that is a great example of the kind of output I would expect to be in a verbose stream for this command. This verbose output would not be noise, because it includes additional detail that is not visible by default (and rightly so) that would add value to a caller trying to figure out why a particular rule is not showing up in certain scenarios. This verbose output would also be highly useful to the community because it would allow them to catch scripts and/or modules that were a little too "suppress-happy", in which case they could inform the author about the error in their ways.
In summary, Invoke-ScriptAnalyzer should:
a) convert the current WriteVerbose calls that output what are really progress messages to the verbose stream to WriteProgress calls (this will also help wrt performance, so that end users see the progress as it is happening)
b) add WriteVerbose calls that output verbose messages indicating when a rule is suppressed, identifying the rule that is suppressed, the line/file where it would have been raised, and ideally the line/file where the attribute to suppress that rule was defined (the source of the suppression).
This issue is a great example of why issue #193 should be approved and implemented.
Today if you run Invoke-ScriptAnalyzer on a moderate sized module recursively with the -Verbose switch, you get 38 verbose output messages per file in your module. For one of my modules that has 58 files (I put each function in its own file if the module is only small-to-medium in size), this results in 2204 verbose messages being sent to the console. These 2204 verbose messages are nothing but noise to me.
For each of the files that are processed, I get one verbose message that indicates a file is being analyzed and then I get 37 messages (one for each rule, so that will only grow over time) indicating that a rule is being processed for that file. Those should be progress messages, not verbose messages, and so they should be output using WriteProgress, not WriteVerbose. Verbose should be reserved for non-progress messages that provide some additional detail about what is happening behind the scenes -- some small amount of information that would be useful for the invoker to know if they want the additional detail, but that they don't see regularly. This is exactly why the PSProvideVerboseMessage rule needs to go away -- it encourages users to wrongly add verbose message output where there shouldn't be any.
The reason why I invoked Invoke-ScriptAnalyzer with -Verbose in the first place is because I wanted to see if it was writing a verbose message to the output stream when a rule is found but suppressed. It is not doing this, but that is a great example of the kind of output I would expect to be in a verbose stream for this command. This verbose output would not be noise, because it includes additional detail that is not visible by default (and rightly so) that would add value to a caller trying to figure out why a particular rule is not showing up in certain scenarios. This verbose output would also be highly useful to the community because it would allow them to catch scripts and/or modules that were a little too "suppress-happy", in which case they could inform the author about the error in their ways.
In summary, Invoke-ScriptAnalyzer should: a) convert the current WriteVerbose calls that output what are really progress messages to the verbose stream to WriteProgress calls (this will also help wrt performance, so that end users see the progress as it is happening) b) add WriteVerbose calls that output verbose messages indicating when a rule is suppressed, identifying the rule that is suppressed, the line/file where it would have been raised, and ideally the line/file where the attribute to suppress that rule was defined (the source of the suppression).