Commit 3aa646b
[ruby] Add Support for ERB files (#5447)
* [ruby] Add support for basic ERB files (#5404)
* Added tests for ERB processing
* update test expectation
* Add isLineFeed func
* removed erb config file test
* Fixed new line issues with ERB files, updated test expectations
* [ruby] rework erb support. Added templateOutRaw and templateOutEscape operators. Included explicit return for ERB file processing
* [ruby] Add .html.erb files as config files for ruby
* review comments
* Fixed ERB lowering implementation. Updated test expectations
* Updated comments
* remove test
* upgrade ruby-ast-gen version
* upgrade ruby-ast-gen version, remove unnecessary whitespace
* [ruby] update code string and tests for joern__buffer changes to self.joern__buffer
* [ruby] update ERB tests to reflect no line numbers being set from ruby_ast_gen
* [ruby] remove self parameter from lambda, capture from outside instead
* [ruby] Add empty expression for if statement with no expressions in body specifically in ERB files
* [ruby] Only look for the closest self in the outerscope in closure body
* [ruby] capture self variable
* fix: resolve multiple self identifier refOuts bug
* chore: add return type
* refactor: scalafmt run
* fix: resolve incorrect closure binding refOut bug
This also fixes a bug where a lambda param IDENTIFIER was not referencing the param
* feat: use joern__buffer_append
* chore: scalafmt
* fix: recognise joern_inner_buffer appends as erb calls
* fix: retain joern__buffer_append args' receiver ast
* improvement: turn lookupSelfInOuterScope into wrapper
* improvement: override span instead of using 2 parameter lists
* refactor: remove debug lines in test
* improvement: move typeFullName to outer scope
* improvement: use buffer_append constant
* improvement: use Option.when
* improvement: remove case for self
* improvement: remove ERB call special case
* improvement: use camelCase for ERB buffer symbols and methods
* refactor: scalafmt
* cleanup: remove unused variable
* improvement: rename isErbCall
* improvement: avoid unnecessary call
* refactor: refactor block
* fix: don't generate receiver AST if isStatic
* fix: add tmp assignments to tests
* Revert "fix: add tmp assignments to tests"
This reverts commit f0fdf28.
* Revert "fix: don't generate receiver AST if isStatic"
This reverts commit 39edae8.
* chore: use Option.unless
---------
Co-authored-by: Tebogo Selahle <[email protected]>1 parent 8676e7b commit 3aa646b
File tree
16 files changed
+793
-98
lines changed- joern-cli/frontends
- rubysrc2cpg/src
- main
- resources
- scala/io/joern/rubysrc2cpg
- astcreation
- datastructures
- parser
- passes
- test/scala/io/joern/rubysrc2cpg
- passes
- querying
- x2cpg/src/main/scala/io/joern/x2cpg/frontendspecific/rubysrc2cpg
16 files changed
+793
-98
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
252 | 254 | | |
253 | 255 | | |
254 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
255 | 265 | | |
256 | 266 | | |
257 | 267 | | |
| |||
Lines changed: 64 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
9 | 8 | | |
10 | 9 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 10 | + | |
19 | 11 | | |
20 | 12 | | |
21 | 13 | | |
| |||
42 | 34 | | |
43 | 35 | | |
44 | 36 | | |
| 37 | + | |
45 | 38 | | |
46 | 39 | | |
47 | 40 | | |
| |||
64 | 57 | | |
65 | 58 | | |
66 | 59 | | |
| 60 | + | |
67 | 61 | | |
68 | 62 | | |
69 | 63 | | |
| |||
162 | 156 | | |
163 | 157 | | |
164 | 158 | | |
165 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
166 | 165 | | |
167 | 166 | | |
168 | 167 | | |
| |||
191 | 190 | | |
192 | 191 | | |
193 | 192 | | |
194 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
195 | 199 | | |
196 | 200 | | |
197 | 201 | | |
198 | 202 | | |
199 | 203 | | |
200 | 204 | | |
201 | 205 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
212 | 219 | | |
213 | | - | |
| 220 | + | |
| 221 | + | |
214 | 222 | | |
215 | 223 | | |
216 | 224 | | |
| |||
223 | 231 | | |
224 | 232 | | |
225 | 233 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
230 | 243 | | |
231 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
232 | 249 | | |
233 | 250 | | |
234 | 251 | | |
| |||
278 | 295 | | |
279 | 296 | | |
280 | 297 | | |
281 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
282 | 303 | | |
283 | 304 | | |
284 | 305 | | |
| |||
307 | 328 | | |
308 | 329 | | |
309 | 330 | | |
310 | | - | |
| 331 | + | |
311 | 332 | | |
312 | 333 | | |
313 | 334 | | |
| |||
662 | 683 | | |
663 | 684 | | |
664 | 685 | | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
665 | 693 | | |
666 | 694 | | |
667 | 695 | | |
| |||
970 | 998 | | |
971 | 999 | | |
972 | 1000 | | |
973 | | - | |
| 1001 | + | |
| 1002 | + | |
974 | 1003 | | |
975 | 1004 | | |
976 | 1005 | | |
| |||
1087 | 1116 | | |
1088 | 1117 | | |
1089 | 1118 | | |
| 1119 | + | |
| 1120 | + | |
1090 | 1121 | | |
Lines changed: 60 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
83 | 84 | | |
84 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
85 | 89 | | |
86 | | - | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
| |||
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
| 99 | + | |
| 100 | + | |
95 | 101 | | |
96 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
97 | 114 | | |
98 | 115 | | |
99 | 116 | | |
| |||
205 | 222 | | |
206 | 223 | | |
207 | 224 | | |
208 | | - | |
| 225 | + | |
209 | 226 | | |
210 | 227 | | |
211 | | - | |
| 228 | + | |
212 | 229 | | |
213 | 230 | | |
214 | | - | |
| 231 | + | |
215 | 232 | | |
216 | 233 | | |
217 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
218 | 238 | | |
219 | | - | |
| 239 | + | |
220 | 240 | | |
221 | 241 | | |
222 | 242 | | |
223 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
224 | 246 | | |
225 | 247 | | |
226 | 248 | | |
| |||
229 | 251 | | |
230 | 252 | | |
231 | 253 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
| 254 | + | |
| 255 | + | |
241 | 256 | | |
242 | | - | |
| 257 | + | |
| 258 | + | |
243 | 259 | | |
| 260 | + | |
244 | 261 | | |
245 | 262 | | |
246 | 263 | | |
| |||
614 | 631 | | |
615 | 632 | | |
616 | 633 | | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
617 | 648 | | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
511 | 515 | | |
512 | 516 | | |
513 | 517 | | |
| |||
685 | 689 | | |
686 | 690 | | |
687 | 691 | | |
| 692 | + | |
688 | 693 | | |
0 commit comments