2012-04-30 09:37:34 +00:00
|
|
|
class Checkstyle < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Check Java source against a coding standard"
|
2014-10-28 05:41:49 +00:00
|
|
|
homepage "http://checkstyle.sourceforge.net/"
|
2015-08-09 21:15:03 +00:00
|
|
|
url "https://downloads.sourceforge.net/project/checkstyle/checkstyle/6.9/checkstyle-6.9-all.jar"
|
|
|
|
sha256 "b97de32dd519744fe501dff90c1d8dc94c267c5fd5bc367be05dc1a693451502"
|
2012-04-30 09:37:34 +00:00
|
|
|
|
|
|
|
def install
|
2015-01-30 03:24:38 +00:00
|
|
|
libexec.install "checkstyle-#{version}-all.jar"
|
2013-08-12 23:47:38 +00:00
|
|
|
bin.write_jar_script libexec/"checkstyle-#{version}-all.jar", "checkstyle"
|
2012-04-30 09:37:34 +00:00
|
|
|
end
|
2014-02-15 19:15:34 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
path = testpath/"foo.java"
|
|
|
|
path.write "public class Foo{ }\n"
|
|
|
|
|
2015-02-25 20:57:07 +00:00
|
|
|
output = `#{bin}/checkstyle -c /sun_checks.xml #{path}`
|
2014-02-15 19:15:34 +00:00
|
|
|
errors = output.split("\n").select { |line| line.start_with?(path) }
|
2015-08-09 21:15:03 +00:00
|
|
|
assert_match "#{path}:1:17: '{' is not preceded with whitespace.", errors.join(" ")
|
2014-02-15 19:15:34 +00:00
|
|
|
assert_equal errors.size, $?.exitstatus
|
|
|
|
end
|
2012-04-30 09:37:34 +00:00
|
|
|
end
|