Explanation

This rule analyses all expressions and determines whether they are using TODAY in a correct manner:

  • It should only be used as default value for 1 attribute
  • It should always be called via this 1 attribute, never directly in other expressions

Possible improvements

Make an attribute which contains TODAY as default expression and use references to this attribute everywhere you currently have "TODAY". This attribute can then easily be used for time travelling.

Example


This expression compares a date with TODAY to calculate the age of a child. This can lead to issues when testing requires time travelling. By using a reference attribute, only this single attribute needs to be changed whenever time travelling is required instead of having to change every expression mentioning TODAY.

It results in this code smell: