The Programming Rules Review is also new in MZ-Tools 8.0 and allows you to define custom rules such as:
- If a ListView has the View property with the lvwReport value, it must have the FullRowSelect property with the True value.
- The DAO reference is forbidden.
- The Microsoft ActiveX Data Objects reference is mandatory for ActiveX Dll projects, and its version must be 2.6.
- A method cannot have more than 10 parameters.
- The BackColor property of forms must be &H8000000F&.
- The Height property of the Command controls must be 3600.
- Code files must contain the Option Explicit statement.
- The code of a method cannot contain a “forbidden” statement such as GoTo.
- A method cannot have more than 500 lines of code.
You get the idea, don’t you? The Programming Rules Review is part of the Quality Review feature:
The programming rules are created, customized and enabled/disabled in the corresponding section of the “Options” window, “Team Options” tab, “Quality Review” > “Programming Rules Review” node:
As you can see, after an (optional) Id for the programming rule and a description, the first important thing is the item to review, which can be any object or a collection of objects, from the IDE to a parameter of a method:
If you select an item to review that is an object, then you can define a condition that must meet that object. The condition uses a property of that object, and operator, and a value or set of values:
Apart from the “What to review” tab, there are another two tabs. The second tab sets when to review the item. If you don’t set conditions, the item is always reviewed. But for example, you may want to review something only when its project is Standard Exe, but not when it is an ActiveX dll:
When the Programming Rules Review finds violations of some programming rule, it shows them in the Results toolwindow:
So, the Programming Rules Review allows you to create rules for almost any validation that you want to perform, and it is a powerful tool to ensure that quality rules that are defined by a team lead are enforced. The setup installs some programming rules as samples to get started.