IgnoreRules.parse constructor
IgnoreRules.parse(
- String content
Parses ignore rules from file content.
Implementation
factory IgnoreRules.parse(String content) {
final patterns = <IgnorePattern>[];
final negations = <String>{};
for (final line in content.split('\n')) {
final trimmed = line.trim();
if (trimmed.isEmpty || trimmed.startsWith('#')) {
continue;
}
if (trimmed.startsWith('!')) {
negations.add(trimmed.substring(1));
} else {
final pattern = IgnorePattern.parse(trimmed);
if (pattern != null) {
patterns.add(pattern);
}
}
}
return IgnoreRules._(patterns, negations);
}