Skip to content

Contribution Guidelines

Petr Zemek edited this page Dec 14, 2017 · 5 revisions

General Information

Any contributions are welcome!

  • Code changes are to be submitted via pull requests.
  • For reporting issues or feature requests, use the GitHub issue tracker.
  • For more details about the project, see our wiki.

Coding Conventions

When submitting code changes, please respect the following coding conventions.

General

  • Use UNIX line endings (\n).
  • Use the UTF-8 encoding.
  • Write all the code and comments in English.
  • Strip useless trailing whitespace before you commit.
  • When in doubt, respect the already established style (take a look at the formatting used in other source files).

Git

  • Format of commit messages:

     A short summary (up to 80-90 characters).
    
     Details, such as:
     - Why was the change necessary?
     - Are there any related commits?
     - Is the commit part of an issue? If so, specify the issue number either in the summary or here.
    

C++

  • Use tabs for indentation.
  • Try not to write lines longer than 100 characters. Try to keep them around 80-90 characters per line.
  • Use camelCase for variable and function names, CamelCase for type names, snake_case for namespaces, and UPPER_CASE for constants and macros.
  • Always include { and } when writing compound statements (e.g. if, for), even if they contain only a single statement (for safety reasons).
  • Group includes into three parts: standard system includes, external libraries, and our own includes.
  • Order includes within groups lexicographically.
  • Use Doxygen to write API documentation.

Python

  • Use PEP8 conventions.

    A brief summary:

    • Use 4 spaces for indentation.
    • Use snake_case for variable and function names, CamelCase for type names, and UPPER_CASE for constants.
    • Internal variables, functions, methods, etc. should be prefixed with an underscore (e.g. def _my_internal_method(self):).
    • Group imports into three parts: standard system imports, external packages, and our own modules and packages.

    Exceptions:

    • Line length, which can be up to 100 characters. However, try to keep it around 80 characters per line.

    Tip: To verify that our source files adhere to PEP8, you can run flake8 on your source files. Note, however, that this tool is not able to detect all discrepancies, just some of them.

  • Order imports within groups lexicographically.

  • Use Sphinx to write API documentation.

Bash

  • Use tabs for indentation.