The content of this page is no longer updated as of July 2017. Visit https://docs.sideci.com for up to date documentation.

Configuration with `sideci.yml`

Last Updated July 25, 2017

By placing the sideci.yml file in the root directory of the repository, you will be able to setup the automated code review functionality of SideCI. Each function can be turned on and off from the SideCI screen. Moreover, each function conforms with the respective customizations. You can specify the customizations or settings that are not supported by each function in the sideci.yml file.

The sideci.yml file is supported by following that.

  • Rubocop
  • Rails Best Practices

  • PHP_CodeSniffer

  • PHP Mess Detector

  • HAML-Lint

  • Flake8

  • JSHint

  • ESLint

  • Coffeelint

  • TSLint

  • SCSS-Lint

  • stylelint

  • SwiftLint

Create the sideci.yml file

Create, modify and save the sideci.yml file in the root directory of the repository and add this under the git management.

$ cd /your/project/dir/path
$ touch sideci.yml
$ git add sideci.yml
$ vi sideci.yml
$ git commit -am "add sideci.yml"

Writing the sideci.yml file

To set the automated code review, indicate linter and specify the respective function name(tool name), options and the options to specify. Options cannot be setup for documents which are not indicated in this document. Kindly let us know if there are options which are not described in the document but you would like to set.

Example

For multiple function setup, kindly indicate them as shown below.

linter:
  code_sniffer:
    options:
      standard: PSR2
      dir: app/
  phpmd:
    options:
      rule: codesize,naming,custom_rule.xml

Rubocop

You can specify the .rubocop.yml path.

linter:
  rubocop:
    options:
      config: 'lint_config/.rubocop.yml'

Rails Best Practices

You can specify the content that can be specified as an execution parameter in rails_best_practices gem via the sideci.yml file.
Please indicate it in the sideci.yml as shown below.

linter:
  rails_best_practices:
    options:
      vendor: true
      spec: true
      test: true
      features: true
      exclude: 'foo,bar'
      only: 'hoge,fuga'

Options from vendor to features will be available upon setting these to true.
The option will not be available if it is not indicated in the sideci.yml file.

exclude and only will pass a value to the respective options. Moreover, the short command options -x,-o are not supported.

Kindly check the following for more details on the execution parameters.
rails_best_practices#Other command-line options

PHP_CodeSniffer

You can set the basic coding standard and the target directory in the sideci.yml file.
Since General frameworks have auto recognition, you don’t need to describe sideci.yml file.
The following frameworks specify coding standards and target directory by automatically.

- CakePHP
  + standard: CakePHP
  + dir: app/
- FuelPHP
  + standard: FuelPHP
  + dir: fuel/
- CodeIgniter
  + standard: CodeIgniter
  + dir: application/
- Symfony
  + standard: Symfony2
  + dir: app/

You can specify basic coding rules via standard. Please indicate as shown below.

linter:
  code_sniffer:
    options:
      standard: PSR2

The basic coding rules that can be specified are as follows.

$ phpcs -i
The installed coding standards are FuelPHP, Symfony2, CodeIgniter, CakePHP, PEAR, Zend, Squiz, PSR2, PHPCS, PSR1, MySource, WordPress-Docs, WordPress-Extra, WordPress-VIP, WordPress and WordPress-Core

When SideCI is executing PHP_CodeSniffer, at the time of executing phpcs command, the current directory will be the top of the repository.

You can specify a custom rule following the standard: /path/to/MyStandard format.

linter:
  code_sniffer:
    options:
      standard: phpcs.xml

You can specify the target directory to be checked via dir and, default encoding via encoding.

linter:
  code_sniffer:
    options:
      dir: app/
      encoding: utf-8

We have prepared an example repository that has above rules sideci_php_sandbox branch:test/phpcs_custom_ruleset . Kindly use this as a reference if needed.

PHPMD - PHP Mess Detector

You can select rules via rule. Please indicate as shown below.

linter:
  phpmd:
    options:
      rule: codesize

Followings are available rules.

cleancode,codesize,controversial,design,naming,unusedcode

Moreover, you can also specify a customized ruleset. You can specify it as shown below.

linter:
  phpmd:
    options:
      rule: ruleset.xml

Kindly check the following for the details and customization of each rule.
PHPMD - PHP Mess Detector: Documentation#Rules

We have prepared an example repository that has above rules sideci_php_sandbox branch:test/phpmd_custom_rules. Kindly use this as a reference if needed.

HAML-Lint

You can specify the contents that can be specified in the haml-lint execution parameters via the sideci.yml file.
Please indicate it in the sideci.yml as shown below.

