warehouse
warehouse copied to clipboard
Linter doesn't catch invalid template test
From https://github.com/pypi/warehouse/pull/13457
Raised a TemplateError for if foo is None
Why doesn't curlylint catch this?
During investigation, I learned that the test here doesn't actually render templates - rather the get_template() method calls the filesystem and loads the file only, doesn't actually render it (we'd need to inject piles of variables for that to happen).
This test will catch a class of errors like missing endif tags (jinja2.exceptions.TemplateSyntaxError), but doesn't perform the testing that would have surfaced an invalid test condition (aka jinja2.exceptions.TemplateRuntimeError)
I opened https://github.com/thibaudcolas/curlylint/issues/153 to discuss this kind of thing.