Skip to content

Commit cf7ebe2

Browse files
authored
Merge pull request #11471 from github/rc/3.8
Merge rc/3.8 into main
2 parents bc6f0c1 + 5898615 commit cf7ebe2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+168
-440
lines changed

.github/ISSUE_TEMPLATE/ql---general.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ assignees: ''
1010
**Description of the issue**
1111

1212
<!-- Please explain briefly what is the problem.
13-
If it is about an LGTM project, please include its URL.-->
13+
If it is about a GitHub project, please include its URL. -->
1414

cpp/ql/lib/definitions.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import IDEContextual
1212
*
1313
* In some cases it is preferable to modify locations (the
1414
* `hasLocationInfo()` predicate) so that they are short, and
15-
* non-overlapping with other locations that might be highlighted in
16-
* the LGTM interface.
15+
* non-overlapping with other locations that might be reported as
16+
* code scanning alerts on GitHub.
1717
*
1818
* We need to give locations that may not be in the database, so
1919
* we use `hasLocationInfo()` rather than `getLocation()`.

cpp/ql/src/Likely Bugs/RedundantNullCheckSimple.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
*/
1313

1414
/*
15-
* Note: this query is not assigned a precision yet because we don't want it on
16-
* LGTM until its performance is well understood.
15+
* Note: this query is not assigned a precision yet because we don't want it
16+
* to be included in query suites until its performance is well understood.
1717
*/
1818

1919
import cpp

cpp/ql/src/Metrics/Dependencies/ExternalDependencies.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Library extends LibraryT {
5252
// The versions reported for C/C++ dependencies are just the versions that
5353
// happen to be installed on the system where the build takes place.
5454
// Reporting those versions is likely to cause misunderstandings, both for
55-
// people reading them and for the vulnerability checker of lgtm.
55+
// people reading them and for vulnerability checkers.
5656
result = "unknown"
5757
}
5858

docs/codeql/codeql-language-guides/analyzing-control-flow-in-python.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Example finding unreachable AST nodes
4747
where not exists(node.getAFlowNode())
4848
select node
4949
50-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/669220024/>`__. The demo projects on LGTM.com all have some code that has no control flow node, and is therefore unreachable. However, since the ``Module`` class is also a subclass of the ``AstNode`` class, the query also finds any modules implemented in C or with no source code. Therefore, it is better to find all unreachable statements.
50+
Many codebases have some code that has no control flow node, and is therefore unreachable. However, since the ``Module`` class is also a subclass of the ``AstNode`` class, the query also finds any modules implemented in C or with no source code. Therefore, it is better to find all unreachable statements.
5151

5252
Example finding unreachable statements
5353
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -60,7 +60,7 @@ Example finding unreachable statements
6060
where not exists(s.getAFlowNode())
6161
select s
6262
63-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/670720181/>`__. This query gives fewer results, but most of the projects have some unreachable nodes. These are also highlighted by the standard "Unreachable code" query. For more information, see `Unreachable code <https://lgtm.com/rules/3980095>`__ on LGTM.com.
63+
This query should give fewer results. You can also find unreachable code using the standard "Unreachable code" query. For more information, see `Unreachable code <https://codeql.github.com/codeql-query-help/python/py-unreachable-statement/>`__.
6464

