Skip to content

Commit 9d65552

Browse files
committed
Code quality improvement
1 parent d0c09f4 commit 9d65552

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

csharp/ql/src/API Abuse/IncorrectCompareToSignature.ql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ predicate compareToMethod(Method m, Type paramType) {
3333
paramType = m.getAParameter().getType()
3434
}
3535

36-
from Method m, RefType declaringType, Type actualParamType
36+
from Method m, RefType declaringType, Type actualParamType, string paramTypeName
3737
where
3838
m.isSourceDeclaration() and
3939
declaringType = m.getDeclaringType() and
4040
compareToMethod(m, actualParamType) and
41-
not implementsIComparable(declaringType, actualParamType)
41+
not implementsIComparable(declaringType, actualParamType) and
42+
paramTypeName = actualParamType.getName()
4243
select m,
43-
"The parameter of this 'CompareTo' method is of type '" + actualParamType.getName() +
44-
"', but the declaring type does not implement 'IComparable<" + actualParamType.getName() + ">'."
44+
"The parameter of this 'CompareTo' method is of type '" + paramTypeName +
45+
"', but the declaring type does not implement 'IComparable<" + paramTypeName + ">'."

0 commit comments

Comments
 (0)