Use rule id for config validation error (#1463)

* chore(config): use rule id for error

* feat(config): ensure rule.id is not empty
This commit is contained in:
Richard Gomez authored and GitHub committed 2024-08-08 15:47:34 -05:00
1 parent d3c4b9078e
commit c0fda4358e
4 files changed
+19 -3

No files matched your search

+6 -1
View File
@@ -86,10 +86,15 @@ func TestTranslate(t *testing.T) {
},
},
},
{
cfgName: "missing_id",
cfg: Config{},
wantError: fmt.Errorf("rule ID is missing or empty, regex: (?i)(discord[a-z0-9_ .\\-,]{0,25})(=|>|:=|\\|\\|:|<=|=>|:).{0,5}['\\\"]([a-h0-9]{64})['\\\"]"),
},
{
cfgName: "bad_entropy_group",
cfg: Config{},
wantError: fmt.Errorf("Discord API key invalid regex secret group 5, max regex secret group 3"),
wantError: fmt.Errorf("discord-api-key: invalid regex secret group 5, max regex secret group 3"),
},
{
cfgName: "base",