The rule to check the parameters of routines. Checked things:
- Do the routine uses all its parameters.
- Do the routine uses string or int for its parameters.
The syntax in a configuration file is:
[ruleType] ?not? params [checkType] [declarationType]
- ruleType is the type of rule which will be executed. Proper values are: check, search, count and fix. For more information about the types of rules, please refer to the program's documentation. Check type will raise an error if there is a procedure which doesn't use all its parameters. Search type will list all procedures which uses their all parameters and raise error if nothing was found. Count type will simply list the amount of procedures which uses all their parameters. Fix type will execute the default shell command set by the program's setting fixCommand.
- optional word not means negation for the rule. Adding word not will change to inform only about procedures which have all parameters used. Probably useable only with search and count type of rule.
- params is the name of the rule. It is case-insensitive, thus it can be set as params, PARAMS or pArAmS.
- checkType is the type of check to perform by the rule. Possible values:
used: check do all parameters of routines are used.standardtypes: check do routines use string or int for their parameters.all: perform all the rule's checks. - declarationType is the type of declaration which will be checked for the
parameters usage. Possible values:
procedures: check all procedures, functions and methods.templates: check templates only.all: check all routines declarations (procedures, functions, templates, macros, etc.).
Disabling the rule
It is possible to disable the rule for a selected part of the checked code
by using pragma ruleOff: "params" in the declaration from which the rule
should be disabled. For example, if the rule should be disabled for procedure
main(), the full declaration of it should be:
proc main() {.ruleOff: "params".}
To enable the rule again, the pragma ruleOn: "params" should be added in
the element which should be checked. For example, if the rule should be
re-enabled for function myFunc(a: int), the full declaration should be:
func myFunc(a: int) {.ruleOn: "params".}
Examples
Check if all procedures in module uses their parameters:
check params used proceduresSearch for all declarations which don't use their all parameters:
search not params used all