Skip to content

Commit

Permalink
Substitute environment variables already in setter of cq_description_…
Browse files Browse the repository at this point in the history
…template
  • Loading branch information
JasperCraeghs committed Nov 7, 2023
1 parent cda7224 commit ec109b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/mlx/regex_checker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import hashlib
import os
import re
from pathlib import Path

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/mlx/warnings_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ec109b2

Please sign in to comment.