Skip to content

Commit 1318930

Browse files
committed
fix(settings): add check for empty settings values
- make no change to data if settings value is empty - update telex test to handle cases of empty value data and include slack url - remove slack_url field from config
1 parent 79a5855 commit 1318930

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/core/analyzer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ def _apply_data_settings(self):
4747
"""
4848
for setting in self.settings:
4949
if setting["label"] == "commit_types":
50-
self.commit_types.update(ast.literal_eval(setting["default"]))
50+
self.commit_types.update(ast.literal_eval(setting["default"])) if setting["default"] else self.commit_types
5151
if setting["label"] == "example_commits":
52-
self.example_commits.update(ast.literal_eval(setting["default"]))
52+
self.example_commits.update(ast.literal_eval(setting["default"])) if setting["default"] else self.example_commits
5353
if setting["label"] == "training_data":
54-
self.commit_training_data.update(ast.literal_eval(setting["default"]))
54+
self.commit_training_data.update(ast.literal_eval(setting["default"])) if setting["default"] else self.commit_training_data
5555
if setting["label"] == "slack_url":
5656
self.slack_url = setting["default"]
5757

tests/test_telex.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,19 @@ def test_send_from_telex_failure():
3737
json={
3838
"message": '[{"id": "8ce4cf04f4rw6w8600675237350b14b4", "message": "fix(auth): child\n\nFixed a race condcvghdczhjvjhzcvhjvzhjvhjvczjonization mechanisms.", "timestamp": "2025-02-18T10:17:54+01:00", "url": "https://github.com/8", "author": {"name": "test", "email": "[email protected]"}}]',
3939
"settings": [
40+
{
41+
"label": "slack_url",
42+
"type": "text",
43+
"required": True,
44+
"description": "Slack Webhook URL",
45+
"default": "https://slack.com"
46+
},
4047
{
4148
"label": "commit_types",
4249
"type": "text",
4350
"description": "Custom commit types and keywords",
4451
"required": False,
45-
"default": "{'feat': ['add', 'implement', 'new', 'introduce'], 'fix': ['fix', 'resolve', 'patch', 'address']}",
52+
"default": "",
4653
},
4754
{
4855
"label": "Example Commits",

0 commit comments

Comments
 (0)