Lints your silverstripe php code, checks for potential bugs.
composer require --dev sunnysideup/easy-coding-standards:dev-master
composer global require sunnysideup/easy-coding-standards:dev-master
composer global update
~/.bashrc
(or otherwise):PATH=~/.composer/vendor/bin:$PATH
PATH=~/.config/composer/vendor/bin:$PATH
To make the composer vendor/bin
available anywhere
now you should be able to run it from anywhere like this:
sslint-ecs [dir]
Once intalled you can run some simple commands to lint your Silverstripe (and other) code.
Make sure to always run from root of project, even if you are linting a vendor module.
All commands take one parameter: the dir you wan to lint.
The default is app/src
.
vendor/bin/sslint-ecs [dir]
If installed globally:
sslint-ecs [dir]
vendor/bin/sslint-stan [dir]
If installed globally:
sslint-stan [dir]
vendor/bin/sslint-compat [dir]
If installed globally:
sslint-compat [dir]
vendor/bin/sslint-all [dir]
If installed globally:
sslint-all [dir]
If you install js standards, like this (you may need to use sudo
):
npm install standard --global
Then you can the following command to fix your js:
vendor/bin/sslint-js [dir]
If installed globally:
sslint-js [dir]
You may need to set the right directory - e.g.
On top of your code dir you can add one config file:
sslint-ecs -a myproject/_config.php foo/bar
default: app/_config.php
This is only relevant for sslint-stan
.
1 = only show serious worries,
6 = show all issues.
default: 4
sslint-stan -l 2 foo/bar
This is only relevant for sslint-compat
.
default: 7.4
sslint-compat -p 7.3 foo/bar
Git commit message. This is used by the sslint-all
command.
This is used by the sslint-ecs
command.
Set an alternative location for the Easy Coding Standards config file.
This is used by the sslint-stan
command.
Set an alternative location for the PHP Stan config file.
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem