Summary
The naming convention rule (MPR001) for enumerations conflicts with Mendix's
official naming best practices. The rule flags the exact naming pattern Mendix
recommends as a violation.
Details
DefaultEnumerationPattern in mdl/linter/rules/naming.go is:
var DefaultEnumerationPattern = regexp.MustCompile(`^[A-Z][a-zA-Z0-9]*$`)
This requires plain PascalCase and disallows underscores. However, the
Mendix Naming Convention Best Practices
state that enumerations should carry an ENUM_ prefix:
"Enumerations should be identified with a prefix. The name of the enumeration
should reflect its business context, for example, ENUM_ShippingStatus."
(prefix table: Enumeration → ENUM_)
As a result, the recommended name ENUM_ShippingStatus fails the pattern
(_ is not in [a-zA-Z0-9]), and the rule's toPascalCase suggestion rewrites
it to something like EnumShippingstatus — also incorrect per the convention.
Suggested fix
Allow the ENUM_ prefix, mirroring the microflow approach:
var DefaultEnumerationPattern = regexp.MustCompile(`^(ENUM_)?[A-Z][a-zA-Z0-9]*$`)
And update the suggestion helper to preserve the ENUM_ prefix.
References
Summary
The naming convention rule (
MPR001) for enumerations conflicts with Mendix'sofficial naming best practices. The rule flags the exact naming pattern Mendix
recommends as a violation.
Details
DefaultEnumerationPatterninmdl/linter/rules/naming.gois:This requires plain PascalCase and disallows underscores. However, the
Mendix Naming Convention Best Practices
state that enumerations should carry an
ENUM_prefix:As a result, the recommended name
ENUM_ShippingStatusfails the pattern(
_is not in[a-zA-Z0-9]), and the rule'stoPascalCasesuggestion rewritesit to something like
EnumShippingstatus— also incorrect per the convention.Suggested fix
Allow the
ENUM_prefix, mirroring the microflow approach:And update the suggestion helper to preserve the
ENUM_prefix.References
mdl/linter/rules/naming.go