mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
Code quality improvement
This commit is contained in:
@@ -33,12 +33,13 @@ predicate compareToMethod(Method m, Type paramType) {
|
||||
paramType = m.getAParameter().getType()
|
||||
}
|
||||
|
||||
from Method m, RefType declaringType, Type actualParamType
|
||||
from Method m, RefType declaringType, Type actualParamType, string paramTypeName
|
||||
where
|
||||
m.isSourceDeclaration() and
|
||||
declaringType = m.getDeclaringType() and
|
||||
compareToMethod(m, actualParamType) and
|
||||
not implementsIComparable(declaringType, actualParamType)
|
||||
not implementsIComparable(declaringType, actualParamType) and
|
||||
paramTypeName = actualParamType.getName()
|
||||
select m,
|
||||
"The parameter of this 'CompareTo' method is of type '" + actualParamType.getName() +
|
||||
"', but the declaring type does not implement 'IComparable<" + actualParamType.getName() + ">'."
|
||||
"The parameter of this 'CompareTo' method is of type '" + paramTypeName +
|
||||
"', but the declaring type does not implement 'IComparable<" + paramTypeName + ">'."
|
||||
|
||||
Reference in New Issue
Block a user