Skip to content

Commit

Permalink
Merge 3886081 into c0186df
Browse files Browse the repository at this point in the history
  • Loading branch information
moylop260 committed Oct 20, 2022
2 parents c0186df + 3886081 commit 8c8df64
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pylint_odoo/checkers/no_modules.py
Expand Up @@ -792,7 +792,11 @@ def visit_call(self, node):
printf_args = (
misc.WrapperModuleChecker.
_get_printf_str_args_kwargs(str2translate))
if isinstance(printf_args, tuple) and len(printf_args) >= 2:
format_args = (
misc.WrapperModuleChecker.
_get_format_str_args_kwargs(str2translate)[0])
if (isinstance(printf_args, tuple) and len(printf_args) >= 2 or
len(format_args) >= 2):
# Return tuple for %s and dict for %(varname)s
# Check just the following cases "%s %s..."
self.add_message('translation-positional-used',
Expand Down
2 changes: 1 addition & 1 deletion pylint_odoo/test/main.py
Expand Up @@ -64,7 +64,7 @@
'translation-field': 2,
'translation-required': 15,
'translation-contains-variable': 10,
'translation-positional-used': 5,
'translation-positional-used': 7,
'use-vim-comment': 1,
'wrong-tabs-instead-of-spaces': 2,
'eval-referenced': 5,
Expand Down
4 changes: 4 additions & 0 deletions pylint_odoo/test_repo/broken_module/models/broken_model.py
Expand Up @@ -302,12 +302,16 @@ def my_method1(self, variable1):
# so you can't change the order in the translation
_('%s %d') % ('hello', 3)
_('%s %s') % ('hello', 'world')
_('{} {}').format('hello', 3)
_('{} {}').format('hello', 'world')

# Valid cases
_('%(strname)s') % {'strname': 'hello'}
_('%(strname)s %(intname)d') % {'strname': 'hello', 'intname': 3}
_('%s') % 'hello'
_('%d') % 3
_('{}').format('hello')
_('{}').format(3)
return error_msg

def my_method2(self, variable2):
Expand Down

0 comments on commit 8c8df64

Please sign in to comment.