Code quality improvement

This commit is contained in:
Tamas Vajk
2024-03-21 11:26:45 +01:00
parent d0c09f43a9
commit 9d655520cc

View File

@@ -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 + ">'."