From b1afb2fc4dcc58b418e65da893b69601144e7b0b Mon Sep 17 00:00:00 2001 From: e3betht Date: Mon, 22 Jun 2015 11:19:31 -0500 Subject: [PATCH 1/5] Updating the readme with the custom config info and updating the yml file to include an example of the custom configurations --- .codeclimate.yml | 7 +++++-- README.md | 26 +++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 4a7e0a1..95592ca 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,6 +1,9 @@ exclude_paths: - - "/lib/testing.php" - - "/vendor/" + - "/examples/*" engines: phpcodesniffer: enabled: true + config: + - custom_exclude_paths: "*/test.php","/vendor/" + - file_extensions: "php,inc,lib" + - 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). From 1c7b577ac9bf58838f326fc2aa75ee9289a7cb18 Mon Sep 17 00:00:00 2001 From: e3betht Date: Mon, 22 Jun 2015 14:31:02 -0500 Subject: [PATCH 2/5] Adjusting remediation values --- engine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine.php b/engine.php index aac58ad..64e3e02 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'] * 50000 ); $iterations++; From 12c57de3e2cb170761826223aeb7a02c1f2ba4b7 Mon Sep 17 00:00:00 2001 From: e3betht Date: Mon, 22 Jun 2015 14:56:55 -0500 Subject: [PATCH 3/5] adjusting redmediation values after discussion --- engine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine.php b/engine.php index 64e3e02..4e71a62 100644 --- a/engine.php +++ b/engine.php @@ -58,7 +58,7 @@ 'end' => $phpcs_issue_data['line'] ) ), - 'remediation_points' => $phpcs_issue_data['severity'] * 50000 + 'remediation_points' => $phpcs_issue_data['severity'] * 1.5 * 50000 ); $iterations++; From 417fb35206543eafd196d7d7f04e970562f404f1 Mon Sep 17 00:00:00 2001 From: e3betht Date: Mon, 22 Jun 2015 15:15:24 -0500 Subject: [PATCH 4/5] Removing decimal from remediation calculation --- engine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine.php b/engine.php index 4e71a62..7670ab4 100644 --- a/engine.php +++ b/engine.php @@ -58,7 +58,7 @@ 'end' => $phpcs_issue_data['line'] ) ), - 'remediation_points' => $phpcs_issue_data['severity'] * 1.5 * 50000 + 'remediation_points' => $phpcs_issue_data['severity'] * 75000 ); $iterations++; From b0cd334c65a2acc94feb51b17484fa2b249ed1f9 Mon Sep 17 00:00:00 2001 From: e3betht Date: Mon, 22 Jun 2015 15:16:41 -0500 Subject: [PATCH 5/5] Updating yml file for engine-specific excludes --- .codeclimate.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 95592ca..f9b74e2 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,9 +1,8 @@ exclude_paths: - - "/examples/*" + - "/vendor/*" engines: phpcodesniffer: enabled: true config: - - custom_exclude_paths: "*/test.php","/vendor/" - - file_extensions: "php,inc,lib" + - file_extensions: "php" - standard: "PSR1","PSR2" \ No newline at end of file