class Checkstyle < Formula desc "Check Java source against a coding standard" homepage "http://checkstyle.sourceforge.net/" url "https://downloads.sourceforge.net/project/checkstyle/checkstyle/6.15/checkstyle-6.15-all.jar" sha256 "cfd29fefe1abff1224ed8f57136cd88188b62164284282df5010de1c14a7d84f" 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