mirror of
https://github.com/github/codeql.git
synced 2026-07-13 15:28:16 +02:00
25 lines
771 B
Plaintext
25 lines
771 B
Plaintext
/**
|
|
* @name Property value is not used when setting a property
|
|
* @description Ignoring the value assigned to a property is potentially confusing and
|
|
* can lead to unexpected results.
|
|
* @kind problem
|
|
* @problem.severity warning
|
|
* @precision high
|
|
* @id cs/unused-property-value
|
|
* @tags reliability
|
|
* maintainability
|
|
* language-features
|
|
*/
|
|
|
|
import csharp
|
|
|
|
from Setter setter
|
|
where
|
|
not exists(setter.getAParameter().getAnAccess()) and
|
|
not exists(ThrowStmt t | t.getEnclosingCallable() = setter) and
|
|
setter.hasBody() and // Trivial setter is OK
|
|
not setter.getDeclaration().overrides() and
|
|
not setter.getDeclaration().implements() and
|
|
not setter.getDeclaration().isVirtual()
|
|
select setter, "Value ignored when setting property."
|