homebrew-core/Formula/checkstyle.rb
Igor Kapkov 8c36bf133f checkstyle 8.19
Closes #38672.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
2019-04-05 12:32:07 +02:00

23 lines
876 B
Ruby

class Checkstyle < Formula
desc "Check Java source against a coding standard"
homepage "https://checkstyle.sourceforge.io/"
url "https://github.com/checkstyle/checkstyle/releases/download/checkstyle-8.19/checkstyle-8.19-all.jar"
sha256 "d35bd180c22a8304be1c8e7ab44832300bda14da1bb70a1c29f8c5946424fd80"
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 = Utils.popen_read("#{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, $CHILD_STATUS.exitstatus
end
end