Files
codeql/csharp/ql/src/Useless code/UnusedLabel.ql
2025-06-17 09:56:43 +02:00

18 lines
396 B
Plaintext

/**
* @name Unused label
* @description An unused label serves no purpose and should be removed.
* @kind problem
* @problem.severity warning
* @precision high
* @id cs/unused-label
* @tags quality
* maintainability
* useless-code
*/
import csharp
from LabelStmt label
where not exists(GotoLabelStmt goto | label = goto.getTarget())
select label, "This label is not used."