Git Product home page Git Product logo

coding-standards-1's Introduction

Modern Tribe Coding Standards

The Modern Tribe Coding Standard is a set of PHP_CodeSniffer rules for use primarily with the SquareOne framework.

Requirements

  • PHP ^8.0

Install

Composer v2:

composer require --dev moderntribe/coding-standards "^3.0"`

Composer v1:

Add to the repositories object:

    {
      "type": "vcs",
      "url": "[email protected]:moderntribe/coding-standards.git"
    }

And require-dev:

  "moderntribe/coding-standards": "^3.0"

Project ruleset

Ensure you're running PHP 8.0 locally!

To use this ruleset, create a phpcs.xml.dist in the root of the project and add the following content:

<?xml version="1.0"?>
<ruleset>
	<arg name="basepath" value="." />
	<arg name="extensions" value="php" />
	<arg name="severity" value="4" />
	<arg name="tab-width" value="4" />
	<arg name="parallel" value="80" />
	<arg name="colors" />

	<!--  Update to the PHP version your production/local docker container runs on -->
	<config name="testVersion" value="8.0" />
	<!-- php -r 'echo PHP_VERSION_ID;' -->
	<config name="php_version" value="80022" />

	<!-- Fix WordPress's terrible typing breaking PHPCS -->
	<config name="minimum_supported_wp_version" value="5.6.0" />

	<!-- Ignore warnings, show progress of the run and show sniff names -->
	<arg value="nps" />

	<!-- Directories to be checked -->
	<file>./wp-content/plugins/core</file>
	<file>./wp-content/themes/core</file>
	<file>./wp-content/mu-plugins</file>

	<!-- Exclude files -->
	<exclude-pattern>*-config.php</exclude-pattern>
	<exclude-pattern>*vendor/</exclude-pattern>
	<exclude-pattern>*tests/*</exclude-pattern>
	<exclude-pattern>*.twig</exclude-pattern>
	<exclude-pattern>*webpack/</exclude-pattern>

	<!-- Include the Modern Tribe coding standard -->
	<rule ref="ModernTribe" />
</ruleset>

Add phpcs.xml to your .gitignore

Manual Usage

PHPCS

./vendor/bin/phpcs --standard=ModernTribe /path/to/files/**.php

PHPCBF

./vendor/bin/phpcbf --standard=ModernTribe /path/to/files/**.php

Resources:

coding-standards-1's People

Contributors

defunctl avatar chrismkindred avatar

Stargazers

Kimura Yuu avatar Morpheus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.