Fix path of working dir for Jinja linters
Make jinja linters independent of working directory, so it will be possible to run them locally. Change-Id: I01398e2faae7564ae464cd3ac9512d1d27cba187
This commit is contained in:
parent
227610bc80
commit
ba0644eb7c
@ -25,6 +25,7 @@ from jinja2 import Environment
|
||||
from jinja2 import exceptions
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Jinja Environment
|
||||
env = Environment()
|
||||
@ -52,9 +53,9 @@ def validate_jinja_templates(file_path):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.chdir("..")
|
||||
root_path = os.getcwd()
|
||||
jinja_files = get_jinja_files(root_path)
|
||||
base_dir = os.path.join(os.path.dirname(sys.argv[0]), "..")
|
||||
os.chdir(base_dir)
|
||||
jinja_files = get_jinja_files(base_dir)
|
||||
for file_path in jinja_files:
|
||||
validate_jinja_templates(file_path)
|
||||
print('Validating: %s' % file_path)
|
||||
|
Loading…
Reference in New Issue
Block a user