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
Copy file name to clipboardExpand all lines: README.md
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,8 @@ You can suppress a rule by decorating a script/function or script/function param
53
53
54
54
}
55
55
56
+
All rule violations within the scope of the script/function/parameter you decorate will be suppressed.
57
+
56
58
To suppress a message on a specific parameter, set the `SuppressMessageAttribute`'s `CheckId` parameter to the name of the parameter:
57
59
58
60
function SuppressTwoVariables()
@@ -63,25 +65,24 @@ To suppress a message on a specific parameter, set the `SuppressMessageAttribute
63
65
{
64
66
}
65
67
}
66
-
67
-
To suppress a rule for an entire function/script, decorate the `param` block of the script/function and set the `SuppressMessageAttribute's``Scope` property to `Function`:
68
+
69
+
Use the `SuppressMessageAttribute`'s `Scope` property to limit rule suppression to functions or classes within the attribute's scope. Use the value `Function` to suppress violations on all functions within the attribute's scope. Use the value `Class` to suppress violoations on all classes within the attribute's scope:
The above example demonstrates how to suppress rule violations for internal functions using the `SuppressMessageAttribute`'s `Scope` property.
83
84
84
-
Finally, you can restrict suppression inside a scope by setting the `SuppressMessageAttribute's``Target` property to a regular expression that causes the script analyzer to skip functions/variables/parameters/objects whose names match the regular expression.
85
+
You can further restrict suppression based on a function/parameter/class/variable/object's name by setting the `SuppressMessageAttribute's``Target` property to a regular expression. Any function/parameter/class/variable/object whose name matches the regular expression is skipped.
0 commit comments