OCA / odoo-pre-commit-hooks

Linters of Odoo addons that complement pylint-odoo
GNU Affero General Public License v3.0
10 stars 12 forks source link

[IMP] Help msg for "xml-view-dangerous-replace-low-priority" #68

Closed antonag32 closed 1 year ago

antonag32 commented 1 year ago

Replacing elements is by nature unsafe since xpaths in other views may reference the element. Other methods should be tried first, this information has been added to the error message generated by this check to help users.

antonag32 commented 1 year ago

@luisg123v @moylop260 Can you please review?

The new message ends up looking like this:

****xml-view-dangerous-replace-low-priority****
test_repo/broken_module/model_view2.xml:25 Dangerous use of "replace" from view with priority 0 < 99. Only replace as a last resort. Try position="attributes", position="move" or invisible="1" first. - [xml-view-dangerous-replace-low-priority]
antonag32 commented 1 year ago

@luisg123v I also improved the message for qweb replace as mentioned, however I am not very experienced on templates, can you check if the tip is correct (using t-if="0"), thanks.

moylop260 commented 1 year ago

@oscarolar

Are the messages good for you?

oscarolar commented 1 year ago

it's good enough to me, thanks @moylop260

antonag32 commented 1 year ago

@moylop260 - Can you try running tox -e update-readme locally?.

tox -e update-readme produces no errors locally for me, but is failing on the CI, wondering if it happens to you too.

moylop260 commented 1 year ago

@antonag32

The tox -e update-readme is an env running only in py3.10 (same than CI) in order to avoid different output bc py version variant

I just ran locally and it is working as expected

Could you check if it is running only from py3.10 in your local, please?

antonag32 commented 1 year ago

@antonag32

The tox -e update-readme is an env running only in py3.10 (same than CI) in order to avoid different output bc py version variant

I just ran locally and it is working as expected

Could you check if it is running only from py3.10 in your local, please?

I am using Python 3.10.9 but if it works on your machine then it probably has to do with my system, I will try running it on a docker container.