Upgrading Your Rules Definition Files
The format required for rules definition files changed in ValidateThis 0.98, in a way that makes older rules definition files incompatible. If you are upgrading from a version prior to 0.98 please read this page for more information about the change and a tip for easily upgrading your files using Eclipse.
Changes to the Param Element
The only piece of metadata that changed its format is the param element. It is now a requirement to specify a name and value attribute for the param element, whereas prior to version 0.98 neither were required (nor even supported).
To illustrate this change, the following examples of rules using param elements in both the old format and the new format, both in xml and json, have been provided:
Old (unsupported) xml format:
1 2 3 4 5 6 |
|
New xml format:
1 2 3 4 5 6 |
|
Old (unsupported) json format:
1 2 3 4 5 6 7 8 9 10 |
|
New json format:
1 2 3 4 5 6 7 8 9 10 |
|
What Do I Have to Change?
Based on the format change described above, you’ll have to change any rules in your files that use the param element.
Upgrading Your Files Using Eclipse
Marc Esher was kind enough to contribute a regular expression that can be used with Eclipse’s find and replace feature. In the dialog, using the following values:
- find: <param (.?)=“(.?)”
- replace: <param name=“$1” value=“$2”
Make sure the “Regular Expressions” checkbox is checked.