From ec109b2cec2cb3943d3455ebd33154a8b4dcd0a5 Mon Sep 17 00:00:00 2001 From: jce Date: Tue, 7 Nov 2023 14:37:44 +0100 Subject: [PATCH] Substitute environment variables already in setter of cq_description_template --- src/mlx/regex_checker.py | 3 +-- src/mlx/warnings_checker.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mlx/regex_checker.py b/src/mlx/regex_checker.py index 5ccbd442..1230a37b 100644 --- a/src/mlx/regex_checker.py +++ b/src/mlx/regex_checker.py @@ -1,5 +1,4 @@ import hashlib -import os import re from pathlib import Path @@ -62,7 +61,7 @@ def add_code_quality_finding(self, match): groups = {name: result for name, result in match.groupdict().items() if result} for name, result in groups.items(): if name.startswith("description"): - finding["description"] = self.cq_description_template.substitute(os.environ, description=result) + finding["description"] = self.cq_description_template.substitute(description=result) break else: return # no description was found, which is the bare minimum diff --git a/src/mlx/warnings_checker.py b/src/mlx/warnings_checker.py index f8997799..86c7e4c9 100644 --- a/src/mlx/warnings_checker.py +++ b/src/mlx/warnings_checker.py @@ -39,7 +39,7 @@ def cq_description_template(self): @cq_description_template.setter def cq_description_template(self, template_obj): try: - template_obj.substitute(os.environ, description='test') + template_obj.template = template_obj.substitute(os.environ, description='$description') except KeyError as err: raise ValueError(f"Failed to find environment variable from configuration value " f"'cq_description_template': {err}") from err