Development

Contributing

Contributions to the target library (or any of the accompanying R or python packages) are welcome as pull requests to the develop branch. Please see the below guidelines on coding styles, testing and documentation.

Suggestions or bug reports can be posted here: https://github.com/kkholst/target/issues

For bug reports please include a small reproducible example which clearly demonstrates the bug.

Coding styles, unit tests and documentation

Documentation

The C++ code is documented using Doxygen.

The python code is documented using the numpy docstring format

The R code is documented using roxygen2

The main documentation of this project is based on sphinx and the in subdirectory (relative to the root of the repository) doc/source

The documentation should be written in ReStructuredText (rst)

or alternatively in Emacs Org mode (org).

Org is the preferred format, in which case both the exported rst and org file must be checked into the git repository (use ox-ravel to automatically export to rst). Note, that in this case only the org-file should be manually edited.

Unit tests

C++ tests are located in the subdirectory ./tests and written using doctest

The unit tests can be compiled and executed from the root directory with

make test

R tests are located in the subdirectory ./R-package/targeted/tests and written using testthat

The unit tests can be compiled and executed from the root directory with

make testr

To run the R package checks

make checkr

Python tests are located in the subdirectory ./python-package/tests

The unit tests can be compiled and executed from the root directory with

make testpy

or directly from the python-package``directory with ``pytest-runner:

pytest

Code coverage

Code coverage results are automatically created and posted here:

https://codecov.io/gh/kkholst/target

Reports can also be built locally by running

make cov

from either the root directory (code coverage for C++ source code) or ./python-package (code coverage for python source codE).

Coding style

The target library follows the Google’s C++ style guide.

The code should be checked using the cppcheck static code analyzer and cclint (which may installed from PyPi using pip3 install cclint).

From the root directory run

make check

Sanitizers

The Undefined Behaviour Sanitizer via clang++ can be executed with

make sanitizer

which runs the unit-tests and examples from the directory misc.

Roadmap