isIgnore function

Future<bool> isIgnore(
  1. String path,
  2. Project project
)

Implementation

Future<bool> isIgnore(String path, Project project) async {
  final join = project.fs.path.join;
  final rootPath = project.rootPath;
  if (path == project.allIntegrationTestFilePath) {
    return true;
  }

  if (isHidden(path, rootPath) || isFunnyFile(path)) {
    return true;
  }

  final ignoredPaths = await project.ignoredPaths();
  for (final ignorePath in ignoredPaths) {
    final fullPath = project.fs.path.join(project.rootPath, ignorePath);
    final glob = getGlob(fullPath);
    if (glob.matches(path)) {
      return true;
    }
  }

  return !onlyPaths.any((dir) => path.startsWith(join(rootPath, dir)));
}