2017 © Pedro Peláez
 

phpcodesniffer-standard coding-standards-wp

Infinum WordPress Coding Standards

image

infinum/coding-standards-wp

Infinum WordPress Coding Standards

  • Friday, July 27, 2018
  • by infinum
  • Repository
  • 1 Watchers
  • 2 Stars
  • 4,496 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 18 Versions
  • 42 % Grown

The README.md

image, (*1)

Latest Stable Version Release Date of the Latest Version, (*2)

CI checks, (*3)

Minimum PHP Version Tested on PHP 7.4 to 8.3, (*4)

License: MIT Total Downloads, (*5)

Eightshift Coding Standards for WordPress

This package contains Eightshift Coding Standards for WordPress for 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., (*6)

Installation

Composer

Composer install is simple. Just run, (*7)

composer require infinum/eightshift-coding-standards, (*8)

or add to your composer.json, (*9)

"require-dev": {
  "infinum/eightshift-coding-standards": "^2.0"
}

Copy and modify the configuration file into your project (from the project root), (*10)

cp vendor/infinum/eightshift-coding-standards/phpcs.xml.dist.sample phpcs.xml.dist 

Then, run the following command to run the standards checks in your project:, (*11)

vendor/squizlabs/php_codesniffer/bin/phpcs

You can also selectively check files or directories by specifying them., (*12)

Recommendation

It's recommended that you install a Composer plugin that will handle the registration of standards with PHP_CodeSniffer., (*13)

Working in IDE

Sublime Text 3

To make the sniff work in Sublime Text 3, you need to have sublime linter set up, and add phpcs linter., (*14)

Then in your settings you need to reference the path to the coding standards. It should look something like this, (*15)

"paths": {
    "linux": [],
    "osx": [
        "${project}/vendor/bin/",
        "/Users/user_name/wpcs/vendor/bin"
    ],
    "windows": []
},

The path depends on where you've installed your standards. Then in the linters user settings you'll need to add in the linters key, (*16)

"phpcs": {
    "@disable": false,
    "args": [],
    "excludes": [],
    "standard": "Eightshift"
},

Or set the standard to point to the phpcs.xml.dist in your root folder (preferred method), (*17)

"phpcs": {
    "@disable": false,
    "args": [],
    "excludes": [],
    "standard": "$folder/phpcs.xml.dist"
},

Note about global installation

In your wpcs folder, when adding Eightshift folder. You can clone this repository there, be sure to comment out the <config name="installed_paths" value="vendor/wp-coding-standards/wpcs"/> part, so that your sniffer won't go looking for that folder., (*18)

Visual Studio Code

To set up phpcs in your VSCode, use vscode-phpcs extension. Once installed in the user settings set, (*19)

"phpcs.enable": true,
"phpcs.standard": "Eightshift",

This will look in your project's vendor folder for the Eightshift's WordPress Coding Standards, and run the sniffs on every save. You can see the issues in the Problems tab at the bottom., (*20)

Atom

To set up phpcs in the Atom editor, you need to install a couple of packages. First install the base linter package for Atom: linter. Upon completion you will be prompted to install its dependency linter-ui-default. After that install linter-phpcs., (*21)

In linter-phpcs package settings you can set the path to previously installed phpcs or allow the package to search for phpcs executable inside your project. Also, you must set the name of the standard: "Eightshift" or path to the ruleset.xml of Eightshift's WordPress Coding Standards. We recommend you to disable searching for configuration files because that can cause some other standards to be used instead., (*22)

In config.cson linter-phpcs settings can look like this:, (*23)

# If you want to use phpcs executable available in project
"linter-phpcs":
  autoConfigSearch: false
  codeStandardOrConfigFile: "Eightshift"
  disableWhenNoConfigFile: true

# If you want to use specific phpcs executable
"linter-phpcs":
  autoConfigSearch: false
  autoExecutableSearch: false
  codeStandardOrConfigFile: "Eightshift"
  disableWhenNoConfigFile: true
  executablePath: "/Users/user_name/wpcs/vendor/bin/phpcs" #For Mac users
  executablePath: "path_to_composer/vendor/bin/phpcs.bat" # For Windows users

# If you want to use specific standard
"linter-phpcs":
  autoConfigSearch: false
  codeStandardOrConfigFile: "vendor/infinum/eightshift-coding-standards/Eightshift/ruleset.xml"
  disableWhenNoConfigFile: true

Credits

Eightshift WordPress Coding Standards are maintained and sponsored by Infinum., (*24)

License

Eightshift WordPress Coding Standards are Copyright © 2023 Infinum. This is free software, and may be redistributed under the terms specified in the LICENSE file., (*25)

The Versions

27/07 2018

dev-master

9999999-dev https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

MIT GPL-2.0

The Requires

 

wordpress phpcs standards infinum eightshift

27/07 2018

0.3.1

0.3.1.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

MIT

The Requires

 

wordpress phpcs standards infinum eightshift

27/07 2018

dev-feature/update-ruleset

dev-feature/update-ruleset https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

MIT

The Requires

 

wordpress phpcs standards infinum eightshift

26/07 2018

0.3.0

0.3.0.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

MIT

The Requires

 

wordpress phpcs standards infinum eightshift

21/06 2018

0.2.8

0.2.8.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

MIT

The Requires

 

wordpress phpcs standards infinum eightshift

20/02 2018

0.2.7

0.2.7.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

MIT

The Requires

 

wordpress phpcs standards infinum eightshift

28/10 2017

0.2.6

0.2.6.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards

28/10 2017

0.2.5

0.2.5.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards

28/10 2017

0.2.4

0.2.4.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards

19/09 2017

0.2.3

0.2.3.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards

25/07 2017

0.2.2

0.2.2.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards

18/07 2017

0.2.1

0.2.1.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards

14/07 2017

0.2.0

0.2.0.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards

14/07 2017

0.1.4

0.1.4.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards

14/07 2017

0.1.3

0.1.3.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards

14/07 2017

0.1.2

0.1.2.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards

14/07 2017

0.1.1

0.1.1.0 https://github.com/infinum/coding-standards-wp

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards

07/07 2017

0.1.0

0.1.0.0 https://github.com/infinum/wp-coding-standards

Infinum WordPress Coding Standards

  Sources   Download

GPL-2.0

The Requires

 

wordpress phpcs standards