Commit Graph

176 Commits

Author SHA1 Message Date
Alex Ford
c6b6a83501 extend FLines* tests 2021-04-21 10:42:53 +01:00
Alex Ford
a1c91e28da move FLines* tests to a common directory 2021-04-21 10:34:58 +01:00
Alex Ford
50a0f282bf add basic tests for FLines queries 2021-04-20 17:36:16 +01:00
Arthur Baars
24bb11b20a Improve module/class resolution 2021-04-14 17:14:38 +02:00
Arthur Baars
12ee957331 Add test cases 2021-04-14 17:12:39 +02:00
Arthur Baars
754bfdd136 Ignore include/prepend statements in blocks
Include and prepend statements are rarely used in block in normal code and when
used in normal code they tend to be in blocks that are passed to methods like
`module_eval` which is a builtin method that evaluates a block in the context
of some other module (typically created with Module.new). We currently don't attempt
to track such "dynamically" constructed modules, and ignoring such modules
 and the `module_eval` calls on them seems fine for now.

Another, much more frequent use of include/prepend statements in blocks is in Rspec.describe and
Rspec.context method calls in tests. Rspec also evaluates those blocks in the context of some
special Rspec class. Precisely tracking such calls during the initial construction of the module/class
hierarchy would be really hard and there would be little benefit because the interesting modules and classes of
an application are not defined in test files.
2021-04-14 09:53:19 +02:00
Arthur Baars
280fe73063 Add test case with 'module_eval' call with block containing 'prepend' statement 2021-04-14 09:53:19 +02:00
Arthur Baars
2db999d0da Improve module resolution 2021-04-09 09:51:24 +02:00
Arthur Baars
039e8b36a5 Add some include/prepend tests 2021-04-07 17:27:33 +02:00
Arthur Baars
063b085078 Address comments 2021-04-07 15:57:13 +02:00
Arthur Baars
f12e6ea8ea Avoid 'Object::' prefixes 2021-03-30 16:14:21 +02:00
Arthur Baars
b2c7185664 Add tests 2021-03-30 15:49:41 +02:00
Arthur Baars
eebbc7e505 AST: rename Class/Module to ClassDefinition/ModuleDefinition 2021-03-30 15:40:01 +02:00
Tom Hvitved
0bb5007103 Reintroduce hidden then/else/do in AST; include all in CFG 2021-03-25 14:22:35 +01:00
Tom Hvitved
58ecd771d3 AST: Exclude empty then/else/do statements 2021-03-25 09:53:55 +01:00
Nick Rolfe
c6958f64e4 Make CFG for AssignExpr visit left operand before right 2021-03-19 14:25:38 +00:00
Tom Hvitved
e175513293 Remove duplicate tuple patterns 2021-03-19 10:52:29 +01:00
Nick Rolfe
6bcc433af3 Uncomment empty class and module in CFG test 2021-03-18 19:02:32 +00:00
Nick Rolfe
9493997e9d Make space in CFG test for two new lines in the middle
Commented out to make it easier to ignore the noise from line number
changes.
2021-03-18 19:01:11 +00:00
Nick Rolfe
4ce7faf868 Fix erroneous flow from 'raise' call to StmtSequence 2021-03-18 13:01:27 +00:00
Tom Hvitved
3bb2c529a5 CFG: Revert change to mandatory parameters 2021-03-18 10:43:10 +01:00
Nick Rolfe
32e2b257bf Port CFG implementation to public AST interface 2021-03-17 20:28:47 +00:00
Nick Rolfe
26c251f080 Order CFG nodes by column as well 2021-03-17 19:07:52 +00:00
Tom Hvitved
7eaf02a0bf Make external AstNode an IPA type 2021-03-16 12:50:20 +01:00
Arthur Baars
c672169621 Merge pull request #155 from github/aibaars/order-ast-test
AST: order edges by target node
2021-03-15 10:43:34 +01:00
Arthur Baars
d54db292f7 Move semmle.order property to printAst.qll 2021-03-15 10:33:10 +01:00
Arthur Baars
3e5ff1d042 AST: order edges by target node
When printing a tree CodeQL iterates over the nodes and
for each node prints the successor edges as children. If the
the successor edges are ordered by target node then the children
printe in the right order in the expected output.
2021-03-12 16:52:34 +01:00
Arthur Baars
cde496cc4c Merge pull request #152 from github/aibaars/fix-vars
Fix VariableRead/WriteAcess for instance and class variables
2021-03-11 17:05:56 +01:00
Calum Grant
bf873c8ad1 Merge pull request #147 from github/calumgrant/use-detect
Ruby: New query UseDetect
2021-03-10 14:39:37 +00:00
Arthur Baars
f28071ceb6 Fix VariableRead/WriteAcess for instance and class variables 2021-03-09 13:55:55 +01:00
Arthur Baars
600d9c66ae Remove VariableScope 2021-03-09 11:56:17 +01:00
Arthur Baars
86a89ab1fe Remove VariableScope IPA type 2021-03-09 11:48:18 +01:00
Calum Grant
855d190800 Ruby: Test local data flow 2021-03-09 10:25:24 +00:00
Calum Grant
5b4bf584a1 Ruby: Update qltest output for new select format 2021-03-09 10:20:23 +00:00
Calum Grant
ca497479c2 Ruby: Finish the test for UseDetect 2021-03-04 15:44:05 +00:00
Calum Grant
522bcff79d Ruby: Initial test case 2021-03-04 15:38:09 +00:00
Arthur Baars
39181ec871 AST: printAST: show all primary classes and method names 2021-02-25 15:25:49 +01:00
Arthur Baars
e2b2a450ac AST: add printAST test case 2021-02-25 15:25:49 +01:00
Arthur Baars
f3d1c804be Update test data 2021-02-25 12:57:18 +01:00
Arthur Baars
999b82ca73 Remove imports of TreeSitter 2021-02-25 12:57:18 +01:00
Arthur Baars
27a2310840 CFG: sort expected output by file path and line 2021-02-25 12:27:11 +01:00
Arthur Baars
0f940349ba AST: rename getExpr predicates to more meaningful names 2021-02-25 10:11:29 +01:00
Arthur Baars
336b310668 AST: improve AST for special parameters 2021-02-24 19:07:16 +01:00
Arthur Baars
cb21e8edda CFG: hide nodes that are not proper AstNodes 2021-02-24 19:07:16 +01:00
Arthur Baars
d6c0049a7e AST: make SetterMethodCall instance of MethodCall 2021-02-24 13:06:54 +01:00
Arthur Baars
7ae20f3b5b AST: add SetterMethodCall as instance of LhsExpr 2021-02-24 13:06:54 +01:00
Arthur Baars
79bb20b31f AST: add MethodCall as a subclass of Call 2021-02-24 13:06:53 +01:00
Arthur Baars
5fe7bd57fa AST: calls without method name 2021-02-24 13:02:22 +01:00
Nick Rolfe
6c84f2c3dc Add test case for multiple statements in interpolation 2021-02-23 15:52:11 +00:00
Arthur Baars
c0b5ac760a AST: rename getLhs/getRhs to getLeftOperand/getRightOperand 2021-02-18 14:37:58 +01:00