Skip to content

Commit

Permalink
Coding standards fixes across entire plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tommusrhodus committed Nov 15, 2024
1 parent 7b2316b commit a27b3d7
Show file tree
Hide file tree
Showing 28 changed files with 276 additions and 98 deletions.
69 changes: 58 additions & 11 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,72 @@
<?xml version="1.0"?>
<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-"/>

<rule ref="WordPress-Extra" />

<rule ref="Jetpack">
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="MediaWiki.Usage.ForbiddenFunctions.isset" />
<exclude name="Squiz.Commenting.FileComment.WrongStyle" />
</rule>

<rule ref="Jetpack-Compat-81" />

<!-- What NOT to scan. -->
<exclude-pattern>*/bin/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/*.asset.php</exclude-pattern> <!-- This file is generated by the Gutenberg build process. -->
<exclude-pattern>*/dependencies/*</exclude-pattern> <!-- This folder is generated by the PHP scoping process. -->

<!-- How to scan. -->
<arg value="sp"/> <!-- Show sniff and progress. -->
<arg name="colors"/> <!-- Show results with colors. Disable if working on Windows. -->
<arg name="parallel" value="8"/> <!-- Enables parallel processing when available for faster results. -->
<arg name="extensions" value="php"/> <!-- Only scan PHP files. -->

<!-- Run against the PHPCompatibilityWP ruleset and check for cross-version support for PHP 8.1 and higher. -->
<rule ref="PHPCompatibilityWP"/>
<config name="testVersion" value="8.1-"/>

<!-- Run against the WordPress-Extra ruleset and check for the minimum supported WP version. -->
<rule ref="WordPress-Extra">
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound" />
</rule>
<config name="minimum_wp_version" value="6.1"/>

<rule ref="Jetpack-Compat-82" />
<!-- Disallow blank lines at start/end of for/foreach/if blocks. -->
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
<properties>
<property name="blank_line_check" value="true"/>
</properties>
</rule>

<!-- Ensure documentation blocks follow basic formatting like containing a short description and not mixing tag groups. -->
<rule ref="Generic.Commenting.DocComment">
<!-- Ignore indentation as it conflicts with our attempts to align across multiple tag blocks. -->
<exclude name="Generic.Commenting.DocComment.TagValueIndent" />
<!-- Ignore @param tags not being first since normally start with @since and @version tags. -->
<exclude name="Generic.Commenting.DocComment.ParamNotFirst" />
</rule>

<!-- Remove isset with multiple values rule -->
<rule ref="MediaWiki.Usage.ForbiddenFunctions.isset">
<exclude />
<!-- Check that function comments exist and that they contain @param, @return and @throws tags. -->
<rule ref="Squiz.Commenting.FunctionComment">
<properties>
<!-- Ignore missing tags if @inheritDoc is present. -->
<property name="skipIfInheritdoc" value="true" />
</properties>
<!-- Ignore missing type hints since we sometimes want to ignore them on hooks. -->
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing"/>
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing"/>
</rule>

<!-- Exclude node modules and vendor folders -->
<exclude-pattern>node_modules/*</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>tests/*</exclude-pattern>
<!-- Check that class comments exists. -->
<rule ref="Squiz.Commenting.ClassComment">
<!-- Ignore the presence of tags such as @version and @since. -->
<exclude name="Squiz.Commenting.ClassComment.TagNotAllowed" />
</rule>

<!-- Check that the proper text domain(s) is used everywhere. -->
<rule ref="WordPress.WP.I18n">
Expand Down
2 changes: 1 addition & 1 deletion assets/js/build/editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-hooks', 'wp-i18n', 'wp-plugins'), 'version' => 'bb58f17b4511295bda87');
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-hooks', 'wp-i18n', 'wp-plugins'), 'version' => 'c1726964d95efb0f9880');
2 changes: 1 addition & 1 deletion assets/js/build/editor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/build/theme-install.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '3145422ea2aa5e4a5ad2');
<?php return array('dependencies' => array(), 'version' => 'ef159c714f95891e50d5');
2 changes: 1 addition & 1 deletion assets/js/build/theme-install.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions assets/js/src/components/video-block.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InspectorControls, MediaUpload, MediaUploadCheck } from '@wordpress/block-editor';
import { PanelBody, TextControl, Button } from '@wordpress/components';
import { InspectorControls } from '@wordpress/block-editor';
import { PanelBody, TextControl } from '@wordpress/components';
import { addFilter } from '@wordpress/hooks';
import { createHigherOrderComponent } from '@wordpress/compose';

Expand Down Expand Up @@ -64,7 +64,7 @@ addFilter(
createHigherOrderComponent( BlockEdit => {
return props => {
const { attributes, setAttributes, isSelected } = props;
const { src, url, provider, poster } = attributes;
const { src, url, provider } = attributes;

// Sync mediaURL with src if they differ
if ( src && src !== url ) {
Expand Down
Loading

0 comments on commit a27b3d7

Please sign in to comment.