Skip to content

Commit 0801142

Browse files
Assign categories to diagnostics #216
1 parent 4d2d701 commit 0801142

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

CheckedExceptions/AnalyzerReleases.Unshipped.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
### New Rules
33
Rule ID | Category | Severity | Notes
44
--------|----------|----------|--------------------
5-
THROW001 | Usage | Warning | CheckedExceptionsAnalyzer
5+
THROW001 | Control flow | Warning | CheckedExceptionsAnalyzer
66
THROW002 | Usage | Info | CheckedExceptionsAnalyzer
77
THROW003 | Usage | Warning | CheckedExceptionsAnalyzer
88
THROW004 | Usage | Warning | CheckedExceptionsAnalyzer
9-
THROW005 | Usage | Warning | CheckedExceptionsAnalyzer
10-
THROW006 | Usage | Warning | CheckedExceptionsAnalyzer
11-
THROW007 | Usage | Warning | CheckedExceptionsAnalyzer
12-
THROW008 | Usage | Warning | CheckedExceptionsAnalyzer
13-
THROW009 | Usage | Warning | CheckedExceptionsAnalyzer
14-
THROW010 | Usage | Error | CheckedExceptionsAnalyzer
15-
THROW011 | Usage | Warning | CheckedExceptionsAnalyzer
16-
THROW012 | Usage | Warning | CheckedExceptionsAnalyzer
17-
THROW013 | Usage | Warning | CheckedExceptionsAnalyzer
18-
THROW020 | Usage | Hidden | CheckedExceptionsAnalyzer
9+
THROW005 | Contract | Warning | CheckedExceptionsAnalyzer
10+
THROW006 | Contract | Warning | CheckedExceptionsAnalyzer
11+
THROW007 | Contract | Warning | CheckedExceptionsAnalyzer
12+
THROW008 | Contract | Warning | CheckedExceptionsAnalyzer
13+
THROW009 | Control flow | Warning | CheckedExceptionsAnalyzer
14+
THROW010 | Contract | Error | CheckedExceptionsAnalyzer
15+
THROW011 | Contract | Warning | CheckedExceptionsAnalyzer
16+
THROW012 | Contract | Warning | CheckedExceptionsAnalyzer
17+
THROW013 | Control flow | Warning | CheckedExceptionsAnalyzer
18+
THROW020 | Control flow | Hidden | CheckedExceptionsAnalyzer

