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