homebrew-core/Formula/wartremover.rb

40 lines
1.2 KiB
Ruby

class Wartremover < Formula
desc "Flexible Scala code linting tool"
homepage "https://github.com/wartremover/wartremover"
url "https://github.com/wartremover/wartremover/archive/v3.0.8.tar.gz"
sha256 "a1810bd0745691777b0924879da416d8cf41a47ebec5c2a3df4b20d7baa22cd8"
license "Apache-2.0"
head "https://github.com/wartremover/wartremover.git", branch: "master"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "ce999355586b005afe1804e1de9880e7e342f1edc68e677c4e65b9c70ca1727b"
end
depends_on "sbt" => :build
depends_on "openjdk"
def install
system "sbt", "-sbt-jar", Formula["sbt"].opt_libexec/"bin/sbt-launch.jar", "core/assembly"
libexec.install "wartremover-assembly.jar"
bin.write_jar_script libexec/"wartremover-assembly.jar", "wartremover"
end
test do
(testpath/"foo").write <<~EOS
object Foo {
def foo() {
var msg = "Hello World"
println(msg)
}
}
EOS
cmd = "#{bin}/wartremover -traverser org.wartremover.warts.Unsafe foo 2>&1"
assert_match "var is disabled", shell_output(cmd, 1)
end
end