private static CompilerMessage CompilerErrorFor(GendarmeRuleData gendarmeRuleData) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(gendarmeRuleData.Problem); stringBuilder.AppendLine(gendarmeRuleData.Details); stringBuilder.AppendLine(string.IsNullOrEmpty(gendarmeRuleData.Location) ? string.Format("{0} at line : {1}", (object) gendarmeRuleData.Source, (object) gendarmeRuleData.Line) : gendarmeRuleData.Location); string str = stringBuilder.ToString(); return new CompilerMessage() { type = CompilerMessageType.Error, message = str, file = gendarmeRuleData.File, line = gendarmeRuleData.Line, column = 1 }; }
private static GendarmeRuleData GetGendarmeRuleDataFor(IList<string> output, int index) { GendarmeRuleData gendarmeRuleData = new GendarmeRuleData(); for (int i = index; i < output.Count; i++) { string text = output[i]; if (text.StartsWith("Problem:")) { gendarmeRuleData.Problem = text.Substring(text.LastIndexOf("Problem:", StringComparison.Ordinal) + "Problem:".Length); } else { if (text.StartsWith("* Details")) { gendarmeRuleData.Details = text; } else { if (text.StartsWith("* Source")) { gendarmeRuleData.IsAssemblyError = false; gendarmeRuleData.Source = text; gendarmeRuleData.Line = GendarmeOutputParser.GetLineNumberFrom(text); gendarmeRuleData.File = GendarmeOutputParser.GetFileNameFrome(text); } else { if (text.StartsWith("* Severity")) { gendarmeRuleData.Severity = text; } else { if (text.StartsWith("* Location")) { gendarmeRuleData.IsAssemblyError = true; gendarmeRuleData.Location = text; } else { if (!text.StartsWith("* Target")) { gendarmeRuleData.LastIndex = i; break; } gendarmeRuleData.Target = text; } } } } } } return gendarmeRuleData; }
private static CompilerMessage CompilerErrorFor(GendarmeRuleData gendarmeRuleData) { StringBuilder builder = new StringBuilder(); builder.AppendLine(gendarmeRuleData.Problem); builder.AppendLine(gendarmeRuleData.Details); builder.AppendLine(string.IsNullOrEmpty(gendarmeRuleData.Location) ? string.Format("{0} at line : {1}", gendarmeRuleData.Source, gendarmeRuleData.Line) : gendarmeRuleData.Location); string str = builder.ToString(); return(new CompilerMessage { type = CompilerMessageType.Error, message = str, file = gendarmeRuleData.File, line = gendarmeRuleData.Line, column = 1 }); }
private static GendarmeRuleData GetGendarmeRuleDataFor(IList <string> output, int index) { var gendarmeRuleData = new GendarmeRuleData(); //Read until we hit a non detail line. for (var i = index; i < output.Count; i++) { var currentLine = output[i]; const string problemString = "Problem:"; if (currentLine.StartsWith(problemString)) { gendarmeRuleData.Problem = currentLine.Substring(currentLine.LastIndexOf(problemString, StringComparison.Ordinal) + problemString.Length); } else if (currentLine.StartsWith("* Details")) { gendarmeRuleData.Details = currentLine; } else if (currentLine.StartsWith("* Source")) { gendarmeRuleData.IsAssemblyError = false; gendarmeRuleData.Source = currentLine; gendarmeRuleData.Line = GetLineNumberFrom(currentLine); gendarmeRuleData.File = GetFileNameFrome(currentLine); } else if (currentLine.StartsWith("* Severity")) { gendarmeRuleData.Severity = currentLine; } else if (currentLine.StartsWith("* Location")) { gendarmeRuleData.IsAssemblyError = true; gendarmeRuleData.Location = currentLine; } else if (currentLine.StartsWith("* Target")) { gendarmeRuleData.Target = currentLine; } else { gendarmeRuleData.LastIndex = i; break; } } return(gendarmeRuleData); }
private static GendarmeRuleData GetGendarmeRuleDataFor(IList <string> output, int index) { GendarmeRuleData data = new GendarmeRuleData(); for (int i = index; i < output.Count; i++) { string currentLine = output[i]; if (currentLine.StartsWith("Problem:")) { data.Problem = currentLine.Substring(currentLine.LastIndexOf("Problem:", StringComparison.Ordinal) + "Problem:".Length); } else if (currentLine.StartsWith("* Details")) { data.Details = currentLine; } else if (currentLine.StartsWith("* Source")) { data.IsAssemblyError = false; data.Source = currentLine; data.Line = GetLineNumberFrom(currentLine); data.File = GetFileNameFrome(currentLine); } else if (currentLine.StartsWith("* Severity")) { data.Severity = currentLine; } else if (currentLine.StartsWith("* Location")) { data.IsAssemblyError = true; data.Location = currentLine; } else if (currentLine.StartsWith("* Target")) { data.Target = currentLine; } else { data.LastIndex = i; return(data); } } return(data); }
private static GendarmeRuleData GetGendarmeRuleDataFor(IList<string> output, int index) { GendarmeRuleData gendarmeRuleData = new GendarmeRuleData(); for (int index1 = index; index1 < output.Count; ++index1) { string currentLine = output[index1]; if (currentLine.StartsWith("Problem:")) gendarmeRuleData.Problem = currentLine.Substring(currentLine.LastIndexOf("Problem:", StringComparison.Ordinal) + "Problem:".Length); else if (currentLine.StartsWith("* Details")) gendarmeRuleData.Details = currentLine; else if (currentLine.StartsWith("* Source")) { gendarmeRuleData.IsAssemblyError = false; gendarmeRuleData.Source = currentLine; gendarmeRuleData.Line = GendarmeOutputParser.GetLineNumberFrom(currentLine); gendarmeRuleData.File = GendarmeOutputParser.GetFileNameFrome(currentLine); } else if (currentLine.StartsWith("* Severity")) gendarmeRuleData.Severity = currentLine; else if (currentLine.StartsWith("* Location")) { gendarmeRuleData.IsAssemblyError = true; gendarmeRuleData.Location = currentLine; } else if (currentLine.StartsWith("* Target")) { gendarmeRuleData.Target = currentLine; } else { gendarmeRuleData.LastIndex = index1; break; } } return gendarmeRuleData; }