CheckedExceptions/CheckedExceptionsAnalyzer.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public partial class CheckedExceptionsAnalyzer : DiagnosticAnalyzer
4141
DiagnosticIdUnhandled,
4242
"Unhandled exception",
4343
"Unhandled exception type '{0}'",
44-
"Usage",
44+
"Control flow",
4545
DiagnosticSeverity.Warning,
4646
isEnabledByDefault: true,
4747
description: "Reports exceptions that are thrown but not caught or declared with [Throws], potentially violating exception safety.");
@@ -77,7 +77,7 @@ public partial class CheckedExceptionsAnalyzer : DiagnosticAnalyzer
7777
DiagnosticIdDuplicateDeclarations,
7878
"Avoid duplicate declarations of the same exception type",
7979
"Duplicate declaration of the exception type '{0}' found. Remove it to avoid redundancy.",
80-
"Usage",
80+
"Contract",
8181
DiagnosticSeverity.Warning,
8282
isEnabledByDefault: true,
8383
description: "Detects multiple exception declarations for the same exception type on a single member, which is redundant.");
@@ -86,7 +86,7 @@ public partial class CheckedExceptionsAnalyzer : DiagnosticAnalyzer
8686
DiagnosticIdMissingThrowsFromBaseMember,
8787
"Missing Throws declaration for exception declared on base member",
8888
"Exception '{1}' declared in '{0}' is not declared in this override or implemented member",
89-
"Usage",
89+
"Contract",
9090
DiagnosticSeverity.Warning,
9191
isEnabledByDefault: true,
9292
description: "Ensures that overridden or implemented members declare exceptions required by their base or interface definitions.");
@@ -95,7 +95,7 @@ public partial class CheckedExceptionsAnalyzer : DiagnosticAnalyzer
9595
DiagnosticIdMissingThrowsOnBaseMember,
9696
"Incompatible Throws declaration",
9797
"Exception '{1}' is not compatible with throws declaration(s) in '{0}'",
98-
"Usage",
98+
"Contract",
9999
DiagnosticSeverity.Warning,
100100
isEnabledByDefault: true,
101101
description: "Ensures that overridden or implemented members do not declare exceptions incompatible with their base or interface definitions.");
@@ -104,7 +104,7 @@ public partial class CheckedExceptionsAnalyzer : DiagnosticAnalyzer
104104
DiagnosticIdDuplicateThrowsByHierarchy,
105105
title: "Redundant exception declaration",
106106
messageFormat: "Exception already handled by declaration of super type ('{0}')",
107-
category: "Usage",
107+
category: "Contract",
108108
DiagnosticSeverity.Warning,
109109
isEnabledByDefault: true,
110110
description: "Detects redundant [Throws] declarations where a more general exception type already covers the specific exception.");
@@ -113,7 +113,7 @@ public partial class CheckedExceptionsAnalyzer : DiagnosticAnalyzer
113113
DiagnosticIdRedundantTypedCatchClause,
114114
title: "Redundant catch typed clause",
115115
messageFormat: "Exception type '{0}' is never thrown within the try block",
116-
category: "Usage",
116+
category: "Control flow",
117117
DiagnosticSeverity.Warning,
118118
isEnabledByDefault: true,
119119
description: "Detects catch clauses for exception types that are never thrown inside the associated try block, making the catch clause redundant.",
@@ -123,7 +123,7 @@ public partial class CheckedExceptionsAnalyzer : DiagnosticAnalyzer
123123
DiagnosticIdRedundantCatchAllClause,
124124
title: "Redundant catch-all clause",
125125
messageFormat: "This catch-all clause is redundant because no exceptions remain to be handled",
126-
category: "Usage",
126+
category: "Control flow",
127127
DiagnosticSeverity.Warning,
128128
isEnabledByDefault: true,
129129
description: "Reports catch-all clauses that cannot handle any exceptions because all exceptions " +
@@ -134,7 +134,7 @@ public partial class CheckedExceptionsAnalyzer : DiagnosticAnalyzer
134134
DiagnosticIdThrowsDeclarationNotValidOnFullProperty,
135135
title: "Throws attribute is not valid on full property declarations",
136136
messageFormat: "Throws attribute is not valid on full property declarations. Place it on accessors instead.",
137-
category: "Usage",
137+
category: "Contract",
138138
DiagnosticSeverity.Error,
139139
isEnabledByDefault: true,
140140
description: "The [Throws] attribute cannot be applied to full property declarations. Instead, place the attribute on individual accessors (get or set) to indicate which operations may throw exceptions.");
@@ -143,7 +143,7 @@ public partial class CheckedExceptionsAnalyzer : DiagnosticAnalyzer
143143
DiagnosticIdXmlDocButNoThrows,
144144
title: "Exception in XML documentation is not declared with [Throws]",
145145
messageFormat: "Exception '{0}' is documented in XML documentation but not declared with [Throws]",
146-
category: "Usage",
146+
category: "Contract",
147147
DiagnosticSeverity.Warning,
148148
isEnabledByDefault: true,
149149
description: "This member's XML documentation declares an exception, but it is not declared with a [Throws] attribute. " +
@@ -153,7 +153,7 @@ public partial class CheckedExceptionsAnalyzer : DiagnosticAnalyzer
153153
DiagnosticIdRedundantExceptionDeclaration,
154154
title: "Redundant exception declaration",
155155
messageFormat: "Exception '{0}' is declared but never thrown",
156-
category: "Usage",
156+
category: "Contract",
157157
DiagnosticSeverity.Warning,
158158
isEnabledByDefault: true,
159159
description: "Detects exception types declared with [Throws] that are never thrown in the method or property body, making the declaration redundant.");
@@ -162,7 +162,7 @@ public partial class CheckedExceptionsAnalyzer : DiagnosticAnalyzer
162162
DiagnosticIdRuleUnreachableCode,
163163
title: "Unreachable code",
164164
messageFormat: "The code is unreachable in the current control flow",
165-
category: "Usage",
165+
category: "Control flow",
166166
defaultSeverity: DiagnosticSeverity.Hidden,
167167
isEnabledByDefault: true,
168168
description: "Detects throw statements that cannot be reached due to surrounding control flow or exception handling.",

0 commit comments

Comments
 (0)