public virtual HashSet <string> InitializeExceptions(string exceptionsFile, string diagnosticId) { ExceptionsOptions = InitializeExceptionsOptions(diagnosticId); HashSet <string> exceptions = new HashSet <string>(); if (!ExceptionsOptions.IgnoreExceptionsFile) { exceptions = LoadExceptions(exceptionsFile); } return(exceptions); }
public virtual ExceptionsOptions LoadExceptionsOptions(string diagnosticId) { ExceptionsOptions options = new ExceptionsOptions(); string ignoreExceptionsFile = GetValueFromEditorConfig(diagnosticId, @"ignore_exceptions_file"); options.IgnoreExceptionsFile = !string.IsNullOrWhiteSpace(ignoreExceptionsFile); string generateExceptionsFile = GetValueFromEditorConfig(diagnosticId, @"generate_exceptions_file"); options.GenerateExceptionsFile = !string.IsNullOrWhiteSpace(generateExceptionsFile); return(options); }
public virtual ExceptionsOptions LoadExceptionsOptions(SourceText text, string diagnosticId) { ExceptionsOptions options = new ExceptionsOptions(); foreach (TextLine textLine in text.Lines) { string line = textLine.ToString(); if (line.Contains($@"dotnet_code_quality.{diagnosticId}.ignore_exceptions_file")) { options.IgnoreExceptionsFile = true; } if (line.Contains($@"dotnet_code_quality.{diagnosticId}.generate_exceptions_file")) { options.GenerateExceptionsFile = true; } } return(options); }