homebrew-core/Formula/phpmd.rb

29 lines
764 B
Ruby

class Phpmd < Formula
desc "PHP Mess Detector"
homepage "https://phpmd.org"
url "https://github.com/phpmd/phpmd/releases/download/2.9.1/phpmd.phar"
sha256 "e3648204e9b010f44203acaed5d03e38a91d75d31dae7c7a1048e2614fbea564"
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