Weblate モジュールへの貢献

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:

コーディングのガイドライン

Weblate のコードはすべて、 セキュリティ設計原則 を念頭に記述しなければなりません。

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.

テストの実行

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

参考

The CI integration is very similar to Weblate testsuite and continuous integration.

Coding standard and linting the code

コードは PEP-8 コーディング ガイドラインに従い、black コード整形ツールを使用して書式設定することが必要です。

コードの品質を検査するには flake 8 を使用します。推奨プラグインの一覧は .pre-commit-config.yaml にあり、設定は:file:`setup.cfg`にあります。

これを実行する最も簡単な方法は、pre-commit をインストールすることです。リポジトリには、コミットされたファイルが正常であることを確認するための設定が含まれています。インストール後(すでに requirements-lint.txt に含まれています)、Weblate のチェックアウトで pre-commit install を実行して有効にします。これにより、すべての変更が自動的に検査されます。

手動で検査を実行し、すべてのファイルの実行を検査する方法:

pre-commit run --all