-
Notifications
You must be signed in to change notification settings - Fork 15
Description
EGL's recently-introduced outdentation feature, breaks traceability links. For example, if the template from the EGX playground example is modified as follows (outdentation added in line 6)
[*Generate a <h1> with the name of the person*]
<h1>[%=p.name%]'s Tasks</h1>
[*Generate a table for the person's tasks*]
<table>
[*For every task*]
[%for (t in p.getTasks()){-%]
[*Generate a row with the title of the task*]
<tr>
<td>[%=t.title%]</td>
</tr>
[%}%]
</table>
[%
// Returns the tasks of a person
operation Person getTasks() {
return Task.all.select(
t|t.effort.exists(e|e.person = self));
}
%]
the reported trace links for task titles are broken (see below)
This is because outdentation is implemented partly using a post-transformation formatter, and formatters are expected to deal with updating traceability themselves (which the outdentation formatter doesn't).
Given that most formatters only add/remove whitespace, we could introduce an abstract e.g. TraceabilityPreservingFormatter class that updates trace links given only the original and the formatted text and make EGL's OutdentationFormatter, as well as other formatters, extend it. To deal with cases where formatters actually do more than adding/removing whitespace, TraceabilityPreservingFormatter could actually check that the original/formatted text only differ in whitespace and fail or report a warning otherwise.
