05498383d5
Closes #6432. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
23 lines
839 B
Ruby
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.2/checkstyle-7.2-all.jar"
|
|
sha256 "f842f1170ee5b31adafedb7e6590518d01f788d673b804f0e2f37ff91e854c96"
|
|
|
|
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
|