1dde8bd392
Closes #48708. Signed-off-by: Rui Chen <chenrui333@gmail.com>
26 lines
736 B
Ruby
26 lines
736 B
Ruby
class Phpmd < Formula
|
|
desc "PHP Mess Detector"
|
|
homepage "https://phpmd.org"
|
|
url "https://github.com/phpmd/phpmd/releases/download/2.8.1/phpmd.phar"
|
|
sha256 "86b2f14553e23f9bf05e5231b366aab41357a72159c7f0f85c275dca5ce332e6"
|
|
|
|
bottle :unneeded
|
|
|
|
def install
|
|
bin.install "phpmd.phar" => "phpmd"
|
|
end
|
|
|
|
test do
|
|
(testpath/"src/HelloWorld/Greetings.php").write <<~EOS
|
|
<?php
|
|
namespace HelloWorld;
|
|
class Greetings {
|
|
public static function sayHelloWorld($name) {
|
|
return 'HelloHomebrew';
|
|
}
|
|
}
|
|
EOS
|
|
|
|
assert_match /Avoid unused parameters such as '\$name'\.$/, shell_output("#{bin}/phpmd --ignore-violations-on-exit src/HelloWorld/Greetings.php text unusedcode")
|
|
end
|
|
end
|