Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrRuleNotFound = errors.New("rule not found")
ErrRuleNotFound is returned when a rule is not found
Functions ¶
This section is empty.
Types ¶
type Name ¶
type Name string
const ( SemverMajor Name = "semver-major" SemverMinor Name = "semver-minor" SemverPatch Name = "semver-patch" CalverMajor Name = "calver-major" CalverMinor Name = "calver-minor" CalverPatch Name = "calver-patch" CalverPrerelease Name = "calver-prerelease" Regex Name = "regex" Always Name = "always" )
func ParseRuleName ¶
ParseRuleName takes a rule name as a string and checks if it exists in the predefined rules. If the rule is found, it returns the corresponding Name and a nil error. If the rule is not found, it returns an empty Name and an error indicating that the rule was not found.
Parameters:
- name: A string representing the name of the rule to be parsed.
Returns:
- Name: The corresponding Name if found.
- error: An error if the rule is not found.
type RuleInterface ¶
type RuleInterface interface { Init(actualTag string, tagsAvailable []string, value string) Evaluate() (matchWithRule bool, newTag string, err error) GetNewTag() string }
func GetRule ¶
func GetRule(name Name) (RuleInterface, error)
GetRule retrieves a RuleInterface based on the provided name. It takes a Name type as an argument and returns the corresponding RuleInterface from the rules map. If the name does not exist in the map, the behavior is dependent on the implementation of the rules map.
Parameters:
- name: The name of the rule to retrieve.
Returns:
- RuleInterface: The rule associated with the given name.
func GetRuleWithUntypedName ¶
func GetRuleWithUntypedName(name string) (RuleInterface, error)
GetRuleWithUntypedName retrieves a RuleInterface based on the provided name. It takes a string as an argument and returns the corresponding RuleInterface from the rules map. If the name does not exist in the map, the behavior is dependent on the implementation of the rules map.
type Rules ¶
type Rules map[Name]RuleInterface