82fb72283a
Closes #32279. Signed-off-by: Chongyu Zhu <i@lembacon.com>
38 lines
1 KiB
Ruby
38 lines
1 KiB
Ruby
class Pmd < Formula
|
|
desc "Source code analyzer for Java, JavaScript, and more"
|
|
homepage "https://pmd.github.io"
|
|
url "https://github.com/pmd/pmd/releases/download/pmd_releases/6.7.0/pmd-bin-6.7.0.zip"
|
|
sha256 "276ecb3bc9e8d4665cb3d5fe2a3aff7856b517edda069f80d73189eefe7a6070"
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on :java => "1.8+"
|
|
|
|
def install
|
|
rm Dir["bin/*.bat"]
|
|
libexec.install Dir["*"]
|
|
(bin/"pmd").write_env_script libexec/"bin/run.sh",
|
|
Language::Java.java_home_env("1.8+")
|
|
end
|
|
|
|
def caveats; <<~EOS
|
|
Run with `pmd` (instead of `run.sh` as described in the documentation).
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"java/testClass.java").write <<~EOS
|
|
public class BrewTestClass {
|
|
// dummy constant
|
|
public String SOME_CONST = "foo";
|
|
|
|
public boolean doTest () {
|
|
return true;
|
|
}
|
|
}
|
|
EOS
|
|
|
|
system "#{bin}/pmd", "pmd", "-d", "#{testpath}/java", "-R",
|
|
"rulesets/java/basic.xml", "-f", "textcolor", "-l", "java"
|
|
end
|
|
end
|