#LIN3S CS
The coding standards in the LIN3S way.
##WHY? This package is created to centralize all the checks style of LIN3S projects, in an easy way to install all the tools and improving the maintainability. It is a flexible and customizable solution to automatize all related with coding standards. This library is focused to PHP, Javascript and Sass projects.
- Checks if Composer json has changes, the lock must be commited too.
- Fixes the PHP code with fully customizable PHP-CS-Fixer.
- Shorts the use statements and added a proper header inside PHP files with PHP-Formatter.
- Checks mess detections with PHPMD.
- Checks the Sass best practices with Scss-lint.
- Checks the code quality of Javascript files with ESLint.
This library is very focused to use as pre-commit hook so, this is the reason of Git PHP class exists. The checkers only check the files that they are going to commit, except PHP-CS-Fixer and PHP-Formatter. Apart of the checking, they fix PHP files so, the command affects to all the files that accomplish the requirements.
##Prerequisites LIN3S's CS is a PHP console application so, it requires PHP itself. Apart of it, this library has the following requirements:
- Scss-lint:
gem install scss-lint
- Eslint:
npm install -g eslint
##Getting started The recommended and the most suitable way to install is through Composer. Be sure that the tool is installed in your system and execute the following command:
$ composer require lin3s/cs
Then you have to update the composer.json
with the following code:
"scripts-dev": {
"post-update-cmd": [
"LIN3S\\CS\\Composer\\Hooks::buildDistFile",
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"LIN3S\\CS\\Composer\\Hooks::addHooks",
"LIN3S\\CS\\Composer\\Hooks::addFiles"
]
"post-install-cmd": [
"LIN3S\\CS\\Composer\\Hooks::buildDistFile",
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"LIN3S\\CS\\Composer\\Hooks::addHooks",
"LIN3S\\CS\\Composer\\Hooks::addFiles"
]
},
"extra": {
"incenteev-parameters": {
"file": ".lin3s_cs.yml",
"dist-file": ".lin3s_cs.yml.dist"
}
}
REMEMBER: The
.lin3s_cs.yml
file is generated dynamically with Composer. The best practices recommend that only track the.dist
file ignoring the.lin3s_cs.yml
inside.gitignore
. In the same way, we recommend that, also, dynamically generated.scss_lint.yml
,.eslint.yml
and.editorconfig
files, it should be ignored.