6565
The ``BasicBlock`` class
6666
------------------------
@@ -114,7 +114,7 @@ Example finding mutually exclusive blocks within the same function
114114
)
115115
select b1, b2
116116
117-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/671000028/>`__. This typically gives a very large number of results, because it is a common occurrence in normal control flow. It is, however, an example of the sort of control-flow analysis that is possible. Control-flow analyses such as this are an important aid to data flow analysis. For more information, see ":doc:`Analyzing data flow in Python <analyzing-data-flow-in-python>`."
117+
This typically gives a very large number of results, because it is a common occurrence in normal control flow. It is, however, an example of the sort of control-flow analysis that is possible. Control-flow analyses such as this are an important aid to data flow analysis. For more information, see ":doc:`Analyzing data flow in Python <analyzing-data-flow-in-python>`."
118118

119119
Further reading
120120
---------------

docs/codeql/codeql-language-guides/analyzing-data-flow-in-python.rst

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,9 @@ Python has builtin functionality for reading and writing files, such as the func
9797
call = API::moduleImport("os").getMember("open").getACall()
9898
select call.getArg(0)
9999
100-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/8635258505893505141/>`__. Two of the demo projects make use of this low-level API.
101-
102100
Notice the use of the ``API`` module for referring to library functions. For more information, see ":doc:`Using API graphs in Python <using-api-graphs-in-python>`."
103101

104-
Unfortunately this will only give the expression in the argument, not the values which could be passed to it. So we use local data flow to find all expressions that flow into the argument:
102+
Unfortunately this query will only give the expression in the argument, not the values which could be passed to it. So we use local data flow to find all expressions that flow into the argument:
105103

106104
.. code-block:: ql
107105
@@ -115,9 +113,7 @@ Unfortunately this will only give the expression in the argument, not the values
115113
DataFlow::localFlow(expr, call.getArg(0))
116114
select call, expr
117115
118-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/8213643003890447109/>`__. Many expressions flow to the same call.
119-
120-
We see that we get several data-flow nodes for an expression as it flows towards a call (notice repeated locations in the ``call`` column). We are mostly interested in the "first" of these, what might be called the local source for the file name. To restrict attention to such local sources, and to simultaneously make the analysis more performant, we have the QL class ``LocalSourceNode``. We could demand that ``expr`` is such a node:
116+
Typically, you will see several data-flow nodes for an expression as it flows towards a call (notice repeated locations in the ``call`` column). We are mostly interested in the "first" of these, what might be called the local source for the file name. To restrict attention to such local sources, and to simultaneously make the analysis more performant, we have the QL class ``LocalSourceNode``. We could demand that ``expr`` is such a node:
121117

122118
.. code-block:: ql
123119
@@ -160,9 +156,9 @@ As an alternative, we can ask more directly that ``expr`` is a local source of t
160156
expr = call.getArg(0).getALocalSource()
161157
select call, expr
162158
163-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/6602079735954016687/>`__. All these three queries give identical results. We now mostly have one expression per call.
159+
These three queries all give identical results. We now mostly have one expression per call.
164160

165-
We still have some cases of more than one expression flowing to a call, but then they flow through different code paths (possibly due to control-flow splitting, as in the second case).
161+
We still have some cases of more than one expression flowing to a call, but then they flow through different code paths (possibly due to control-flow splitting).
166162

167163
We might want to make the source more specific, for example a parameter to a function or method. This query finds instances where a parameter is used as the name when opening a file:
168164

@@ -178,7 +174,7 @@ We might want to make the source more specific, for example a parameter to a fun
178174
DataFlow::localFlow(p, call.getArg(0))
179175
select call, p
180176
181-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/3998032643497238063/>`__. Very few results now; these could feasibly be inspected manually.
177+
For most codebases, this will return only a few results and these could be inspected manually.
182178

183179
Using the exact name supplied via the parameter may be too strict. If we want to know if the parameter influences the file name, we can use taint tracking instead of data flow. This query finds calls to ``os.open`` where the filename is derived from a parameter:
184180

@@ -194,7 +190,7 @@ Using the exact name supplied via the parameter may be too strict. If we want to
194190
TaintTracking::localTaint(p, call.getArg(0))
195191
select call, p
196192
197-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/2129957933670836953/>`__. Now we get more results and in more projects.
193+
Typically, this finds more results.
198194

