2018-06-29 10:39:06 +01:00
|
|
|
Contributing
|
|
|
|
============
|
|
|
|
|
|
|
|
Code
|
|
|
|
----
|
2015-03-10 13:09:31 +00:00
|
|
|
|
2018-05-14 17:21:59 +01:00
|
|
|
We welcome code contributions via GitHub pull requests. To help with
|
2015-06-03 11:58:34 +01:00
|
|
|
maintainability of the code line we ask that the code uses a coding style
|
|
|
|
consistent with the rest of WA code. Briefly, it is
|
2015-06-01 10:36:21 +01:00
|
|
|
|
|
|
|
- `PEP8 <https://www.python.org/dev/peps/pep-0008/>`_ with line length and block
|
2018-01-19 10:49:56 +00:00
|
|
|
comment rules relaxed (the wrapper for PEP8 checker inside ``dev_scripts``
|
2015-06-01 10:36:21 +01:00
|
|
|
will run it with appropriate configuration).
|
|
|
|
- Four-space indentation (*no tabs!*).
|
|
|
|
- Title-case for class names, underscore-delimited lower case for functions,
|
|
|
|
methods, and variables.
|
|
|
|
- Use descriptive variable names. Delimit words with ``'_'`` for readability.
|
|
|
|
Avoid shortening words, skipping vowels, etc (common abbreviations such as
|
|
|
|
"stats" for "statistics", "config" for "configuration", etc are OK). Do
|
|
|
|
*not* use Hungarian notation (so prefer ``birth_date`` over ``dtBirth``).
|
|
|
|
|
2018-05-14 17:21:59 +01:00
|
|
|
New extensions should also follow implementation guidelines specified in the
|
2018-05-18 10:03:20 +01:00
|
|
|
:ref:`writing-plugins` section of the documentation.
|
2015-03-10 13:09:31 +00:00
|
|
|
|
|
|
|
We ask that the following checks are performed on the modified code prior to
|
|
|
|
submitting a pull request:
|
|
|
|
|
|
|
|
.. note:: You will need pylint and pep8 static checkers installed::
|
|
|
|
|
|
|
|
pip install pep8
|
|
|
|
pip install pylint
|
|
|
|
|
2018-06-05 11:01:01 +01:00
|
|
|
It is recommended that you install via pip rather than through your
|
|
|
|
distribution's package manager because the latter is likely to
|
2015-03-10 13:09:31 +00:00
|
|
|
contain out-of-date version of these tools.
|
|
|
|
|
|
|
|
- ``./dev_scripts/pylint`` should be run without arguments and should produce no
|
|
|
|
output (any output should be addressed by making appropriate changes in the
|
|
|
|
code or adding a pylint ignore directive, if there is a good reason for
|
|
|
|
keeping the code as is).
|
|
|
|
- ``./dev_scripts/pep8`` should be run without arguments and should produce no
|
|
|
|
output (any output should be addressed by making appropriate changes in the
|
|
|
|
code).
|
2018-01-19 10:49:56 +00:00
|
|
|
- If the modifications touch core framework (anything under ``wa/framework``), unit
|
2015-03-10 13:09:31 +00:00
|
|
|
tests should be run using ``nosetests``, and they should all pass.
|
|
|
|
|
|
|
|
- If significant additions have been made to the framework, unit
|
|
|
|
tests should be added to cover the new functionality.
|
|
|
|
|
|
|
|
- If modifications have been made to documentation (this includes description
|
2018-01-19 10:49:56 +00:00
|
|
|
attributes for Parameters and Extensions), documentation should be built to
|
2015-03-10 13:09:31 +00:00
|
|
|
make sure no errors or warning during build process, and a visual inspection
|
|
|
|
of new/updated sections in resulting HTML should be performed to ensure
|
|
|
|
everything renders as expected.
|
|
|
|
|
2018-01-19 10:49:56 +00:00
|
|
|
Once you have your contribution is ready, please follow instructions in `GitHub
|
|
|
|
documentation <https://help.github.com/articles/creating-a-pull-request/>`_ to
|
2015-03-10 13:09:31 +00:00
|
|
|
create a pull request.
|
2018-06-29 10:39:06 +01:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Documentation
|
|
|
|
-------------
|
|
|
|
|
|
|
|
Headings
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
To allow for consistent headings to be used through out the document the
|
|
|
|
following character sequences should be used when creating headings
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
=========
|
|
|
|
Heading 1
|
|
|
|
=========
|
|
|
|
|
|
|
|
Only used for top level headings which should also have an entry in the
|
|
|
|
navigational side bar.
|
|
|
|
|
|
|
|
*********
|
|
|
|
Heading 2
|
|
|
|
*********
|
|
|
|
|
|
|
|
Main page heading used for page title, should not have a top level entry in the
|
|
|
|
side bar.
|
|
|
|
|
|
|
|
Heading 3
|
|
|
|
==========
|
|
|
|
|
|
|
|
Regular section heading.
|
|
|
|
|
|
|
|
Heading 4
|
|
|
|
---------
|
|
|
|
|
|
|
|
Sub-heading.
|
|
|
|
|
|
|
|
Heading 5
|
|
|
|
~~~~~~~~~
|
|
|
|
|
|
|
|
Heading 6
|
|
|
|
^^^^^^^^^
|
|
|
|
|
|
|
|
Heading 7
|
|
|
|
"""""""""
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Configuration Listings
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
To keep a consistent style for presenting configuration options, the preferred
|
|
|
|
style is to use a `Field List`.
|
|
|
|
|
|
|
|
(See: http://docutils.sourceforge.net/docs/user/rst/quickref.html#field-lists)
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
|
|
|
:parameter: My Description
|
|
|
|
|
|
|
|
Will render as:
|
|
|
|
|
|
|
|
:parameter: My Description
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
API Style
|
|
|
|
~~~~~~~~~
|
|
|
|
|
|
|
|
When documenting an API the currently preferred style is to provide a short
|
|
|
|
description of the class, followed by the attributes of the class in a
|
|
|
|
`Definition List` followed by the methods using the `method` directive.
|
|
|
|
|
|
|
|
(See: http://docutils.sourceforge.net/docs/user/rst/quickref.html#definition-lists)
|
|
|
|
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
|
|
|
API
|
|
|
|
===
|
|
|
|
|
|
|
|
:class:`MyClass`
|
|
|
|
----------------
|
|
|
|
|
|
|
|
:class:`MyClass` is an example class to demonstrate API documentation.
|
|
|
|
|
|
|
|
``attribute1``
|
|
|
|
The first attribute of the example class.
|
|
|
|
|
|
|
|
``attribute2``
|
|
|
|
Another attribute example.
|
|
|
|
|
|
|
|
methods
|
|
|
|
"""""""
|
|
|
|
|
|
|
|
.. method:: MyClass.retrieve_output(name)
|
|
|
|
|
|
|
|
Retrieve the output for ``name``.
|
|
|
|
|
|
|
|
:param name: The output that should be returned.
|
|
|
|
:return: An :class:`Output` object for ``name``.
|
|
|
|
:raises NotFoundError: If no output can be found.
|
|
|
|
|
|
|
|
|
|
|
|
Will render as:
|
|
|
|
|
|
|
|
:class:`MyClass` is an example class to demonstrate API documentation.
|
|
|
|
|
|
|
|
``attribute1``
|
|
|
|
The first attribute of the example class.
|
|
|
|
|
|
|
|
``attribute2``
|
|
|
|
Another attribute example.
|
|
|
|
|
|
|
|
methods
|
|
|
|
^^^^^^^
|
|
|
|
|
|
|
|
.. method:: MyClass.retrieve_output(name)
|
|
|
|
|
|
|
|
Retrieve the output for ``name``.
|
|
|
|
|
|
|
|
:param name: The output that should be returned.
|
|
|
|
:return: An :class:`Output` object for ``name``.
|
|
|
|
:raises NotFoundError: If no output can be found.
|