Skip to content

ENUM lint rule (MPR001) rejects the Mendix-recommended ENUM_ prefix #715

Description

@recktenwaldfabian

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions