Skip to content

Commit 78dd233

Browse files
authored
Merge pull request #3458 from mavasani/MergeChanges
Merge 2.9.x -> master
2 parents de5ac36 + 564ea9d commit 78dd233

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

GuidelinesForNewRules.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@
77

88
3. Follow the below steps to choose the appropriate **rule ID** for the new rule:
99

10-
1. Choose the **applicable 'category'** for the new rule. See [DiagnosticCategoryAndIdRanges.txt](.//src//Utilities//Compiler//DiagnosticCategoryAndIdRanges.txt) for current diagnostic categories, and the CA IDs reserved for each category.
11-
2. Refer to the current [official documentation](https://docs.microsoft.com/visualstudio/code-quality/code-analysis-for-managed-code-warnings) for all CA rules by rule category. For example, while adding a new rule in the `Performance` category, you should navigate to the [Performance Rules section](https://docs.microsoft.com/visualstudio/code-quality/performance-warnings). Say you find that `CA1824` is the last documented rule ID in this category, and there are couple of doc issues on that page for very recently added rules `CA1825` and `CA1826` for which we documentation still needs to be added, then you can choose `CA1827` as the ID for your rule.
12-
3. Double check that you have chosen an unused CA ID by searching the repo, for example use following query for `CA1827`: https://github.com/dotnet/roslyn-analyzers/search?q=CA1827.
10+
1. Choose the **applicable 'category'** for the new rule. See [DiagnosticCategoryAndIdRanges.txt](.//src//Utilities//Compiler//DiagnosticCategoryAndIdRanges.txt) for current diagnostic categories, and the CA IDs currently in use for each category.
11+
2. Choose the **next available CA ID** for the chosen 'category' from [DiagnosticCategoryAndIdRanges.txt](.//src//Utilities//Compiler//DiagnosticCategoryAndIdRanges.txt).
12+
For example, while adding a new rule in the `Performance` category, if `CA1800-CA1829` represents the current CA ID range in `DiagnosticCategoryAndIdRanges.txt`, then:
13+
1. Choose `CA1830` as the rule ID for your rule.
14+
2. Update the range for `Performance` in [DiagnosticCategoryAndIdRanges.txt](.//src//Utilities//Compiler//DiagnosticCategoryAndIdRanges.txt) to `CA1800-CA1830`
15+
16+
You can refer to the [official documentation](https://docs.microsoft.com/visualstudio/code-quality/code-analysis-for-managed-code-warnings) for all released CA rules by rule category.
1317

1418
4. Follow the below guidelines to choose the appropriate **analyzer package** for the new rule:
1519

src/Utilities/Compiler/DiagnosticCategoryAndIdRanges.txt

+17-11
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
# FORMAT:
33
# 'Category': Comma separate list of 'StartId-EndId' or 'Id' or 'Prefix'
44

5-
# FxCop rules
6-
Design: CA1000-CA1099, CA2210
7-
Globalization: CA1300-CA1399, CA2101
8-
Mobility: CA1600-CA1699
9-
Performance: CA1800-CA1899, HA
10-
Security: CA2100-CA2199, CA2300-CA2399, CA3000-CA3147, CA5300-CA5499
11-
Usage: CA1801, CA1806, CA1816, CA2200-CA2209, CA2211-CA2299
12-
Naming: CA1700-CA1799
13-
Maintainability: CA1500-CA1599
14-
Reliability: CA2000-CA2099, CA9999
15-
Documentation: CA1200-CA1299
5+
# Code Analysis (CA) rules - https://docs.microsoft.com/visualstudio/code-quality/code-analysis-for-managed-code-warnings
6+
#
7+
# The ranges below represent the **currently used IDs** for the corresponding category.
8+
# When implementing a new rule for the category:
9+
# 1. Choose the rule ID immediately following the range end.
10+
# 2. Update the range end to the chosen rule ID.
11+
#
12+
Design: CA2210, CA1000-CA1069
13+
Globalization: CA2101, CA1300-CA1309
14+
Mobility: CA1600-CA1601
15+
Performance: HA, CA1800-CA1829
16+
Security: CA2100-CA2153, CA2300-CA2330, CA3000-CA3147, CA5300-CA5403
17+
Usage: CA1801, CA1806, CA1816, CA2200-CA2209, CA2211-CA2247
18+
Naming: CA1700-CA1726
19+
Maintainability: CA1500-CA1509
20+
Reliability: CA9999, CA2000-CA2014
21+
Documentation: CA1200-CA1200
1622

1723
# Microsoft CodeAnalysis API rules
1824
MicrosoftCodeAnalysisCorrectness: RS1000-RS1999

0 commit comments

Comments
 (0)