Contributing to Weblate modules

Besides the main repository, Weblate consists of several Python modules. All these follow same structure and this documentation covers them all.

For example, this covers:

Coding guidelines

Orice cod pentru Weblate ar trebui să fie scris cu Security by Design Principles în minte.

Any code should come with documentation explaining the behavior. Don’t forget documenting methods, complex code blocks, or user visible features.

Any new code should utilize PEP 484 type hints. We’re not checking this in our CI yet as existing code does not yet include them.

Running tests

The tests are executed using py.test. First you need to install test requirements:

pip install -r requirements-test.txt

You can then execute the testsuite in the repository checkout:

py.test

Vezi și

The CI integration is very similar to Weblate testsuite și integrare continuă.

Coding standard and linting the code

Codul trebuie să respecte liniile directoare de codare PEP-8 și trebuie formatat folosind formatul de cod black.

Pentru a verifica calitatea codului, puteți utiliza flake8, plugin-urile recomandate sunt listate în .pre-commit-config.yaml, iar configurația sa este plasată în setup.cfg.

The easiest approach to enforce all this is to install pre-commit. The repository contains configuration for it to verify the committed files are sane. After installing it (it is already included in the requirements-lint.txt) turn it on by running pre-commit install in Weblate checkout. This way all your changes will be automatically checked.

De asemenea, puteți declanșa verificarea manual, pentru a verifica toate fișierele rulate:

pre-commit run --all