##// END OF EJS Templates
docs: separate coding/contribution guidelines...
Søren Løvborg -
r6277:50f1a6ad default
parent child Browse files
Show More
@@ -1,187 +1,191 b''
1 .. _contributing:
1 .. _contributing:
2
2
3 =========================
3 =========================
4 Contributing to Kallithea
4 Contributing to Kallithea
5 =========================
5 =========================
6
6
7 Kallithea is developed and maintained by its users. Please join us and scratch
7 Kallithea is developed and maintained by its users. Please join us and scratch
8 your own itch.
8 your own itch.
9
9
10
10
11 Infrastructure
11 Infrastructure
12 --------------
12 --------------
13
13
14 The main repository is hosted on Our Own Kallithea (aka OOK) at
14 The main repository is hosted on Our Own Kallithea (aka OOK) at
15 https://kallithea-scm.org/repos/kallithea/, our self-hosted instance
15 https://kallithea-scm.org/repos/kallithea/, our self-hosted instance
16 of Kallithea.
16 of Kallithea.
17
17
18 For now, we use Bitbucket_ for `pull requests`_ and `issue tracking`_. The
18 For now, we use Bitbucket_ for `pull requests`_ and `issue tracking`_. The
19 issue tracker is for tracking bugs, not for support, discussion, or ideas --
19 issue tracker is for tracking bugs, not for support, discussion, or ideas --
20 please use the `mailing list`_ or :ref:`IRC <readme>` to reach the community.
20 please use the `mailing list`_ or :ref:`IRC <readme>` to reach the community.
21
21
22 We use Weblate_ to translate the user interface messages into languages other
22 We use Weblate_ to translate the user interface messages into languages other
23 than English. Join our project on `Hosted Weblate`_ to help us.
23 than English. Join our project on `Hosted Weblate`_ to help us.
24 To register, you can use your Bitbucket or GitHub account. See :ref:`translations`
24 To register, you can use your Bitbucket or GitHub account. See :ref:`translations`
25 for more details.
25 for more details.
26
26
27
27
28 Getting started
28 Getting started
29 ---------------
29 ---------------
30
30
31 To get started with development::
31 To get started with development::
32
32
33 hg clone https://kallithea-scm.org/repos/kallithea
33 hg clone https://kallithea-scm.org/repos/kallithea
34 cd kallithea
34 cd kallithea
35 virtualenv ../kallithea-venv
35 virtualenv ../kallithea-venv
36 source ../kallithea-venv/bin/activate
36 source ../kallithea-venv/bin/activate
37 pip install --upgrade pip setuptools
37 pip install --upgrade pip setuptools
38 pip install -e .
38 pip install -e .
39 paster make-config Kallithea my.ini
39 paster make-config Kallithea my.ini
40 paster setup-db my.ini --user=user --email=user@example.com --password=password --repos=/tmp
40 paster setup-db my.ini --user=user --email=user@example.com --password=password --repos=/tmp
41 paster serve my.ini --reload &
41 paster serve my.ini --reload &
42 firefox http://127.0.0.1:5000/
42 firefox http://127.0.0.1:5000/
43
43
44 You can also start out by forking https://bitbucket.org/conservancy/kallithea
44 You can also start out by forking https://bitbucket.org/conservancy/kallithea
45 on Bitbucket_ and create a local clone of your own fork.
45 on Bitbucket_ and create a local clone of your own fork.
46
46
47
47
48 Running tests
48 Running tests
49 -------------
49 -------------
50
50
51 After finishing your changes make sure all tests pass cleanly. Install the test
51 After finishing your changes make sure all tests pass cleanly. Install the test
52 dependencies, then run the testsuite by invoking ``py.test`` from the
52 dependencies, then run the testsuite by invoking ``py.test`` from the
53 project root::
53 project root::
54
54
55 pip install -r dev_requirements.txt
55 pip install -r dev_requirements.txt
56 py.test
56 py.test
57
57
58 Note that testing on Python 2.6 also requires ``unittest2``.
58 Note that testing on Python 2.6 also requires ``unittest2``.
59
59
60 You can also use ``tox`` to run the tests with all supported Python versions
60 You can also use ``tox`` to run the tests with all supported Python versions
61 (currently Python 2.6--2.7).
61 (currently Python 2.6--2.7).
62
62
63 When running tests, Kallithea uses `kallithea/tests/test.ini` and populates the
63 When running tests, Kallithea uses `kallithea/tests/test.ini` and populates the
64 SQLite database specified there.
64 SQLite database specified there.
65
65
66 It is possible to avoid recreating the full test database on each invocation of
66 It is possible to avoid recreating the full test database on each invocation of
67 the tests, thus eliminating the initial delay. To achieve this, run the tests as::
67 the tests, thus eliminating the initial delay. To achieve this, run the tests as::
68
68
69 paster serve kallithea/tests/test.ini --pid-file=test.pid --daemon
69 paster serve kallithea/tests/test.ini --pid-file=test.pid --daemon
70 KALLITHEA_WHOOSH_TEST_DISABLE=1 KALLITHEA_NO_TMP_PATH=1 py.test
70 KALLITHEA_WHOOSH_TEST_DISABLE=1 KALLITHEA_NO_TMP_PATH=1 py.test
71 kill -9 $(cat test.pid)
71 kill -9 $(cat test.pid)
72
72
73 In these commands, the following variables are used::
73 In these commands, the following variables are used::
74
74
75 KALLITHEA_WHOOSH_TEST_DISABLE=1 - skip whoosh index building and tests
75 KALLITHEA_WHOOSH_TEST_DISABLE=1 - skip whoosh index building and tests
76 KALLITHEA_NO_TMP_PATH=1 - disable new temp path for tests, used mostly for testing_vcs_operations
76 KALLITHEA_NO_TMP_PATH=1 - disable new temp path for tests, used mostly for testing_vcs_operations
77
77
78 You can run individual tests by specifying their path as argument to py.test.
78 You can run individual tests by specifying their path as argument to py.test.
79 py.test also has many more options, see `py.test -h`. Some useful options
79 py.test also has many more options, see `py.test -h`. Some useful options
80 are::
80 are::
81
81
82 -k EXPRESSION only run tests which match the given substring
82 -k EXPRESSION only run tests which match the given substring
83 expression. An expression is a python evaluable
83 expression. An expression is a python evaluable
84 expression where all names are substring-matched
84 expression where all names are substring-matched
85 against test names and their parent classes. Example:
85 against test names and their parent classes. Example:
86 -x, --exitfirst exit instantly on first error or failed test.
86 -x, --exitfirst exit instantly on first error or failed test.
87 --lf rerun only the tests that failed at the last run (or
87 --lf rerun only the tests that failed at the last run (or
88 all if none failed)
88 all if none failed)
89 --ff run all tests but run the last failures first. This
89 --ff run all tests but run the last failures first. This
90 may re-order tests and thus lead to repeated fixture
90 may re-order tests and thus lead to repeated fixture
91 setup/teardown
91 setup/teardown
92 --pdb start the interactive Python debugger on errors.
92 --pdb start the interactive Python debugger on errors.
93 -s, --capture=no don't capture stdout (any stdout output will be
93 -s, --capture=no don't capture stdout (any stdout output will be
94 printed immediately)
94 printed immediately)
95
95
96
96
97 Coding/contribution guidelines
97 Contribution guidelines
98 ------------------------------
98 -----------------------
99
99
100 Kallithea is GPLv3 and we assume all contributions are made by the
100 Kallithea is GPLv3 and we assume all contributions are made by the
101 committer/contributor and under GPLv3 unless explicitly stated. We do care a
101 committer/contributor and under GPLv3 unless explicitly stated. We do care a
102 lot about preservation of copyright and license information for existing code
102 lot about preservation of copyright and license information for existing code
103 that is brought into the project.
103 that is brought into the project.
104
104
105 Contributions will be accepted in most formats -- such as pull requests on
106 Bitbucket, something hosted on your own Kallithea instance, or patches sent by
107 email to the `kallithea-general`_ mailing list.
108
109 When contributing via Bitbucket, please make your fork of
110 https://bitbucket.org/conservancy/kallithea/ `non-publishing`_ -- it is one of
111 the settings on "Repository details" page. This ensures your commits are in
112 "draft" phase and makes it easier for you to address feedback and for project
113 maintainers to integrate your changes.
114
115 .. _non-publishing: https://www.mercurial-scm.org/wiki/Phases#Publishing_Repository
116
117 Make sure to test your changes both manually and with the automatic tests
118 before posting.
119
120 We care about quality and review and keeping a clean repository history. We
121 might give feedback that requests polishing contributions until they are
122 "perfect". We might also rebase and collapse and make minor adjustments to your
123 changes when we apply them.
124
125 We try to make sure we have consensus on the direction the project is taking.
126 Everything non-sensitive should be discussed in public -- preferably on the
127 mailing list. We aim at having all non-trivial changes reviewed by at least
128 one other core developer before pushing. Obvious non-controversial changes will
129 be handled more casually.
130
131 For now we just have one official branch ("default") and will keep it so stable
132 that it can be (and is) used in production. Experimental changes should live
133 elsewhere (for example in a pull request) until they are ready.
134
135
136 Coding guidelines
137 -----------------
138
105 We don't have a formal coding/formatting standard. We are currently using a mix
139 We don't have a formal coding/formatting standard. We are currently using a mix
106 of Mercurial (http://mercurial.selenic.com/wiki/CodingStyle), pep8, and
140 of Mercurial (http://mercurial.selenic.com/wiki/CodingStyle), pep8, and
107 consistency with existing code. Run ``scripts/run-all-cleanup`` before
141 consistency with existing code. Run ``scripts/run-all-cleanup`` before
108 committing to ensure some basic code formatting consistency.
142 committing to ensure some basic code formatting consistency.
109
143
110 We support both Python 2.6.x and 2.7.x and nothing else. For now we don't care
144 We support both Python 2.6.x and 2.7.x and nothing else. For now we don't care
111 about Python 3 compatibility.
145 about Python 3 compatibility.
112
146
113 We try to support the most common modern web browsers. IE9 is still supported
147 We try to support the most common modern web browsers. IE9 is still supported
114 to the extent it is feasible, IE8 is not.
148 to the extent it is feasible, IE8 is not.
115
149
116 We primarily support Linux and OS X on the server side but Windows should also work.
150 We primarily support Linux and OS X on the server side but Windows should also work.
117
151
118 HTML templates should use 2 spaces for indentation ... but be pragmatic. We
152 HTML templates should use 2 spaces for indentation ... but be pragmatic. We
119 should use templates cleverly and avoid duplication. We should use reasonable
153 should use templates cleverly and avoid duplication. We should use reasonable
120 semantic markup with element classes and IDs that can be used for styling and testing.
154 semantic markup with element classes and IDs that can be used for styling and testing.
121 We should only use inline styles in places where it really is semantic (such as
155 We should only use inline styles in places where it really is semantic (such as
122 ``display: none``).
156 ``display: none``).
123
157
124 JavaScript must use ``;`` between/after statements. Indentation 4 spaces. Inline
158 JavaScript must use ``;`` between/after statements. Indentation 4 spaces. Inline
125 multiline functions should be indented two levels -- one for the ``()`` and one for
159 multiline functions should be indented two levels -- one for the ``()`` and one for
126 ``{}``.
160 ``{}``.
127 Variables holding jQuery objects should be named with a leading ``$``.
161 Variables holding jQuery objects should be named with a leading ``$``.
128
162
129 Commit messages should have a leading short line summarizing the changes. For
163 Commit messages should have a leading short line summarizing the changes. For
130 bug fixes, put ``(Issue #123)`` at the end of this line.
164 bug fixes, put ``(Issue #123)`` at the end of this line.
131
165
132 Use American English grammar and spelling overall. Use `English title case`_ for
166 Use American English grammar and spelling overall. Use `English title case`_ for
133 page titles, button labels, headers, and 'labels' for fields in forms.
167 page titles, button labels, headers, and 'labels' for fields in forms.
134
168
135 .. _English title case: https://en.wikipedia.org/wiki/Capitalization#Title_case
169 .. _English title case: https://en.wikipedia.org/wiki/Capitalization#Title_case
136
170
137 Contributions will be accepted in most formats -- such as pull requests on
138 Bitbucket, something hosted on your own Kallithea instance, or patches sent by
139 email to the `kallithea-general`_ mailing list.
140
141 When contributing via Bitbucket, please make your fork of
142 https://bitbucket.org/conservancy/kallithea/ `non-publishing`_ -- it is one of
143 the settings on "Repository details" page. This ensures your commits are in
144 "draft" phase and makes it easier for you to address feedback and for project
145 maintainers to integrate your changes.
146
147 .. _non-publishing: https://www.mercurial-scm.org/wiki/Phases#Publishing_Repository
148
149 Make sure to test your changes both manually and with the automatic tests
150 before posting.
151
152 We care about quality and review and keeping a clean repository history. We
153 might give feedback that requests polishing contributions until they are
154 "perfect". We might also rebase and collapse and make minor adjustments to your
155 changes when we apply them.
156
157 We try to make sure we have consensus on the direction the project is taking.
158 Everything non-sensitive should be discussed in public -- preferably on the
159 mailing list. We aim at having all non-trivial changes reviewed by at least
160 one other core developer before pushing. Obvious non-controversial changes will
161 be handled more casually.
162
163 For now we just have one official branch ("default") and will keep it so stable
164 that it can be (and is) used in production. Experimental changes should live
165 elsewhere (for example in a pull request) until they are ready.
166
167
171
168 "Roadmap"
172 "Roadmap"
169 ---------
173 ---------
170
174
171 We do not have a road map but are waiting for your contributions. Refer to the
175 We do not have a road map but are waiting for your contributions. Refer to the
172 wiki_ for some ideas of places we might want to go -- contributions in these
176 wiki_ for some ideas of places we might want to go -- contributions in these
173 areas are very welcome.
177 areas are very welcome.
174
178
175
179
176 Thank you for your contribution!
180 Thank you for your contribution!
177 --------------------------------
181 --------------------------------
178
182
179
183
180 .. _Weblate: http://weblate.org/
184 .. _Weblate: http://weblate.org/
181 .. _issue tracking: https://bitbucket.org/conservancy/kallithea/issues?status=new&status=open
185 .. _issue tracking: https://bitbucket.org/conservancy/kallithea/issues?status=new&status=open
182 .. _pull requests: https://bitbucket.org/conservancy/kallithea/pull-requests
186 .. _pull requests: https://bitbucket.org/conservancy/kallithea/pull-requests
183 .. _bitbucket: http://bitbucket.org/
187 .. _bitbucket: http://bitbucket.org/
184 .. _mailing list: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
188 .. _mailing list: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
185 .. _kallithea-general: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
189 .. _kallithea-general: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
186 .. _Hosted Weblate: https://hosted.weblate.org/projects/kallithea/kallithea/
190 .. _Hosted Weblate: https://hosted.weblate.org/projects/kallithea/kallithea/
187 .. _wiki: https://bitbucket.org/conservancy/kallithea/wiki/Home
191 .. _wiki: https://bitbucket.org/conservancy/kallithea/wiki/Home
General Comments 0
You need to be logged in to leave comments. Login now