PSR-12 coding standards compliance
Add phpcs/phpcbf tooling (composer require-dev, scripts, .phpcs.xml). Auto-fix tabs to spaces across all PHP files (phpcbf). Add missing doc comments for classes and constructors. Add missing @param tags on public/private methods.
This commit is contained in:
47
.phpcs.xml
Normal file
47
.phpcs.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="NextBridge">
|
||||
<description>PSR-12 coding standard for NextBridge RoundCube plugin</description>
|
||||
|
||||
<!-- Use PSR-12 as base with RoundCube-specific exclusions -->
|
||||
<rule ref="PSR12">
|
||||
<!-- Allow longer lines for readability -->
|
||||
<exclude name="Generic.Files.LineLength"/>
|
||||
<!-- RoundCube plugins don't use namespaces -->
|
||||
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
|
||||
<!-- RoundCube plugins use lowercase class names by convention -->
|
||||
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
|
||||
<!-- RoundCube plugins can have side effects (require_once) -->
|
||||
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
|
||||
<!-- RoundCube hooks use snake_case method names by convention -->
|
||||
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
|
||||
</rule>
|
||||
|
||||
<!-- Allow @url/@link in class doc comments -->
|
||||
<rule ref="Squiz.Commenting.ClassComment">
|
||||
<exclude name="Squiz.Commenting.ClassComment.TagNotAllowed"/>
|
||||
</rule>
|
||||
<rule ref="Squiz.Commenting.FunctionComment">
|
||||
<exclude name="Squiz.Commenting.FunctionComment.MissingReturn"/>
|
||||
</rule>
|
||||
|
||||
<!-- Line length: warn at 120, no hard limit -->
|
||||
<rule ref="Generic.Files.LineLength">
|
||||
<properties>
|
||||
<property name="lineLimit" value="120"/>
|
||||
<property name="absoluteLineLimit" value="0"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Require class documentation -->
|
||||
<rule ref="Squiz.Commenting.ClassComment"/>
|
||||
|
||||
<!-- Require function documentation with @param and @return -->
|
||||
<rule ref="Squiz.Commenting.FunctionComment"/>
|
||||
|
||||
<!-- Files to check -->
|
||||
<file>ident_switch.php</file>
|
||||
<file>lib/</file>
|
||||
|
||||
<!-- Exclude vendor directories -->
|
||||
<exclude-pattern>*/vendor/*</exclude-pattern>
|
||||
</ruleset>
|
||||
Reference in New Issue
Block a user