eightshift-coding-standards

Eightshift coding standards for WordPress

MIT License

Downloads
78K
Stars
16
Committers
4

Bot releases are hidden (Show)

eightshift-coding-standards - 3.0.0 Latest Release

Published by iruzevic 5 months ago

Changed

  • Components helpers in the new [email protected] is deprecated and removed. Instead Helpers is used. The Eightshift.Security.ComponentsEscape sniff is updated and renamed to Eightshift.Security.HelpersEscape to reflect this change.
eightshift-coding-standards - ES Coding Standards v2 beta

Published by goranalkovic-infinum about 1 year ago

Updated to WPCS v3.0.0

Still beta, as a fix that'll be in WPCS v3.1.0 is not out yet.

Thanks to @dingo-d for the update!

eightshift-coding-standards - Update FunctionComment Sniff

Published by dingo-d over 2 years ago

Changed

  • Add a parameter $allowedExtendedClasses in the FunctionComment sniff
    • This way we can add a list of specific extending CLI classes which won't trigger
      phpcs error on the __invoke() method.
eightshift-coding-standards - Minor CI/CD fix

Published by dingo-d over 2 years ago

This release just fixes the CI/CD failures (xmllint and line width issue in one of the sniff file), no functional changes were made

eightshift-coding-standards - 1.5.0 Update

Published by dingo-d over 2 years ago

Added

  • Add overriddenClass parameter for the EightShift ComponentsEscape sniff
    • This parameter will catch the cases where the libs Components class has been overridden.
  • Add ignoreComments property for the line length sniff

Fixed

  • Fixed the edge case with overwriting libs classes.

Changed

  • Code cleanup in EightShift ComponentsEscape sniff
eightshift-coding-standards - Ruleset fix

Published by dingo-d over 2 years ago

Fixed

  • Exclude the native WordPress.Security.EscapeOutput.OutputNotEscaped sniff, because we are overloading it
eightshift-coding-standards - ComponentsEscape sniff bugfix

Published by dingo-d over 2 years ago

Fixed

  • Fixed Eightshift.Security.ComponentsEscape sniff
    • There was a case where the next string token caused issue because there was no guard clause
      to check if the string is actually a Components class or not.
eightshift-coding-standards - 1.4.0

Published by dingo-d over 2 years ago

Added

  • EightShift ruleset: add rules for use statements
    • Adds a new dependency on the Slevomat Coding Standard library.
    • Adds four sniffs from this coding standard to the ruleset:
      1. Forbidding unused use statements.
      2. Enforcing fully qualified global functions and constants.
      3. Enforcing import use statements for everything else.
    • Includes fixing up the EightShift coding standards code base for these new rules.
    • Ref: https://github.com/slevomat/coding-standard
  • Add new EightShift FunctionComment sniff
    • This sniff overloads the Squiz.Commenting.FunctionComment sniff which normally comes included via the WordPress-Docs ruleset and makes an allowance for the __invoke method in the CLI classes.
    • Includes:
      • Unit tests.
      • Adjusting the ruleset to maintain the same excludes as WPCS had from the Squiz ruleset.
      • Adjusting the ruleset to maintain the previous exclude for parameter alignment.
  • Add new EightShift ComponentsEscape sniff
    • This sniff overloads the WordPress.Security.EscapeOutput.OutputNotEscaped sniff which comes included with WordPress-Extra ruleset and makes an allowance for a certain EightshiftLibs\Helpers\Components static methods (render and outputCssVariables).
  • Add @covers tag for all the tests
  • Add the documentation for the new sniffs

Changed

  • PHPCS ruleset: tabs not spaces
  • PHPCS: simplify ruleset
  • Composer
  • Update composer to add the allow-plugins
  • Update disallow do_shortcode sniff
    • The sniff is updated so that it extends the WPCS Sniff class. This class has two super useful helpers: is_token_namespaced and is_class_object_call. They allow super quick checks for namespaced functions and static functions named do_shortcode which would otherwise trigger a false positive result.
  • Update GitHub Actions Workflow update
    • Update composer install action to v2.
    • Add concurrency check to save resources.
  • Update minimum PHP version to 7.4 and tab width in the ruleset to 4

Removed

  • Composer
    • Remove the Composer PHPCS plugin dependency as it already is a dependency of both PHPCSExtra as well as SlevomatCodingStandards, so we'll inherit it anyway.

Fixed

  • Fix the wrong namespace in the ruleset
  • PHPCS: improve PHPCompatibility check for this repo
    • Remove the dependency as it is already a dependency of PHPCompatibilityWP and having both may cause version conflicts later.
    • Reset the severity of all PHPCompatibility sniffs to 5 for scanning the EightShiftCS code itself as that code is run outside the context of WordPress.

A huge thanks to Juliette Reinders Folmer (@jrfnl) for amazing help in fixing tons of issues with the ruleset and sniffs.

eightshift-coding-standards - 1.3.0

Published by dingo-d over 3 years ago

Removed

  • Modified escaping sniff
    • The sniff wasn't working correctly, and we'll wait for the upstream to fix the issue
  • Exclude doc comment align sniff

Fixed

  • Improve disallow do shortcode sniff (better regex and tests)
  • Fixed the namespace in the ruleset.xml

Changed

  • Update minimum supported WP version to 5.4
eightshift-coding-standards - 1.2.0

Published by dingo-d over 3 years ago

