Feuermagier / autograder

Automatic grading of student's Java code
MIT License
13 stars 7 forks source link

Improve avoid shadowing lint, by only triggering when the shadowed variables are both used. #525

Open Luro02 opened 1 month ago

Luro02 commented 1 month ago

Summary

The lint should only trigger when both the shadowed variable and the variable that shadows it are used in the same method.

Alternative: Check how fields are referenced in other methods. If they are referenced by this. everywhere, then it is not that confusing to introduce a parameter/variable with the same name. Otherwise it could be confused.

Lint Name

AVOID_SHADOWING

Reproducer

<code>