Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML record: Place id attribute before model #26

Open
voronind opened this issue Jun 8, 2022 · 5 comments
Open

XML record: Place id attribute before model #26

voronind opened this issue Jun 8, 2022 · 5 comments
Assignees
Labels
check-autofix Checks with possible develop of autofix without affecting code check-xml Checks related to XML files enhancement New feature or request stale PR/Issue without recent activity, it'll be soon closed automatically.

Comments

@voronind
Copy link

voronind commented Jun 8, 2022

Odoo guidelines says that id attribute must be before model attribute for XML records.

Many OCA repos will be need to disable this checking or fix data files. In other case linter will fail.

@voronind voronind added the enhancement New feature or request label Jun 8, 2022
@moylop260
Copy link
Collaborator

See the following output using Odoo v15.0:

rgrep "<record model=\".*\" id=\".*\"" odoo --include=*.xml |wc -l
1243

rgrep "<record model=\".*\" id=\".*\"" enterprise --include=*.xml |wc -l
386

What about creating a new generation of lints (new project) compatible with pre-commit in order to auto-fix XML?

e.g.

@voronind
Copy link
Author

voronind commented Jun 9, 2022

And create 3rd project: pylint-odoo-project that will check respecting module dependencies.
In fact there is insufficient maintenance of one pylint-odoo project.

@moylop260
Copy link
Collaborator

Currently, the OCA is moving to auto-fix

In fact, you could do a small script to do it and only create the file hook for pre-commit in order to be auto-called from OCA pipelines and auto-fixed all the projects in one shot

It doesn't need to do a big project as pylint or sufficient maintenance

Check the following similar small project:

It has only 2 commits and 3 files (README, pre-commit-hook, script)

Try to do proof of concept to create a script to get all the record nodes of a XML and change the id of position

and I can help you to adapt it to pre-commit

It could be better to auto-fix all them instead of mark it and fix manually

There are other kinds of lints that are not easy to auto-fix it or it is impossible to do it

But it is a good example to auto-fix it easy

@luisg123v
Copy link

Same for eval before name, e.g.:

<field eval="1" name="priority" />

@moylop260 moylop260 transferred this issue from OCA/pylint-odoo Oct 21, 2022
@moylop260 moylop260 added check-xml Checks related to XML files check-autofix Checks with possible develop of autofix without affecting code labels Oct 24, 2022
@moylop260 moylop260 self-assigned this Oct 28, 2022
@github-actions
Copy link

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
check-autofix Checks with possible develop of autofix without affecting code check-xml Checks related to XML files enhancement New feature or request stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

No branches or pull requests

3 participants