Skip to content

Provide more getter helpers for templates; use fewer extraneous objects #2377

Closed
@srawlins

Description

@srawlins

I think it is a smell in a template to reach out of a ModelElement into strange places like .packageGraph. The desire to access information on the packageGraph field is not bad, but it should be more accessible so that templates don't have to jump through a UML diagram to get at what they need.

In the standard templates, there are actually only 28 instances of using nested properties at all:

git grep '{{\s*[a-zA-Z_]\+\.' lib/templates/ |wc -l

Many of these are perfectly innocent. I don't see a reason to change {{self.name}} or {{parent.kind}}. As a matter of fact, when filtering out {{parent and {{self, the only other case is using {{packageGraph.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-code-healthInternal changes to our tools and workflows to make them cleaner, simpler, or more maintainable

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions