OCA / pylint-odoo

Odoo plugin for Pylint
http://www.pylint.org
142 stars 168 forks source link

Warning about Version arguments in file resource path "?v=1" #160

Closed a-da closed 6 years ago

a-da commented 7 years ago

selection_010

This will not fail in debug= mode, but will fail in normal mode.

We spend 1 hour do understand the reason.

We can add a check as

"?" in file_path or "#" in file_path 
moylop260 commented 7 years ago

Could you help me a litlle more to understand it?

a-da commented 7 years ago

This is the point, its hard to understand, what warning is trying to say.

It try to open css fille open("xxx_affiliation_widget/static/widget.css?v=1") and fail.

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <template id="assets_backend" name="xxx_affiliation_widget" inherit_id="web.assets_backend">
            <xpath expr="." position="inside">
                <!-- wrong but is working in odoo web debug mode -->
                <link rel="stylesheet"
                      href="/xxx_affiliation_widget/static/widget.css?v=1"/>

               <!-- correct but is working working odoo web debug mode also -->
                <link rel="stylesheet"
                      href="/xxx_affiliation_widget/static/widget.css"/>

                <script type="text/javascript"
                        src="/xxx_affiliation_widget/static/widget.js"/>
            </xpath>
        </template>
    </data>
</openerp>

selection_015

moylop260 commented 6 years ago

I got it Thank you for the clarification.

+1 -- Moisés López Calderón Vauxoo - OpenERP's Gold Partner Mobile: (+521) 477-752-22-30 Office: (+52) 477-773-33-46 web: http://www.vauxoo.com twitter: @vauxoo @moylop260 hangout: moylop260@vauxoo.com

moylop260 commented 6 years ago

@JesusZapata Could you add a new check, if the href of a link is a valid file path?

moylop260 commented 6 years ago

@a-da Could you test if https://github.com/OCA/pylint-odoo/pull/163 makes the work?

a-da commented 6 years ago

@moylop260 tested, working

virtualenv -p python2 /tmp/a
/tmp/a/bin/pip install git+https://github.com/vauxoo-dev/pylint-odoo.git@master-oca-character-not-valid-in-resource-link-jesuszapata
source-bash /tmp/a/bin/activate
pylint --reports=n module_affiliation_widget/
(a) $ pylint --reports=n module_affiliation_widget/                                                                                    ************* Module module_affiliation_widget
W7944:  8,0:(character-not-valid-in-resource-link) :  The resource in in src/href contains a not valid chararter | module_affiliation_widget/view.xml