199195
Global data flow
200196
----------------
@@ -369,8 +365,6 @@ This data flow configuration tracks data flow from environment variables to open
369365
select fileOpen, "This call to 'os.open' uses data from $@.",
370366
environment, "call to 'os.getenv'"
371367
372-
➤ `Running this in the query console on LGTM.com <https://lgtm.com/query/6582374907796191895/>`__ unsurprisingly yields no results in the demo projects.
373-
374368
375369
Further reading
376370
---------------

docs/codeql/codeql-language-guides/annotations-in-java.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ We could then write this query to find all ``@SuppressWarnings`` annotations att
5151
anntp.hasQualifiedName("java.lang", "SuppressWarnings")
5252
select ann, ann.getValue("value")
5353
54-
➤ `See the full query in the query console on LGTM.com <https://lgtm.com/query/1775658606775222283/>`__. Several of the LGTM.com demo projects use the ``@SuppressWarnings`` annotation. Looking at the ``value``\ s of the annotation element returned by the query, we can see that the *apache/activemq* project uses the ``"rawtypes"`` value described above.
54+
If the codebase you are analyzing uses the ``@SuppressWarnings`` annotation, you can check the ``value``\ s of the annotation element returned by the query. They should use the ``"rawtypes"`` value described above.
5555

5656
As another example, this query finds all annotation types that only have a single annotation element, which has name ``value``:
5757

@@ -66,8 +66,6 @@ As another example, this query finds all annotation types that only have a singl
6666
)
6767
select anntp
6868
69-
➤ `See the full query in the query console on LGTM.com <https://lgtm.com/query/2145264152490258283/>`__.
70-
7169
Example: Finding missing ``@Override`` annotations
7270
--------------------------------------------------
7371

@@ -124,7 +122,7 @@ This makes it very easy to write our query for finding methods that override ano
124122
not overriding.getAnAnnotation() instanceof OverrideAnnotation
125123
select overriding, "Method overrides another method, but does not have an @Override annotation."
126124
127-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/7419756266089837339/>`__. In practice, this query may yield many results from compiled library code, which aren't very interesting. It's therefore a good idea to add another conjunct ``overriding.fromSource()`` to restrict the result to only report methods for which source code is available.
125+
In practice, this query may yield many results from compiled library code, which aren't very interesting. It's therefore a good idea to add another conjunct ``overriding.fromSource()`` to restrict the result to only report methods for which source code is available.
128126

129127
Example: Finding calls to deprecated methods
130128
--------------------------------------------
@@ -237,7 +235,7 @@ Now we can extend our query to filter out calls in methods carrying a ``Suppress
237235
and not call.getCaller().getAnAnnotation() instanceof SuppressDeprecationWarningAnnotation
238236
select call, "This call invokes a deprecated method."
239237
240-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/8706367340403790260/>`__. It's fairly common for projects to contain calls to methods that appear to be deprecated.
238+
It's fairly common for projects to contain calls to methods that appear to be deprecated.
241239

242240
Further reading
243241
---------------

docs/codeql/codeql-language-guides/codeql-for-cpp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Experiment and learn how to write effective and efficient queries for CodeQL dat
2121
hash-consing-and-value-numbering
2222

2323

24-
- :doc:`Basic query for C and C++ code <basic-query-for-cpp-code>`: Learn to write and run a simple CodeQL query using LGTM.
24+
- :doc:`Basic query for C and C++ code <basic-query-for-cpp-code>`: Learn to write and run a simple CodeQL query.
2525

2626
- :doc:`CodeQL library for C and C++ <codeql-library-for-cpp>`: When analyzing C or C++ code, you can use the large collection of classes in the CodeQL library for C and C++.
2727

docs/codeql/codeql-language-guides/codeql-for-csharp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Experiment and learn how to write effective and efficient queries for CodeQL dat
1212
codeql-library-for-csharp
1313
analyzing-data-flow-in-csharp
1414

15-
- :doc:`Basic query for C# code <basic-query-for-csharp-code>`: Learn to write and run a simple CodeQL query using LGTM.
15+
- :doc:`Basic query for C# code <basic-query-for-csharp-code>`: Learn to write and run a simple CodeQL query.
1616

