Beispiel #1
0
        private void UpdateRecord(string line)
        {
            Match  match = RegExFileLineColumnMessage.Match(line);
            string file;
            string lineNumber;
            string columnNumber;
            string type;
            string message;

            ts.TraceData(TraceEventType.Verbose, 1, "UpdateRecord match count " + match.Groups.Count);
            if (match.Groups.Count == 6)
            {
                file = match.Groups[1].Value;

                // we simply ignore errors and warnings from system includes
                if (DTE2Utils.IsSystemInclude(file))
                {
                    return;
                }

                lineNumber   = match.Groups[2].Value;
                columnNumber = match.Groups[3].Value;
                type         = match.Groups[4].Value;
                message      = match.Groups[5].Value;

                Reporting.Violation violation = _report.CreateViolation();
                violation.FilePath     = file;
                violation.LineNumber   = lineNumber;
                violation.ColumnNumber = columnNumber;
                if (type == "warning")
                {
                    violation.Severity = Reporting.Violation.ESeverity.WARNING;
                }
                else
                {
                    violation.Severity = Reporting.Violation.ESeverity.ERROR;
                }

                violation.Message     = message;
                violation.FullMessage = line;
                if (_report.AddViolation(violation))
                {
                    DelegateViolation(violation);
                }
                else
                {
                    ts.TraceData(TraceEventType.Verbose, 1, "UpdateRecord already added");
                }
            }
        }
Beispiel #2
0
        private void OnAnalyzerViolation(Reporting.Violation violation)
        {
            ts.TraceInformation("OnAnalyzerViolation " + violation.FilePath +
                                "(" + violation.LineNumber + "," + violation.ColumnNumber + "): " + violation.Message);

            TaskErrorCategory taskErrorCategory = Microsoft.VisualStudio.Shell.TaskErrorCategory.Error;

            if (violation.Severity == Reporting.Violation.ESeverity.WARNING)
            {
                taskErrorCategory = Microsoft.VisualStudio.Shell.TaskErrorCategory.Warning;
            }

            ErrorListHelper.Write(
                Microsoft.VisualStudio.Shell.TaskCategory.BuildCompile,
                taskErrorCategory,
                violation.Message,
                violation.FilePath,
                Convert.ToInt32(violation.LineNumber),
                Convert.ToInt32(violation.ColumnNumber));
        }