saveourtool/diktat

Shadowing of variables detection

Open

#425 opened on Oct 19, 2020

View on GitHub
 (1 comment) (0 reactions) (1 assignee)Kotlin (40 forks)github user discovery
enhancementgood first issuehelp wanted

Repository metrics

Stars
 (571 stars)
PR merge metrics
 (PR metrics pending)

Description

Diktat should be able to detect shadowed variables as it can cause serious issues.

Name shadowing can cause following issues. There should be no shadowing.
infinite loop:

fun main() {
        var x = 0
        while (x < 10) {
            var x = 0
            x++
        }
}

Contributor guide