The goal of Maintainer Quality Tools (MQT) is to provide helpers to ensure the quality of Odoo addons.
If you are a developer and are looking to run the pre-commit actions locally, you don't need this repository. Follow the pre-commit tool installation instructions.
In a nutshell:
- Install pre-commit in your system:
pip3 install --user pre-commit
- Install pre-commit on yor repository (must be done inside each OCA repo):
pre-commit install
- If you want to manually run it:
pre-commit run --all-files
The OCA-recommended pre-commit
configuration
and associated linters configuration files may be found in the [sample_files]
(https://github.com/OCA/maintainer-quality-tools/tree/master/sample_files/pre-commit-13.0)
directory of this repo.
More information can be found [here] (https://odoo-community.org/blog/the-oca-blog-1/post/black-isort-pre-commit-97).
In order to setup TravisCI continuous integration for your project, just copy the
content of the /sample_files
to your project’s root directory.
If your project depends on other OCA or other Github repositories, create a file called oca_dependencies.txt
at the root of your project and list the dependencies there. One per line like so:
project_name optional_repository_url optional_branch_name
During testbed setup, MQT will automatically download and place these repositories accordingly into the addon path. Note on addons path ordering: They will be placed after your own repo, but before the odoo core repo.
You can test your .travis file in this linter. This is very useful when you are improving your file.
You can use branch or pull request into environment variable VERSION:
- Branch 10.0
VERSION="10.0" ODOO_REPO="odoo/odoo"
- Pull request odoo/odoo#143
VERSION="pull/143" ODOO_REPO="odoo/odoo"
You can use the custom branch into the ODOO_REPO using the environment variable ODOO_BRANCH:
- Branch saas-17
ODOO_REPO="odoo/odoo" ODOO_BRANCH="saas-17"
MQT is also capable to test each module individually.
The intention is to check if all dependencies are correctly defined.
Activate it through the UNIT_TEST
directive.
An additional line should be added to the env:
section,
similar to this one:
- VERSION="8.0" UNIT_TEST="1"
Codecov provides information on the test coverage of your modules.
The configurations is automatic (check default configuration here).
So you don't need to include a .coveragerc
into the repository,
If you do it, it will be simply ignored.
NOTE: the current configuration automatically ignores *_example
modules
from coverage check.
See maintainer-tools CONTRIBUTING doc for further info on tests.
MQT has a nice feature of organizing your testing databases.
You might want to do that if you want to double them up as
staging DBs or if you want to work with an advanced set of
templates in order to speed up your CI pipeline.
Just specify at will:
MQT_TEMPLATE_DB='mqt_odoo_template' MQT_TEST_DB='mqt_odoo_test'
.
Give us feedback on you experiences, and if you could share findings
from your use case, there might be some grateful people arround.
If you want to make a build exclusive for these checks, you can add a line
on the env:
section of the .travis.yml file with this content:
- VERSION="7.0" LINT_CHECK="1"
You will get a faster answer about these questions and also a fast view over semaphore icons in Travis build view.
To avoid making again these checks on other builds, you have to add LINT_CHECK="0" variable on the line:
- VERSION="7.0" ODOO_REPO="odoo/odoo" LINT_CHECK="0"
If you want to make a build without tests, you can use the following directive:
TEST_ENABLE="0"
You will simply get the databases with packages installed, but whithout running any tests.