getCodeStyleViolations method

  1. @override
Future<String> getCodeStyleViolations()
override

Found styleGuide violations from the projectDir.

Implementation

@override
Future<String> getCodeStyleViolations() {
  return runPubGet().then(
    (_) => Process.run(
      'dart',
      <String>[
        'analyze',
        '--format',
        'machine',
        // TODO(bitsydarel): uncomment when, https://github.com/dart-lang/sdk/issues/45286
        // '--options',
        // styleGuide.path,
        projectDir.path,
      ],
      runInShell: true,
      stdoutEncoding: utf8,
      stderrEncoding: utf8,
    ).then((ProcessResult processResult) {
      final String output = processResult.stdout.toString();

      return output.isEmpty ? processResult.stderr.toString() : output;
    }),
  );
}