linter:
  haml_lint:
    options:
      include_linter:
        - TagName
        - EmptyScript
        - LineLength
        - MultilinePipe
      exclude_linter:
        - TagName
      config: 'my-haml-lint-conf.yml'
      file: '**/*haml'
      exclude:
        - 'app/views/layouts/application.html.haml'

include_linter, exclude_linter, exclude will specify an Array. The specified Array will be passed to the parameter as a comma separated string.
config, file will specify a string.

Moreover, file will not be available as --file option, but it will be passed as a parameter for haml-lint when executed.
The option will not be available if it is not indicated in the be sideci.yml file.

Please check the following for more details on the execution parameters.
HAML-Lint#Command Line Flags

Flake8

You can specify the python's version via the sideci.yml file.
When you want to use Python2, please indicate as shown below.

flake8:
  version: 2

JSHint

You can specify the .jshintrc path.

linter:
  jshint:
    options:
      config: 'lint_yml/.jshintrc'

ESLint

You can specify the contents that can be specified in the ESlint execution parameters via the sideci.yml file.

linter:
  eslint:
    npm_install: true
    options:
      config: 'lint_yml/.eslintrc'
      ext: 'js,jsx,es6'
      ignore-path: .gitignore
      no-ignore: application.js
      ignore-pattern: /src/vendor/*
      global: require,exports:true welcome.js

You need to write npm_install: true in sideci.yml because SideCI requires this option in invoking eslint for projects with package.json included.

Coffeelint

You can specify the coffeelint.json path.

linter:
  coffeelint:
    options:
      config: 'lint_yml/coffeelint.json'

SCSS-Lint

You can specify your settings file.

linter:
  scss_lint:
    options:
      config: 'myscsslint.yml'

TSLint

You can specify the tslint.json path.

linter:
  tslint:
    options:
      config: 'lint_yml/tslint.json'

stylelint

You can specify the contents that can be specified in the stylelint execution parameters via the sideci.yml file.

linter:
  stylelint:
    options:
      config: ''
      ignore-path: ''
      syntax: ''
      ignore-disables: ''
      quiet: ''
      report-needless-disables: ''
      glob: '**/*.{css,less,scss,sss}'

SwiftLint

You can specify the contents that can be specified in the swiftlint execution parameters via the sideci.yml file.

linter:
  swiftlint:
    options:
      path: ''
      config: ''
      lenient: ''
      enable-all-rules: ''

Configuration with `sideci.yml`

Last Updated July 25, 2017

By placing the sideci.yml file in the root directory of the repository, you will be able to setup the automated code review functionality of SideCI. Each function can be turned on and off from the SideCI screen. Moreover, each function conforms with the respective customizations. You can specify the customizations or settings that are not supported by each function in the sideci.yml file.

The sideci.yml file is supported by following that.

  • Rubocop
  • Rails Best Practices

  • PHP_CodeSniffer

  • PHP Mess Detector

  • HAML-Lint

  • Flake8

  • JSHint

  • ESLint

  • Coffeelint

  • TSLint

  • SCSS-Lint

  • stylelint

  • SwiftLint

Create the sideci.yml file

Create, modify and save the sideci.yml file in the root directory of the repository and add this under the git management.

$ cd /your/project/dir/path
$ touch sideci.yml
$ git add sideci.yml
$ vi sideci.yml
$ git commit -am "add sideci.yml"

Writing the sideci.yml file

To set the automated code review, indicate linter and specify the respective function name(tool name), options and the options to specify. Options cannot be setup for documents which are not indicated in this document. Kindly let us know if there are options which are not described in the document but you would like to set.

Example

For multiple function setup, kindly indicate them as shown below.

linter:
  code_sniffer:
    options:
      standard: PSR2
      dir: app/
  phpmd:
    options:
      rule: codesize,naming,custom_rule.xml

Rubocop

You can specify the .rubocop.yml path.

linter:
  rubocop:
    options:
      config: 'lint_config/.rubocop.yml'

Rails Best Practices

You can specify the content that can be specified as an execution parameter in rails_best_practices gem via the sideci.yml file.
Please indicate it in the sideci.yml as shown below.

linter:
  rails_best_practices:
    options:
      vendor: true
      spec: true
      test: true
      features: true
      exclude: 'foo,bar'
      only: 'hoge,fuga'

Options from vendor to features will be available upon setting these to true.
The option will not be available if it is not indicated in the sideci.yml file.

exclude and only will pass a value to the respective options. Moreover, the short command options -x,-o are not supported.

Kindly check the following for more details on the execution parameters.
rails_best_practices#Other command-line options

PHP_CodeSniffer

