Skip to content

Commit a36708b

Browse files
committed
Enhanced contribution guidelines robotframework#1805
1 parent 388e8f2 commit a36708b

File tree

1 file changed

+232
-74
lines changed

1 file changed

+232
-74
lines changed

CONTRIBUTING.rst

Lines changed: 232 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,265 @@
1-
How to contribute
2-
=================
3-
4-
Creating issues: reporting bugs and requesting enhancements
5-
-----------------------------------------
6-
7-
Bugs and enhancements are tracked in `Github's issue
8-
tracker <https://github.com/robotframework/robotframework/issues>`__.
9-
You can try asking first in IRC (#robotframework on irc.freenode.net) or
10-
in the `user
11-
group <https://groups.google.com/forum/#!forum/robotframework-users>`__.
12-
Make sure to look through the list of open issues first so that you
13-
don't create a duplicate. When reporting a bug, provide as much
14-
information about the bug as possible: a stack trace or error message,
15-
an example test case or keyword, a log file, and so on. When requesting
16-
an enhancement, describe your use case in as much detail as possible.
1+
Contributing to Robot Framework
2+
===============================
3+
4+
These guidelines instruct how to submit issues and contribute code to the
5+
`Robot Framework project <https://github.com/robotframework/robotframework>`_.
6+
There are also many other projects in the larger `Robot Framework ecosystem
7+
<http://robotframework.org>`_ that you can contribute to. If you notice
8+
a library to tool missing, there is hardly any better way to contribute
9+
than creating your own project.
10+
11+
.. contents::
12+
:depth: 2
13+
:local:
14+
15+
Submitting issues
16+
-----------------
17+
18+
Bugs and enhancements are tracked in the `issue tracker
19+
<https://github.com/robotframework/robotframework/issues>`_. If you are
20+
unsure is something a bug or is a feature worth implementing, you can
21+
first ask on `robotframework-users
22+
<https://groups.google.com/forum/#!forum/robotframework-users>`_ mailing
23+
list or IRC (#robotframework on irc.freenode.net). These and other
24+
similar forums, not the issue tracker, are also places where to ask general
25+
questions.
26+
27+
Before submitting a new issue, it is always a good idea to check is the
28+
same bug or enhancement already reported. If it is, please add your comments
29+
to the existing issue instead of creating a new one.
30+
31+
Reporting bugs
32+
~~~~~~~~~~~~~~
33+
34+
Explain the bug you have encountered so that others can understand it
35+
and preferably also reproduce it. Key things to have in good bug report:
36+
37+
1. Version information
38+
39+
- Robot Framework version
40+
- Python interpreter type (Python, Jython or IronPython) and version
41+
- Operating system name and version
42+
43+
2. Steps to reproduce the problem. With more complex problems it is often
44+
a good idea to create a `short, self contained, correct example (SSCCE)
45+
<http://sscce.org>`_.
46+
47+
3. Possible error message and traceback.
48+
49+
Notice that all information in the issue tracker is public. Do not include
50+
any confidential information there.
51+
52+
Enhancement requests
53+
~~~~~~~~~~~~~~~~~~~~
54+
55+
Describe the new feature and use cases for it in as much detail as possible.
56+
Especially with larger enhancements, be prepared to contribute the code
57+
in form of a pull request as explained below or to pay someone for the work.
58+
Consider also would it be better to implement this functionality as a separate
59+
tool outside the core framework.
60+
61+
Code contributions
62+
------------------
63+
64+
If you have fixed a bug or implemented an enhancement, you can contribute
65+
your changes via GitHub's pull requests. This is no restricted to code,
66+
on the contrary, fixes and enhancements to documentation_ and tests_ alone
67+
are also very valuable.
1768

1869
Choosing something to work on
19-
-----------------------------
70+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71+
72+
Often you already have a bug or an enhancement you want to work on in your
73+
mind, but you can also look at the `issue tracker`_ to find bugs and
74+
enhancements submitted by others. The issues vary significantly in complexity
75+
and difficulty, so you can try to find something that matches your skill level
76+
and knowledge.
2077

21-
Look through the `issue
22-
tracker <https://github.com/robotframework/robotframework/issues>`__ to
23-
find bugs and enhancements to work on. The issues vary significantly in
24-
complexity and difficulty, so you can try to find something that matches
25-
your skill level and knowledge.
78+
Pull requests
79+
~~~~~~~~~~~~~
2680

27-
Creating a pull request
28-
-----------------------
81+
On GitHub pull requests are the main mechanism to contribute code. They
82+
are easy to use both for the contributor and for per person accepting
83+
the contribution, and with more complex contributions it is easy also
84+
for others to join the discussion. Preconditions for creating a pull
85+
requests are having a `GitHub account <https://github.com/>`_,
86+
installing `Git <https://git-scm.com>`_ and forking the
87+
`Robot Framework project`_.
2988

30-
Github has a `good article describing pull
31-
requests <https://help.github.com/articles/using-pull-requests/>`__.
89+
GitHub has a good articles explaining how to
90+
`set up Git <https://help.github.com/articles/set-up-git/>`_,
91+
`fork a repository <https://help.github.com/articles/fork-a-repo/>`_ and
92+
`use pull requests <https://help.github.com/articles/using-pull-requests>`_
93+
so we do not need to go through them in more detail here. We do, however,
94+
recommend to create dedicated branches for pull requests instead of creating
95+
them based on the master branch. This is especially important if you plan to
96+
work on multiple pull requests at the same time.
3297

3398
Style guidelines
3499
~~~~~~~~~~~~~~~~
35100

36-
As with most Python projects, Robot Framework mostly follows
37-
`PEP-8 <https://www.python.org/dev/peps/pep-0008/>`__. When possible,
38-
write code that's easy to understand without requiring comments. Any new
39-
files you add should include the Apache License header.
101+
Robot Framework uses the general Python code conventions defined in `PEP-8
102+
<https://www.python.org/dev/peps/pep-0008/>`_. In addition to that, we try
103+
to write `idiomatic Python
104+
<http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html>`_
105+
and follow the `SOLID principles
106+
<https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)>`_ with all
107+
new code. An important guideline is that the code should be clear enough that
108+
comments are generally not needed.
40109

41-
Testing your changes
42-
~~~~~~~~~~~~~~~~~~~~
110+
Docstrings should be added to public APIs but are not needed in internal
111+
code. When docstrings are added, they should follow `PEP-257
112+
<https://www.python.org/dev/peps/pep-0257/>`_. See `API documentation`_
113+
section below for more details about documentation syntax, generating
114+
API docs, etc.
115+
116+
We are pretty picky about using whitespace. We use blank lines and whitespace
117+
in expressions as dictated by `PEP-8`_, but we also follow these rules:
118+
119+
- Indentation using spaces, not tabs.
120+
- No trailing spaces.
121+
- No extra empty lines at the end of the file.
122+
- Files must end with a newline.
123+
124+
The above rules are good with most other code too. Any good editor or IDE
125+
can be configured to automatically format files according to them.
126+
127+
Documentation
128+
~~~~~~~~~~~~~
129+
130+
With new features adequate documentation is as important as the actual
131+
functionality. Different documentation is needed depending on the issue.
132+
133+
User Guide
134+
''''''''''
135+
136+
Robot Framework's features are explained in the `User Guide
137+
<http://robotframework.org/robotframework/#user-guide>`_. It is generated
138+
using a custom script based on the source in `reStructuredText
139+
<http://docutils.sourceforge.net/rst.html>`_ format. For more details about
140+
editing and generating it see `<doc/userguide/README.rst>`_.
141+
142+
Libraries
143+
'''''''''
144+
145+
If `standard libraries
146+
<http://robotframework.org/robotframework/#standard-libraries>`_ distributed
147+
with Robot Framework are enhanced, also their documentation needs to
148+
be updated. Keyword documentation is created using docstrings and it must
149+
use Robot's own `documentation formatting
150+
<http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#documentation-formatting>`_.
151+
152+
Examples are recommend whenever the new keyword or enhanced functionality is
153+
not trivial. All new enhancements or changes should have a note like
154+
``New in Robot Framework 2.9.`` somewhere in the documentation. Existing
155+
documentation can be used as an example.
156+
157+
Library documentation can be created using `<doc/libraries/lib2html.py>`_
158+
script and should be verified before the code is committed.
159+
160+
API documentation
161+
'''''''''''''''''
162+
163+
Modules and classes defined to be public should have API documentation.
164+
We do not generally use API docs with internal code because it is so hard
165+
to keep the docs in sync with the code. Instead we try to keep the code
166+
as clean and easy to understand as possible.
167+
168+
API docs are created using docstrings following guidelines defined in
169+
`PEP-257`_. They are converted to HTML using `Sphinx <http://sphinx-doc.org/>`_
170+
and its `autodoc <http://sphinx-doc.org/ext/autodoc.html>`_ extension.
171+
Documentation can be created locally using `<doc/api/generate.py>`_ script
172+
that unfortunately creates a lot of errors on the console. Releases API docs
173+
are visible at https://robot-framework.readthedocs.org/.
43174

44-
There are two sets of tests within Robot Framework: ``atest`` and
45-
``utest``. When submitting a pull request, you should always include
46-
tests for your changes. These tests prove that your changes work, help
47-
prevent bugs in the future, and help document what your changes do. Make
48-
sure to run all of the tests before submitting a pull request to be sure
49-
that your changes don't break anything. If you can, test in multiple
50-
environments and interpreters (Windows, Linux, OS X, python, jython,
51-
ironpython, etc).
175+
.. note:: Robot Framework's public API docs are lacking in many ways.
176+
Documentation improvements are highly appreciated!
52177

53-
Acceptance tests (atest)
54-
^^^^^^^^^^^^^^^^^^^^^^^^
178+
Tests
179+
~~~~~
55180

56-
This is a set of tests for Robot Framework written using Robot
57-
Framework. See the `README <atest/README.rst>`__ for more details. If
58-
possible, the tests for your pull request should be acceptance tests.
181+
When submitting a pull request with a new feature or a fix, you should
182+
always include tests for your changes. These tests prove that your changes
183+
work, help prevent bugs in the future, and help document what your changes
184+
do. Depending an the change, you may need `acceptance tests`_, `unit tests`_
185+
or both.
59186

60-
Unit tests (utest)
61-
^^^^^^^^^^^^^^^^^^
187+
Make sure to run all of the tests before submitting a pull request to be sure
188+
that your changes do not break anything. If you can, test in multiple
189+
environments and interpreters (Windows, Linux, OS X, Python, Jython,
190+
IronPython, etc). Pull requests are also automatically tested on `continuous
191+
integration`_.
62192

63-
This is a set of tests for Robot Framework written using Python's
64-
``unittest`` module. See the `README <utest/README.rst>`__ for more
65-
details.
193+
Acceptance tests
194+
''''''''''''''''
195+
196+
Most of Robot Framework's testing is done using acceptance tests that
197+
naturally use Robot Framework itself for testing. Every new functionality
198+
or fix affecting should generally get one or more acceptance tests.
199+
See `<atest/README.rst>`_ for more details for more details about creating
200+
and executing them.
201+
202+
Unit tests
203+
''''''''''
204+
205+
Unit tests are great for testing internal logic and should be added when
206+
appropriate. For more details see `<utest/README.rst>`_.
66207

67208
Continuous integration
68-
~~~~~~~~~~~~~~~~~~~~~~
209+
''''''''''''''''''''''
210+
211+
Robot Framework's continuous integration (CI) servers are visible through
212+
http://robot.radiaatto.ri.fi/. They automatically test all new commits
213+
to the repository both on Linux and on Windows, and pull requests can be
214+
tested there too.
69215

70216
When a new pull request comes in, the CI will ask if one of the admins
71217
can verify the pull request. The admins are currently @jussimalinen and
72218
@pekkaklarck. The commands are:
73219

74220
- ``robotci: once`` (run once)
75-
- ``robotci: enable`` (run when ever this pull request changes)
221+
- ``robotci: enable`` (run whenever this pull request changes)
76222
- ``robotci: whitelist user`` (enable CI for all pull requests coming
77223
from this user)
78224

79225
The commands can be anywhere on the comment. Adding the skip statement
80226
(``[skip ci]``, with the square brackets) to the pull request body will
81-
cause the job not to run.
227+
cause the job not to executed.
228+
229+
Finalizing pull requests
230+
~~~~~~~~~~~~~~~~~~~~~~~~
231+
232+
Once you have code, documentation and tests ready, it is time to finalize
233+
the pull request.
82234

83235
AUTHORS.txt
84-
~~~~~~~~~~~
236+
'''''''''''
85237

86-
Add yourself to ``AUTHORS.txt`` if you'd like credit for your changes.
238+
If you have done any non-trivial change and would like to be credited,
239+
add yourself to `<AUTHORS.txt>`_ file.
87240

88-
Documentation
89-
~~~~~~~~~~~~~
241+
Resolving conflicts
242+
'''''''''''''''''''
243+
244+
Conflicts can occur if there are mew changes to the master that touch the
245+
same code as your changes. In that case you should `sync your fork
246+
<https://help.github.com/articles/syncing-a-fork>`_ and `resolve conflicts
247+
<https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line>`_
248+
to allow for an easy merge.
249+
250+
The most common conflicting file is the aforementioned `AUTHORS.txt`_, but
251+
luckily fixing those conflicts is typically easy.
252+
253+
Squashing commits
254+
'''''''''''''''''
255+
256+
If the pull request contains multiple commits, it is recommended that you
257+
squash them into a single commit before the pull request is merged.
258+
See `Squashing Github pull requests into a single commit
259+
<http://eli.thegreenplace.net/2014/02/19/squashing-github-pull-requests-into-a-single-commit>`_
260+
article for more details about why and how.
90261

91-
If your changes modify Robot Framework's behavior in any way, or if
92-
you're contributing documentation, see the `documentation
93-
README <doc/userguide/README.rst>`__. The libraries that come with Robot
94-
Framework (``BuiltIn``, ``Collections``, etc.) have keyword docstrings
95-
that serve as their documentation. Make sure to update these if
96-
necessary. Functions and methods intended for internal use only
97-
generally do not require docstrings as long as they are written clearly
98-
enough that their purpose can be understood by reading their code.
99-
100-
Squashing and resolving conflicts
101-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102-
103-
When your pull request has been accepted for merging by the project
104-
owners, if you have a lot of commits, you should `squash your
105-
commits <http://eli.thegreenplace.net/2014/02/19/squashing-github-pull-requests-into-a-single-commit>`__.
106-
If your pull request has conflicts with master, rebase your changes with
107-
master to allow for an easy merge.
262+
Squashing is especially important if the pull request contains lof ot
263+
temporary commits and changes that have been later reverted or redone.
264+
Squashing is not needed if the commit history is clean and individual
265+
commits are meaningful alone.

0 commit comments

Comments
 (0)