Login
localHides rule
Login

The rule check if the local declarations in the module don't hide (have the same name) as a parent declarations declared in the module. The syntax in a configuration file is:

[ruleType] ?not? localHides

Disabling the rule

It is possible to disable the rule for a selected part of the checked code by using pragma ruleOff: "localHides" 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: "localHides".}

To enable the rule again, the pragma ruleOn: "localHides" 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 const a = 1, the full declaration should be:

const a {.ruleOn: "localHides".} = 1

Examples

  1. Check if any local declaration hides the parent ones:

    check localHides

  2. Search for all local declarations which not hide the parent ones:

    search not localHides