Skip to content
Jorge Lilao edited this page Sep 27, 2020 · 18 revisions

Contributing

If you detect an error and want to contribute by fixing it or want to add a new feature, you are free to do so. Please, read this document carefully.

  1. Php Minimum Compatibility
  2. Create a Feature Branch
  3. Check Static Code
  4. Add tests
  5. CI Pipelines
  6. Resume

1. Php Minimum Compatibility

At this moment the php minimum compatibility is with php 7.1. Please, the modified/added code must runt in this version.

2. Create a Feature Branch

For ask for a pull request you must add your changes in a feature branch. Please, don't make a pull request from master.

3. Check Static Code

PSR-12 Coding Standard

GitHooks follow PSR12 guidelines. This standad is implemented by PHp Code Sniffer (which is a dev dependency) and the complete ruleset is qa/psr12-ruleset.xml. For check if your changes are folling too PSR12, you can to launch GitHooks in this way:

php bin/githooks tool:phpcs

This fix all autofixable errors and show you the non fixable.

Php Mess Detector

In the same form of Phpcs, GitHooks apply somo rules from Phpmd (phpmd-ruleset.xml).

Only the src code will be checked with Phpmd:

php bin/githooks tool:phpmd

Php Stan

GitHooks pass 8 levels from phpstan. For check the code you can execute:

php bin/githooks tool:phpstan

Launch All Code Analyzers

You can launch all code analyzers (phpcs, phpmd, phpstan) with the project configuration just with one command:

php bin/githooks tool:all

4. Add tests

Add or modify the tests you think be needed. For run the complete test suite you can execute vendor/bin/phpunit. Please, don't ask for pull request without tests which check the new feature.

5. CI Pipelines

GitHooks has two pipeline flows:

  1. Feature flow (for feature branches)
    • Check php sintaxs and phpcs, phpmd and phpstan errors.
    • Launch the test suite on Linux with php 7.4.
  2. Master (for master branch)
    • Check php sintaxs and phpcs, phpmd and phpstan errors.
    • Launch the test suite on Linux, Windows and Mac with all php versions supported (7.1, 7.2, 7.3 and 7.4).

When you request for merge your feature branch with master you must ensure that your feature pipeline pass.

6. Resume

  • Create feature branches. Don't ask us to pull from your master branch.
  • Check the code. You can run php bin/githooks tool:all.
  • Add tests! Your patch won't be accepted if it doesn't have tests. You can run vendor/bin/phpunit.
  • Feature flow must pass.

Documentation

2.x Documentation (actual)
3.x Documentation (work in progress)

Contributing

Clone this wiki locally