2019-06-24 07:38:41 +08:00
|
|
|
<?xml version="1.0"?>
|
2021-03-10 15:02:53 -06:00
|
|
|
<ruleset name="Winter CMS">
|
|
|
|
<description>The coding standard for Winter CMS.</description>
|
2019-06-24 07:38:41 +08:00
|
|
|
<rule ref="PSR2">
|
2019-06-25 17:42:40 +08:00
|
|
|
<!--
|
|
|
|
Exceptions to the PSR-2 guidelines as per our Developer Guide:
|
2021-03-10 15:02:53 -06:00
|
|
|
https://wintercms.com/help/guidelines/developer#psr-exceptions
|
2019-06-25 17:42:40 +08:00
|
|
|
-->
|
2019-06-24 07:38:41 +08:00
|
|
|
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
|
2019-06-25 17:42:40 +08:00
|
|
|
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" />
|
|
|
|
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace" />
|
2022-05-02 16:34:47 +08:00
|
|
|
|
|
|
|
<!-- We're not enforcing a line length limit -->
|
2022-03-23 20:34:49 +08:00
|
|
|
<exclude name="Generic.Files.LineLength" />
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
<rule ref="Squiz.ControlStructures.ControlSignature">
|
|
|
|
<!-- We use 0 spaces before the colon for short (alternative) tags -->
|
|
|
|
<properties>
|
|
|
|
<property name="requiredSpacesBeforeColon" value="0" />
|
|
|
|
</properties>
|
2019-06-25 17:42:40 +08:00
|
|
|
</rule>
|
|
|
|
|
2022-05-02 16:34:47 +08:00
|
|
|
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen">
|
2019-06-25 17:42:40 +08:00
|
|
|
<!--
|
2022-05-02 16:34:47 +08:00
|
|
|
Ignore correct spacing for control structure in partial templates - spacing may be useful for templates to
|
|
|
|
easily deduce HTML code that is conditional
|
2019-06-25 17:42:40 +08:00
|
|
|
-->
|
2022-05-02 16:34:47 +08:00
|
|
|
<exclude-pattern>*/modules/*/behaviors/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/components/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/controllers/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/formwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/reportwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/widgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/behaviors/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/components/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/controllers/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/formwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/reportwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/widgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/partials/*\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
|
|
|
|
<!-- Migration files and tests do not need a namespace defined -->
|
2019-06-25 17:42:40 +08:00
|
|
|
<exclude-pattern>*/database/migrations/*\.php</exclude-pattern>
|
2019-07-02 15:34:41 +08:00
|
|
|
<exclude-pattern>*/tests/*</exclude-pattern>
|
2019-06-24 07:38:41 +08:00
|
|
|
</rule>
|
|
|
|
|
2019-07-18 22:50:37 +08:00
|
|
|
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
|
|
|
|
<!--
|
|
|
|
Test fixtures and cases can have multiple classes defined, only if they are directly related to the test, or are
|
|
|
|
extended classes
|
|
|
|
-->
|
|
|
|
<exclude-pattern>*/tests/*</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2022-05-02 16:34:47 +08:00
|
|
|
<rule ref="PSR2.Files.ClosingTag.NotAllowed">
|
|
|
|
<!--
|
|
|
|
Partials may finish on a closing tag, especially when using the short echo "<?= ?>" tag. We'll allow this.
|
|
|
|
-->
|
|
|
|
<exclude-pattern>*/modules/*/behaviors/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/components/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/controllers/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/formwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/reportwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/widgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/behaviors/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/components/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/controllers/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/formwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/reportwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/widgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/partials/*\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
<rule ref="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE">
|
|
|
|
<!--
|
|
|
|
Partials may have HTML within switch/case statements, which look neater when inline. PHPCS also has difficulty
|
|
|
|
interpreting a short echo tag on a new line within a switch/case statement.
|
|
|
|
-->
|
|
|
|
<exclude-pattern>*/modules/*/behaviors/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/components/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/controllers/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/formwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/reportwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/widgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/behaviors/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/components/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/controllers/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/formwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/reportwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/widgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/partials/*\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
<rule ref="PSR2.ControlStructures.SwitchDeclaration.BreakNotNewLine">
|
|
|
|
<!--
|
|
|
|
Partials may have HTML within switch/case statements, which look neater when inline. PHPCS also has difficulty
|
|
|
|
interpreting a short echo tag on a new line within a switch/case statement.
|
|
|
|
-->
|
|
|
|
<exclude-pattern>*/modules/*/behaviors/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/components/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/controllers/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/formwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/reportwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/widgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/modules/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/behaviors/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/components/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/controllers/*/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/formwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/reportwidgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/widgets/*/partials/*\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>*/plugins/*/*/partials/*\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2022-03-23 20:34:49 +08:00
|
|
|
<arg name="extensions" value="php" />
|
|
|
|
<arg name="colors" />
|
|
|
|
|
2019-06-24 07:38:41 +08:00
|
|
|
<file>bootstrap/</file>
|
|
|
|
<file>config/</file>
|
|
|
|
<file>modules/</file>
|
2021-03-10 15:02:53 -06:00
|
|
|
<file>plugins/winter/demo/</file>
|
2019-06-25 17:42:40 +08:00
|
|
|
<file>tests/</file>
|
2019-06-24 07:38:41 +08:00
|
|
|
|
2019-07-18 22:50:37 +08:00
|
|
|
<!-- Ignore vendor files -->
|
2019-06-25 17:42:40 +08:00
|
|
|
<exclude-pattern>*/vendor/*</exclude-pattern>
|
2019-07-18 22:50:37 +08:00
|
|
|
<!-- Ignore this view file as fixing the issues in here will break the template -->
|
|
|
|
<exclude-pattern>modules/system/views/exception.php</exclude-pattern>
|
2022-07-06 15:00:34 -06:00
|
|
|
<!-- Ignore this view file as PHPCS wants line 8 to have 44 spaces instead of 12, clearly insane -->
|
|
|
|
<exclude-pattern>modules/backend/widgets/mediamanager/partials/_item-icon.php</exclude-pattern>
|
2019-07-18 22:50:37 +08:00
|
|
|
<!-- Ignore this test case completely as it's testing a parse error -->
|
|
|
|
<exclude-pattern>tests/fixtures/plugins/testvendor/goto/Plugin.php</exclude-pattern>
|
2019-06-24 07:38:41 +08:00
|
|
|
</ruleset>
|