1 # CONTRIBUTING GUIDELINES
3 Here are some guidelines for people who want to contribute their code
6 ## Make separate commits for logically separate changes.
8 ## Run the pre-commit checks before committing
12 ## Be picky about whitespace
14 This project is very picky about code style.
15 The style here is the standard Python PEP-8 style:
17 http://www.python.org/dev/peps/pep-0008/
19 * Follow the same style as the existing code.
21 * Use 4-space indents.
23 * Use `variable_names_with_underscores`, AKA "snake case" naming.
24 No camelCase. The only exception is when overriding Qt functions.
26 * Do not introduce trailing whitespace. The "Diff" viewer displays
27 trailing whitespace in red, or you can use "git diff --check".
29 * If you use SublimeText, configure `newline_at_eof_on_save` to true.
31 https://robots.thoughtbot.com/no-newline-at-end-of-file
33 ## Describe your changes well.
35 The first line of the commit message should be a short description (50
36 characters is the soft limit, see DISCUSSION in git-commit(1)), and
37 should skip the full stop. It is also conventional in most cases to
38 prefix the first line with "area: " where the area is a filename or
39 identifier for the general area of the code being modified, e.g.
41 * push: allow pushing to multiple remotes
43 * grep: allow passing in command-line arguments
45 If in doubt which identifier to use, run "git log --no-merges" on the
46 files you are modifying to see the current conventions.
48 The body should provide a meaningful commit message, which:
50 * explains the problem the change tries to solve, iow, what is wrong
51 with the current code without the change.
53 * justifies the way the change solves the problem, iow, why the
54 result with the change is better.
56 * alternate solutions considered but discarded, if any.
58 Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
59 instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
60 to do frotz", as if you are giving orders to the codebase to change
61 its behaviour. Try to make sure your explanation can be understood
62 without external resources. Instead of giving a URL to a mailing list
63 archive, summarize the relevant points of the discussion.
65 If you like, you can put extra tags at the end:
67 * "Reported-by:" is used to credit someone who found the bug that
68 the patch attempts to fix.
70 * "Acked-by:" says that the person who is more familiar with the area
71 the patch attempts to modify liked the patch.
73 * "Reviewed-by:", unlike the other tags, can only be offered by the
74 reviewer and means that she is completely satisfied that the patch
75 is ready for application. It is usually offered only after a
78 * "Tested-by:" is used to indicate that the person applied the patch
79 and found it to have the desired effect.
81 You can also create your own tag or use one that's in common usage
82 such as "Thanks-to:", "Based-on-patch-by:", or "Helped-by:".
86 To improve tracking of who did what, we've borrowed the
87 "sign-off" procedure from the Linux kernel project on patches
88 that are being emailed around. Although core Git is a lot
89 smaller project it is a good discipline to follow it.
91 The sign-off is a simple line at the end of the explanation for
92 the patch, which certifies that you wrote it or otherwise have
93 the right to pass it on as an open-source patch. The rules are
94 pretty simple: if you can certify the below:
96 Developer's Certificate of Origin 1.1
98 By making a contribution to this project, I certify that:
100 (a) The contribution was created in whole or in part by me and I
101 have the right to submit it under the open source license
102 indicated in the file; or
104 (b) The contribution is based upon previous work that, to the best
105 of my knowledge, is covered under an appropriate open source
106 license and I have the right under that license to submit that
107 work with modifications, whether created in whole or in part
108 by me, under the same open source license (unless I am
109 permitted to submit under a different license), as indicated
112 (c) The contribution was provided directly to me by some other
113 person who certified (a), (b) or (c) and I have not modified
116 (d) I understand and agree that this project and the contribution
117 are public and that a record of the contribution (including all
118 personal information I submit with it, including my sign-off) is
119 maintained indefinitely and may be redistributed consistent with
120 this project or the open source license(s) involved.
122 then you just add a line saying
124 Signed-off-by: Random J Developer <random@developer.example.org>
126 This line can be automatically added by Git if you run the git-commit
127 command with the -s option, or using the `Ctrl+i` hotkey in git-cola's
128 commit message editor.
130 Notice that you can place your own Signed-off-by: line when
131 forwarding somebody else's patch with the above rules for
132 D-C-O. Indeed you are encouraged to do so. Do not forget to
133 place an in-body "From: " line at the beginning to properly attribute
134 the change to its true author (see (2) above).
136 Also notice that a real name is used in the Signed-off-by: line. Please
137 don't hide your real name.
141 Please read [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html)
142 for some general tips on bug reporting.
144 ## Internationalization and Localization
146 git-cola is translated to several languages. When strings are presented to
147 the user they must use the `N_('<string>')` function so that `<string>` is
148 translated into a localized string.
150 The translation message files are the `*.po` files in the `po/` directory.
151 Adding a new translation entails creating a new language-specific `.po` file
152 and building the translation files using "make". The `share/locale/`
153 directory tree is generated by "make" from the `po/*` source files.
155 When new (untranslated) strings are added to the project, the `git-cola.pot`
156 base template and the language-specific message files need to be updated with
159 To regenerate `git-cola.pot` and update `.po` files with new strings run:
163 This will update `.po` files with untranslated strings which translators can
164 use to translate `git-cola`.
166 Untranslated strings are denoted by an empty "" string.
168 The `.mo` files have to be regenerated after each change by running:
172 Alternate translations can be tested by setting `$LANG` when running, e.g.
174 env LANG=zh_TW ./bin/git-cola
176 The [Gettext Language Code](https://www.gnu.org/software/gettext/manual/gettext.html#Language-Codes)
177 corresponds to the `.po` filename. Country-specific suffixes use the
178 [Gettext country code](https://www.gnu.org/software/gettext/manual/gettext.html#Country-Codes).
180 We happily welcome pull requests with improvements to `git-cola`'s translations.
182 ## Fork the repo on Github and create a pull request.