drop ViewComponent parts from the ActionView library

This commit is contained in:
Alex Ford
2021-08-26 14:44:23 +01:00
parent a3ae5bcec4
commit 9571e7bccc
3 changed files with 0 additions and 29 deletions

View File

@@ -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.
*

View File

@@ -17,7 +17,5 @@ renderCalls
| app/views/foo/bars/show.html.erb:31:5:31:89 | call to render |
renderToCalls
| app/controllers/foo/bars_controller.rb:10:16:10:97 | call to render_to_string |
viewComponentClasses
| app/components/DummyComponent.rb:1:1:2:3 | DummyComponent |
linkToCalls
| app/views/foo/bars/show.html.erb:33:5:33:41 | call to link_to |

View File

@@ -9,6 +9,4 @@ query predicate renderCalls(RenderCall c) { any() }
query predicate renderToCalls(RenderToCall c) { any() }
query predicate viewComponentClasses(ViewComponentClass cls) { any() }
query predicate linkToCalls(LinkToCall c) { any() }