29 lines
767 B
Ruby
29 lines
767 B
Ruby
class Phpmd < Formula
|
|
desc "PHP Mess Detector"
|
|
homepage "https://phpmd.org"
|
|
url "https://github.com/phpmd/phpmd/releases/download/2.9.0/phpmd.phar"
|
|
sha256 "891bdd366577554ff21208317ce82688bd595586cbdaaa1360e231da6c35568e"
|
|
license "BSD-3-Clause"
|
|
|
|
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
|