Skip to content

Commit 4172871

Browse files
committed
Ruby: QL style fixes
1 parent e975f92 commit 4172871

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

ruby/ql/lib/codeql/ruby/frameworks/ActionDispatch.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ module ActionDispatch {
9090
* The zeroth parent is this block, the first parent is the direct parent of this block, etc.
9191
*/
9292
RouteBlock getParent(int n) {
93-
if n = 0 then result = this else result = getParent().getParent(n - 1)
93+
if n = 0 then result = this else result = this.getParent().getParent(n - 1)
9494
}
9595

9696
/**
@@ -302,9 +302,9 @@ module ActionDispatch {
302302

303303
override Stmt getAStmt() { result = block.getAStmt() }
304304

305-
override string getPathComponent() { result = getNamespace() }
305+
override string getPathComponent() { result = this.getNamespace() }
306306

307-
override string getControllerComponent() { result = getNamespace() }
307+
override string getControllerComponent() { result = this.getNamespace() }
308308

309309
private string getNamespace() { result = call.getArgument(0).getValueText() }
310310

@@ -407,8 +407,8 @@ module ActionDispatch {
407407
*/
408408
string getControllerComponent(int n) {
409409
if n = 0
410-
then result = getLastControllerComponent()
411-
else result = getParentBlock().getParent(n - 1).getControllerComponent()
410+
then result = this.getLastControllerComponent()
411+
else result = this.getParentBlock().getParent(n - 1).getControllerComponent()
412412
}
413413

414414
/**
@@ -417,9 +417,9 @@ module ActionDispatch {
417417
string getController() {
418418
result =
419419
concat(int n |
420-
getControllerComponent(n) != ""
420+
this.getControllerComponent(n) != ""
421421
|
422-
getControllerComponent(n), "/" order by n desc
422+
this.getControllerComponent(n), "/" order by n desc
423423
)
424424
}
425425

@@ -456,8 +456,8 @@ module ActionDispatch {
456456
*/
457457
string getPathComponent(int n) {
458458
if n = 0
459-
then result = getLastPathComponent()
460-
else result = getParentBlock().getParent(n - 1).getPathComponent()
459+
then result = this.getLastPathComponent()
460+
else result = this.getParentBlock().getParent(n - 1).getPathComponent()
461461
}
462462

463463
/**
@@ -466,10 +466,10 @@ module ActionDispatch {
466466
string getPath() {
467467
result =
468468
concat(int n |
469-
getPathComponent(n) != ""
469+
this.getPathComponent(n) != ""
470470
|
471471
// Strip leading and trailing slashes from each path component before combining
472-
stripSlashes(getPathComponent(n)), "/" order by n desc
472+
stripSlashes(this.getPathComponent(n)), "/" order by n desc
473473
)
474474
}
475475

@@ -483,7 +483,7 @@ module ActionDispatch {
483483
* We don't currently make use of this, but it may be useful in future to more accurately
484484
* model the contents of the `params` hash.
485485
*/
486-
string getACapture() { result = getPathComponent(_).regexpFind(":[^:/]+", _, _) }
486+
string getACapture() { result = this.getPathComponent(_).regexpFind(":[^:/]+", _, _) }
487487
}
488488

489489
/**
@@ -805,7 +805,7 @@ module ActionDispatch {
805805
private string singularize(string input) {
806806
exists(string prefix | prefix = input.regexpCapture("(.*)ies", 1) | result = prefix + "y")
807807
or
808-
not input.regexpMatch(".*ies") and
808+
not input.matches("%ies") and
809809
exists(string prefix | prefix = input.regexpCapture("(.*)s", 1) | result = prefix)
810810
or
811811
not input.regexpMatch(".*(ies|s)") and result = input

0 commit comments

Comments
 (0)