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