codeclimate / codeclimate-phpcodesniffer

Code Climate Engine for PHP Code Sniffer
MIT License
28 stars 23 forks source link
code-quality codeclimate codeclimate-engine hacktoberfest metrics php php-codesniffer quality static-analysis static-code-analysis

Code Climate PHP_CodeSniffer Engine

Code Climate

codeclimate-phpcodesniffer is a Code Climate engine that wraps the PHP_Code Sniffer static analysis tool. You can run it on your command line using the Code Climate CLI, or on our hosted analysis platform.

PHP_CodeSniffer helps you detect violations of a defined coding standard.

Installation

  1. If you haven't already, install the Code Climate CLI.
  2. Run codeclimate engines:enable phpcodesniffer. This command both installs the engine and enables it in your .codeclimate.yml file.
  3. You're ready to analyze! Browse into your project's folder and run codeclimate analyze.

Config Options

Format the values for these config options per the PHP_CodeSniffer documentation.

Sample Config

exclude_paths:
 - "/examples/**/*"
engines:
  phpcodesniffer:
    enabled: true
    config:
      file_extensions: "php,inc,lib"
      standard: "PSR1,PSR2,my_custom_php_ruleset.xml"
      ignore_warnings: true
      encoding: utf-8
ratings:
  paths:
  - "**.php"

Supported Coding Standards

In addition to standards provided by default with PHP_CodeSniffer, the Drupal, WordPress, Yii2, and Magento Extension coding standards are supported. Here is the full list:

Need help?

For help with PHP_CodeSniffer, check out their documentation.

If you're running into a Code Climate issue, first look over this project's GitHub Issues, as your question may have already been covered. If not, go ahead and open a support ticket with us.