The rule to check do ranges' declarations in the code follow some design patterns. Checked things:
- Do ranges' declarations have space before and after
..sign.
The syntax in a configuration file is:
[ruleType] ?not? ranges [checkType]
- 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 declaration which violates any of the checks. Search
type will list all declarations which violates any of checks or raise an
error if nothing found. Count type will simply list the amount of the
declarations which violates the checks. Fix type will try to upgrade the
declaration to meet the rule settings. For example, it will add spaces before
and after
..sign or remove them if negation was used. - optional word not means negation for the rule. Adding word not will
change to inform only about declarations which not violate the checks. For
example, it will raise an error when check type find a declaration with space
before and after
..sign. - ranges is the name of the rule. It is case-insensitive, thus it can be set as ranges, ranges or rAnGeS.
- checkType is the type of checks to perform on the declarations. Proper
value is: spaces. It will check if all declarations do they have spaces
before and after
..sign.
Disabling the rule
It is possible to disable the rule for a selected part of the checked code
by using pragma ruleOff: "ranges" in the element from which the rule
should be disabled or in code before it. For example, if the rule should
be disabled for procedure proc main(), the full declaration of it should
be::
proc main() {.ruleOff: "ranges".}
To enable the rule again, the pragma ruleOn: "ranges" should be added in
the element which should be checked or in code before it. For example, if
the rule should be re-enabled for procedure proc main(), the full declaration should
be::
proc main() {.ruleOn: "ranges".}
Examples
Check if all ranges' declarations in the code have spaces before and after
..sign, the opposite to the Nim coding standard:check ranges spaces
Replace all range's declarations in the code with the Nim coding standard:
fix not ranges spaces