Skip to content

Instantly share code, notes, and snippets.

@cynipe
Created June 11, 2015 10:09
Show Gist options
  • Save cynipe/08e9705eceb28ee67ba9 to your computer and use it in GitHub Desktop.
Save cynipe/08e9705eceb28ee67ba9 to your computer and use it in GitHub Desktop.
sideciのドキュメントを読みやすくしたった

sideci.ymlファイルをレポジトリのルートディレクトリに配置頂くことで、SideCIの自動コードレビュー機能の設定を行うことが出来ます。 各機能のオン・オフはSideCIの画面上から行えます。また、各機能はカスタマイズなどはそれぞれの機能に準じます。 各機能がサポートしていないカスタマイズ・設定などについてのみ、sideci.ymlファイルで設定することが可能です。

sideci.ymlファイルをサポートしているのは以下の2つの機能です。

  • PHP_CodeSniffer
  • PHP Mess Detector

sideci.ymlの作成

レポジトリのルートディレクトリに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"

sideci.ymlの書き方

自動コードレビューに関する設定についてはlinterと記載し、その後、各機能名(ツール名)、options、指定したいオプションを指定して下さい。 オプションは本ドキュメントに記載のあるドキュメント以外は設定出来ません。 記載されていない設定したいオプションがある場合はご連絡下さい。

Example

複数の機能について設定する場合には、以下の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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment