parse static method
Implementation
static IgnoreInfo parse(String content) {
final fileIgnores = <String>{};
final lineIgnores = <int, Set<String>>{};
final lines = content.split('\n');
for (var i = 0; i < lines.length; i++) {
final line = lines[i].trim();
final fileMatch = _ignoreForFileRe.firstMatch(line);
if (fileMatch != null) {
final codes = fileMatch.group(1);
if (codes != null) {
fileIgnores.addAll(codes.split(',').map((s) => s.trim()));
}
continue;
}
final lineMatch = _ignoreLineRe.firstMatch(line);
if (lineMatch != null) {
final codes = lineMatch.group(1);
if (codes != null) {
final targetLine = i + 2; // 0-indexed i + 2 = next 1-based line
lineIgnores
.putIfAbsent(targetLine, () => <String>{})
.addAll(codes.split(',').map((s) => s.trim()));
}
}
}
return IgnoreInfo._(fileIgnores: fileIgnores, lineIgnores: lineIgnores);
}