2017 © Pedro Peláez
 

library standards

Library for enforcing EoneoPay coding standards against a code base

image

eoneopay/standards

Library for enforcing EoneoPay coding standards against a code base

  • Monday, July 23, 2018
  • by loyaltycorp
  • Repository
  • 4 Watchers
  • 1 Stars
  • 893 Installations
  • PHP
  • 12 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 54 % Grown

The README.md

EoneoPay Standards Library

This library provides the tools required to check a codebase against the EoneoPay coding standards., (*1)

Installation

This library is installed via composer:, (*2)

composer require --dev eonx-com/standards dev-master

Requirements

This library requires a minimum of PHP 5.6., (*3)

Compatible tools

This library will automatically run the following packages if they are found on the system. They can be installed via composer or available globally, e.g. installed via brew., (*4)

Package Purpose
Copy/Paste Detector Detect code duplication
Paratest Run unit tests in parallel
PHP CodeSniffer Check code style
PHP CS Fixer Standardise code style
PHP Mess Detector Check coding best practices
PHPStan Static analysis of code to detect potential errors
PHPUnit Run unit tests
Security Checker Check project's dependencies for known vulnerabilities

It's recommended you also install the following extensions for PHP., (*5)

Extension Purpose
Xdebug Calculate code coverage of unit tests

Checking your codebase

You can simply run es from the vendor directory to check your code base, any packages which are installed will be run automatically., (*6)

bash vendor/bin/es

Any php files in the app/, src/ or tests/ directories of your application or library will be checked by default. If change detection is used a partial scan will be performed where possible., (*7)

Forcing a full scan

You may want to run a full scan while using change detection. You can pass the -f flag to force a full scan., (*8)

bash vendor/bin/es -f

Running a verbose scan

You may want to run a scan which shows all actions taken and their outcomes. You can pass the -v flag to force a verbose scan., (*9)

bash vendor/bin/es -v

Configuration

You can fine tune the configuration by adding an standards.cfg file to the root directory of your application or library and adjusting the following variables:, (*10)

# Comma separated paths to files to check, absolute or relative to working directory
PATHS=app,src,tests

########## CHANGE DETECTION CONFIGURATION ##########
# The primary branch for your repository which feature branches are merged into
CD_PRIMARY_BRANCH=development
# Branches which a full scan of the paths above should be performed
CD_FULL_SCAN_BRANCHES=master,${CD_PRIMARY_BRANCH}

########## PHP COPY/PASTE DETECTOR CONFIGURATION ##########
# Whether or not to run php copy/paste detector, will run if phpcpd binary is found
PHPCPD_ENABLED=true
# A comma seperated list of regexes to exclude from copy/paste detection
PHPCPD_EXCLUDE_REGEX=
# The minimum number of lines which need to be duplicated to count as copy/paste
PHPCPD_MIN_LINES=5
# The minimum number of duplicated tokens within a line to count as copy/paste
PHPCPD_MIN_TOKENS=70

########## PHP CODE SNIFFER CONFIGURATION ##########
# Whether or not to run php code sniffer, will run if phpcs binary is found
PHPCS_ENABLED=true
# The standards to compare code against, will be ignored if phpcs.xml exists
PHPCS_STANDARDS=vendor/eoneopay/standards/php-code-sniffer/EoneoPay
# Whether to show the code sniffs name on report output
PHPCS_SHOW_SNIFF_NAME=true

########## PHP CS FIXER CONFIGURATION ##########
# Whether or not to run php code sniffer, will run if phpcs binary is found
PHPCS_FIXER_ENABLED=true
# Default rules to be used when no .php_cs file exists in the project
PHPCS_FIXER_RULES='@PSR2,trailing_comma_in_multiline_array'

########## PHP MESS DETECTOR CONFIGURATION ##########
# Whether or not to run php mess destector, will run if phpmd binary is found
PHPMD_ENABLED=true
# The rulesets to use to determine issues, will be ignored if phpmd.xml exists
PHPMD_RULESETS=cleancode,codesize,controversial,design,naming,unusedcode

########## PHPSTAN CONFIGURATION ##########
# Whether or not to run phpstan, will run if phpstan binary is found
PHPSTAN_ENABLED=true
# The reporting level, 1 = loose, 7 = strict
PHPSTAN_REPORTING_LEVEL=7

########## PHPUNIT CONFIGURATION ##########
# Whether or not to run phpunit, will run if paratest or phpunit binary is found
PHPUNIT_ENABLED=true
# Whether or not to enable code coverage checks
PHPUNIT_ENABLE_CODE_COVERAGE=true
# The minimum percentage of coverage to have, will be ignored if coverage check is disabled
PHPUNIT_COVERAGE_MINIMUM_LEVEL=90
# The testsuites to run with coverage
PHPUNIT_COVERAGE_TEST_SUITES=
# The path to output junit parseable log file, can be relative, will be ignored if left blank
PHPUNIT_JUNIT_LOG_PATH=
# The directory containing tests, will be ignored it phpunit.xml exists in working directory
PHPUNIT_TEST_DIRECTORY=tests
# The test suites to run, will run all tests if not specified
PHPUNIT_TEST_SUITES=

########## SECURITY CHECKER CONFIGURATION ##########
# Whether or not to run security-checker, will run if security-checker binary is found
SECURITY_CHECKER_ENABLED=true

Tool configuration

You can also configure individual tools by adding configuration files to the root directory of your application or library., (*11)

Package Filename
Paratest phpunit.xml
PHP CodeSniffer phpcs.xml
PHP CS Fixer .php_cs
PHP Mess Detector phpmd.xml
PHPStan phpstan.neon
PHPUnit phpunit.xml

The Versions

23/07 2018

dev-master

9999999-dev

Library for enforcing EoneoPay coding standards against a code base

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

standards eoneopay

11/07 2018

dev-function-comment-sniff

dev-function-comment-sniff

Library for enforcing EoneoPay coding standards against a code base

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

standards eoneopay