Skip to content

Commit 2d9b52f

Browse files
committed
Update query console links in source-locations.rst, replace deprecated predicates
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 7b4960c commit 2d9b52f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/language/learn-ql/java/source-locations.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ In our example, the expression statement starts at line 5, column 3 (the first t
5454

5555
Class ``File`` defines these member predicates:
5656

57-
- ``getFullName`` returns the fully qualified name of the file.
57+
- ``getAbsolutePath`` returns the fully qualified name of the file.
5858
- ``getRelativePath`` returns the path of the file relative to the base directory of the source code.
5959
- ``getExtension`` returns the extension of the file.
60-
- ``getShortName`` returns the base name of the file, without its extension.
60+
- ``getStem`` returns the base name of the file, without its extension.
6161

6262
In our example, assume file ``A.java`` is located in directory ``/home/testuser/code/pkg``, where ``/home/testuser/code`` is the base directory of the program being analyzed. Then, a ``File`` object for ``A.java`` returns:
6363

64-
- ``getFullName`` is ``/home/testuser/code/pkg/A.java``.
64+
- ``getAbsolutePath`` is ``/home/testuser/code/pkg/A.java``.
6565
- ``getRelativePath`` is ``pkg/A.java``.
6666
- ``getExtension`` is ``java``.
67-
- ``getShortName`` is ``A``.
67+
- ``getStem`` is ``A``.
6868

6969
Determining white space around an operator
7070
------------------------------------------
@@ -110,7 +110,7 @@ Here's a first version of our query:
110110
wsinner > wsouter
111111
select outer, "Whitespace around nested operators contradicts precedence."
112112
113-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/672230027/>`__. This query is likely to find results on most projects.
113+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/8141155897270480914/>`__. This query is likely to find results on most projects.
114114

115115
The first conjunct of the ``where`` clause restricts ``inner`` to be an operand of ``outer``, the second conjunct binds ``wsinner`` and ``wsouter``, while the last conjunct selects the suspicious cases.
116116

@@ -141,9 +141,9 @@ Note that our predicate ``operatorWS`` computes the **total** amount of white sp
141141
wsinner > wsouter
142142
select outer, "Whitespace around nested operators contradicts precedence."
143143
144-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/665761067/>`__. Any results will be refined by our changes to the query.
144+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/3151720037708691205/>`__. Any results will be refined by our changes to the query.
145145

146-
Another source of false positives are associative operators: in an expression of the form ``x + y+z``, the first plus is syntactically nested inside the second, since + in Java associates to the left; hence the expression is flagged as suspicious. But since + is associative to begin with, it does not matter which way around the operators are nested, so this is a false positive.To exclude these cases, let us define a new class identifying binary expressions with an associative operator:
146+
Another source of false positives are associative operators: in an expression of the form ``x + y+z``, the first plus is syntactically nested inside the second, since + in Java associates to the left; hence the expression is flagged as suspicious. But since + is associative to begin with, it does not matter which way around the operators are nested, so this is a false positive. To exclude these cases, let us define a new class identifying binary expressions with an associative operator:
147147

148148
.. code-block:: ql
149149
@@ -173,9 +173,9 @@ Now we can extend our query to discard results where the outer and the inner exp
173173
wsinner > wsouter
174174
select outer, "Whitespace around nested operators contradicts precedence."
175175
176-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/659662169/>`__.
176+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/5714614966569401039/>`__.
177177

178-
Notice that we again use ``getOp``, this time to determine whether two binary expressions have the same operator. Running our improved query now finds the Java standard library bug described in the Overview. It also flags up the following suspicious code in `Hadoop HBase <http://hbase.apache.org/>`__:
178+
Notice that we again use ``getOp``, this time to determine whether two binary expressions have the same operator. Running our improved query now finds the Java standard library bug described in the Overview. It also flags up the following suspicious code in `Hadoop HBase <https://hbase.apache.org/>`__:
179179

180180
.. code-block:: java
181181

0 commit comments

Comments
 (0)