The rule to check if the selected procedure uses all its parameter The syntax in a configuration file is:
[ruleType] ?not? paramsUsed [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.
- paramsUsed is the name of the rule. It is case-insensitive, thus it can be set as paramsUsed, paramsUsed or pArAmSuSeD.
- 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: "paramsUsed" 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: "paramsUsed".}
To enable the rule again, the pragma ruleOn: "paramsUsed" 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: "paramsUsed".}
Examples
Check if all procedures in module uses their parameters:
check paramsUsed procedures
Search for all declarations which don't use their all parameters:
search not paramsUsed all