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