resolve method

ResolvedHookTask resolve(
  1. List<String> filePaths,
  2. int index
)

Resolves the task with the given file paths and index.

filePaths is the list of file paths to process. index is the index of the task.

The index is used during logging to create identifiable task labels for each task. Failure to provide a unique index for each task may result in duplicate task labels and incorrect logging.

Implementation

ResolvedHookTask resolve(List<String> filePaths, int index) {
  final filtered = filterFiles(filePaths);

  final subTasks = this.subTasks(filtered);

  return ResolvedHookTask(
    files: filtered,
    original: this,
    index: index,
    label: label(filtered),
    subTasks: subTasks.indexed.map((e) {
      final (i, task) = e;
      final subIndex = int.parse('${index}0$i');

      final subFiltered = task.filterFiles(filtered);

      return task.resolve(subFiltered, subIndex);
    }).toList(),
  );
}