mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C#: Only consider calling GetHashCode on byte, sbyte, short, ushort and int as useless.
This commit is contained in:
@@ -16,5 +16,12 @@ import semmle.code.csharp.frameworks.System
|
||||
from MethodCall mc, IntegralType t
|
||||
where
|
||||
mc.getTarget() instanceof GetHashCodeMethod and
|
||||
t = mc.getQualifier().getType()
|
||||
t = mc.getQualifier().getType() and
|
||||
(
|
||||
t instanceof ByteType or
|
||||
t instanceof SByteType or
|
||||
t instanceof ShortType or
|
||||
t instanceof UShortType or
|
||||
t instanceof IntType
|
||||
)
|
||||
select mc, "Calling GetHashCode() on type " + t.toStringWithTypes() + " is redundant."
|
||||
|
||||
Reference in New Issue
Block a user