class Overcommit::Hook::PreCommit::DartAnalyzer

Runs ‘dartanalyzer` against modified Dart files. @see dart.dev/tools/dartanalyzer

Constants

MESSAGE_REGEX

Public Instance Methods

run() click to toggle source
# File lib/overcommit/hook/pre_commit/dart_analyzer.rb, line 9
def run
  result = execute(command, args: applicable_files)
  return :pass if result.success?

  extract_messages(
    result.stdout.split("\n").grep(MESSAGE_REGEX),
    MESSAGE_REGEX,
    lambda do |type|
      type.include?('error') ? :error : :warning
    end
  )
end