diff --git a/.phpunit.result.cache b/.phpunit.result.cache new file mode 100644 index 0000000..10982a3 --- /dev/null +++ b/.phpunit.result.cache @@ -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}} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 647d94f..867f726 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Eightshift/Tests/Security/ComponentsEscapeUnitTest.1.inc b/Eightshift/Tests/Security/HelpersEscapeUnitTest.1.inc similarity index 100% rename from Eightshift/Tests/Security/ComponentsEscapeUnitTest.1.inc rename to Eightshift/Tests/Security/HelpersEscapeUnitTest.1.inc diff --git a/Eightshift/Tests/Security/ComponentsEscapeUnitTest.2.inc b/Eightshift/Tests/Security/HelpersEscapeUnitTest.2.inc similarity index 100% rename from Eightshift/Tests/Security/ComponentsEscapeUnitTest.2.inc rename to Eightshift/Tests/Security/HelpersEscapeUnitTest.2.inc diff --git a/Eightshift/Tests/Security/ComponentsEscapeUnitTest.3.inc b/Eightshift/Tests/Security/HelpersEscapeUnitTest.3.inc similarity index 100% rename from Eightshift/Tests/Security/ComponentsEscapeUnitTest.3.inc rename to Eightshift/Tests/Security/HelpersEscapeUnitTest.3.inc diff --git a/Eightshift/Tests/Security/ComponentsEscapeUnitTest.4.inc b/Eightshift/Tests/Security/HelpersEscapeUnitTest.4.inc similarity index 100% rename from Eightshift/Tests/Security/ComponentsEscapeUnitTest.4.inc rename to Eightshift/Tests/Security/HelpersEscapeUnitTest.4.inc diff --git a/Eightshift/Tests/Security/ComponentsEscapeUnitTest.5.inc b/Eightshift/Tests/Security/HelpersEscapeUnitTest.5.inc similarity index 100% rename from Eightshift/Tests/Security/ComponentsEscapeUnitTest.5.inc rename to Eightshift/Tests/Security/HelpersEscapeUnitTest.5.inc diff --git a/Eightshift/Tests/Security/ComponentsEscapeUnitTest.6.inc b/Eightshift/Tests/Security/HelpersEscapeUnitTest.6.inc similarity index 100% rename from Eightshift/Tests/Security/ComponentsEscapeUnitTest.6.inc rename to Eightshift/Tests/Security/HelpersEscapeUnitTest.6.inc diff --git a/Eightshift/Tests/Security/ComponentsEscapeUnitTest.php b/Eightshift/Tests/Security/HelpersEscapeUnitTest.php similarity index 96% rename from Eightshift/Tests/Security/ComponentsEscapeUnitTest.php rename to Eightshift/Tests/Security/HelpersEscapeUnitTest.php index e2db395..de7403f 100644 --- a/Eightshift/Tests/Security/ComponentsEscapeUnitTest.php +++ b/Eightshift/Tests/Security/HelpersEscapeUnitTest.php @@ -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 * diff --git a/Eightshift/ruleset.xml b/Eightshift/ruleset.xml index 3d0cd4a..75669d6 100644 --- a/Eightshift/ruleset.xml +++ b/Eightshift/ruleset.xml @@ -1,5 +1,5 @@ - + Eightshift coding standards for WordPress projects @@ -65,6 +65,15 @@ + + + + + + + diff --git a/README.md b/README.md index 5993a07..291c271 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/phpcs.xml.dist b/phpcs.xml.dist index e7b49a6..8e7a27b 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,6 +1,6 @@ + xsi:noNamespaceSchemaLocation="https://schema.phpcodesniffer.com/phpcs.xsd"> The coding standards used when writing Eightshift Coding Standards itself diff --git a/phpcs.xml.dist.sample b/phpcs.xml.dist.sample index 2bcfffa..8779fde 100644 --- a/phpcs.xml.dist.sample +++ b/phpcs.xml.dist.sample @@ -1,5 +1,5 @@ - + A custom set of rules to check for a WordPress project running Eightshift coding standards for WP. diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2a7297b..2def49b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -10,7 +10,7 @@ - ./Eightshift/Tests/ + vendor/squizlabs/php_codesniffer/tests/Standards/AllSniffs.php