mirror of
https://github.com/github/codeql.git
synced 2025-12-27 22:26:31 +01:00
22 lines
598 B
Plaintext
22 lines
598 B
Plaintext
/**
|
|
* @name Redundant ToString() call
|
|
* @description Explicit calls to `ToString()` can be removed when the call
|
|
* appears in a context where an implicit conversion exists.
|
|
* @kind problem
|
|
* @problem.severity recommendation
|
|
* @precision high
|
|
* @id cs/useless-tostring-call
|
|
* @tags maintainability
|
|
* useless-code
|
|
*/
|
|
|
|
import csharp
|
|
import semmle.code.csharp.commons.Strings
|
|
import semmle.code.csharp.frameworks.System
|
|
|
|
from MethodCall mc
|
|
where
|
|
mc instanceof ImplicitToStringExpr and
|
|
mc.getTarget() instanceof ToStringMethod
|
|
select mc, "Redundant call to 'ToString'."
|