homebrew-core/Formula/checkstyle.rb
Rui Chen 086f9a9b5d checkstyle 8.28
Closes #48381.

Signed-off-by: Alexander Bayandin <a.bayandin@gmail.com>
2019-12-30 14:54:33 +00: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.28/checkstyle-8.28-all.jar"
sha256 "356cf0406ec758ccf9a14b334ab061f11e269033c0f41d18f1c3dd758dd49204"
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