diff --git a/.codeclimate.yml b/.codeclimate.yml index 4a7e0a1..f9b74e2 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,6 +1,8 @@ exclude_paths: - - "/lib/testing.php" - - "/vendor/" + - "/vendor/*" engines: phpcodesniffer: enabled: true + config: + - file_extensions: "php" + - standard: "PSR1","PSR2" \ No newline at end of file diff --git a/README.md b/README.md index b6a179e..c27fabf 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Code Climate PHP Code Sniffer Engine +# Code Climate PHP_CodeSniffer Engine `codeclimate-phpcodesniffer` is a Code Climate engine that wraps the [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) static analysis tool. You can run it on your command line using the Code Climate CLI, or on our hosted analysis platform. -PHP Code Sniffer helps you detect violations of a defined coding standard. +PHP_CodeSniffer helps you detect violations of a defined coding standard. ### Installation @@ -10,8 +10,28 @@ PHP Code Sniffer helps you detect violations of a defined coding standard. 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](https://github.com/squizlabs/PHP_CodeSniffer). + +1. custom_exclude_paths - These are files that you want to exclude from the PHP_CodeSniffer analysis, but not from other Code Climate analyses. +2. file_extensions - This is where you can configure the file extensions for the files that you want PHP_CodeSniffer to analyze. +3. standard - This is the list of standards that you want PHP_CodeSniffer to use while analyzing your files. + +###Sample Config + + exclude_paths: + - "/examples/* + engines: + phpcodesniffer: + enabled: true + config: + - custom_exclude_paths: "*/test.php","/vendor/" + - file_extensions: "php,inc,lib" + - standard: "PSR1","PSR2" + ### Need help? -For help with PHP Code Sniffer, [check out their documentation](https://github.com/squizlabs/PHP_CodeSniffer). +For help with PHP_CodeSniffer, [check out their documentation](https://github.com/squizlabs/PHP_CodeSniffer). If you're running into a Code Climate issue, first look over this project's [GitHub Issues](https://github.com/squizlabs/PHP_CodeSniffer/issues), as your question may have already been covered. If not, [go ahead and open a support ticket with us](https://codeclimate.com/help). diff --git a/engine.php b/engine.php index aac58ad..7670ab4 100644 --- a/engine.php +++ b/engine.php @@ -58,7 +58,7 @@ 'end' => $phpcs_issue_data['line'] ) ), - 'remediation_points' => $phpcs_issue_data['severity'] * $phpcs_issue_data['severity'] * 100 + 'remediation_points' => $phpcs_issue_data['severity'] * 75000 ); $iterations++;