collectFiles method

List<String> collectFiles(
  1. List<String> paths
)

Expands paths into the absolute, sorted list of files to check.

Implementation

List<String> collectFiles(List<String> paths) {
  final files = <String>{};
  for (final input in paths) {
    final path = p.normalize(p.join(workingDirectory, input));
    final type = FileSystemEntity.typeSync(path);
    if (type == FileSystemEntityType.file) {
      if (!path.endsWith('.dart')) {
        throw CheckerInputException('$input is not a Dart file.');
      }
      files.add(path);
    } else if (type == FileSystemEntityType.directory) {
      files.addAll(_testsUnder(path));
    } else {
      throw CheckerInputException('$input does not exist.');
    }
  }
  return files.toList()..sort();
}