2017 © Pedro Peláez
 

library codingstyle

Coding style for Bolt projects

image

bolt/codingstyle

Coding style for Bolt projects

  • Monday, January 15, 2018
  • by bobdenotter
  • Repository
  • 8 Watchers
  • 3 Stars
  • 51,682 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 9 Versions
  • 2 % Grown

The README.md

Bolt coding style standard

PHP

Bolt tries to adhere a coding style based on PSR-2 and the Symfony2 coding standard., (*1)

CodeSniffer

To use run:, (*2)

composer require bolt/codingstyle squizlabs/php_codesniffer escapestudios/symfony2-coding-standard:^3.0@dev --dev

Add a global before require if you want to install it globally., (*3)

If installing globally you also need to configure the installed_paths:, (*4)

phpcs --config-set installed_paths "$(composer config --global data-dir)"

Then create a CodeSniffer config file named phpcs.xml.dist in your project root:, (*5)


<ruleset>
    <!-- Add color to output...umm duh -->
    <arg name="colors"/>

    <!-- Files or folders to sniff -->
    <file>src</file>
    <file>tests</file>

    <!-- Path to our coding standard folder -->
    <rule ref="vendor/bolt/codingstyle/Bolt"/>
</ruleset>

Additional changes can be made here. See CodeSniffer's annotated ruleset for more information., (*6)

phpcs.xml.dist should be committed for all developers to use.
An phpcs.xml file can also be create which takes precedence over phpcs.xml.dist for local changes. This file should be ignored from git., (*7)

Code Fixer

To use run:, (*8)

composer require bolt/codingstyle friendsofphp/php-cs-fixer --dev

Add a global before require if you want to install it globally., (*9)

Then create a config file named .php_cs.dist in your project root:, (*10)

<?php

return Bolt\CsFixer\Config::create()
    // addRules() accepts arrays and traversable objects.
    ->addRules(
        // Create Bolt's standard rules.
        Bolt\CsFixer\Rules::create()
            // Enable risky rules.
            ->risky()
            // Enable PHP 5.6, 7.0, and 7.1 rules. Methods exist for each version.
            //->php71()
    )

    // Modify existing rules or add new ones.
    ->addRules([
        'heredoc_to_nowdoc' => false,
        'mb_str_functions'  => true,
    ])

    // Add directories to scan.
    ->in('src', 'tests')
;

See their website for a list of rules and additional configuration options., (*11)

.php_cs.dist should be committed for all developers to use.
An .php_cs file can also be create which takes precedence over .php_cs.dist for local changes. This file should be ignored from git., (*12)

JavaScript

There's no explicitly written style yet, but when creating the files needed for Bolt using the grunt toolchain there's a target linting the javascript code., (*13)

The Versions

15/01 2018

dev-master

9999999-dev

Coding style for Bolt projects

  Sources   Download

MIT

The Requires

  • php ^5.5 || ^7.0

 

The Development Requires

by Gawain Lynch
by Carson Full

13/01 2018

dev-multiline-whitespace-before-semicolons

dev-multiline-whitespace-before-semicolons

Coding style for Bolt projects

  Sources   Download

MIT

The Requires

  • php ^5.5 || ^7.0

 

The Development Requires

by Gawain Lynch
by Carson Full

19/05 2017

1.0.x-dev

1.0.9999999.9999999-dev

Coding style for Bolt projects

  Sources   Download

MIT

The Requires

 

by Gawain Lynch

19/05 2017

v1.0.5

1.0.5.0

Coding style for Bolt projects

  Sources   Download

MIT

The Requires

 

by Gawain Lynch

11/12 2015

v1.0.4

1.0.4.0

Coding style for Bolt projects

  Sources   Download

MIT

The Requires

 

by Gawain Lynch

03/11 2015

v1.0.3

1.0.3.0

Coding style for Bolt projects

  Sources   Download

MIT

The Requires

 

by Gawain Lynch

03/11 2015

v1.0.2

1.0.2.0

Coding style for Bolt projects

  Sources   Download

MIT

The Requires

 

by Gawain Lynch

17/04 2015

v1.0.1

1.0.1.0

Coding style for Bolt projects

  Sources   Download

MIT

The Requires

 

by Gawain Lynch

11/04 2015

v1.0.0

1.0.0.0

PHP_CodeSniffer rule set for Bolt

  Sources   Download

MIT

by Gawain Lynch