call method

Future<Iterable<Indicate>> call({
  1. required Directory dir,
  2. required String base,
  3. required String head,
})

Implementation

Future<Iterable<Indicate>> call({
  required Directory dir,
  required String base,
  required String head,
}) async {
  final results = await _dartRepository.analyze(dir: dir);

  final indicates = await Future.wait(
    results.map(
      (result) async {
        final message = result.message;
        final path = result.filePath;
        final line = result.line;

        final commitId = await _gitRepository.getLatestCommitId(
          base: base,
          head: head,
          path: path,
          line: line,
        );

        // If no diffs between {base} and {head}, then the commit id is empty.
        // In this case, it is excluded from the list.
        if (commitId.isEmpty) {
          return null;
        }

        return Indicate(
          message: message,
          path: path,
          line: line,
        );
      },
    ),
  );

  return indicates.whereType<Indicate>();
}