Skip to content

Commit

Permalink
chore(theme): lint
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonhundt committed Mar 18, 2024
1 parent 73c789b commit 278cd7c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
51 changes: 51 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WordPress Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">

<description>The Coding standard for the WordPress Coding Standards itself.</description>

<file>.</file>

<arg value="sp"/>
<arg name="extensions" value="php"/>
<arg name="basepath" value="."/>
<arg name="parallel" value="8"/>

<exclude-pattern>/bin/class-ruleset-test.php</exclude-pattern>
<!-- Exclude Composer vendor directory. -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/plugins/*</exclude-pattern>

<rule ref="WordPress">
<exclude name="WordPress.Files.FileName"/>
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition"/>
</rule>

<!-- Enforce PSR1 compatible namespaces. -->
<rule ref="PSR1.Classes.ClassDeclaration"/>

<rule ref="WordPress.Arrays.MultipleStatementAlignment">
<properties>
<property name="alignMultilineItems" value="!=100"/>
<property name="exact" value="false" phpcs-only="true"/>
</properties>
</rule>

<rule ref="PSR2.Methods.FunctionClosingBrace"/>

<!-- Check code for cross-version PHP compatibility. -->
<!-- <config name="testVersion" value="5.4-"/> -->
<!-- <rule ref="PHPCompatibility"> -->
<!-- Exclude PHP constants back-filled by PHPCS. -->
<!-- <exclude name="PHPCompatibility.Constants.NewConstants.t_finallyFound"/> -->
<!-- <exclude name="PHPCompatibility.Constants.NewConstants.t_yieldFound"/> -->
<!-- <exclude name="PHPCompatibility.Constants.NewConstants.t_ellipsisFound"/> -->
<!-- <exclude name="PHPCompatibility.Constants.NewConstants.t_powFound"/> -->
<!-- <exclude name="PHPCompatibility.Constants.NewConstants.t_pow_equalFound"/> -->
<!-- <exclude name="PHPCompatibility.Constants.NewConstants.t_spaceshipFound"/> -->
<!-- <exclude name="PHPCompatibility.Constants.NewConstants.t_coalesceFound"/> -->
<!-- <exclude name="PHPCompatibility.Constants.NewConstants.t_coalesce_equalFound"/> -->
<!-- <exclude name="PHPCompatibility.Constants.NewConstants.t_yield_fromFound"/> -->
<!-- </rule> -->

</ruleset>
4 changes: 2 additions & 2 deletions wp-content/themes/the-world/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function tw_remove_core_block_patterns() {
* @uses add_menu_page() Add links to the menu.
*/
function tw_add_edit_homepage_menu_link() {
add_menu_page('tw_edit_homepage_link', 'The World Homepage', 'publish_posts', "/wp-admin/term.php?taxonomy=program&tag_ID=2&post_type=post", '', 'dashicons-admin-site-alt3', 8);
add_menu_page( 'tw_edit_homepage_link', 'The World Homepage', 'publish_posts', '/wp-admin/term.php?taxonomy=program&tag_ID=2&post_type=post', '', 'dashicons-admin-site-alt3', 8 );
}
endif;
add_action('admin_menu', 'tw_add_edit_homepage_menu_link');
add_action( 'admin_menu', 'tw_add_edit_homepage_menu_link' );

0 comments on commit 278cd7c

Please sign in to comment.