1717
- :doc:`CodeQL library for C# <codeql-library-for-csharp>`: When you're analyzing a C# program, you can make use of the large collection of classes in the CodeQL library for C#.
1818

docs/codeql/codeql-language-guides/codeql-for-go.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Experiment and learn how to write effective and efficient queries for CodeQL dat
1313
abstract-syntax-tree-classes-for-working-with-go-programs
1414
modeling-data-flow-in-go-libraries
1515

16-
- :doc:`Basic query for Go code <basic-query-for-go-code>`: Learn to write and run a simple CodeQL query using LGTM.
16+
- :doc:`Basic query for Go code <basic-query-for-go-code>`: Learn to write and run a simple CodeQL query.
1717

1818
- :doc:`CodeQL library for Go <codeql-library-for-go>`: When you're analyzing a Go program, you can make use of the large collection of classes in the CodeQL library for Go.
1919

docs/codeql/codeql-language-guides/codeql-for-java.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Experiment and learn how to write effective and efficient queries for CodeQL dat
2626
working-with-source-locations
2727
abstract-syntax-tree-classes-for-working-with-java-programs
2828

29-
- :doc:`Basic query for Java code <basic-query-for-java-code>`: Learn to write and run a simple CodeQL query using LGTM.
29+
- :doc:`Basic query for Java code <basic-query-for-java-code>`: Learn to write and run a simple CodeQL query.
3030

3131
- :doc:`CodeQL library for Java <codeql-library-for-java>`: When analyzing Java code, you can use the large collection of classes in the CodeQL library for Java.
3232

docs/codeql/codeql-language-guides/codeql-for-javascript.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Experiment and learn how to write effective and efficient queries for CodeQL dat
1818
abstract-syntax-tree-classes-for-working-with-javascript-and-typescript-programs
1919
data-flow-cheat-sheet-for-javascript
2020

21-
- :doc:`Basic query for JavaScript code <basic-query-for-javascript-code>`: Learn to write and run a simple CodeQL query using LGTM.
21+
- :doc:`Basic query for JavaScript code <basic-query-for-javascript-code>`: Learn to write and run a simple CodeQL query.
2222

2323
- :doc:`CodeQL library for JavaScript <codeql-library-for-javascript>`: When you're analyzing a JavaScript program, you can make use of the large collection of classes in the CodeQL library for JavaScript.
2424

docs/codeql/codeql-language-guides/codeql-for-python.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Experiment and learn how to write effective and efficient queries for CodeQL dat
1616
expressions-and-statements-in-python
1717
analyzing-control-flow-in-python
1818

19-
- :doc:`Basic query for Python code <basic-query-for-python-code>`: Learn to write and run a simple CodeQL query using LGTM.
19+
- :doc:`Basic query for Python code <basic-query-for-python-code>`: Learn to write and run a simple CodeQL query.
2020

2121
- :doc:`CodeQL library for Python <codeql-library-for-python>`: When you need to analyze a Python program, you can make use of the large collection of classes in the CodeQL library for Python.
2222

docs/codeql/codeql-language-guides/codeql-for-ruby.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Experiment and learn how to write effective and efficient queries for CodeQL dat
1414
analyzing-data-flow-in-ruby
1515
using-api-graphs-in-ruby
1616

17-
- :doc:`Basic query for Ruby code <basic-query-for-ruby-code>`: Learn to write and run a simple CodeQL query using LGTM.
17+
- :doc:`Basic query for Ruby code <basic-query-for-ruby-code>`: Learn to write and run a simple CodeQL query.
1818

1919
- :doc:`CodeQL library for Ruby <codeql-library-for-ruby>`: When you're analyzing a Ruby program, you can make use of the large collection of classes in the CodeQL library for Ruby.
2020

0 commit comments

Comments
 (0)