mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
C#: Autoformat QL files
This commit is contained in:
@@ -28,11 +28,9 @@ where
|
||||
itemText = "here"
|
||||
)
|
||||
or
|
||||
(
|
||||
item = c.getAnOperator().(EQOperator) and
|
||||
message = "but it implements $@" and
|
||||
itemText = "operator =="
|
||||
)
|
||||
item = c.getAnOperator().(EQOperator) and
|
||||
message = "but it implements $@" and
|
||||
itemText = "operator =="
|
||||
or
|
||||
exists(IEquatableEqualsMethod eq |
|
||||
item = eq and
|
||||
|
||||
@@ -18,17 +18,13 @@ from Class c, Method present, string missing
|
||||
where
|
||||
c.isSourceDeclaration() and
|
||||
(
|
||||
(
|
||||
present = c.getAMethod().(EqualsMethod) and
|
||||
not c.getAMethod() instanceof GetHashCodeMethod and
|
||||
missing = "GetHashCode()"
|
||||
)
|
||||
present = c.getAMethod().(EqualsMethod) and
|
||||
not c.getAMethod() instanceof GetHashCodeMethod and
|
||||
missing = "GetHashCode()"
|
||||
or
|
||||
(
|
||||
present = c.getAMethod().(GetHashCodeMethod) and
|
||||
not implementsEquals(c) and
|
||||
missing = "Equals(object)"
|
||||
)
|
||||
present = c.getAMethod().(GetHashCodeMethod) and
|
||||
not implementsEquals(c) and
|
||||
missing = "Equals(object)"
|
||||
)
|
||||
select c, "Class '" + c.getName() + "' overrides $@, but not " + missing + ".", present,
|
||||
present.getName()
|
||||
|
||||
@@ -20,10 +20,8 @@ predicate implementsIComparable(ValueOrRefType t, Type paramType) {
|
||||
or
|
||||
t instanceof SystemIComparableTInterface
|
||||
or
|
||||
(
|
||||
t.getABaseType*() instanceof SystemIComparableInterface and
|
||||
paramType instanceof ObjectType
|
||||
)
|
||||
t.getABaseType*() instanceof SystemIComparableInterface and
|
||||
paramType instanceof ObjectType
|
||||
}
|
||||
|
||||
predicate compareToMethod(Method m, Type paramType) {
|
||||
|
||||
@@ -99,7 +99,7 @@ class DiscardedMethodCall extends MethodCall {
|
||||
// to deliberately ignore the returned value
|
||||
not getEnclosingCallable().getStatementBody().getNumberOfStmts() = 1
|
||||
|
|
||||
(important(m) and result = "should always be checked")
|
||||
important(m) and result = "should always be checked"
|
||||
or
|
||||
exists(int percentage | dubious(m, percentage) |
|
||||
result = percentage.toString() + "% of calls to this method have their result used"
|
||||
|
||||
Reference in New Issue
Block a user