Skip to content

Commit

Permalink
Merge 0bf1861 into 4960c52
Browse files Browse the repository at this point in the history
  • Loading branch information
moylop260 committed Oct 20, 2022
2 parents 4960c52 + 0bf1861 commit c433fb1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pylint_odoo/checkers/no_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import itertools
import os
import re
from collections import Counter

import astroid
import rfc3986
Expand Down Expand Up @@ -258,6 +259,11 @@
'context-overridden',
settings.DESC_DFLT
),
'W%d25' % settings.BASE_NOMODULE_ID: (
'The file "%s" is duplicated %d times from manifest key "%s"',
'manifest-data-duplicated',
settings.DESC_DFLT
),
'F%d01' % settings.BASE_NOMODULE_ID: (
'File "%s": "%s" not found.',
'resource-not-exist',
Expand Down Expand Up @@ -822,7 +828,7 @@ def visit_call(self, node):
'manifest-required-author', 'manifest-required-key',
'manifest-version-format', 'resource-not-exist',
'website-manifest-key-not-valid-uri', 'development-status-allowed',
'manifest-maintainers-list')
'manifest-maintainers-list', 'manifest-data-duplicated')
def visit_dict(self, node):
if not os.path.basename(self.linter.current_file) in \
settings.MANIFEST_FILES \
Expand Down Expand Up @@ -881,9 +887,13 @@ def visit_dict(self, node):
self.config.manifest_version_format_parsed))

# Check if resource exist
# Check manifest-data-duplicated
dirname = os.path.dirname(self.linter.current_file)
for key in DFTL_MANIFEST_DATA_KEYS:
for resource in (manifest_dict.get(key) or []):
for resource, coincidences in Counter(manifest_dict.get(key) or []):
if coincidences >= 2:
self.add_message('manifest-data-duplicated', node=node,
args=(resource, coincidences, key))
if os.path.isfile(os.path.join(dirname, resource)):
continue
self.add_message('resource-not-exist', node=node,
Expand Down
1 change: 1 addition & 0 deletions pylint_odoo/test/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'javascript-lint': 24,
'license-allowed': 1,
'manifest-author-string': 1,
'manifest-data-duplicated': 1,
'manifest-deprecated-key': 1,
'manifest-required-author': 1,
'manifest-required-key': 1,
Expand Down
2 changes: 2 additions & 0 deletions pylint_odoo/test_repo/broken_module/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
'skip_xml_check.xml',
'skip_xml_check_2.xml',
'skip_xml_check_3.xml',
'duplicated.xml',
'duplicated.xml',
'report.xml',
'template1.xml',
],
Expand Down

0 comments on commit c433fb1

Please sign in to comment.