Closed
Description
In Suppressing rules in README.md, the last two examples omit the CheckID parameter. When used like this, the constructor for SuppressMessageAttribute throws an exception
Eg. when using the example provided under 'Suppress violations in all the functions' in a script:
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', Scope='Function', Target='*')]
Param()
Write-Output 'Hello world'
When executing this script, PowerShell throws this error:
Cannot find an overload for ".ctor" and the argument count: "1".
The example starting on line 302 should read:
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Scope='Function', Target='*')]
Param()
and on line 307
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Scope='Function', Target='start-b*')]
Param()