saveourtool / diktat

Strict coding standard for Kotlin and a custom set of rules for detecting code smells, code style issues and bugs
https://diktat.saveourtool.com
MIT License
544 stars 39 forks source link

Shadowing of variables detection #425

Open orchestr7 opened 4 years ago

orchestr7 commented 4 years ago

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++
        }
}
orchestr7 commented 3 years ago

426 should help to create the logic next time