Refactor GrapeHeadersBlockCall and GrapeCookiesBlockCall to simplify method call checks

This commit is contained in:
Chad Bentz
2025-09-22 12:52:30 -04:00
parent b837c56bec
commit ecd0ce65fe

View File

@@ -237,11 +237,8 @@ module Grape {
*/ */
private class GrapeHeadersBlockCall extends MethodCall { private class GrapeHeadersBlockCall extends MethodCall {
GrapeHeadersBlockCall() { GrapeHeadersBlockCall() {
exists(GrapeApiClass api | this = grapeApiInstance().getAMethodCall("headers").asExpr().getExpr() and
this.getParent+() = api.getADeclaration() and exists(this.getBlock())
this.getMethodName() = "headers" and
exists(this.getBlock())
)
} }
} }
@@ -251,11 +248,8 @@ module Grape {
*/ */
private class GrapeCookiesBlockCall extends MethodCall { private class GrapeCookiesBlockCall extends MethodCall {
GrapeCookiesBlockCall() { GrapeCookiesBlockCall() {
exists(GrapeApiClass api | this = grapeApiInstance().getAMethodCall("cookies").asExpr().getExpr() and
this.getParent+() = api.getADeclaration() and exists(this.getBlock())
this.getMethodName() = "cookies" and
exists(this.getBlock())
)
} }
} }