Closed antonag32 closed 1 year ago
FYI weird cases are reproduced using the following command:
~/odoo/ircanada 14.0$ oca-checks-odoo-module --disable=xml-oe-structure-missing-id *|grep qweb
The output shows xml-dangerous-qweb-replace-low-priority
errors
But using:
~/odoo/ircanada 14.0$ oca-checks-odoo-module * |grep qweb
The output doesn't show xml-dangerous-qweb-replace-low-priority
errors even if they were not disabled
Good news, we are not crazy and our unittests do work (disable and enable one by one). This is caused by the existence of .oca_hooks.cfg
in the repositories we are testing on. What is needed to solve this is to merge config sources instead of completely replacing them.
Currently if there is a CLI --enable
or --disable
, the same settings on .oca_hooks.cfg
will be completely disregarded. We need to merge them instead.
After further analysis (as stated above) there are no real issues with checks not being disabled. Merging configurations won't be done for the moment, therefore closing.
Fastest way to reproduce:
Run
oca-checks-po --enable=nonexistent --fix
on a repository with .po files that are not formatted correctly (would trigger onpo-pretty-format
).Expected behavior: Only checks mentioned in
--enable
should run, there are no checks named like that (nonexistent), so nothing should happen.Actual behavior: Files are automatically fixed, but no error messages are printed. This means the check (
pretty-format-po
) is running, but its messages are being filtered out. Probably all checks are being run.The two functions related to this (enabling/disabling and filtering out messages) are:
utils.filter_checks_enabled_disabled
utils.getattr_checks
Probably a good idea to:
utils.getattr_checks
into an instance method forBaseChecker
so that enable, disable no longer need to be passed in as args (can be taken directly fromself
)filter_checks_enabled_disabled
by only adding messages when they are enabled (check before adding for cases where the method/check is called regardless of the current enabled/disabled messages)