homebrew-core/Formula/checkstyle.rb
ilovezfs 4dea8db604 checkstyle 7.4
Closes #8350.

Signed-off-by: Tomasz Pajor <tomek@polishgeeks.com>
2016-12-31 13:39:33 +01: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.4/checkstyle-7.4-all.jar"
sha256 "2ea7d4ff74d4da453378d9328c93f02843cb05bc14ec0124cf7690bc6c154d2a"
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