mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
drop ViewComponent parts from the ActionView library
This commit is contained in:
@@ -7,9 +7,6 @@ private import codeql_ruby.ast.internal.Module
|
||||
private import ActionController
|
||||
|
||||
predicate inActionViewContext(AstNode n) {
|
||||
// Within a view component
|
||||
n.getEnclosingModule() instanceof ViewComponentClass
|
||||
or
|
||||
// Within a template
|
||||
// TODO: n.getLocation().getFile() instanceof ErbFile
|
||||
n.getLocation().getFile().getExtension() = "erb"
|
||||
@@ -121,28 +118,6 @@ abstract class RenderToCall extends MethodCall {
|
||||
// A call to `render_to` from within a template or view component.
|
||||
private class ActionViewRenderToCall extends ActionViewContextCall, RenderToCall { }
|
||||
|
||||
private class ViewComponentBaseAccess extends ConstantReadAccess {
|
||||
ViewComponentBaseAccess() {
|
||||
this.getName() = "Base" and
|
||||
this.getScopeExpr().(ConstantAccess).getName() = "ViewComponent"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class extending `ViewComponent::Base`.
|
||||
*/
|
||||
class ViewComponentClass extends ClassDeclaration {
|
||||
ViewComponentClass() {
|
||||
// class Foo < ViewComponent::Base
|
||||
this.getSuperclassExpr() instanceof ViewComponentBaseAccess
|
||||
or
|
||||
// class Bar < Foo
|
||||
exists(ViewComponentClass other |
|
||||
other.getModule() = resolveScopeExpr(this.getSuperclassExpr())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to the ActionView `link_to` helper method.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user