mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Merge pull request #16004 from tamasvajk/feature/adjust-incorrect-compare-to
C#: Simplify the output of `cs/wrong-compareto-signature` to remove e…
This commit is contained in:
@@ -33,13 +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 $@, but $@ does not implement 'IComparable<$@>'.",
|
||||
actualParamType, actualParamType.getName(), declaringType, declaringType.getName(),
|
||||
actualParamType, actualParamType.getName()
|
||||
"The parameter of this 'CompareTo' method is of type '" + paramTypeName +
|
||||
"', but the declaring type does not implement 'IComparable<" + paramTypeName + ">'."
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* The alert message of `cs/wrong-compareto-signature` has been changed to remove unnecessary element references.
|
||||
|
||||
Reference in New Issue
Block a user