You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: docs/language/learn-ql/java/source-locations.rst
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,17 +54,17 @@ In our example, the expression statement starts at line 5, column 3 (the first t
54
54
55
55
Class ``File`` defines these member predicates:
56
56
57
-
- ``getFullName`` returns the fully qualified name of the file.
57
+
- ``getAbsolutePath`` returns the fully qualified name of the file.
58
58
- ``getRelativePath`` returns the path of the file relative to the base directory of the source code.
59
59
- ``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.
61
61
62
62
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:
63
63
64
-
- ``getFullName`` is ``/home/testuser/code/pkg/A.java``.
64
+
- ``getAbsolutePath`` is ``/home/testuser/code/pkg/A.java``.
65
65
- ``getRelativePath`` is ``pkg/A.java``.
66
66
- ``getExtension`` is ``java``.
67
-
- ``getShortName`` is ``A``.
67
+
- ``getStem`` is ``A``.
68
68
69
69
Determining white space around an operator
70
70
------------------------------------------
@@ -110,7 +110,7 @@ Here's a first version of our query:
110
110
wsinner > wsouter
111
111
select outer, "Whitespace around nested operators contradicts precedence."
112
112
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.
114
114
115
115
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.
116
116
@@ -141,9 +141,9 @@ Note that our predicate ``operatorWS`` computes the **total** amount of white sp
141
141
wsinner > wsouter
142
142
select outer, "Whitespace around nested operators contradicts precedence."
143
143
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.
145
145
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:
147
147
148
148
.. code-block:: ql
149
149
@@ -173,9 +173,9 @@ Now we can extend our query to discard results where the outer and the inner exp
173
173
wsinner > wsouter
174
174
select outer, "Whitespace around nested operators contradicts precedence."
175
175
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/>`__.
177
177
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/>`__:
0 commit comments