0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

PHP:phpmdを導入してコードの問題をチェックする

Posted at

役割; バグやバグの温床になるコードを検知する

  • バグの検知
  • 汚いコードの検知
  • 複雑なコードの検知
  • 使用していない引数や関数の検知

composer.jsonを編集(ない場合はPHP_CodeSnifferを参照)

require-devの欄を以下にする。先に入れていたPHP_CodeSnifferの指示の後ろに追記する。
元々のソースは当然公式から得た。

"require-dev": {
        "squizlabs/php_codesniffer": "3.*",
        "phpmd/phpmd" : "@stable"
    },

Composerを更新(アップデート)する

Composerをインストールしていない場合のコマンドは、

composer install

すでにComposerをインストールしている場合は、

composer update

注意点: phpmdが存在しないと表示される

公式でやり方を確認して一度やって見れば、特にComposerもインストールしてあればとても簡単だが、インストールが正常にされているかをコマンド等で確認すると、なぜか存在しないメッセージが表示される。
結論としては、インストールされており、正常に動作する。混乱しやすい部分があるので注意。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?