[PATCH] Extend format string checks to translated format strings.

Vratislav Podzimek vpodzime at redhat.com
Thu Apr 24 05:40:26 UTC 2014


On Wed, 2014-04-23 at 17:39 -0400, David Shea wrote:
> This applies the existing pylint format and logging string checks to
> translated format and logging strings. The two new warning IDs are not
> emitted themselves but are necessary in order to provide an entry point
> to the overriden visit_* functions.
> ---
>  tests/pylint/intl.py | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 88 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/pylint/intl.py b/tests/pylint/intl.py
> index c8baaf3..aec3414 100644
> --- a/tests/pylint/intl.py
> +++ b/tests/pylint/intl.py
> @@ -22,11 +22,38 @@
>  import astroid
>  
>  from pylint.checkers import BaseChecker
> +from pylint.checkers.strings import StringFormatChecker
> +from pylint.checkers.logging import LoggingChecker
>  from pylint.checkers.utils import check_messages
>  from pylint.interfaces import IAstroidChecker
>  
> +from copy import copy
> +
>  translationMethods = ["_", "N_", "P_", "C_", "CN_", "CP_"]
>  
> +# Returns a list of the message strings for a given translation method call
> +def _get_message_strings(node):
> +    msgstrs = []
Could this be a set instead of a list? It could be slightly faster in
some rare cases and it shouldn't hurt anything.

However, this looks good to me even as it is.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list