Skip to content

Commit 626210a

Browse files
authored
add phpcs check with Magento Coding Standard to CI (#341)
* add phpcs check with Magento Coding Standard to CI * escape values in phtml template
1 parent 07cd567 commit 626210a

File tree

6 files changed

+642
-3
lines changed

6 files changed

+642
-3
lines changed

.changelogger.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ versioned_files:
55
- rel_path: composer.dev.json
66
pattern: '"version": "{{ old_version }}",'
77
jinja: '"version": "{{ new_version }}",'
8+
- rel_path: composer.magento-coding-standard.dev.json
9+
pattern: '"version": "{{ old_version }}",'
10+
jinja: '"version": "{{ new_version }}",'
811
- rel_path: etc/module.xml
912
pattern: 'name="Klaviyo_Reclaim" setup_version="{{ old_version }}" schema_version="{{ old_version }}"'
1013
jinja: 'name="Klaviyo_Reclaim" setup_version="{{ new_version }}" schema_version="{{ new_version }}"'

.github/workflows/continuous_integration.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,15 @@ jobs:
3838
run: pip install changelogged==0.11.3
3939
- name: Validate Changelog
4040
run: changelogger check --fail
41+
magento-coding-standard:
42+
runs-on: ubuntu-latest
43+
env:
44+
COMPOSER: composer.magento-coding-standard.dev.json
45+
steps:
46+
- uses: actions/checkout@v3
47+
- name: Install dependencies
48+
uses: php-actions/composer@v6
49+
with:
50+
dev: yes
51+
- name: Run Magento Coding Standard via PHPCS
52+
run: vendor/bin/phpcs --standard=Magento2 --ignore="*/vendor/*,*/Test/*" --severity=10 .
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "klaviyo/magento2-extension-coding-standard-dev",
3+
"description": "The development composer file for coding standard.",
4+
"type": "magento2-module",
5+
"version": "4.4.0",
6+
"config": {
7+
"allow-plugins": {
8+
"dealerdirect/phpcodesniffer-composer-installer": true
9+
}
10+
},
11+
"require-dev": {
12+
"magento/magento-coding-standard": "38"
13+
},
14+
"scripts": {
15+
"post-install-cmd": [
16+
"([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/,../../magento/php-compatibility-fork/)"
17+
],
18+
"post-update-cmd": [
19+
"([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/,../../magento/php-compatibility-fork/)"
20+
]
21+
}
22+
}

0 commit comments

Comments
 (0)