This commits make a new standalone test for Markup()
The idea is to only flag the usage of Markup inside of runbot if
it is called on the non-constant string.
Markup('<span> %s </span>') % text #should not raise a flag,
Markup('<span> %s </span>' % 'text') #should raise a flag
closes odoo/odoo#131206
Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
Co-authored-by: Alex Roscav <roal@odoo.com>
19 lines
601 B
Python
19 lines
601 B
Python
from os import environ, path
|
|
import subprocess
|
|
import sys
|
|
|
|
#This test is meant to be standalone, correct usage : python test_security.py file1 file2 file3 ...
|
|
|
|
if __name__ == '__main__':
|
|
|
|
HERE = path.dirname(__file__)
|
|
|
|
if 'PYTHONPATH' not in environ:
|
|
environ['PYTHONPATH'] = HERE
|
|
else:
|
|
environ['PYTHONPATH'] += ':' + HERE
|
|
|
|
command = ['pylint', '--rcfile=/dev/null', '--disable=all', '--output-format', 'json', '--enable=non-const-markup', '--reports=n', '--load-plugins=_odoo_checker_markup', *sys.argv[1:]]
|
|
|
|
proc = subprocess.run(command, env=environ, check=True)
|