Coding standard¶
This page is only of interest for Erebot developers.
Table of Contents
Writing code¶
Erebot uses the PSR-2 coding style for PHP code.
Compliance with this standard can be tested by running the following command from the top directory:
phing qa_codesniffer
Writing documentation¶
For the code, we rely on Doxygen commands to automatically extract the API documentation. We use the \ prefix for such commands as it is also recognized by other tools. Also, we use the \copydoc command massively to avoid repeating ourselves while documenting the code.
The rest of the documentation (what you are currently reading) is managed using the Sphinx documentation generator.
All the documentation is stored in the same Git repository as the code to help keep both the code and documentation in sync.
Both documentation can be built by running this command from the top directory:
phing doc
Writing tests¶
We use the PHPUnit testing framework to write unit and functionnal tests for the bot.
The tests are stored in the same Git repository as the code to help keep both the code and its tests in sync.
The test suite can be run by using the following command from the top directory:
phing tests
Other tools¶
We also use other tools to measure various metrics of the code, like code complexity, code repetitions, and so on. The full QA test suite can be run with:
phing qa