From 15221b2dd7c919db96ac1e964f7ecc93cafa59dd Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 16 Nov 2023 12:43:27 +1300 Subject: [PATCH 1/4] =?UTF-8?q?=E2=9C=A8=20Add=20report=20generation=20scr?= =?UTF-8?q?ipts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bespoke-phpcs-report-source | 23 +++++++++++++++++++++++ bespoke-phpcs-report-summary | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 bespoke-phpcs-report-source create mode 100755 bespoke-phpcs-report-summary diff --git a/bespoke-phpcs-report-source b/bespoke-phpcs-report-source new file mode 100755 index 0000000..811e147 --- /dev/null +++ b/bespoke-phpcs-report-source @@ -0,0 +1,23 @@ +#!/usr/bin/env php + 1) { + echo "⚠️ Sorry. You passed an extra parameter, this is currently not supported." . PHP_EOL; + die; +} + +// source +$_SERVER['argv'][] = '--report=source'; + +$_SERVER['argv'][] = 'app'; // scan app folder + +// Use rules defined in project root or by default what defined in bespoke standards +if (file_exists(__DIR__ . '/../../../phpcs.xml')) { + $_SERVER['argv'][] = '--standard=phpcs.xml'; +} else { + $_SERVER['argv'][] = '--standard=' . __DIR__ . '/ruleset.xml'; // rules +} +$_SERVER['argv'][] = '--extensions=php'; // only php files +$_SERVER['argv'][] = '--encoding=utf-8'; + +include __DIR__ . '/../../bin/phpcs'; diff --git a/bespoke-phpcs-report-summary b/bespoke-phpcs-report-summary new file mode 100755 index 0000000..38959f7 --- /dev/null +++ b/bespoke-phpcs-report-summary @@ -0,0 +1,23 @@ +#!/usr/bin/env php + 1) { + echo "⚠️ Sorry. You passed an extra parameter, this is currently not supported." . PHP_EOL; + die; +} + +// Summary +$_SERVER['argv'][] = '--report=summary'; + +$_SERVER['argv'][] = 'app'; // scan app folder + +// Use rules defined in project root or by default what defined in bespoke standards +if (file_exists(__DIR__ . '/../../../phpcs.xml')) { + $_SERVER['argv'][] = '--standard=phpcs.xml'; +} else { + $_SERVER['argv'][] = '--standard=' . __DIR__ . '/ruleset.xml'; // rules +} +$_SERVER['argv'][] = '--extensions=php'; // only php files +$_SERVER['argv'][] = '--encoding=utf-8'; + +include __DIR__ . '/../../bin/phpcs'; From 4bd1e3ceafde2f3c985f39fb83e4e53e4040eff1 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 16 Nov 2023 13:55:41 +1300 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=A7=20Adjust=20where=20sniff=20cod?= =?UTF-8?q?es=20are=20shown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some reports a easier to read without `-s` being forced in, shift this to be where it needs to be --- bespoke-phpcs | 1 + ruleset.xml | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bespoke-phpcs b/bespoke-phpcs index d6e0a4a..b5323cb 100755 --- a/bespoke-phpcs +++ b/bespoke-phpcs @@ -6,6 +6,7 @@ if (count($_SERVER['argv']) >1) { die; } +$_SERVER['argv'][] = '-s'; // Include sniff codes $_SERVER['argv'][] = 'app'; // scan app folder // Use rules defined in project root or by default what defined in bespoke standards diff --git a/ruleset.xml b/ruleset.xml index fffbe9e..198ca7e 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -6,10 +6,9 @@ ./vendor/* */thirdparty/* - + - From 278fd2b1bff478f8d003725608ac53fded061baa Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 16 Nov 2023 14:09:36 +1300 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=94=A7=20Ensure=20new=20scripts=20pas?= =?UTF-8?q?s=20through=20and=20are=20visible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/composer.json b/composer.json index 1ba4511..9381e08 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,8 @@ "bin": [ "bespoke-phpcbf", "bespoke-phpcs", + "bespoke-phpcs-report-source", + "bespoke-phpcs-report-summary", "bespoke-phplint" ], "require": { From 37563f3208669852ec6d16eff013c94337926c5f Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 16 Nov 2023 14:41:54 +1300 Subject: [PATCH 4/4] =?UTF-8?q?=20=F0=9F=9A=B8=20Inform=20when=20you've=20?= =?UTF-8?q?passed=20stuff=20we=20dont=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bespoke-phpcs-report-source | 2 +- bespoke-phpcs-report-summary | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bespoke-phpcs-report-source b/bespoke-phpcs-report-source index 811e147..a722de2 100755 --- a/bespoke-phpcs-report-source +++ b/bespoke-phpcs-report-source @@ -2,7 +2,7 @@ 1) { - echo "⚠️ Sorry. You passed an extra parameter, this is currently not supported." . PHP_EOL; + echo "⚠️ Sorry. Parameters are currently not supported." . PHP_EOL; die; } diff --git a/bespoke-phpcs-report-summary b/bespoke-phpcs-report-summary index 38959f7..8f9a6db 100755 --- a/bespoke-phpcs-report-summary +++ b/bespoke-phpcs-report-summary @@ -2,7 +2,7 @@ 1) { - echo "⚠️ Sorry. You passed an extra parameter, this is currently not supported." . PHP_EOL; + echo "⚠️ Sorry. Parameters are currently not supported." . PHP_EOL; die; }