Sha256: fbf5745a74359dc17d645c38a918dcde35e918cde649fdd14ca5a79226681cda
Contents?: true
Size: 732 Bytes
Versions: 2
Compression:
Stored size: 732 Bytes
Contents
module Overcommit::Hook::PreCommit # Runs `scalastyle` against any modified Scala files. # # @see http://www.scalastyle.org/ class Scalastyle < Base MESSAGE_REGEX = / ^(?<type>error|warning)\s file=(?<file>.+)\s message=.+\s line=(?<line>\d+) /x def run result = execute(command + applicable_files) output = result.stdout.chomp messages = output.split("\n").grep(MESSAGE_REGEX) return :pass if result.success? && messages.empty? # example message: # error file=/path/to/file.scala message=Error message line=1 column=1 extract_messages( messages, MESSAGE_REGEX, lambda { |type| type.to_sym } ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
overcommit-0.27.0 | lib/overcommit/hook/pre_commit/scalastyle.rb |
overcommit-0.26.0 | lib/overcommit/hook/pre_commit/scalastyle.rb |