Skip to content

Commit 9571e7b

Browse files
committed
drop ViewComponent parts from the ActionView library
1 parent a3ae5bc commit 9571e7b

File tree

3 files changed

+0
-29
lines changed

3 files changed

+0
-29
lines changed

ql/src/codeql_ruby/frameworks/ActionView.qll

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ private import codeql_ruby.ast.internal.Module
77
private import ActionController
88

99
predicate inActionViewContext(AstNode n) {
10-
// Within a view component
11-
n.getEnclosingModule() instanceof ViewComponentClass
12-
or
1310
// Within a template
1411
// TODO: n.getLocation().getFile() instanceof ErbFile
1512
n.getLocation().getFile().getExtension() = "erb"
@@ -121,28 +118,6 @@ abstract class RenderToCall extends MethodCall {
121118
// A call to `render_to` from within a template or view component.
122119
private class ActionViewRenderToCall extends ActionViewContextCall, RenderToCall { }
123120

124-
private class ViewComponentBaseAccess extends ConstantReadAccess {
125-
ViewComponentBaseAccess() {
126-
this.getName() = "Base" and
127-
this.getScopeExpr().(ConstantAccess).getName() = "ViewComponent"
128-
}
129-
}
130-
131-
/**
132-
* A class extending `ViewComponent::Base`.
133-
*/
134-
class ViewComponentClass extends ClassDeclaration {
135-
ViewComponentClass() {
136-
// class Foo < ViewComponent::Base
137-
this.getSuperclassExpr() instanceof ViewComponentBaseAccess
138-
or
139-
// class Bar < Foo
140-
exists(ViewComponentClass other |
141-
other.getModule() = resolveScopeExpr(this.getSuperclassExpr())
142-
)
143-
}
144-
}
145-
146121
/**
147122
* A call to the ActionView `link_to` helper method.
148123
*

ql/test/library-tests/frameworks/ActionView.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@ renderCalls
1717
| app/views/foo/bars/show.html.erb:31:5:31:89 | call to render |
1818
renderToCalls
1919
| app/controllers/foo/bars_controller.rb:10:16:10:97 | call to render_to_string |
20-
viewComponentClasses
21-
| app/components/DummyComponent.rb:1:1:2:3 | DummyComponent |
2220
linkToCalls
2321
| app/views/foo/bars/show.html.erb:33:5:33:41 | call to link_to |

ql/test/library-tests/frameworks/ActionView.ql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ query predicate renderCalls(RenderCall c) { any() }
99

1010
query predicate renderToCalls(RenderToCall c) { any() }
1111

12-
query predicate viewComponentClasses(ViewComponentClass cls) { any() }
13-
1412
query predicate linkToCalls(LinkToCall c) { any() }

0 commit comments

Comments
 (0)