Implement all of the Find Unused Variables and Parameters functionality in Code Analysis
Currently Code Analysis does not implement all of the items that Find Unused Variables and Parameters does.
Specifically I know it's missing:
- Declared variables that are used before a value is assigned
- Assigned values that are never used
With this code:
DECLARE @Test NVARCHAR(1)
DECLARE @Test2 INT
DECLARE @Test3 DATE
SET @Test = 1
SET @Test = N'Test' + @Test2
Code Analysis will flag the DECLARE for @Test for having a NVARCHAR of size 1 and @Test3 for not being used, but it will not flag @Test2 for being used before a value is assigned to it and for the values assigned to @Test1 never being used.
It would be nice if those additional checks were in Code Analysis so that we could see the real time feedback we get with the other checks. As it stands, we can get to it, but devs have to remember to run that extra check once they are done.