Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bsu/BSUWordPressCS",
"version": "1.1.5",
"version": "1.2.0",
"description": "Custom PHPCS sniffs for BSU WordPress standards",
"author": "BSU|NTC Web Services",
"license": "Copyright Web Services, Bemidji State University - All Rights Reserved. Unauthorized copying of any files or code in this package, via any medium is strictly prohibited.",
Expand Down
36 changes: 36 additions & 0 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,40 @@
<rule ref="./Sniffs/Commenting"/>
<rule ref="./Sniffs/Functions"/>
<rule ref="./Sniffs/Spacing"/>

<!--
Enforce BSU_ prefix on all global PHP symbols to prevent naming collisions
with WordPress core and plugins, and to make theme code instantly identifiable
in stack traces.

Covers: functions (bsu_), classes (BSU_), constants (BSU_).

Hook names and global variables are excluded:
- Hook names: WordPress core hooks (the_content, gallery_style, etc.) cannot be
renamed. We hook into them via add_filter/apply_filters — not defining new ones.
- Global variables: WordPress core globals ($post, $wpdb, $wp_query) are accessed
with the global keyword inside methods. The rule cannot distinguish accessing an
existing global from declaring a new one.
-->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="bsu_"/>
<element value="BSU_"/>
</property>
</properties>
<!--
Exclude template files (view layer — unprefixed local variables by design),
the BSU facade (named exactly "BSU" with no slug suffix), and any vendor or
Sniff directories that belong to the standard itself rather than project code.
-->
<exclude-pattern>*/template-parts/*\.php$</exclude-pattern>
<exclude-pattern>*/template-*\.php$</exclude-pattern>
<exclude-pattern>*/templateincludes-*\.php$</exclude-pattern>
<exclude-pattern>*/functions/class-bsu\.php$</exclude-pattern>
<exclude-pattern>*/Sniffs/*\.php$</exclude-pattern>
<exclude-pattern>*/vendor/*\.php$</exclude-pattern>
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound"/>
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound"/>
</rule>
</ruleset>
Loading