Skip to content

Commit

Permalink
Merge pull request #33 from Automattic/feature/jetpack-cs
Browse files Browse the repository at this point in the history
Updates plugin to use Jetpack coding standards
  • Loading branch information
tommusrhodus authored Nov 12, 2024
2 parents f11631c + c4f4b68 commit e257fc0
Show file tree
Hide file tree
Showing 8 changed files with 288 additions and 125 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/php-syntax-errors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,3 @@ jobs:
- name: Check all files for syntax errors
if: ${{ matrix.php >= 8.2 }} # At least the minimum PHP version required by the plugin.
run: find -L $GITHUB_WORKSPACE -path $GITHUB_WORKSPACE/vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l

- name: Check bootstrap files for syntax errors
if: ${{ matrix.php <= 8.1 }}
run: find $GITHUB_WORKSPACE -maxdepth 1 -name 'team51-plugin-scaffold.php' -print0 | xargs -0 -n 1 -P 4 php -l
17 changes: 13 additions & 4 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0"?>
<ruleset name="team51-plugin-scaffold" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>Custom ruleset for the Team51 plugin.</description>
<ruleset name="t3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<config name="minimum_supported_wp_version" value="6.3" />
<config name="testVersion" value="7.0-"/>

<!-- Extend the A8CTeam51 ruleset. -->
<rule ref="./vendor/a8cteam51/team51-configs/quality-tools/phpcs.xml.dist"/>
<rule ref="Jetpack" />
<rule ref="Jetpack-Compat-82" />

<!-- Exclude class filename check -->
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
Expand All @@ -22,6 +23,14 @@
</properties>
</rule>

<rule ref="Jetpack.Functions.I18n">
<properties>
<property name="text_domain" type="array">
<element value="tumblr3"/>
</property>
</properties>
</rule>

<!-- Check that the proper prefix is used everywhere. -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
Expand Down
5 changes: 4 additions & 1 deletion assets/js/build/editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins'), 'version' => '4eb3efbc3546d4a3ffa6');
<?php return array(
'dependencies' => array( 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins' ),
'version' => '4eb3efbc3546d4a3ffa6',
);
5 changes: 4 additions & 1 deletion assets/js/build/theme-garden.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<?php return array('dependencies' => array(), 'version' => 'bee837eb4a53a080e012');
<?php return array(
'dependencies' => array(),
'version' => 'bee837eb4a53a080e012',
);
5 changes: 4 additions & 1 deletion assets/js/build/theme-install.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<?php return array('dependencies' => array(), 'version' => '3145422ea2aa5e4a5ad2');
<?php return array(
'dependencies' => array(),
'version' => '3145422ea2aa5e4a5ad2',
);
16 changes: 4 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,16 @@
"homepage": "https://cupcakelabs.wordpress.com/"
}
],
"repositories": [
{
"type": "vcs",
"url": "https://github.com/a8cteam51/team51-configs"
}
],
"require": {
"php": ">=7.3",
"ext-json": "*"
},
"require-dev": {
"a8cteam51/team51-configs": "dev-trunk",
"wp-coding-standards/wpcs": "^3",
"phpcompatibility/phpcompatibility-wp": "*",
"roave/security-advisories": "dev-latest",
"phpunit/phpunit": "^8",
"yoast/phpunit-polyfills": "^3.0",
"wp-cli/wp-cli-bundle": "^2.11"
"wp-cli/wp-cli-bundle": "^2.11",
"automattic/jetpack-codesniffer": "^4.0"
},
"autoload": {
"psr-4": {
Expand All @@ -39,8 +31,8 @@
"wp": "vendor/bin/wp",
"phpunit": "vendor/bin/phpunit",
"generate-autoloader": "@composer dump-autoload -o",
"format:php": "phpcbf --standard=./.phpcs.xml --basepath=. . -v",
"lint:php": "phpcs --standard=./.phpcs.xml --basepath=. . -v",
"format:php": "phpcbf --standard=./.phpcs.xml --basepath=. --extensions=php . -v",
"lint:php": "phpcs --standard=./.phpcs.xml --basepath=. --extensions=php . -v",
"internationalize": [
"@makepot",
"@updatepo",
Expand Down
Loading

0 comments on commit e257fc0

Please sign in to comment.