38 lines
1.1 KiB
Ruby
38 lines
1.1 KiB
Ruby
class Detekt < Formula
|
|
desc "Static code analysis for Kotlin"
|
|
homepage "https://github.com/detekt/detekt"
|
|
url "https://github.com/detekt/detekt/releases/download/v1.19.0/detekt-cli-1.19.0-all.jar"
|
|
sha256 "4bc545c95c3711daeedd7766a9884ac50f2a49a0b472cef2b14dae332c58294d"
|
|
license "Apache-2.0"
|
|
|
|
livecheck do
|
|
url :homepage
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "bbd9f04be63b4f3493ea4d95676ed905a22f6196abc6ecaa4ddc8aa0e6112eb9"
|
|
end
|
|
|
|
depends_on "openjdk@11"
|
|
|
|
def install
|
|
libexec.install "detekt-cli-#{version}-all.jar"
|
|
bin.write_jar_script libexec/"detekt-cli-#{version}-all.jar", "detekt", java_version: "11"
|
|
end
|
|
|
|
test do
|
|
# generate default config for testing
|
|
system bin/"detekt", "--generate-config"
|
|
assert_match "empty-blocks:", File.read(testpath/"detekt.yml")
|
|
|
|
(testpath/"input.kt").write <<~EOS
|
|
fun main() {
|
|
|
|
}
|
|
EOS
|
|
shell_output("#{bin}/detekt --input input.kt --report txt:output.txt --config #{testpath}/detekt.yml", 2)
|
|
assert_equal "EmptyFunctionBlock", shell_output("cat output.txt").slice(/\w+/)
|
|
end
|
|
end
|