Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }