mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
Ruby: remove some redundant getASubclass() calls
This commit is contained in:
@@ -40,7 +40,7 @@ private API::Node activeRecordClassApiNode() {
|
||||
// In Rails applications `ApplicationRecord` typically extends `ActiveRecord::Base`, but we
|
||||
// treat it separately in case the `ApplicationRecord` definition is not in the database.
|
||||
API::getTopLevelMember("ApplicationRecord")
|
||||
].getASubclass()
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ private API::Node activeRecordClassApiNode() {
|
||||
class ActiveRecordModelClass extends ClassDeclaration {
|
||||
ActiveRecordModelClass() {
|
||||
this.getSuperclassExpr() =
|
||||
activeRecordClassApiNode().getAValueReachableFromSource().asExpr().getExpr()
|
||||
activeRecordClassApiNode().getASubclass().getAValueReachableFromSource().asExpr().getExpr()
|
||||
}
|
||||
|
||||
// Gets the class declaration for this class and all of its super classes
|
||||
|
||||
@@ -17,8 +17,9 @@ module ActiveResource {
|
||||
/**
|
||||
* An ActiveResource model class. This is any (transitive) subclass of ActiveResource.
|
||||
*/
|
||||
pragma[nomagic]
|
||||
private API::Node modelApiNode() {
|
||||
result = API::getTopLevelMember("ActiveResource").getMember("Base").getASubclass+()
|
||||
result = API::getTopLevelMember("ActiveResource").getMember("Base").getASubclass()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -85,7 +85,6 @@ module ActiveStorage {
|
||||
// Class methods
|
||||
API::getTopLevelMember("ActiveStorage")
|
||||
.getMember("Blob")
|
||||
.getASubclass()
|
||||
.getAMethodCall(["create_after_unfurling!", "create_and_upload!"]),
|
||||
// Instance methods
|
||||
any(BlobInstance i, DataFlow::CallNode c |
|
||||
|
||||
@@ -42,7 +42,7 @@ private class GraphqlRelayClassicMutationClass extends ClassDeclaration {
|
||||
this.getSuperclassExpr() =
|
||||
graphQlSchema()
|
||||
.getMember("RelayClassicMutation")
|
||||
.getASubclass*()
|
||||
.getASubclass()
|
||||
.getAValueReachableFromSource()
|
||||
.asExpr()
|
||||
.getExpr()
|
||||
|
||||
@@ -18,8 +18,7 @@ module Twirp {
|
||||
*/
|
||||
class ServiceInstantiation extends DataFlow::CallNode {
|
||||
ServiceInstantiation() {
|
||||
this =
|
||||
API::getTopLevelMember("Twirp").getMember("Service").getASubclass().getAnInstantiation()
|
||||
this = API::getTopLevelMember("Twirp").getMember("Service").getAnInstantiation()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +61,7 @@ module Twirp {
|
||||
*/
|
||||
class ClientInstantiation extends DataFlow::CallNode {
|
||||
ClientInstantiation() {
|
||||
this = API::getTopLevelMember("Twirp").getMember("Client").getASubclass().getAnInstantiation()
|
||||
this = API::getTopLevelMember("Twirp").getMember("Client").getAnInstantiation()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user