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