Skip to content

Commit 7d0bfe8

Browse files
authored
Merge pull request #10531 from github/nickrolfe/title-case
Ruby: use consistent capitalization with `import ... as`
2 parents ad48915 + df8a182 commit 7d0bfe8

File tree

9 files changed

+103
-103
lines changed

9 files changed

+103
-103
lines changed

ruby/ql/lib/codeql/ruby/ast/internal/AST.qll

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ private import codeql.ruby.ast.internal.Call
44
private import codeql.ruby.ast.internal.Parameter
55
private import codeql.ruby.ast.internal.Pattern
66
private import codeql.ruby.ast.internal.Variable
7-
private import codeql.ruby.AST as AST
7+
private import codeql.ruby.AST as Ast
88
private import Synthesis
99

1010
module MethodName {
@@ -20,7 +20,7 @@ module MethodName {
2020
@ruby_token_operator;
2121
}
2222

23-
private predicate mkSynthChild(SynthKind kind, AST::AstNode parent, int i) {
23+
private predicate mkSynthChild(SynthKind kind, Ast::AstNode parent, int i) {
2424
any(Synthesis s).child(parent, i, SynthChild(kind))
2525
}
2626

@@ -29,7 +29,7 @@ private module Cached {
2929
cached
3030
newtype TAstNode =
3131
TAddExprReal(Ruby::Binary g) { g instanceof @ruby_binary_plus } or
32-
TAddExprSynth(AST::AstNode parent, int i) { mkSynthChild(AddExprKind(), parent, i) } or
32+
TAddExprSynth(Ast::AstNode parent, int i) { mkSynthChild(AddExprKind(), parent, i) } or
3333
TAliasStmt(Ruby::Alias g) or
3434
TAlternativePattern(Ruby::AlternativePattern g) or
3535
TArgumentList(Ruby::AstNode g) {
@@ -62,7 +62,7 @@ private module Cached {
6262
g instanceof @ruby_operator_assignment_starstarequal
6363
} or
6464
TAssignExprReal(Ruby::Assignment g) or
65-
TAssignExprSynth(AST::AstNode parent, int i) { mkSynthChild(AssignExprKind(), parent, i) } or
65+
TAssignExprSynth(Ast::AstNode parent, int i) { mkSynthChild(AssignExprKind(), parent, i) } or
6666
TAssignLShiftExpr(Ruby::OperatorAssignment g) {
6767
g instanceof @ruby_operator_assignment_langlelangleequal
6868
} or
@@ -86,34 +86,34 @@ private module Cached {
8686
TBeginBlock(Ruby::BeginBlock g) or
8787
TBeginExpr(Ruby::Begin g) or
8888
TBitwiseAndExprReal(Ruby::Binary g) { g instanceof @ruby_binary_ampersand } or
89-
TBitwiseAndExprSynth(AST::AstNode parent, int i) {
89+
TBitwiseAndExprSynth(Ast::AstNode parent, int i) {
9090
mkSynthChild(BitwiseAndExprKind(), parent, i)
9191
} or
9292
TBitwiseOrExprReal(Ruby::Binary g) { g instanceof @ruby_binary_pipe } or
93-
TBitwiseOrExprSynth(AST::AstNode parent, int i) { mkSynthChild(BitwiseOrExprKind(), parent, i) } or
93+
TBitwiseOrExprSynth(Ast::AstNode parent, int i) { mkSynthChild(BitwiseOrExprKind(), parent, i) } or
9494
TBitwiseXorExprReal(Ruby::Binary g) { g instanceof @ruby_binary_caret } or
95-
TBitwiseXorExprSynth(AST::AstNode parent, int i) {
95+
TBitwiseXorExprSynth(Ast::AstNode parent, int i) {
9696
mkSynthChild(BitwiseXorExprKind(), parent, i)
9797
} or
9898
TBlockArgument(Ruby::BlockArgument g) or
9999
TBlockParameter(Ruby::BlockParameter g) or
100-
TBraceBlockSynth(AST::AstNode parent, int i) { mkSynthChild(BraceBlockKind(), parent, i) } or
100+
TBraceBlockSynth(Ast::AstNode parent, int i) { mkSynthChild(BraceBlockKind(), parent, i) } or
101101
TBraceBlockReal(Ruby::Block g) { not g.getParent() instanceof Ruby::Lambda } or
102102
TBreakStmt(Ruby::Break g) or
103103
TCaseEqExpr(Ruby::Binary g) { g instanceof @ruby_binary_equalequalequal } or
104104
TCaseExpr(Ruby::Case g) or
105105
TCaseMatch(Ruby::CaseMatch g) or
106106
TCharacterLiteral(Ruby::Character g) or
107107
TClassDeclaration(Ruby::Class g) or
108-
TClassVariableAccessReal(Ruby::ClassVariable g, AST::ClassVariable v) {
108+
TClassVariableAccessReal(Ruby::ClassVariable g, Ast::ClassVariable v) {
109109
ClassVariableAccess::range(g, v)
110110
} or
111-
TClassVariableAccessSynth(AST::AstNode parent, int i, AST::ClassVariable v) {
111+
TClassVariableAccessSynth(Ast::AstNode parent, int i, Ast::ClassVariable v) {
112112
mkSynthChild(ClassVariableAccessKind(v), parent, i)
113113
} or
114114
TComplementExpr(Ruby::Unary g) { g instanceof @ruby_unary_tilde } or
115115
TComplexLiteral(Ruby::Complex g) or
116-
TConstantReadAccessSynth(AST::AstNode parent, int i, string value) {
116+
TConstantReadAccessSynth(Ast::AstNode parent, int i, string value) {
117117
mkSynthChild(ConstantReadAccessKind(value), parent, i)
118118
} or
119119
TDefinedExpr(Ruby::Unary g) { g instanceof @ruby_unary_definedquestion } or
@@ -122,7 +122,7 @@ private module Cached {
122122
not strictcount(int i | exists(g.getParent().(Ruby::LeftAssignmentList).getChild(i))) = 1
123123
} or
124124
TDivExprReal(Ruby::Binary g) { g instanceof @ruby_binary_slash } or
125-
TDivExprSynth(AST::AstNode parent, int i) { mkSynthChild(DivExprKind(), parent, i) } or
125+
TDivExprSynth(Ast::AstNode parent, int i) { mkSynthChild(DivExprKind(), parent, i) } or
126126
TDo(Ruby::Do g) or
127127
TDoBlock(Ruby::DoBlock g) { not g.getParent() instanceof Ruby::Lambda } or
128128
TElementReference(Ruby::ElementReference g) or
@@ -134,7 +134,7 @@ private module Cached {
134134
TEnsure(Ruby::Ensure g) or
135135
TEqExpr(Ruby::Binary g) { g instanceof @ruby_binary_equalequal } or
136136
TExponentExprReal(Ruby::Binary g) { g instanceof @ruby_binary_starstar } or
137-
TExponentExprSynth(AST::AstNode parent, int i) { mkSynthChild(ExponentExprKind(), parent, i) } or
137+
TExponentExprSynth(Ast::AstNode parent, int i) { mkSynthChild(ExponentExprKind(), parent, i) } or
138138
TFalseLiteral(Ruby::False g) or
139139
TFile(Ruby::File g) or
140140
TFindPattern(Ruby::FindPattern g) or
@@ -146,10 +146,10 @@ private module Cached {
146146
TForwardArgument(Ruby::ForwardArgument g) or
147147
TGEExpr(Ruby::Binary g) { g instanceof @ruby_binary_rangleequal } or
148148
TGTExpr(Ruby::Binary g) { g instanceof @ruby_binary_rangle } or
149-
TGlobalVariableAccessReal(Ruby::GlobalVariable g, AST::GlobalVariable v) {
149+
TGlobalVariableAccessReal(Ruby::GlobalVariable g, Ast::GlobalVariable v) {
150150
GlobalVariableAccess::range(g, v)
151151
} or
152-
TGlobalVariableAccessSynth(AST::AstNode parent, int i, AST::GlobalVariable v) {
152+
TGlobalVariableAccessSynth(Ast::AstNode parent, int i, Ast::GlobalVariable v) {
153153
mkSynthChild(GlobalVariableAccessKind(v), parent, i)
154154
} or
155155
THashKeySymbolLiteral(Ruby::HashKeySymbol g) or
@@ -163,70 +163,70 @@ private module Cached {
163163
THereDoc(Ruby::HeredocBeginning g) or
164164
TIdentifierMethodCall(Ruby::Identifier g) { isIdentifierMethodCall(g) } or
165165
TIfReal(Ruby::If g) or
166-
TIfSynth(AST::AstNode parent, int i) { mkSynthChild(IfKind(), parent, i) } or
166+
TIfSynth(Ast::AstNode parent, int i) { mkSynthChild(IfKind(), parent, i) } or
167167
TIfModifierExpr(Ruby::IfModifier g) or
168168
TInClause(Ruby::InClause g) or
169-
TInstanceVariableAccessReal(Ruby::InstanceVariable g, AST::InstanceVariable v) {
169+
TInstanceVariableAccessReal(Ruby::InstanceVariable g, Ast::InstanceVariable v) {
170170
InstanceVariableAccess::range(g, v)
171171
} or
172-
TInstanceVariableAccessSynth(AST::AstNode parent, int i, AST::InstanceVariable v) {
172+
TInstanceVariableAccessSynth(Ast::AstNode parent, int i, Ast::InstanceVariable v) {
173173
mkSynthChild(InstanceVariableAccessKind(v), parent, i)
174174
} or
175175
TIntegerLiteralReal(Ruby::Integer g) {
176176
not any(Ruby::Complex r).getChild() = g and not any(Ruby::Rational r).getChild() = g
177177
} or
178-
TIntegerLiteralSynth(AST::AstNode parent, int i, int value) {
178+
TIntegerLiteralSynth(Ast::AstNode parent, int i, int value) {
179179
mkSynthChild(IntegerLiteralKind(value), parent, i)
180180
} or
181181
TKeywordParameter(Ruby::KeywordParameter g) or
182182
TLEExpr(Ruby::Binary g) { g instanceof @ruby_binary_langleequal } or
183183
TLShiftExprReal(Ruby::Binary g) { g instanceof @ruby_binary_langlelangle } or
184-
TLShiftExprSynth(AST::AstNode parent, int i) { mkSynthChild(LShiftExprKind(), parent, i) } or
184+
TLShiftExprSynth(Ast::AstNode parent, int i) { mkSynthChild(LShiftExprKind(), parent, i) } or
185185
TLTExpr(Ruby::Binary g) { g instanceof @ruby_binary_langle } or
186186
TLambda(Ruby::Lambda g) or
187187
TLine(Ruby::Line g) or
188188
TLeftAssignmentList(Ruby::LeftAssignmentList g) or
189189
TLocalVariableAccessReal(Ruby::Identifier g, TLocalVariableReal v) {
190190
LocalVariableAccess::range(g, v)
191191
} or
192-
TLocalVariableAccessSynth(AST::AstNode parent, int i, AST::LocalVariable v) {
192+
TLocalVariableAccessSynth(Ast::AstNode parent, int i, Ast::LocalVariable v) {
193193
mkSynthChild(LocalVariableAccessRealKind(v), parent, i)
194194
or
195195
mkSynthChild(LocalVariableAccessSynthKind(v), parent, i)
196196
} or
197197
TLogicalAndExprReal(Ruby::Binary g) {
198198
g instanceof @ruby_binary_and or g instanceof @ruby_binary_ampersandampersand
199199
} or
200-
TLogicalAndExprSynth(AST::AstNode parent, int i) {
200+
TLogicalAndExprSynth(Ast::AstNode parent, int i) {
201201
mkSynthChild(LogicalAndExprKind(), parent, i)
202202
} or
203203
TLogicalOrExprReal(Ruby::Binary g) {
204204
g instanceof @ruby_binary_or or g instanceof @ruby_binary_pipepipe
205205
} or
206-
TLogicalOrExprSynth(AST::AstNode parent, int i) { mkSynthChild(LogicalOrExprKind(), parent, i) } or
206+
TLogicalOrExprSynth(Ast::AstNode parent, int i) { mkSynthChild(LogicalOrExprKind(), parent, i) } or
207207
TMethod(Ruby::Method g) or
208-
TMethodCallSynth(AST::AstNode parent, int i, string name, boolean setter, int arity) {
208+
TMethodCallSynth(Ast::AstNode parent, int i, string name, boolean setter, int arity) {
209209
mkSynthChild(MethodCallKind(name, setter, arity), parent, i)
210210
} or
211211
TModuleDeclaration(Ruby::Module g) or
212212
TModuloExprReal(Ruby::Binary g) { g instanceof @ruby_binary_percent } or
213-
TModuloExprSynth(AST::AstNode parent, int i) { mkSynthChild(ModuloExprKind(), parent, i) } or
213+
TModuloExprSynth(Ast::AstNode parent, int i) { mkSynthChild(ModuloExprKind(), parent, i) } or
214214
TMulExprReal(Ruby::Binary g) { g instanceof @ruby_binary_star } or
215-
TMulExprSynth(AST::AstNode parent, int i) { mkSynthChild(MulExprKind(), parent, i) } or
215+
TMulExprSynth(Ast::AstNode parent, int i) { mkSynthChild(MulExprKind(), parent, i) } or
216216
TNEExpr(Ruby::Binary g) { g instanceof @ruby_binary_bangequal } or
217217
TNextStmt(Ruby::Next g) or
218218
TNilLiteralReal(Ruby::Nil g) or
219-
TNilLiteralSynth(AST::AstNode parent, int i) { mkSynthChild(NilLiteralKind(), parent, i) } or
219+
TNilLiteralSynth(Ast::AstNode parent, int i) { mkSynthChild(NilLiteralKind(), parent, i) } or
220220
TNoRegExpMatchExpr(Ruby::Binary g) { g instanceof @ruby_binary_bangtilde } or
221221
TNotExpr(Ruby::Unary g) { g instanceof @ruby_unary_bang or g instanceof @ruby_unary_not } or
222222
TOptionalParameter(Ruby::OptionalParameter g) or
223223
TPair(Ruby::Pair g) or
224224
TParenthesizedExpr(Ruby::ParenthesizedStatements g) or
225225
TParenthesizedPattern(Ruby::ParenthesizedPattern g) or
226226
TRShiftExprReal(Ruby::Binary g) { g instanceof @ruby_binary_ranglerangle } or
227-
TRShiftExprSynth(AST::AstNode parent, int i) { mkSynthChild(RShiftExprKind(), parent, i) } or
227+
TRShiftExprSynth(Ast::AstNode parent, int i) { mkSynthChild(RShiftExprKind(), parent, i) } or
228228
TRangeLiteralReal(Ruby::Range g) or
229-
TRangeLiteralSynth(AST::AstNode parent, int i, boolean inclusive) {
229+
TRangeLiteralSynth(Ast::AstNode parent, int i, boolean inclusive) {
230230
mkSynthChild(RangeLiteralKind(inclusive), parent, i)
231231
} or
232232
TRationalLiteral(Ruby::Rational g) { not any(Ruby::Complex r).getChild() = g } or
@@ -255,24 +255,24 @@ private module Cached {
255255
)
256256
} or
257257
TSelfReal(Ruby::Self g) or
258-
TSelfSynth(AST::AstNode parent, int i, AST::SelfVariable v) {
258+
TSelfSynth(Ast::AstNode parent, int i, Ast::SelfVariable v) {
259259
mkSynthChild(SelfKind(v), parent, i)
260260
} or
261261
TSimpleParameterReal(Ruby::Identifier g) { g instanceof Parameter::Range } or
262-
TSimpleParameterSynth(AST::AstNode parent, int i) {
262+
TSimpleParameterSynth(Ast::AstNode parent, int i) {
263263
mkSynthChild(SimpleParameterKind(), parent, i)
264264
} or
265265
TSimpleSymbolLiteral(Ruby::SimpleSymbol g) or
266266
TSingletonClass(Ruby::SingletonClass g) or
267267
TSingletonMethod(Ruby::SingletonMethod g) or
268268
TSpaceshipExpr(Ruby::Binary g) { g instanceof @ruby_binary_langleequalrangle } or
269269
TSplatExprReal(Ruby::SplatArgument g) or
270-
TSplatExprSynth(AST::AstNode parent, int i) { mkSynthChild(SplatExprKind(), parent, i) } or
270+
TSplatExprSynth(Ast::AstNode parent, int i) { mkSynthChild(SplatExprKind(), parent, i) } or
271271
TSplatParameter(Ruby::SplatParameter g) {
272272
not g.getParent() instanceof Ruby::ArrayPattern and
273273
not g.getParent() instanceof Ruby::FindPattern
274274
} or
275-
TStmtSequenceSynth(AST::AstNode parent, int i) { mkSynthChild(StmtSequenceKind(), parent, i) } or
275+
TStmtSequenceSynth(Ast::AstNode parent, int i) { mkSynthChild(StmtSequenceKind(), parent, i) } or
276276
TStringArrayLiteral(Ruby::StringArray g) or
277277
TStringConcatenation(Ruby::ChainedString g) or
278278
TStringEscapeSequenceComponentNonRegexp(Ruby::EscapeSequence g) {
@@ -298,7 +298,7 @@ private module Cached {
298298
g.getParent() instanceof Ruby::Regex
299299
} or
300300
TSubExprReal(Ruby::Binary g) { g instanceof @ruby_binary_minus } or
301-
TSubExprSynth(AST::AstNode parent, int i) { mkSynthChild(SubExprKind(), parent, i) } or
301+
TSubExprSynth(Ast::AstNode parent, int i) { mkSynthChild(SubExprKind(), parent, i) } or
302302
TSubshellLiteral(Ruby::Subshell g) or
303303
TSymbolArrayLiteral(Ruby::SymbolArray g) or
304304
TTernaryIfExpr(Ruby::Conditional g) or
@@ -548,7 +548,7 @@ private module Cached {
548548

549549
/** Gets the `i`th synthesized child of `parent`. */
550550
cached
551-
AST::AstNode getSynthChild(AST::AstNode parent, int i) {
551+
Ast::AstNode getSynthChild(Ast::AstNode parent, int i) {
552552
result = TAddExprSynth(parent, i)
553553
or
554554
result = TAssignExprSynth(parent, i)
@@ -613,7 +613,7 @@ private module Cached {
613613
* `child` (or both) is a synthesized node.
614614
*/
615615
cached
616-
predicate synthChild(AST::AstNode parent, int i, AST::AstNode child) {
616+
predicate synthChild(Ast::AstNode parent, int i, Ast::AstNode child) {
617617
child = getSynthChild(parent, i)
618618
or
619619
any(Synthesis s).child(parent, i, RealChildRef(child))
@@ -626,18 +626,18 @@ private module Cached {
626626
* nodes.
627627
*/
628628
cached
629-
Ruby::AstNode toGeneratedInclSynth(AST::AstNode n) {
629+
Ruby::AstNode toGeneratedInclSynth(Ast::AstNode n) {
630630
result = toGenerated(n)
631631
or
632632
not exists(toGenerated(n)) and
633-
exists(AST::AstNode parent |
633+
exists(Ast::AstNode parent |
634634
synthChild(parent, _, n) and
635635
result = toGeneratedInclSynth(parent)
636636
)
637637
}
638638

639639
cached
640-
Location getLocation(AST::AstNode n) {
640+
Location getLocation(Ast::AstNode n) {
641641
synthLocation(n, result)
642642
or
643643
n.isSynthesized() and
@@ -648,12 +648,12 @@ private module Cached {
648648
}
649649

650650
cached
651-
predicate lhsExpr(AST::Expr e) {
651+
predicate lhsExpr(Ast::Expr e) {
652652
explicitAssignmentNode(toGenerated(e), _)
653653
or
654654
implicitAssignmentNode(toGenerated(e))
655655
or
656-
e = getSynthChild(any(AST::AssignExpr ae), 0)
656+
e = getSynthChild(any(Ast::AssignExpr ae), 0)
657657
}
658658
}
659659

ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImplSpecific.qll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ private import ControlFlowGraphImpl as Impl
33
private import Completion as Comp
44
private import codeql.ruby.ast.internal.Synthesis
55
private import Splitting as Splitting
6-
private import codeql.ruby.CFG as CFG
6+
private import codeql.ruby.CFG as Cfg
77

88
/** The base class for `ControlFlowTree`. */
99
class ControlFlowTreeBase extends RB::AstNode {
@@ -29,7 +29,7 @@ predicate completionIsSimple(Completion c) { c instanceof Comp::SimpleCompletion
2929
/** Holds if `c` is a valid completion for `e`. */
3030
predicate completionIsValidFor(Completion c, ControlFlowElement e) { c.isValidFor(e) }
3131

32-
class CfgScope = CFG::CfgScope;
32+
class CfgScope = Cfg::CfgScope;
3333

3434
predicate getCfgScope = Impl::getCfgScope/1;
3535

@@ -50,7 +50,7 @@ class SplitKindBase = Splitting::TSplitKind;
5050

5151
class Split = Splitting::Split;
5252

53-
class SuccessorType = CFG::SuccessorType;
53+
class SuccessorType = Cfg::SuccessorType;
5454

5555
/** Gets a successor type that matches completion `c`. */
5656
SuccessorType getAMatchingSuccessorType(Completion c) { result = c.getAMatchingSuccessorType() }
@@ -60,15 +60,15 @@ SuccessorType getAMatchingSuccessorType(Completion c) { result = c.getAMatchingS
6060
* expression.
6161
*/
6262
predicate successorTypeIsSimple(SuccessorType t) {
63-
t instanceof CFG::SuccessorTypes::NormalSuccessor
63+
t instanceof Cfg::SuccessorTypes::NormalSuccessor
6464
}
6565

6666
/** Holds if `t` is an abnormal exit type out of a CFG scope. */
6767
predicate isAbnormalExitType(SuccessorType t) {
68-
t instanceof CFG::SuccessorTypes::RaiseSuccessor or
69-
t instanceof CFG::SuccessorTypes::ExitSuccessor
68+
t instanceof Cfg::SuccessorTypes::RaiseSuccessor or
69+
t instanceof Cfg::SuccessorTypes::ExitSuccessor
7070
}
7171

7272
class Location = RB::Location;
7373

74-
class Node = CFG::CfgNode;
74+
class Node = Cfg::CfgNode;

0 commit comments

Comments
 (0)