@Test public void parseWithCircles() { String input = " lint • Close instances of `dart.core.Sink`. • lib/main.dart:63:9 • close_sinks\n" + " hint • The value of the local variable '_controller' isn't used. • lib/main.dart:63:9 • unused_local_variable"; List<DartAnalyzerReportIssue> issues = parser.parse(input); assertThat(issues.size()).isEqualTo(2); assertFilePath(issues.get(0), FILE_PATH); assertLineNumber(issues.get(0), 63); assertRuleId(issues.get(0), "close_sinks"); assertMessage(issues.get(0), "Close instances of `dart.core.Sink`."); assertFilePath(issues.get(1), FILE_PATH); assertLineNumber(issues.get(1), 63); assertRuleId(issues.get(1), RULE_ID_UNUSED_LOCAL_VARIABLE); assertMessage(issues.get(1), "The value of the local variable '_controller' isn't used."); }
public List<DartAnalyzerReportIssue> parse(String input) { List<DartAnalyzerReportIssue> issues = new ArrayList<>(); String[] lines = input.split(System.getProperty("line.separator")); Pattern pattern = Pattern.compile("(error|hint|lint)(.*)(-|•)(.*)(-|•)(.*):(.*):(.*)(-|•)(.*)"); for (int i = 0; i < lines.length; i++) { Matcher matcher = pattern.matcher(lines[i]); while (matcher.find()) { String filePath = matcher.group(6).trim(); int lineNum = Integer.parseInt(matcher.group(7).trim()); String message = matcher.group(4).trim(); String ruleId = matcher.group(10).trim(); issues.add(new DartAnalyzerReportIssue(ruleId, message, filePath, lineNum)); } } return issues; }
DartAnalyzerReportParser { public List<DartAnalyzerReportIssue> parse(String input) { List<DartAnalyzerReportIssue> issues = new ArrayList<>(); String[] lines = input.split(System.getProperty("line.separator")); Pattern pattern = Pattern.compile("(error|hint|lint)(.*)(-|•)(.*)(-|•)(.*):(.*):(.*)(-|•)(.*)"); for (int i = 0; i < lines.length; i++) { Matcher matcher = pattern.matcher(lines[i]); while (matcher.find()) { String filePath = matcher.group(6).trim(); int lineNum = Integer.parseInt(matcher.group(7).trim()); String message = matcher.group(4).trim(); String ruleId = matcher.group(10).trim(); issues.add(new DartAnalyzerReportIssue(ruleId, message, filePath, lineNum)); } } return issues; } }
DartAnalyzerReportParser { public List<DartAnalyzerReportIssue> parse(String input) { List<DartAnalyzerReportIssue> issues = new ArrayList<>(); String[] lines = input.split(System.getProperty("line.separator")); Pattern pattern = Pattern.compile("(error|hint|lint)(.*)(-|•)(.*)(-|•)(.*):(.*):(.*)(-|•)(.*)"); for (int i = 0; i < lines.length; i++) { Matcher matcher = pattern.matcher(lines[i]); while (matcher.find()) { String filePath = matcher.group(6).trim(); int lineNum = Integer.parseInt(matcher.group(7).trim()); String message = matcher.group(4).trim(); String ruleId = matcher.group(10).trim(); issues.add(new DartAnalyzerReportIssue(ruleId, message, filePath, lineNum)); } } return issues; }  }
DartAnalyzerReportParser { public List<DartAnalyzerReportIssue> parse(String input) { List<DartAnalyzerReportIssue> issues = new ArrayList<>(); String[] lines = input.split(System.getProperty("line.separator")); Pattern pattern = Pattern.compile("(error|hint|lint)(.*)(-|•)(.*)(-|•)(.*):(.*):(.*)(-|•)(.*)"); for (int i = 0; i < lines.length; i++) { Matcher matcher = pattern.matcher(lines[i]); while (matcher.find()) { String filePath = matcher.group(6).trim(); int lineNum = Integer.parseInt(matcher.group(7).trim()); String message = matcher.group(4).trim(); String ruleId = matcher.group(10).trim(); issues.add(new DartAnalyzerReportIssue(ruleId, message, filePath, lineNum)); } } return issues; }  List<DartAnalyzerReportIssue> parse(String input); }
DartAnalyzerReportParser { public List<DartAnalyzerReportIssue> parse(String input) { List<DartAnalyzerReportIssue> issues = new ArrayList<>(); String[] lines = input.split(System.getProperty("line.separator")); Pattern pattern = Pattern.compile("(error|hint|lint)(.*)(-|•)(.*)(-|•)(.*):(.*):(.*)(-|•)(.*)"); for (int i = 0; i < lines.length; i++) { Matcher matcher = pattern.matcher(lines[i]); while (matcher.find()) { String filePath = matcher.group(6).trim(); int lineNum = Integer.parseInt(matcher.group(7).trim()); String message = matcher.group(4).trim(); String ruleId = matcher.group(10).trim(); issues.add(new DartAnalyzerReportIssue(ruleId, message, filePath, lineNum)); } } return issues; }  List<DartAnalyzerReportIssue> parse(String input);  }