(cls, context, template_name, taints)
| 115 | class JinjaTemplateVisitor(Visitor): |
| 116 | @classmethod |
| 117 | def from_template(cls, context, template_name, taints) -> JinjaTemplateVisitor: |
| 118 | tpl_path = Path(context.visitor.normalized_path).parent / "templates" / template_name |
| 119 | if not tpl_path.exists(): |
| 120 | logger.info(f"Could not find jinja template: '{template_name}'") |
| 121 | return |
| 122 | |
| 123 | new_location = context.visitor.location.create_child( |
| 124 | new_location=tpl_path |
| 125 | ) |
| 126 | |
| 127 | new_location.metadata.update({ |
| 128 | "template_path": tpl_path, |
| 129 | "template_context": context.node.args[1:], |
| 130 | "taints": taints, |
| 131 | }) |
| 132 | |
| 133 | v = cls(location=new_location) |
| 134 | v.load_tree() |
| 135 | return v |
| 136 | |
| 137 | def load_tree(self): |
| 138 | if self.path: |
no test coverage detected