Table of Contents

Class RulesetManager

Namespace
SunamoRuleset
Assembly
SunamoRuleset.dll

Manages loading, parsing, and saving of Visual Studio ruleset files. Supports Microsoft Code Quality, .NET Core, and C# Code Analysis rule types.

public class RulesetManager
Inheritance
RulesetManager
Inherited Members
Extension Methods

Constructors

RulesetManager(string)

Initializes a new instance of the RulesetManager class by parsing a ruleset file.

public RulesetManager(string rulesetPath)

Parameters

rulesetPath string

The full path to the .ruleset file to parse.

Properties

Rules

Dictionary of parsed rules grouped by their analyzer type.

public Dictionary<RulesetTypes, List<RulesetRule>> Rules { get; set; }

Property Value

Dictionary<RulesetTypes, List<RulesetRule>>

Methods

ConvertToDotSyntax(RulesetTypes)

Converts a RulesetTypes enum value to its dot-separated analyzer namespace string.

public string? ConvertToDotSyntax(RulesetTypes rulesetType)

Parameters

rulesetType RulesetTypes

The ruleset type to convert.

Returns

string

The dot-separated namespace string, or null for None.

GetRuleType(string)

Determines the analyzer type for a given rule code based on its prefix or known rule lists.

public static RulesetTypes GetRuleType(string rule)

Parameters

rule string

The rule code (e.g., "CS0168", "CA1000").

Returns

RulesetTypes

The RulesetTypes corresponding to the rule code.

Save()

Saves the current ruleset configuration back to the file it was loaded from.

public void Save()