scan method

Future<List<File>> scan(
  1. String rootPath
)

Scans rootPath recursively and returns every .dart file that isn't excluded by the configured rules.

Implementation

Future<List<File>> scan(String rootPath) async {
  final root = Directory(rootPath);
  if (!await root.exists()) {
    throw FileSystemException('Directory not found', rootPath);
  }

  final files = <File>[];

  await for (final entity in root.list(recursive: true, followLinks: false)) {
    if (entity is! File) continue;
    if (!entity.path.endsWith('.dart')) continue;

    final relative = p.relative(entity.path, from: rootPath);
    if (_isExcluded(relative)) continue;

    files.add(entity);
  }

  return files;
}