Contributing ++

This commit is contained in:
Stefan Kalscheuer 2018-01-20 12:34:32 +01:00
parent b8b1dc83de
commit 7329574d09

View File

@ -2,7 +2,7 @@
As for all great Open Source projects, contributions in form of bug reports and code are welcome and important to keep the project alive. As for all great Open Source projects, contributions in form of bug reports and code are welcome and important to keep the project alive.
In general, this project follows the [Git Flow](https://guides.github.com/introduction/flow/). In general, this project follows the [GitHub Flow](https://guides.github.com/introduction/flow/).
Fork the project, commit your changes to your branch, open a pull request and it will probably be merged. Fork the project, commit your changes to your branch, open a pull request and it will probably be merged.
However, to ensure maintainability and quality of the code, there are some guidelines you might be more or less familiar with. However, to ensure maintainability and quality of the code, there are some guidelines you might be more or less familiar with.
For that purpose, this document describes the important points. For that purpose, this document describes the important points.
@ -14,7 +14,7 @@ If you experience any issues with the plugin or the code, don't hesitate to file
### Bug Reports ### Bug Reports
Think you found a bug? Think you found a bug?
Please clearly state what happens and describe your environment. Please clearly state what happens and describe your environment to help tracking down the issue.
* Which version of the plugin are you running? * Which version of the plugin are you running?
* Which version of WordPress? * Which version of WordPress?
@ -31,7 +31,7 @@ No problem, please open an issue and describe what and why you think this change
If you want to contribute your code to solve an issue or implement a desired feature yourself, you might open a pull request. If you want to contribute your code to solve an issue or implement a desired feature yourself, you might open a pull request.
If the changes introduce new functionality or affect major parts of existing code, please consider opening an issue for discussion first. If the changes introduce new functionality or affect major parts of existing code, please consider opening an issue for discussion first.
For adding new functionality a new test case the corresponding PHPUnit test would be nice (no hard criterion). For adding new functionality a new test case the corresponding PHPUnit test would be nice (no hard criterion though).
### Branches ### Branches
@ -39,7 +39,7 @@ The `master` branch represents the current state of development.
Please ensure your initial code is up to date with it at the time you start development. Please ensure your initial code is up to date with it at the time you start development.
The `master` should also be target for most pull requests. The `master` should also be target for most pull requests.
In addition, this project features a `develop` branch, which hold cutting edge developments, not necessarily considered stable or even compatible. In addition, this project features a `develop` branch, which holds bleeding edge developments, not necessarily considered stable or even compatible.
Do not expect this code to run smoothly, but you might have a look into the history to see if some work on an issue has already been started there. Do not expect this code to run smoothly, but you might have a look into the history to see if some work on an issue has already been started there.
For fixes and features, there might be additional branches, likely prefixed by `ft-` (feature) or `hf-` (hotfix) followed by an issue number (if applicable) and/or a title. For fixes and features, there might be additional branches, likely prefixed by `ft-` (feature) or `hf-` (hotfix) followed by an issue number (if applicable) and/or a title.
@ -62,7 +62,7 @@ If your patch fixes an issue, reference the ID in the first line.
If you feel like you have to _briefly_ explain your changes, do it (for long explanations and discussion, consider opening an issue or describe in the PR). If you feel like you have to _briefly_ explain your changes, do it (for long explanations and discussion, consider opening an issue or describe in the PR).
**Example commit:** **Example commit:**
``` ```text
Fix nasty bug from #1337 Fix nasty bug from #1337
This example commit fixes the issue that some people write non-speaking commit messages like 'done magic'. This example commit fixes the issue that some people write non-speaking commit messages like 'done magic'.
@ -75,7 +75,7 @@ You might sign your work, although that's no must.
Short answer: When it makes sense. Short answer: When it makes sense.
Bugfixes should be merges in time - assuming they pass the above criteria. Bugfixes should be merged in time - assuming they pass the above criteria.
New features might be assigned to a certain milestone and as a result of this be scheduled according to the planned release cycle. New features might be assigned to a certain milestone and as a result of this be scheduled according to the planned release cycle.
## Compatibility ## Compatibility
@ -88,9 +88,17 @@ If you are unsure if your code matches these versions, the test will probably te
In case you think, your change is more important than maintaining backwards compatibility, please start a discussion to see, In case you think, your change is more important than maintaining backwards compatibility, please start a discussion to see,
if we might increase the minimum version or find a workaround for legacy systems. if we might increase the minimum version or find a workaround for legacy systems.
## Build Environment
All you need to start off - besides your favorite IDE of course - is [Composer](https://getcomposer.org).
Running `composer install` will fetch all dependencies and build tools required.
You might have noticed that this project contains a [Robo](http://robo.li) build script.
Running the _build_-task (`./vendor/bin/robo build`) executes the full chain from cleanup over test to bundling the final product in the `dist` directory.
A complete list of the available tasks and options can be shown by running `robo list`.
## Unit Tests ## Unit Tests
The PHP code is tested by a PHPUnit test. The PHP code is tested by a PHPUnit tests.
All test files are located in the `test` directory. All test files are located in the `test` directory.
Files ending with `-test.php` will be automatically included into the test suite. Files ending with `-test.php` will be automatically included into the test suite.
The coverage is not yet perfect, but be invited to write tests for methods not yet covered or newly introduced by your patch. The coverage is not yet perfect, but be invited to write tests for methods not yet covered or newly introduced by your patch.
@ -102,7 +110,7 @@ Please make sure that you are at least roughly familiar with those guidelines.
The code style is automatically checked for commits (including pull requests) using [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer). The code style is automatically checked for commits (including pull requests) using [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
You can check your code against the configured ruleset yourself by running You can check your code against the configured ruleset yourself by running
`./vendor/bin/phpcs --standard=phpcs.xml your-edited-file.php` (assuming `composer install` has been executed). `./vendor/bin/phpcs --standard=phpcs.xml your-edited-file.php` (assuming `composer install` has been executed) or the Robo task `robo test:cs` for a complete scan.
Please see these standards as guidelines. Please see these standards as guidelines.
If code style this is the only test that fails and your code's semantics are fine, don't hesitate to submit your pull request anyway. If code style this is the only test that fails and your code's semantics are fine, don't hesitate to submit your pull request anyway.
@ -113,6 +121,9 @@ We probably find a solution for that.
Automated tests are run using [Travis CI](https://travis-ci.org/stklcode/statify-blacklist) for every commit including pull requests. Automated tests are run using [Travis CI](https://travis-ci.org/stklcode/statify-blacklist) for every commit including pull requests.
They ensure compatibility with the supported PHP versions and the WP Coding Standards. They ensure compatibility with the supported PHP versions and the WP Coding Standards.
There is also a semi-automated code quality analysis pushing results to [SonarCloud](https://sonarcloud.io/dashboard?id=de.stklcode.web.wordpress.plugins%3Astatify-blacklist).
Keep in mind that the ruleset is not yet perfect, so not every minor issue has to be fixed immediately.
## Still Open Questions? ## Still Open Questions?
If anything is still left unanswered and you're unsure if you got it right, don't hesitate to contact a team member. If anything is still left unanswered and you're unsure if you got it right, don't hesitate to contact a team member.