Skip to content

Latest commit

 

History

History
42 lines (35 loc) · 2.41 KB

File metadata and controls

42 lines (35 loc) · 2.41 KB

Atc.CodeAnalysis.CSharp.Factories


SuppressMessageAttributeFactory

SuppressMessage Attribute Factory.

Remarks: Code Analysis Warnings for Managed Code by CheckId: https://docs.microsoft.com/en-us/visualstudio/code-quality/code-analysis-warnings-for-managed-code-by-checkid?view=vs-2019.

public static class SuppressMessageAttributeFactory

Static Methods

CreateCodeAnalysisSuppression

SuppressMessageAttribute CreateCodeAnalysisSuppression(int checkId, string justification)

Summary: Creates a System.Diagnostics.CodeAnalysis.SuppressMessageAttribute for a Code Analysis (CA) rule suppression.

Parameters:
     checkId  -  The numeric identifier of the CA rule to suppress (e.g., 1062 for CA1062).
     justification  -  The justification for suppressing the rule. If null or empty, defaults to "OK.".

Returns: A System.Diagnostics.CodeAnalysis.SuppressMessageAttribute configured for the specified rule. Well-known rules receive their canonical category and human-readable title; unknown rules receive a generic "Microsoft.Design" category and the bare rule id, which is sufficient for the analyzer match (matching is on rule id only, not on category).

CreateStyleCopSuppression

SuppressMessageAttribute CreateStyleCopSuppression(int checkId, string justification)

Summary: Creates a System.Diagnostics.CodeAnalysis.SuppressMessageAttribute for a StyleCop (SA) rule suppression.

Parameters:
     checkId  -  The numeric identifier of the SA rule to suppress (e.g., 1413 for SA1413).
     justification  -  The justification for suppressing the rule. If null or empty, defaults to "OK.".

Returns: A System.Diagnostics.CodeAnalysis.SuppressMessageAttribute configured for the specified rule. Well-known rules receive their canonical category and human-readable title; unknown rules receive a generic "StyleCop.CSharp.MaintainabilityRules" category and the bare rule id.


Generated by MarkdownCodeDoc version 1.2