python - Extending pylint to deal with template variables? -


i wrote say module make formatted printing simpler , more straightforward. e.g.

say("{len(items)} retrieved; {n_errors} encountered") 

rather than:

print("{0} retrieved; {1} encountered".format(len(items), n_errors)) 

that part going great. run pylint gotchas , mistakes. unfortunately, many data values constructed solely usefulness in output operations, , pylint cannot "see" use in say call (or other templates output mechanism) constitutes genuine use of variable. wave after wave of w0612 (unused-variable) warnings can result.

it's possible put in ignore comments, seems retrograde. i'd rather extend pylint understand variables used in say() templates are, in fact, used.

.../pylint/checkers/variables.py appears place add check, i'm unfamiliar codebase. hints or suggestions how register variables used in format-style strings are, indeed, used?

in 'variables' checker, used variable removed self._to_consume[-1] list (self being checker , [-1] because stack of per function variables list.

anyway, alex right further discussion on topic should rather go code-quality mailing list.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -