You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @name Local variable is initialized but not used
* @description A local variable is initialized once, but never read or written to. Either the local variable is useless, or its value was intended to be used but is not.
* @kind problem
* @problem.severity recommendation
* @precision low
* @id java/unused-initialized-local
* @tags external/cwe/cwe-563
*/
import java
import DeadLocals
fromLocalVariableDeclExprve,LocalVariableDeclv
where
v=ve.getVariable()and
notassigned(v)and
notread(v)and
exists(ve.getInit())and
notexprHasNoEffect(ve.getInit())
selectv,"Local variable "+v.getName()+" is never read or written to after it is initialised."