sideci.ymlファイルをレポジトリのルートディレクトリに配置頂くことで、SideCIの自動コードレビュー機能の設定を行うことが出来ます。 各機能のオン・オフはSideCIの画面上から行えます。また、各機能はカスタマイズなどはそれぞれの機能に準じます。 各機能がサポートしていないカスタマイズ・設定などについてのみ、sideci.ymlファイルで設定することが可能です。
sideci.ymlファイルをサポートしているのは以下の2つの機能です。
- PHP_CodeSniffer
- PHP Mess Detector
レポジトリのルートディレクトリにsideci.ymlを作成、編集、保存、gitの管理下に追加して下さい。
Example: sideci.yml
$ cd /your/project/dir/path
$ touch sideci.yml
$ git add sideci.yml
$ vi sideci.yml
$ git commit -am "add sideci.yml"
自動コードレビューに関する設定についてはlinterと記載し、その後、各機能名(ツール名)、options、指定したいオプションを指定して下さい。 オプションは本ドキュメントに記載のあるドキュメント以外は設定出来ません。 記載されていない設定したいオプションがある場合はご連絡下さい。
複数の機能について設定する場合には、以下のExampleのように記載して下さい。
Example:sideci.yml
linter:
code_sniffer:
options:
standard: PSR2
phpmd:
options:
rules: codesize,naming,custom_rule.xml
PHP_CodeSniffer standardにて基本コーディング規約の指定が行えます。下記の様に記載して下さい。
Example: sideci.yml
linter:
code_sniffer:
options:
standard: PSR2
インストールされている指定可能な基本コーディング規約は以下のとおりです。 $ phpcs -i The installed coding standards are FuelPHP, Symfony, CodeIgniter, CakePHP, PSR2, PEAR, MySource, Zend, PSR1, Squiz and PHPCS
PHPMD - PHP Mess Detector ruleにてruleの選択が可能です。下記の様に記載して下さい。
linter:
phpmd:
options:
rule: codesize
選択可能なruleは以下のとおりです。
cleancode,codesize,controversial,design,naming,unusedcode
各ruleの詳細やカスタマイズは下記を御覧ください。
PHPMD - PHP Mess Detector: Documentation#Rules