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.12.0/phpmd.phar"
sha256 "efd26128699b59bbec1e902414c1c82b2dbbdbaedd94d3c20b6323b5c85e48e8"
license "BSD-3-Clause"
bottle do
sha256 cellar: :any_skip_relocation, all: "dbdb27064206ac5c34d7cfa5f4275bc11a8969613b9998ecb8ce47d66e299bc9"
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