You can set the basic coding standard and the target directory in the sideci.yml file.
Since General frameworks have auto recognition, you don’t need to describe sideci.yml file.
The following frameworks specify coding standards and target directory by automatically.

- CakePHP
  + standard: CakePHP
  + dir: app/
- FuelPHP
  + standard: FuelPHP
  + dir: fuel/
- CodeIgniter
  + standard: CodeIgniter
  + dir: application/
- Symfony
  + standard: Symfony2
  + dir: app/

You can specify basic coding rules via standard. Please indicate as shown below.

linter:
  code_sniffer:
    options:
      standard: PSR2

The basic coding rules that can be specified are as follows.

$ phpcs -i
The installed coding standards are FuelPHP, Symfony2, CodeIgniter, CakePHP, PEAR, Zend, Squiz, PSR2, PHPCS, PSR1, MySource, WordPress-Docs, WordPress-Extra, WordPress-VIP, WordPress and WordPress-Core

When SideCI is executing PHP_CodeSniffer, at the time of executing phpcs command, the current directory will be the top of the repository.

You can specify a custom rule following the standard: /path/to/MyStandard format.

linter:
  code_sniffer:
    options:
      standard: phpcs.xml

You can specify the target directory to be checked via dir and, default encoding via encoding.

linter:
  code_sniffer:
    options:
      dir: app/
      encoding: utf-8

We have prepared an example repository that has above rules sideci_php_sandbox branch:test/phpcs_custom_ruleset . Kindly use this as a reference if needed.

PHPMD - PHP Mess Detector

You can select rules via rule. Please indicate as shown below.

linter:
  phpmd:
    options:
      rule: codesize

Followings are available rules.

cleancode,codesize,controversial,design,naming,unusedcode

Moreover, you can also specify a customized ruleset. You can specify it as shown below.

linter:
  phpmd:
    options:
      rule: ruleset.xml

Kindly check the following for the details and customization of each rule.
PHPMD - PHP Mess Detector: Documentation#Rules

We have prepared an example repository that has above rules sideci_php_sandbox branch:test/phpmd_custom_rules. Kindly use this as a reference if needed.

HAML-Lint

You can specify the contents that can be specified in the haml-lint execution parameters via the sideci.yml file.
Please indicate it in the sideci.yml as shown below.

linter:
  haml_lint:
    options:
      include_linter:
        - TagName
        - EmptyScript
        - LineLength
        - MultilinePipe
      exclude_linter:
        - TagName
      config: 'my-haml-lint-conf.yml'
      file: '**/*haml'
      exclude:
        - 'app/views/layouts/application.html.haml'

include_linter, exclude_linter, exclude will specify an Array. The specified Array will be passed to the parameter as a comma separated string.
config, file will specify a string.

Moreover, file will not be available as --file option, but it will be passed as a parameter for haml-lint when executed.
The option will not be available if it is not indicated in the be sideci.yml file.

Please check the following for more details on the execution parameters.
HAML-Lint#Command Line Flags

Flake8

You can specify the python's version via the sideci.yml file.
When you want to use Python2, please indicate as shown below.

flake8:
  version: 2

JSHint

You can specify the .jshintrc path.

linter:
  jshint:
    options:
      config: 'lint_yml/.jshintrc'

ESLint

You can specify the contents that can be specified in the ESlint execution parameters via the sideci.yml file.

linter:
  eslint:
    npm_install: true
    options:
      config: 'lint_yml/.eslintrc'
      ext: 'js,jsx,es6'
      ignore-path: .gitignore
      no-ignore: application.js
      ignore-pattern: /src/vendor/*
      global: require,exports:true welcome.js

You need to write npm_install: true in sideci.yml because SideCI requires this option in invoking eslint for projects with package.json included.

Coffeelint

You can specify the coffeelint.json path.

linter:
  coffeelint:
    options:
      config: 'lint_yml/coffeelint.json'

SCSS-Lint

You can specify your settings file.

linter:
  scss_lint:
    options:
      config: 'myscsslint.yml'

TSLint

You can specify the tslint.json path.

linter:
  tslint:
    options:
      config: 'lint_yml/tslint.json'

stylelint

You can specify the contents that can be specified in the stylelint execution parameters via the sideci.yml file.

linter:
  stylelint:
    options:
      config: ''
      ignore-path: ''
      syntax: ''
      ignore-disables: ''
      quiet: ''
      report-needless-disables: ''
      glob: '**/*.{css,less,scss,sss}'

SwiftLint

You can specify the contents that can be specified in the swiftlint execution parameters via the sideci.yml file.

linter:
  swiftlint:
    options:
      path: ''
      config: ''
      lenient: ''
      enable-all-rules: ''