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
1 change: 1 addition & 0 deletions .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"defects":{"EightshiftCS\\Eightshift\\Tests\\Commenting\\FunctionCommentUnitTest::testSniff":4,"EightshiftCS\\Eightshift\\Tests\\ControlStructures\\DisallowAlternativeSyntaxUnitTest::testSniff":4,"EightshiftCS\\Eightshift\\Tests\\Security\\HelpersEscapeUnitTest::testSniff":4,"EightshiftCS\\Eightshift\\Tests\\Shortcodes\\DisallowDoShortcodeUnitTest::testSniff":4},"times":{"EightshiftCS\\Eightshift\\Tests\\Commenting\\FunctionCommentUnitTest::testSniff":0.002,"EightshiftCS\\Eightshift\\Tests\\ControlStructures\\DisallowAlternativeSyntaxUnitTest::testSniff":0,"EightshiftCS\\Eightshift\\Tests\\Security\\HelpersEscapeUnitTest::testSniff":0,"EightshiftCS\\Eightshift\\Tests\\Shortcodes\\DisallowDoShortcodeUnitTest::testSniff":0}}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ The semantic versioning started from version 0.2.1.

_No documentation available about unreleased changes yet._

## [3.1.0](https://github.com/infinum/eightshift-coding-standards/compare/3.0.1...3.1.0)

### Added
- Enabled `Universal.ControlStructures.DisallowAlternativeSyntax` from PHPCSExtra (already a transitive dependency via WPCS) to enforce curly braces for all control structures; disallows `endif`, `endforeach`, `endfor`, `endwhile`, and `endswitch`. `allowWithInlineHTML` is set to `false` to disallow alternative syntax even when inline HTML is present. Includes auto-fixer support.

### Changed
- Updated PHP_CodeSniffer repository link in README from `squizlabs/PHP_CodeSniffer` to `PHPCSStandards/PHP_CodeSniffer`.
- Updated `xsi:noNamespaceSchemaLocation` schema URL in `Eightshift/ruleset.xml`, `phpcs.xml.dist`, and `phpcs.xml.dist.sample` to use the canonical `https://schema.phpcodesniffer.com/phpcs.xsd` permalink.

### Fixed
- PHPUnit test suite bootstrap — changed `phpunit.xml.dist` to use `AllSniffs.php` as entry point so `PHP_CODESNIFFER_STANDARD_DIRS` globals are properly populated.
- Renamed `ComponentsEscapeUnitTest` files to `HelpersEscapeUnitTest` to match the `HelpersEscapeSniff` name and satisfy sniff feature completeness checks.

## [3.0.1](https://github.com/infinum/eightshift-coding-standards/compare/3.0.0...3.0.1)

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

/**
* Unit test class for the FunctionCommentUnitTest sniff.
* Unit test class for the HelpersEscape sniff.
*
* @covers \EightshiftCS\Eightshift\Sniffs\Security\HelpersEscapeSniff
*
Expand Down
11 changes: 10 additions & 1 deletion Eightshift/ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Eightshift" namespace="EightshiftCS\Eightshift" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Eightshift" namespace="EightshiftCS\Eightshift" xsi:noNamespaceSchemaLocation="https://schema.phpcodesniffer.com/phpcs.xsd">
<description>Eightshift coding standards for WordPress projects</description>

<config name="encoding" value="utf-8"/>
Expand Down Expand Up @@ -65,6 +65,15 @@
<exclude name="Eightshift.Commenting.FunctionComment.SpacingAfterParamType"/>
</rule>

<!-- Disallow alternative control structure syntax (endif, endforeach, etc.). Use curly braces.
allowWithInlineHTML=false: disallow even when inline HTML is present between the control structure tags.
This sniff is provided by PHPCSExtra, which is already a transitive dependency via WPCS. -->
<rule ref="Universal.ControlStructures.DisallowAlternativeSyntax">
<properties>
<property name="allowWithInlineHTML" value="false"/>
</properties>
</rule>

<!-- Use tabs, not spaces. -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Eightshift Coding Standards for WordPress

This package contains [Eightshift Coding Standards for WordPress](https://handbook.infinum.co/books/wordpress) for
[PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer/). The intention of this package is to have a unified
[PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer/). The intention of this package is to have a unified
code across the WordPress projects we do at Eightshift, and to help with the code review.

## Installation
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Eightshift Coding Standards for WordPress"
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
xsi:noNamespaceSchemaLocation="https://schema.phpcodesniffer.com/phpcs.xsd">

<description>The coding standards used when writing Eightshift Coding Standards itself</description>

Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Example Project" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Example Project" xsi:noNamespaceSchemaLocation="https://schema.phpcodesniffer.com/phpcs.xsd">

<description>A custom set of rules to check for a WordPress project running Eightshift coding standards for WP.
</description>
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<testsuites>
<testsuite name="Eightshift">
<directory suffix="UnitTest.php">./Eightshift/Tests/</directory>
<file>vendor/squizlabs/php_codesniffer/tests/Standards/AllSniffs.php</file>
</testsuite>
</testsuites>
</phpunit>
Loading