mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
Kotlin: Format queries
This commit is contained in:
@@ -76,7 +76,9 @@ class CollectionSizeMethod extends CollectionMethod {
|
||||
|
||||
/** A method that mutates the collection it belongs to. */
|
||||
class CollectionMutator extends CollectionMethod {
|
||||
CollectionMutator() { pragma[only_bind_into](this).getName().regexpMatch("add.*|remove.*|push|pop|clear") }
|
||||
CollectionMutator() {
|
||||
pragma[only_bind_into](this).getName().regexpMatch("add.*|remove.*|push|pop|clear")
|
||||
}
|
||||
}
|
||||
|
||||
/** A method call that mutates a collection. */
|
||||
@@ -89,7 +91,9 @@ class CollectionMutation extends MethodAccess {
|
||||
|
||||
/** A method that queries the contents of a collection without mutating it. */
|
||||
class CollectionQueryMethod extends CollectionMethod {
|
||||
CollectionQueryMethod() { pragma[only_bind_into](this).getName().regexpMatch("contains|containsAll|get|size|peek") }
|
||||
CollectionQueryMethod() {
|
||||
pragma[only_bind_into](this).getName().regexpMatch("contains|containsAll|get|size|peek")
|
||||
}
|
||||
}
|
||||
|
||||
/** A `new` expression that allocates a fresh, empty collection. */
|
||||
|
||||
@@ -45,9 +45,7 @@ abstract class GeneratedFile extends File { }
|
||||
* A file detected as generated based on commonly-used marker comments.
|
||||
*/
|
||||
library class MarkerCommentGeneratedFile extends GeneratedFile {
|
||||
MarkerCommentGeneratedFile() {
|
||||
any(GeneratedFileMarker t).getFile() = this
|
||||
}
|
||||
MarkerCommentGeneratedFile() { any(GeneratedFileMarker t).getFile() = this }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,9 @@ class MapMutation extends MethodAccess {
|
||||
/** A method that queries the contents of the map it belongs to without mutating it. */
|
||||
class MapQueryMethod extends MapMethod {
|
||||
MapQueryMethod() {
|
||||
pragma[only_bind_into](this).getName().regexpMatch("get|containsKey|containsValue|entrySet|keySet|values|isEmpty|size")
|
||||
pragma[only_bind_into](this)
|
||||
.getName()
|
||||
.regexpMatch("get|containsKey|containsValue|entrySet|keySet|values|isEmpty|size")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user