homebrew-core/Formula/phpmd.rb

33 lines
897 B
Ruby

class Phpmd < Formula
desc "PHP Mess Detector"
homepage "https://phpmd.org"
url "https://github.com/phpmd/phpmd/releases/download/2.13.0/phpmd.phar"
sha256 "2cd47ba93dca22121eabd58f757546b27bb3cd7378cdefe3b83329b7529efc0d"
license "BSD-3-Clause"
bottle do
sha256 cellar: :any_skip_relocation, all: "6dd2ce138c5191cb6d04b638ec16483bd642d67f21e9dd4b473417f909503f8c"
end
depends_on "php"
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