natepage/standards

Package to run coding standards tests.

Installs: 114

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 3

Forks: 2

Open Issues: 0

Type:package

dev-master 2018-11-27 03:39 UTC

This package is auto-updated.

Last update: 2024-11-27 17:15:48 UTC


README

This package is an easy-to-use all in one coding standards package. It allows you in just a few seconds to check your code against the most popular tools in terms of code quality and have a clear answer about: Are you a champion? Or do you still need improve? (Don't worry if you're reading this, you're already a champion!)

Installation

Standards is a package to use during your development process, you can install it using Composer.

Inside one project

Use composer to add the package as a dev dependency:

composer require --dev natepage/standards

You can now run the standards tools as:

cd my-project
php vendor/bin/standards

Multiple projects

If you are working on multiple projects at the same time (which is surely the case for a champion), you can install the package as a global dependency and run it in all your projects:

composer global require natepage/standards

To make your life easier you can set Standards as a local binary to have an handy way to run it from anywhere:

# If your operating system doesn't have /usr/local/bin/ create it
mkdir /usr/local/bin

# Create a symlink of standards in your local bin
ln -s ~/.composer/vendor/natepage/standards/bin/standards /usr/local/bin/standards

Then you can run it in your projects:

cd my-project
standards # Run standards tools

cd my-project2
standards # Run standards tools

Tools

Default tools

By default, Standards comes with a collection of tools ready to go and offers you an easy way to customise the different options each tool can have. For any further information about those tools, please feel free to have a look directly at their documentation.

  • EasyCodingStandard: Easiest way to start using PHP CS Fixer and PHP_CodeSniffer with 0-knowledge
  • PHPCPD: Copy/Paste Detector (CPD) for PHP code
  • Paratest: Parallel testing for PHPUnit
  • PHPMD: Takes a given PHP source code base and look for several potential problems within that source
  • PHPStan: PHP Static Analysis Tool - discover bugs in your code without running it
  • PHPUnit: Run unit tests in PHP applications
  • SecurityChecker: PHP security vulnerabilities monitoring

Usage

Standalone

Once you've required the package using composer, inside an existing project or as a global dependency, you can run the tools on your code from your favourite terminal using the binary as follows:

# Using the link created by composer
cd my-project
php vendor/bin/standards

# Using the binary directly
cd my-project
php vendor/natepage/standards/bin/standards

Configuration

Standards offers you all the flexibility you need via a large panel of options you can configure. Most of them have default values you can override if you need to.

Configuration file

If you want to override configuration every time you run Standards, you can create a standards.yaml file at the root level of your project.

Command Input Options

When running Standards, you can at runtime pass input option to override any exposed configuration.

standards --only=phpcs,phpmd --phpcs.show-sniff-name=false

To know more about all available input options simply use the -h|-help option to display to full list.

Available Configuration