2019-11-20 14:29:36 +00:00
|
|
|
class Detekt < Formula
|
|
|
|
desc "Static code analysis for Kotlin"
|
2020-05-26 19:25:42 +00:00
|
|
|
homepage "https://github.com/detekt/detekt"
|
2020-10-20 12:16:56 +00:00
|
|
|
url "https://jcenter.bintray.com/io/gitlab/arturbosch/detekt/detekt-cli/1.14.2/detekt-cli-1.14.2-all.jar"
|
|
|
|
sha256 "04d3e959061c546af3cea9e08794621c03a6caf157f6847a31b4d13d55df961a"
|
2020-07-14 00:03:37 +00:00
|
|
|
license "Apache-2.0"
|
2019-11-20 14:29:36 +00:00
|
|
|
|
2020-08-28 15:36:02 +00:00
|
|
|
livecheck do
|
|
|
|
url :homepage
|
|
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
|
|
end
|
|
|
|
|
2019-12-17 22:37:31 +00:00
|
|
|
bottle :unneeded
|
2019-12-10 03:57:46 +00:00
|
|
|
|
2020-02-04 10:56:01 +00:00
|
|
|
depends_on "openjdk"
|
2019-11-20 14:29:36 +00:00
|
|
|
|
|
|
|
def install
|
2019-11-26 23:02:27 +00:00
|
|
|
libexec.install "detekt-cli-#{version}-all.jar"
|
2020-08-05 14:51:02 +00:00
|
|
|
bin.write_jar_script libexec/"detekt-cli-#{version}-all.jar", "detekt"
|
2019-11-20 14:29:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2020-08-13 23:34:11 +00:00
|
|
|
# generate default config for testing
|
|
|
|
system bin/"detekt", "--generate-config"
|
|
|
|
assert_match "empty-blocks:", File.read(testpath/"detekt.yml")
|
|
|
|
|
2019-11-26 14:22:37 +00:00
|
|
|
(testpath/"input.kt").write <<~EOS
|
|
|
|
fun main() {
|
|
|
|
|
|
|
|
}
|
|
|
|
EOS
|
2020-08-13 23:34:11 +00:00
|
|
|
shell_output("#{bin}/detekt --input input.kt --report txt:output.txt --config #{testpath}/detekt.yml", 2)
|
2019-11-26 14:22:37 +00:00
|
|
|
assert_equal "EmptyFunctionBlock", shell_output("cat output.txt").slice(/\w+/)
|
2019-11-20 14:29:36 +00:00
|
|
|
end
|
|
|
|
end
|