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.7.tar.gz"
sha256 "dc835232a6abc04df9222ddcb543b8602ac102dc670f12f8b8bd2bffa97b7454"
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: "13ed1ca9ce51b92754de2838f8369a4dff03bc0930cd7e35f3ede429d2a70bec"
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