-
File an issue describing your proposed rule prior to working on a PR. This will ensure that the rule gets triaged and there is no duplicate work involved from an existing rule OR another contributor working on a similar rule.
-
Newly proposed rule would be tagged with Needs-Review label. An Approved-Rule label indicates that the proposal has been reviewed and a PR to implement the rule would be accepted.
-
Follow the below steps to choose the appropriate rule ID for the new rule:
- Choose the applicable 'category' for the new rule. See DiagnosticCategoryAndIdRanges.txt for current diagnostic categories, and the CA IDs reserved for each category.
- Refer to the current official documentation 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. Say you find thatCA1824
is the last documented rule ID in this category, and there are couple of doc issues on that page for very recently added rulesCA1825
andCA1826
for which we documentation still needs to be added, then you can chooseCA1827
as the ID for your rule. - 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.
-
Follow the below guidelines to choose the appropriate analyzer package for the new rule:
- Read the README section here to get an idea of the content of the analyzer packages in the repo.
- For majority of cases, you would be contributing to either Microsoft.CodeQuality.Analyzers or Microsoft.NetCoreAnalyzers. Analyzers related to pure code quality improvements, which are not specific to any API should go into
Microsoft.CodeQuality.Analyzers
. Analyzers specific to usage of a specific .NetCore/.NetStandard API should go intoMicrosoft.NetCore.Analyzers
package. - A good rule of thumb is that if your analyzer needs to invoke
GetTypeByMetadataName
, then most likely it is an API specific analyzer and belongs toMicrosoft.NetCore.Analyzers
.
-
NOTE: Once the new rule is merged, it needs to be documented. Either submit a PR on the official documentation page for the rule's category (preferred) or file an issue. If filing an issue, please include all relevant information in the issue to allow the documentation experts to easily author the documentation. For example, see this issue.