warehouse icon indicating copy to clipboard operation
warehouse copied to clipboard

Linter doesn't catch invalid template test

Open miketheman opened this issue 2 years ago • 3 comments

From https://github.com/pypi/warehouse/pull/13457

Raised a TemplateError for if foo is None

Why doesn't curlylint catch this?

miketheman avatar Apr 20 '23 15:04 miketheman

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)

miketheman avatar Apr 20 '23 22:04 miketheman

I opened https://github.com/thibaudcolas/curlylint/issues/153 to discuss this kind of thing.

miketheman avatar Apr 20 '23 23:04 miketheman