Derek Jones | f3ab257 | 2012-07-02 11:12:44 -0700 | [diff] [blame] | 1 | ########################### |
| 2 | Contributing to CodeIgniter |
| 3 | ########################### |
| 4 | |
David Wosnitza | ce899c9 | 2014-12-14 07:25:01 +0100 | [diff] [blame] | 5 | .. toctree:: |
| 6 | :titlesonly: |
| 7 | |
| 8 | ../documentation/index |
| 9 | ../DCO |
| 10 | |
Derek Jones | f3ab257 | 2012-07-02 11:12:44 -0700 | [diff] [blame] | 11 | CodeIgniter is a community driven project and accepts contributions of code |
| 12 | and documentation from the community. These contributions are made in the form |
Master Yoda | bd2a7e4 | 2015-03-25 02:36:31 -0700 | [diff] [blame] | 13 | of Issues or `Pull Requests <https://help.github.com/articles/using-pull-requests/>`_ |
| 14 | on the `CodeIgniter repository <https://github.com/bcit-ci/CodeIgniter>`_ on GitHub. |
Derek Jones | f3ab257 | 2012-07-02 11:12:44 -0700 | [diff] [blame] | 15 | |
| 16 | Issues are a quick way to point out a bug. If you find a bug or documentation |
| 17 | error in CodeIgniter then please check a few things first: |
| 18 | |
| 19 | - There is not already an open Issue |
| 20 | - The issue has already been fixed (check the develop branch, or look for |
| 21 | closed Issues) |
| 22 | - Is it something really obvious that you fix it yourself? |
| 23 | |
| 24 | Reporting issues is helpful but an even better approach is to send a Pull |
| 25 | Request, which is done by "Forking" the main repository and committing to your |
| 26 | own copy. This will require you to use the version control system called Git. |
| 27 | |
James L Parry | 9442ac4 | 2014-11-10 22:53:16 -0800 | [diff] [blame] | 28 | ******* |
| 29 | Support |
| 30 | ******* |
| 31 | |
| 32 | Note that GitHub is not for general support questions! |
| 33 | |
| 34 | If you are having trouble using a feature of CodeIgniter, ask for help on the forum. |
| 35 | |
David Wosnitza | ce899c9 | 2014-12-14 07:25:01 +0100 | [diff] [blame] | 36 | If you are wondering if you are using |
James L Parry | 9442ac4 | 2014-11-10 22:53:16 -0800 | [diff] [blame] | 37 | something correctly or if you have found a bug, ask on the forum first. |
| 38 | |
James L Parry | 1a162f1 | 2014-11-24 00:51:13 -0800 | [diff] [blame] | 39 | **************************** |
James L Parry | 9442ac4 | 2014-11-10 22:53:16 -0800 | [diff] [blame] | 40 | Tips for a Good Issue Report |
James L Parry | 1a162f1 | 2014-11-24 00:51:13 -0800 | [diff] [blame] | 41 | **************************** |
James L Parry | 9442ac4 | 2014-11-10 22:53:16 -0800 | [diff] [blame] | 42 | |
| 43 | Use a descriptive subject line (eg parser library chokes on commas) rather than a vague one (eg. your code broke). |
| 44 | |
| 45 | Address a single issue in a report. |
| 46 | |
| 47 | Identify the CodeIgniter version (eg 3.0-develop) and the component if you know it (eg. parser library) |
| 48 | |
| 49 | Explain what you expected to happen, and what did happen. |
| 50 | Include error messages and stacktrace, if any. |
| 51 | |
| 52 | Include short code segments if they help to explain. |
| 53 | Use a pastebin or dropbox facility to include longer segments of code or screenshots - do not include them in the issue report itself. |
| 54 | This means setting a reasonable expiry for those, until the issue is resolved or closed. |
| 55 | |
| 56 | If you know how to fix the issue, you can do so in your own fork & branch, and submit a pull request. |
| 57 | The issue report information above should be part of that. |
| 58 | |
| 59 | If your issue report can describe the steps to reproduce the problem, that is great. |
| 60 | If you can include a unit test that reproduces the problem, that is even better, as it gives whoever is fixing |
| 61 | it a clearer target! |
| 62 | |
| 63 | |
Derek Jones | f3ab257 | 2012-07-02 11:12:44 -0700 | [diff] [blame] | 64 | ********** |
| 65 | Guidelines |
| 66 | ********** |
| 67 | |
| 68 | Before we look into how, here are the guidelines. If your Pull Requests fail |
| 69 | to pass these guidelines it will be declined and you will need to re-submit |
| 70 | when you’ve made the changes. This might sound a bit tough, but it is required |
| 71 | for us to maintain quality of the code-base. |
| 72 | |
| 73 | PHP Style |
| 74 | ========= |
| 75 | |
| 76 | All code must meet the `Style Guide |
Master Yoda | bd2a7e4 | 2015-03-25 02:36:31 -0700 | [diff] [blame] | 77 | <http://www.codeigniter.com/userguide3/general/styleguide.html>`_, which is |
Derek Jones | f3ab257 | 2012-07-02 11:12:44 -0700 | [diff] [blame] | 78 | essentially the `Allman indent style |
| 79 | <http://en.wikipedia.org/wiki/Indent_style#Allman_style>`_, underscores and |
| 80 | readable operators. This makes certain that all code is the same format as the |
| 81 | existing code and means it will be as readable as possible. |
| 82 | |
| 83 | Documentation |
| 84 | ============= |
| 85 | |
| 86 | If you change anything that requires a change to documentation then you will |
| 87 | need to add it. New classes, methods, parameters, changing default values, etc |
| 88 | are all things that will require a change to documentation. The change-log |
| 89 | must also be updated for every change. Also PHPDoc blocks must be maintained. |
| 90 | |
| 91 | Compatibility |
| 92 | ============= |
| 93 | |
Andrey Andreev | 934d6d9 | 2015-01-12 15:03:10 +0200 | [diff] [blame] | 94 | CodeIgniter recommends PHP 5.4 or newer to be used, but it should be |
| 95 | compatible with PHP 5.2.4 so all code supplied must stick to this |
| 96 | requirement. If PHP 5.3 (and above) functions or features are used then |
| 97 | there must be a fallback for PHP 5.2.4. |
Derek Jones | f3ab257 | 2012-07-02 11:12:44 -0700 | [diff] [blame] | 98 | |
| 99 | Branching |
| 100 | ========= |
| 101 | |
| 102 | CodeIgniter uses the `Git-Flow |
| 103 | <http://nvie.com/posts/a-successful-git-branching-model/>`_ branching model |
| 104 | which requires all pull requests to be sent to the "develop" branch. This is |
| 105 | where the next planned version will be developed. The "master" branch will |
| 106 | always contain the latest stable version and is kept clean so a "hotfix" (e.g: |
| 107 | an emergency security patch) can be applied to master to create a new version, |
| 108 | without worrying about other features holding it up. For this reason all |
| 109 | commits need to be made to "develop" and any sent to "master" will be closed |
| 110 | automatically. If you have multiple changes to submit, please place all |
| 111 | changes into their own branch on your fork. |
| 112 | |
| 113 | One thing at a time: A pull request should only contain one change. That does |
| 114 | not mean only one commit, but one change - however many commits it took. The |
| 115 | reason for this is that if you change X and Y but send a pull request for both |
| 116 | at the same time, we might really want X but disagree with Y, meaning we |
| 117 | cannot merge the request. Using the Git-Flow branching model you can create |
| 118 | new branches for both of these features and send two requests. |
| 119 | |
| 120 | Signing |
| 121 | ======= |
| 122 | You must sign your work, certifying that you either wrote the work or |
| 123 | otherwise have the right to pass it on to an open source project. git makes |
| 124 | this trivial as you merely have to use `--signoff` on your commits to your |
| 125 | CodeIgniter fork. |
| 126 | |
| 127 | .. code-block:: bash |
| 128 | |
| 129 | git commit --signoff |
| 130 | |
| 131 | or simply |
| 132 | |
| 133 | .. code-block:: bash |
| 134 | |
| 135 | git commit -s |
| 136 | |
| 137 | This will sign your commits with the information setup in your git config, e.g. |
| 138 | |
| 139 | Signed-off-by: John Q Public <john.public@example.com> |
| 140 | |
David Wosnitza | ce899c9 | 2014-12-14 07:25:01 +0100 | [diff] [blame] | 141 | If you are using Tower there is a "Sign-Off" checkbox in the commit window. You |
| 142 | could even alias git commit to use the -s flag so you don’t have to think about |
Derek Jones | f3ab257 | 2012-07-02 11:12:44 -0700 | [diff] [blame] | 143 | it. |
| 144 | |
David Wosnitza | ce899c9 | 2014-12-14 07:25:01 +0100 | [diff] [blame] | 145 | By signing your work in this manner, you certify to a "Developer's Certificate |
Derek Jones | f3ab257 | 2012-07-02 11:12:44 -0700 | [diff] [blame] | 146 | or Origin". The current version of this certificate is in the :doc:`/DCO` file |
David Wosnitza | ce899c9 | 2014-12-14 07:25:01 +0100 | [diff] [blame] | 147 | in the root of this documentation. |