Contributing

If you want to contribute code to the HELIPORT repository, please make sure to follow these guidelines.

Code Formatting

The Python code should be formatted by running the following Ruff commands:

# fix lint violations
ruff check --fix .
# format code
ruff format .

Django templates should be formatted using djLint:

djlint --lint --reformat .

The programs ruff and djlint can be installed from PyPI, e.g. via pipx.

JavaScript, CSS, YAML, and various other types of files should be formatted using Prettier. A Yarn command is provided for this purpose:

yarnpkg format

Licensing

Please make sure to add a license header to all new files. The REUSE tool can help you with this:

reuse annotate --license GPL-3.0-or-later --copyright "Your institution" path/to/file

You can check if the code is up to the REUSE spec like this:

reuse lint

reuse can be installed from PyPI, e.g. via pipx.

Git Hooks

For automated checks during git commit, the pre-commit hook provided in the repository can be used. You can activate it by copying or linking it into the .git/hooks directory:

ln -rs .gitlab/bin/pre-commit.py .git/hooks/pre-commit

If you use set up HELIPORT as a git submodule, the hooks need to be linked via the parent git directory:

ln -rs .gitlab/bin/pre-commit.py ../.git/modules/heliport/hooks/pre-commit

The checks prevent the creation of a commit if the code does not follow the conventions. They can be skipped using git commit --no-verify.