Files
codeql/csharp/ql/src/Dead Code/UnusedField.ql
2019-01-02 12:59:07 +01:00

23 lines
522 B
Plaintext

/**
* @name Unused field
* @description Finds private fields that seem to never be used, or solely used from dead methods
* @kind problem
* @problem.severity warning
* @precision low
* @id cs/unused-field
* @tags maintainability
* useless-code
* external/cwe/cwe-561
*/
import csharp
import DeadCode
from Field f
where
not extractionIsStandalone() and
f.fromSource() and
isDeadField(f) and
not f.getDeclaringType().isPartial()
select f, "Unused field (or field used from dead method only)"