Added

  • Workflows for GH Actions
  • Docs for custom sniffs
  • Modified escaping sniff
    • will exclude the custom Components::render() method from the eightshift-libs
  • Added phpcs extra ruleset for array spacing and array best practices
  • Update samples for ruleset

Changed

  • Updated sniffs namespace
eightshift-coding-standards - Package renaming

Published by dingo-d almost 4 years ago

We renamed the package from infinum/coding-standards-wp to infinum/eightshift-coding-standards.

eightshift-coding-standards - 1.0.1 Update version

Published by dingo-d about 4 years ago

Added

  • Added a rule to prevent underscores denoting the private methods/properties
eightshift-coding-standards - 1.0.0 Version

Published by dingo-d about 4 years ago

⚠️ This is a breaking change ⚠️

This is the official release of the Infinum coding standards for WordPress. It contains breaking changes, mostly in regard of the naming scheme.
To equate the way we write our PHP and JS we opted to follow a modified PSR standards.

What this means is that we will remove liberal spacing, add some PSR12 modifications regarding arguments placing in closures, change snake_case with CamelCase for classes (for autoload puropses) and some other minor changes that will be documented below.
If you wish to use the old standards, be sure to modify your projects composer.json file with the appropriate version.

Added

  • Added PSR-12 standards
  • Added more tests
  • Updated the WPCS to 2.3.0
  • Updated scripts

Removed

  • Removed the Test bootstrap
  • Removed PHP 5.6 support and raised the recommended PHP version to 7.2 or higher
  • Removed WordPress-Core standards

Changed

  • Replaced WordPress naming standards to modified PSR standards
  • Changed the namespace of the WPCS core classes
eightshift-coding-standards - Version 0.4.3

Published by dingo-d over 4 years ago

Fixed

  • Fixed the sniff namespace alias to WordPressCS\WordPress in the DisallowedShortcodeSniff
eightshift-coding-standards - Version 0.4.2

Published by dingo-d over 4 years ago

Added

  • Add check for minification of scripts or files
  • Added no ByteOrderMark allowed check
  • Add eval() check
  • Add goto check

Changed

  • Updated coding standards of the standard
  • Updated the minimum WP suported version
  • Readme update
  • Updated dealerdirect suggestions and packages version update

Removed

  • Remove autoloading from the ruleset
  • Removed test bootstrap
  • Removed allowed pattern for underscore - pattern in files in sections
eightshift-coding-standards - Update version 0.4.1

Published by dingo-d almost 6 years ago

Added

  • Silenced previously excluded sniffs to avoid loading the entire WordPress ruleset
  • Silenced WordPress.Arrays.ArrayIndentation to avoid it clashing with Generic indentation sniff

Removed

  • Fixed multiple alignment sniff issue

Changed

  • Reorganized sniff rules
  • Raised the minimum supported PHP version to PHP 7.1
eightshift-coding-standards - Update version 0.4.0

Published by dingo-d almost 6 years ago

This is a big update to the Infinum's coding standards for WordPress. A lot of things were fixed and changed as listed in the changelog:

Added

  • Unit tests - the basic setup is taken from https://github.com/WPTRT/WPThemeReview/
  • Ignore rule about enqueueing scripts in the footer
  • .gitattributes file for release purposes
  • Added internal ruleset for writing additional sniffs
  • Added rule about alignment of assignment operators (see this customizable property)
  • Added a rule about function parameters and indentation
  • Ignore unused parameters in functions on account on hooks
  • Added a rule about private methods and properties - they MUST NOT be prefixed with an underscore
  • Added PHPCompatibilityWP ruleset for checking a cross-version PHP compatibility (from PHP 7.0 onwards)
  • Added detailed CHANGELOG
  • Updated readme
  • Added autoload for loading the standards
  • Updated composer.json
    • added different requirements
    • added unit test packages
    • moved phpcodesniffer-composer-installer to suggested package
    • updated scripts
  • Added .travis.yml for automatic checks on new sniff addition

Removed

  • Removed ruleset.xml from the root of the standards
  • Removed WordPress.Arrays.MultipleStatementAlignment exclusion rule

Fixed

  • Minor coding standard fix in the DisallowDoShortcode sniff
  • Fix the array indentation issue
eightshift-coding-standards - Minor update

Published by dingo-d about 6 years ago

Force WPCS dependency to be greater or equal to 1.0.0

eightshift-coding-standards - Post WPCS 1.0.0 update

Published by dingo-d about 6 years ago

This update is made after the release of WPCS 1.0.0 version.

Changes:

  • Removed custom one class per file sniff as it is already included in the WPCS
  • Added code analysis sniff for unused parameters Generic.CodeAnalysis.UnusedFunctionParameter
  • Removed WordPress-VIP ruleset as it's deprecated
  • Moved PostsPerPage rule from VIP to WP namespace
  • Moved DirectDatabaseQuery from VIP to WP namespace, and YodaConditions as well
  • Update the WPCS dependency to the latest version
  • Update Readme
  • Update composer.json
  • Add minimum WP version check, and depreciation check
  • Removed DOMDocument exclusions from ruleset, as it is project specific and can be added per project
eightshift-coding-standards - Update array indentation

Published by dingo-d over 6 years ago

Updated array indentation to respect 2 spaces instead of 4 when indenting array keys.

Package Rankings
Top 7.33% on Packagist.org
Badges
Extracted from project README
Latest Stable Version Release Date of the Latest Version CI checks Minimum PHP Version Tested on PHP 7.4 to 8.3 License: MIT Total Downloads
Related Projects