fix: add warning for long secret names #359

Merged
decentral1se merged 14 commits from rix/abra:add-secret-length-linting into main 2024-04-06 21:41:37 +00:00
Showing only changes of commit 95b081867c - Show all commits

View File

@ -115,6 +115,13 @@ var LintRules = map[string][]LintRule{
HowToResolve: "upload your recipe to git.coopcloud.tech/coop-cloud/...",
Function: LintHasRecipeRepo,
},
{
Ref: "R014",
Level: "warn",
Description: "Long secret names",
HowToResolve: "Reduce the lenght of secret names to 12 characters.",
rix marked this conversation as resolved Outdated

%s/lenght/length/

`%s/lenght/length/`
Outdated
Review

Good spot! fixed now : )

Good spot! fixed now : )
Function: LintSecretLengths,
},
},
"error": {
{
@ -401,6 +408,16 @@ func LintHasRecipeRepo(recipe recipe.Recipe) (bool, error) {
return true, nil
}
func LintSecretLengths(recipe recipe.Recipe) (bool, error) {
for name := range recipe.Config.Secrets {
if len(name) > 12 {
return false, fmt.Errorf("secret %s is longer than 12 characters", name)
}
}
return true, nil
}
func LintValidTags(recipe recipe.Recipe) (bool, error) {
recipeDir := path.Join(config.RECIPES_DIR, recipe.Name)