From acb56dd3875b08b14f41267f4c3a818297e642ed Mon Sep 17 00:00:00 2001 From: Allie Micka Date: Tue, 29 Oct 2024 18:01:19 -0500 Subject: [PATCH 1/5] [PGOV-300] Copy default phpcs.xml from Coder docs at https://github.com/pfrenssen/coder#store-settings-in-a-phpcsxmldist-file --- phpcs.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 phpcs.xml diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 00000000..f9028176 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,25 @@ + + + PHP CodeSniffer configuration for example development. + + . + + + + + + + + + + + + From 9ba58008db8cc48f1cd20afb68492d0a11ea7108 Mon Sep 17 00:00:00 2001 From: Allie Micka Date: Tue, 29 Oct 2024 18:11:37 -0500 Subject: [PATCH 2/5] [PGOV-300] Fix paths so the rulesets can be found by the phpcs command. --- phpcs.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpcs.xml b/phpcs.xml index f9028176..9a98d282 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -10,12 +10,12 @@ - + - + - . + PHP CodeSniffer configuration for development. + + web/modules/custom + + + From 8ec122269397f89b58e604cd1ad692f67c54035b Mon Sep 17 00:00:00 2001 From: Allie Micka Date: Thu, 31 Oct 2024 12:40:57 -0500 Subject: [PATCH 4/5] [PGOV-300] Add helper functions that allow developers to run 'ddev phpcs' and/or 'composer phpcs' --- .ddev/commands/web/phpcbf | 6 ++++++ .ddev/commands/web/phpcs | 6 ++++++ composer.json | 3 +++ 3 files changed, 15 insertions(+) create mode 100755 .ddev/commands/web/phpcbf create mode 100755 .ddev/commands/web/phpcs diff --git a/.ddev/commands/web/phpcbf b/.ddev/commands/web/phpcbf new file mode 100755 index 00000000..7ded5dcc --- /dev/null +++ b/.ddev/commands/web/phpcbf @@ -0,0 +1,6 @@ +#!/bin/bash + +# Run the PHP Code Fixer against the codebase. See phpcs.xml in the project +# root for configuration settings. + +phpcbf "$@" diff --git a/.ddev/commands/web/phpcs b/.ddev/commands/web/phpcs new file mode 100755 index 00000000..77fed6e6 --- /dev/null +++ b/.ddev/commands/web/phpcs @@ -0,0 +1,6 @@ +#!/bin/bash + +# Run the PHP Code Sniffer against the codebase. See phpcs.xml in the project +# root for configuration settings. + +phpcs "$@" diff --git a/composer.json b/composer.json index e367ef2a..32d2d4ad 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,9 @@ "url": "https://packages.drupal.org/8" } ], + "scripts": { + "phpcs": "phpcs --standard=phpcs.xml" + }, "require": { "composer/installers": "^2.0", "cweagans/composer-patches": "^1.7", From a15d5738ed9a3bceee384e6b7bc870c01105f805 Mon Sep 17 00:00:00 2001 From: Allie Micka Date: Tue, 29 Oct 2024 18:01:19 -0500 Subject: [PATCH 5/5] [PGOV-300] Ensure that local commands use the common phpcs configuration --- .ddev/commands/web/phpcbf | 2 +- .ddev/commands/web/phpcs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ddev/commands/web/phpcbf b/.ddev/commands/web/phpcbf index 7ded5dcc..89947353 100755 --- a/.ddev/commands/web/phpcbf +++ b/.ddev/commands/web/phpcbf @@ -3,4 +3,4 @@ # Run the PHP Code Fixer against the codebase. See phpcs.xml in the project # root for configuration settings. -phpcbf "$@" +phpcbf --standard=phpcs.xml "$@" diff --git a/.ddev/commands/web/phpcs b/.ddev/commands/web/phpcs index 77fed6e6..0af01b21 100755 --- a/.ddev/commands/web/phpcs +++ b/.ddev/commands/web/phpcs @@ -3,4 +3,4 @@ # Run the PHP Code Sniffer against the codebase. See phpcs.xml in the project # root for configuration settings. -phpcs "$@" +phpcs --standard=phpcs.xml "$@"