Skip to content

Commit

Permalink
Merge pull request #10 from vauxoo-dev/master-oca-deprecated-tag-openerp
Browse files Browse the repository at this point in the history
[ADD] Add check 'deprecated-openerp-xml-node'
  • Loading branch information
pedrobaeza committed Nov 2, 2015
2 parents ae8955a + ebc8d56 commit d11d7a3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
25 changes: 24 additions & 1 deletion pylint_odoo/checkers/modules_odoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@
'javascript-lint',
settings.DESC_DFLT
),
'W%d04' % settings.BASE_OMODULE_ID: (
'%s:%d Deprecated <openerp> xml node',
'deprecated-openerp-xml-node',
settings.DESC_DFLT
),
'W%d05' % settings.BASE_OMODULE_ID: (
'%s:%d record res.users without '
'context="{\'no_reset_password\': True}"',
'create-user-wo-reset-password',
settings.DESC_DFLT
),

}


Expand Down Expand Up @@ -192,3 +196,22 @@ def _check_javascript_lint(self):
if self.msg_args:
return False
return True

def _check_deprecated_openerp_xml_node(self):
'''Check deprecated <openerp> xml node
:return: False if exists <openerp> node and
add list of xml files in self.msg_args
'''
xml_files = self.filter_files_ext('xml')
self.msg_args = []
for xml_file in xml_files:
doc = self.parse_xml(os.path.join(self.module_path, xml_file))
openerp_nodes = doc.xpath("/openerp") \
if not isinstance(doc, basestring) else []
if openerp_nodes:
lineno = openerp_nodes[0].sourceline
self.msg_args.append((
xml_file, lineno))
if self.msg_args:
return False
return True
2 changes: 1 addition & 1 deletion pylint_odoo/test/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pylint_odoo import misc


EXPECTED_ERRORS = 47
EXPECTED_ERRORS = 52


class MainTest(unittest.TestCase):
Expand Down

0 comments on commit d11d7a3

Please sign in to comment.