getIgnoreReason static method
Get the reason a file should be ignored
Implementation
static String? getIgnoreReason(
String filePath,
String? content,
List<String> patterns,
List<String> exactFiles, {
CommentStyle style = CommentStyle.cStyle,
}) {
final normalizedPath = filePath.replaceAll('\\', '/');
// Check exact file matches
for (final file in exactFiles) {
if (normalizedPath == file || normalizedPath.endsWith('/$file')) {
return 'In ignore files list';
}
}
// Check patterns
for (final pattern in patterns) {
if (_matchGlobPattern(normalizedPath, pattern)) {
return 'Matches pattern: $pattern';
}
}
// Check generated markers in content
if (content != null && hasGeneratedMarker(content, style)) {
return 'Contains generated file marker';
}
return null;
}