homebrew-core/Formula/checkstyle.rb
ilovezfs 24c229cb57 checkstyle 7.3
Closes #7251.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-11-26 16:45:25 -08:00

23 lines
839 B
Ruby

class Checkstyle < Formula
desc "Check Java source against a coding standard"
homepage "http://checkstyle.sourceforge.net/"
url "https://downloads.sourceforge.net/project/checkstyle/checkstyle/7.3/checkstyle-7.3-all.jar"
sha256 "9bd5c711c03a7f246f4b4826719a7a40e2b36389945633dafe9b8e1bedb81066"
bottle :unneeded
def install
libexec.install "checkstyle-#{version}-all.jar"
bin.write_jar_script libexec/"checkstyle-#{version}-all.jar", "checkstyle"
end
test do
path = testpath/"foo.java"
path.write "public class Foo{ }\n"
output = `#{bin}/checkstyle -c /sun_checks.xml #{path}`
errors = output.lines.select { |line| line.start_with?("[ERROR] #{path}") }
assert_match "#{path}:1:17: '{' is not preceded with whitespace.", errors.join(" ")
assert_equal errors.size, $?.exitstatus
end
end