documentation update + code fixes

This commit is contained in:
Antonio Ramirez
2017-06-11 23:25:51 +02:00
parent 4dedf111a1
commit 7344ad31df
91 changed files with 1699 additions and 827 deletions

View File

@ -0,0 +1,60 @@
Clean Code
==========
We have added some development tools for you to contribute to the library with clean code:
- **PHP mess detector**: Takes a given PHP source code base and look for several potential problems within that source.
- **PHP code sniffer**: Tokenizes PHP, Javascript and CSS files and detectes violations of a defined set of coding
standards.
- **PHP code fixer**: Analyzes some PHP source code and tries to fix coding standards issues.
- **Tests**: Well, everybody knows why tests exists.
Using PHP mess detector
-----------------------
PHP mess detector takes a given PHP source code base and look for several potential problems within that source. The
following is a sample usage with all options available:
```bash
./vendor/bin/phpmd ./src text codesize,unusedcode,naming,design,controversial,cleancode
```
For further information, please visit [PHP mess detector documentation](https://phpmd.org/)
Using PHP code sniffer
----------------------
Global settings file: `phpcs.xml.dist` (added into Git)
Local settings file (you can add it locally): `phpcs.xml` (ignored by Git)
- Run checking by `PHP_CodeSniffer`: `./vendor/bin/phpcs`
- Show check report in patch form: `./vendor/bin/phpcs --report=diff`
- Automatically fix all fixable issues: `./vendor/bin/phpcbf`
For further information, please visit [squizlabs/PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)
Using PHP code fixer
--------------------
Global settings file: `.php_cs.dist` (added into Git)
Local settings file (you can add it locally): `.php_cs` (ignored by Git)
- Run checking by `PHP-CS-Fixer`: `./vendor/bin/php-cs-fixer --config=.php_cs.dist fix ./src --dry-run`
- Automatically fix all fixable issues: ` ./vendor/bin/php-cs-fixer --config=.php_cs.dist fix ./src`
For further information, please visit [FriendsOfPHP/PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer)
Running Tests
-------------
We are using `Codeception` for testing the module. Do the following:
- Create a `yii2-usuario-test` database.
- Add database access configuration `tests/_app/config/db.php`
- Run `./vendor/bin/codecept build`
- Run `./vendor/bin/codecept functional`
We still need to add `unit` tests to the module. Feel free to add your tests to it as long as it makes use of
`Codeception`.
© [2amigos](http://www.2amigos.us/) 2013-2017

View File

@ -0,0 +1,30 @@
# How to contribute
Contributions are **welcome** and will be fully **credited**.
We accept contributions via Pull Requests on [Github](https://github.com/2amigos/yii2-usuario).
## Pull Requests
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
- **Add tests!** - Your new features won't be accepted if it doesn't have tests.
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
- **Create feature branches** - Don't ask us to pull from your master branch.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
## Clean Code
- Follow the guidelines at [Clean Code](clean-code.md)
© [2amigos](http://www.2amigos.us/) 2013-2017