Skip to content

Commit 2b3b64c

Browse files
committed
Update query console links in expressions-statements.rst
Removes 'eclipse-cdt/cdt' and 'gradle/gradle' from the queried projects because they cannot be queried currently, and instead queries all demo projects which are currently available.
1 parent c10a598 commit 2b3b64c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/language/learn-ql/java/expressions-statements.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ We'll start by writing a query that finds less-than expressions (CodeQL class ``
4242
expr.getRightOperand().getType().hasName("long")
4343
select expr
4444
45-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/672320008/>`__. This query usually finds results on most projects.
45+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/490866529746563234/>`__. This query usually finds results on most projects.
4646

4747
Notice that we use the predicate ``getType`` (available on all subclasses of ``Expr``) to determine the type of the operands. Types, in turn, define the ``hasName`` predicate, which allows us to identify the primitive types ``int`` and ``long``. As it stands, this query finds *all* less-than expressions comparing ``int`` and ``long``, but in fact we are only interested in comparisons that are part of a loop condition. Also, we want to filter out comparisons where either operand is constant, since these are less likely to be real bugs. The revised query looks like this:
4848

@@ -57,7 +57,7 @@ Notice that we use the predicate ``getType`` (available on all subclasses of ``E
5757
not expr.getAnOperand().isCompileTimeConstant()
5858
select expr
5959
60-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/690010001/>`__. Notice that fewer results are found.
60+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/4315986481180063825/>`__. Notice that fewer results are found.
6161

6262
The class ``LoopStmt`` is a common superclass of all loops, including, in particular, ``for`` loops as in our example above. While different kinds of loops have different syntax, they all have a loop condition, which can be accessed through predicate ``getCondition``. We use the reflexive transitive closure operator ``*`` applied to the ``getAChildExpr`` predicate to express the requirement that ``expr`` should be nested inside the loop condition. In particular, it can be the loop condition itself.
6363

@@ -120,7 +120,7 @@ Now we rewrite our query to make use of these new classes:
120120
not expr.getAnOperand().isCompileTimeConstant()
121121
select expr
122122
123-
➤ `See the full query in the query console on LGTM.com <https://lgtm.com/query/1951710018/lang:java/>`__.
123+
➤ `See the full query in the query console on LGTM.com <https://lgtm.com/query/506868054626167462/>`__.
124124

125125
Further reading
126126
---------------

0 commit comments

Comments
 (0)