config: add phpcs.xml to exclude class-naming convention sniff

Created phpcs.xml ruleset that inherits from WordPress-Core but excludes
WordPress.Files.FileName.InvalidClassFileName sniff. This is an architectural
choice: PRAutoBlogger uses short class names (class-logger.php) instead of
fully-qualified names (class-prautoblogger-logger.php) for better readability.

Updated CI workflow to use phpcs.xml instead of --standard=WordPress-Core.
Remaining violations (56 wpdb + 2 docblock) are still addressed with inline
phpcs:ignore pragmas with documented reasons.
This commit is contained in:
peptiderepo
2026-04-23 03:27:55 +00:00
parent 0e1551be42
commit 26059e7f12
2 changed files with 18 additions and 1 deletions

View File

@@ -66,7 +66,7 @@ jobs:
"phpcsstandards/phpcsextra:^1.0"
- name: Run PHPCS
run: |
phpcs --standard=WordPress-Core \
phpcs --standard=phpcs.xml \
--extensions=php \
--ignore=vendor/*,tests/*,node_modules/* \
--warning-severity=0 \

17
phpcs.xml Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<ruleset name="PRAutoBlogger">
<description>Custom PHPCS ruleset for PRAutoBlogger based on WordPress-Core</description>
<!-- Use WordPress-Core as the base standard -->
<rule ref="WordPress-Core">
<!-- Exclude the class file naming convention check -->
<!-- This is an architectural choice: we use short class names (class-logger.php)
instead of full names (class-prautoblogger-logger.php) for readability. -->
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
</rule>
<!-- File scope -->
<arg name="extensions" value="php" />
<arg name="ignore" value="vendor/*,tests/*,node_modules/*" />
<arg name="warning-severity" value="0" />
</ruleset>