Skip to content

Merge rc/3.8 into main #11612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
97db2c9
First draft update basic query to use VS Code
felicitymay Nov 24, 2022
229c3e6
Update for James' review comments
felicitymay Nov 28, 2022
1dc6640
Remove superfluous content
felicitymay Nov 28, 2022
c66569b
Generalize cpp changes and apply to csharp
felicitymay Nov 29, 2022
0def31a
Update Go article
felicitymay Nov 29, 2022
1142b77
Update articles for other languages
felicitymay Nov 29, 2022
0d7b27d
A few fixes
felicitymay Nov 29, 2022
6dee013
Merge branch 'rc/3.8' into felicitymay-8441-basic-query-2
felicitymay Nov 30, 2022
9eafee3
Some updates missed in earlier PRs
felicitymay Nov 30, 2022
3e1d49a
First draft update tutorials
felicitymay Nov 30, 2022
86e2333
Fix typo and try improving formatting
felicitymay Nov 30, 2022
38b8cf4
Update docs/codeql/codeql-language-guides/basic-query-for-java-code.rst
felicitymay Dec 1, 2022
6869ad4
Apply suggestions from code review
felicitymay Dec 1, 2022
31ab22e
Release preparation for version 2.11.5
invalid-email-address Dec 1, 2022
60e326b
Merge pull request #11530 from github/release-prep/2.11.5
smowton Dec 1, 2022
26908ea
Update docs/codeql/codeql-language-guides/using-flow-labels-for-preci…
felicitymay Dec 2, 2022
5e35785
Post-release preparation for codeql-cli-2.11.5
invalid-email-address Dec 2, 2022
42a438c
Apply suggestions from code review
felicitymay Dec 2, 2022
7aca35d
Apply suggestions from code review
felicitymay Dec 2, 2022
50c85f6
Merge pull request #11545 from github/post-release-prep/codeql-cli-2.…
smowton Dec 2, 2022
5a57844
Merge pull request #11503 from github/felicitymay-8441-next-batch
felicitymay Dec 2, 2022
2b24870
Merge pull request #11468 from github/felicitymay-8441-basic-query-2
felicitymay Dec 2, 2022
dea9adb
Merge branch 'codeql-cli-2.11.5' into felicitymay-8441-detective
felicitymay Dec 2, 2022
90c6771
Merge pull request #11502 from github/felicitymay-8441-detective
felicitymay Dec 5, 2022
6884db1
Remove another outdated reference
felicitymay Dec 5, 2022
d893768
Docs: rewrite "defining the results of a query"
nickrolfe Dec 2, 2022
f31a7cf
Apply suggestions from code review
nickrolfe Dec 5, 2022
96476cb
Merge pull request #11561 from github/felicitymay-lgtm-fixes
felicitymay Dec 5, 2022
731419f
Remove reference to query console
nickrolfe Dec 5, 2022
23b02f4
Merge pull request #11544 from github/nickrolfe/update-query-docs
nickrolfe Dec 5, 2022
3249485
Merge remote-tracking branch 'origin/codeql-cli-2.11.5' into smowton/…
smowton Dec 7, 2022
c7725ec
Merge pull request #11605 from github/smowton/admin/merge-2.11.5-into…
adityasharad Dec 7, 2022
49bc524
Merge remote-tracking branch 'origin/rc/3.8' into smowton/admin/merge…
smowton Dec 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cpp/ql/lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.5

No user-facing changes.

## 0.4.4

No user-facing changes.
Expand Down
3 changes: 3 additions & 0 deletions cpp/ql/lib/change-notes/released/0.4.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.4.5

No user-facing changes.
2 changes: 1 addition & 1 deletion cpp/ql/lib/codeql-pack.release.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.4.4
lastReleaseVersion: 0.4.5
2 changes: 1 addition & 1 deletion cpp/ql/lib/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/cpp-all
version: 0.4.5-dev
version: 0.4.6-dev
groups: cpp
dbscheme: semmlecode.cpp.dbscheme
extractor: cpp
Expand Down
4 changes: 4 additions & 0 deletions cpp/ql/src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.5

No user-facing changes.

## 0.4.4

No user-facing changes.
Expand Down
3 changes: 3 additions & 0 deletions cpp/ql/src/change-notes/released/0.4.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.4.5

No user-facing changes.
2 changes: 1 addition & 1 deletion cpp/ql/src/codeql-pack.release.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.4.4
lastReleaseVersion: 0.4.5
2 changes: 1 addition & 1 deletion cpp/ql/src/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/cpp-queries
version: 0.4.5-dev
version: 0.4.6-dev
groups:
- cpp
- queries
Expand Down
4 changes: 4 additions & 0 deletions csharp/ql/campaigns/Solorigate/lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.3.5

No user-facing changes.

## 1.3.4

No user-facing changes.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.3.5

No user-facing changes.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 1.3.4
lastReleaseVersion: 1.3.5
2 changes: 1 addition & 1 deletion csharp/ql/campaigns/Solorigate/lib/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/csharp-solorigate-all
version: 1.3.5-dev
version: 1.3.6-dev
groups:
- csharp
- solorigate
Expand Down
4 changes: 4 additions & 0 deletions csharp/ql/campaigns/Solorigate/src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.3.5

No user-facing changes.

## 1.3.4

No user-facing changes.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.3.5

No user-facing changes.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 1.3.4
lastReleaseVersion: 1.3.5
2 changes: 1 addition & 1 deletion csharp/ql/campaigns/Solorigate/src/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/csharp-solorigate-queries
version: 1.3.5-dev
version: 1.3.6-dev
groups:
- csharp
- solorigate
Expand Down
4 changes: 4 additions & 0 deletions csharp/ql/lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.5

No user-facing changes.

## 0.4.4

### Minor Analysis Improvements
Expand Down
3 changes: 3 additions & 0 deletions csharp/ql/lib/change-notes/released/0.4.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.4.5

No user-facing changes.
2 changes: 1 addition & 1 deletion csharp/ql/lib/codeql-pack.release.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.4.4
lastReleaseVersion: 0.4.5
2 changes: 1 addition & 1 deletion csharp/ql/lib/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/csharp-all
version: 0.4.5-dev
version: 0.4.6-dev
groups: csharp
dbscheme: semmlecode.csharp.dbscheme
extractor: csharp
Expand Down
4 changes: 4 additions & 0 deletions csharp/ql/src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.5

No user-facing changes.

## 0.4.4

No user-facing changes.
Expand Down
3 changes: 3 additions & 0 deletions csharp/ql/src/change-notes/released/0.4.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.4.5

No user-facing changes.
2 changes: 1 addition & 1 deletion csharp/ql/src/codeql-pack.release.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.4.4
lastReleaseVersion: 0.4.5
2 changes: 1 addition & 1 deletion csharp/ql/src/qlpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codeql/csharp-queries
version: 0.4.5-dev
version: 0.4.6-dev
groups:
- csharp
- queries
Expand Down
75 changes: 29 additions & 46 deletions docs/codeql/codeql-language-guides/basic-query-for-cpp-code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
Basic query for C and C++ code
==============================

Learn to write and run a simple CodeQL query using LGTM.
Learn to write and run a simple CodeQL query using Visual Studio Code with the CodeQL extension.

.. include:: ../reusables/vs-code-basic-instructions/setup-to-run-queries.rst

About the query
---------------
Expand All @@ -14,62 +16,33 @@ The query we're going to run performs a basic search of the code for ``if`` stat

if (error) { }

Running the query
-----------------

#. In the main search box on LGTM.com, search for the project you want to query. For tips, see `Searching <https://lgtm.com/help/lgtm/searching>`__.

#. Click the project in the search results.

#. Click **Query this project**.

This opens the query console. (For information about using this, see `Using the query console <https://lgtm.com/help/lgtm/using-query-console>`__.)

.. pull-quote::
.. include:: ../reusables/vs-code-basic-instructions/find-database.rst

Note
Running a quick query
---------------------

Alternatively, you can go straight to the query console by clicking **Query console** (at the top of any page), selecting **C/C++** from the **Language** drop-down list, then choosing one or more projects to query from those displayed in the **Project** drop-down list.
.. include:: ../reusables/vs-code-basic-instructions/run-quick-query-1.rst

#. Copy the following query into the text box in the query console:
#. In the quick query tab, delete ``select ""`` and paste the following query beneath the import statement ``import cpp``.

.. code-block:: ql

import cpp

from IfStmt ifstmt, BlockStmt block
where ifstmt.getThen() = block and
block.getNumStmt() = 0
select ifstmt, "This 'if' statement is redundant."

LGTM checks whether your query compiles and, if all is well, the **Run** button changes to green to indicate that you can go ahead and run the query.

#. Click **Run**.

The name of the project you are querying, and the ID of the most recently analyzed commit to the project, are listed below the query box. To the right of this is an icon that indicates the progress of the query operation:

.. image:: ../images/query-progress.png
:align: center

.. pull-quote::

Note
.. include:: ../reusables/vs-code-basic-instructions/run-quick-query-2.rst

Your query is always run against the most recently analyzed commit to the selected project.
.. image:: ../images/codeql-for-visual-studio-code/basic-cpp-query-results-1.png
:align: center

The query will take a few moments to return results. When the query completes, the results are displayed below the project name. The query results are listed in two columns, corresponding to the two expressions in the ``select`` clause of the query. The first column corresponds to the expression ``ifstmt`` and is linked to the location in the source code of the project where ``ifstmt`` occurs. The second column is the alert message.
If any matching code is found, click a link in the ``ifstmt`` column to open the file and highlight the matching ``if`` statement.

➤ `Example query results <https://lgtm.com/query/4242591143131494898/>`__
.. image:: ../images/codeql-for-visual-studio-code/basic-cpp-query-results-2.png
:align: center

.. pull-quote::

Note

An ellipsis (…) at the bottom of the table indicates that the entire list is not displayed—click it to show more results.

#. If any matching code is found, click a link in the ``ifstmt`` column to view the ``if`` statement in the code viewer.

The matching ``if`` statement is highlighted with a yellow background in the code viewer. If any code in the file also matches a query from the standard query library for that language, you will see a red alert message at the appropriate point within the code.
.. include:: ../reusables/vs-code-basic-instructions/note-store-quick-query.rst

About the query structure
~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -120,7 +93,7 @@ In this case, identifying the ``if`` statement with the empty ``then`` branch as

To exclude ``if`` statements that have an ``else`` branch:

#. Extend the ``where`` clause to include the following extra condition:
#. Edit your query and extend the ``where`` clause to include the following extra condition:

.. code-block:: ql

Expand All @@ -134,14 +107,24 @@ To exclude ``if`` statements that have an ``else`` branch:
block.getNumStmt() = 0 and
not ifstmt.hasElse()

#. Click **Run**.
#. Re-run the query.

There are now fewer results because ``if`` statements with an ``else`` branch are no longer reported.

➤ `See this in the query console <https://lgtm.com/query/1899933116489579248/>`__

Further reading
---------------

.. include:: ../reusables/cpp-further-reading.rst
.. include:: ../reusables/codeql-ref-tools-further-reading.rst

.. Article-specific substitutions for the reusables used in docs/codeql/reusables/vs-code-basic-instructions

.. |language-text| replace:: C/C++

.. |language-code| replace:: ``cpp``

.. |example-url| replace:: https://github.com/protocolbuffers/protobuf

.. |image-quick-query| image:: ../images/codeql-for-visual-studio-code/quick-query-tab-cpp.png

.. |result-col-1| replace:: The first column corresponds to the expression ``ifstmt`` and is linked to the location in the source code of the project where ``ifstmt`` occurs.
72 changes: 27 additions & 45 deletions docs/codeql/codeql-language-guides/basic-query-for-csharp-code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
Basic query for C# code
=======================

Learn to write and run a simple CodeQL query using LGTM.
Learn to write and run a simple CodeQL query using Visual Studio Code with the CodeQL extension.

.. include:: ../reusables/vs-code-basic-instructions/setup-to-run-queries.rst

About the query
---------------
Expand All @@ -14,62 +16,33 @@ The query we're going to run performs a basic search of the code for ``if`` stat

if (error) { }

Running the query
-----------------

#. In the main search box on LGTM.com, search for the project you want to query. For tips, see `Searching <https://lgtm.com/help/lgtm/searching>`__.

#. Click the project in the search results.

#. Click **Query this project**.

This opens the query console. (For information about using this, see `Using the query console <https://lgtm.com/help/lgtm/using-query-console>`__.)

.. pull-quote::
.. include:: ../reusables/vs-code-basic-instructions/find-database.rst

Note
Running a quick query
---------------------

Alternatively, you can go straight to the query console by clicking **Query console** (at the top of any page), selecting **C#** from the **Language** drop-down list, then choosing one or more projects to query from those displayed in the **Project** drop-down list.
.. include:: ../reusables/vs-code-basic-instructions/run-quick-query-1.rst

#. Copy the following query into the text box in the query console:
#. In the quick query tab, delete ``select ""`` and paste the following query beneath the import statement ``import csharp``.

.. code-block:: ql

import csharp

from IfStmt ifstmt, BlockStmt block
where ifstmt.getThen() = block and
block.isEmpty()
select ifstmt, "This 'if' statement is redundant."

LGTM checks whether your query compiles and, if all is well, the **Run** button changes to green to indicate that you can go ahead and run the query.

#. Click **Run**.

The name of the project you are querying, and the ID of the most recently analyzed commit to the project, are listed below the query box. To the right of this is an icon that indicates the progress of the query operation:

.. image:: ../images/query-progress.png
:align: center

.. pull-quote::
.. include:: ../reusables/vs-code-basic-instructions/run-quick-query-2.rst

Note
.. image:: ../images/codeql-for-visual-studio-code/basic-csharp-query-results-1.png
:align: center

Your query is always run against the most recently analyzed commit to the selected project.
If any matching code is found, click a link in the ``ifstmt`` column to open the file and highlight the matching ``if`` statement.

The query will take a few moments to return results. When the query completes, the results are displayed below the project name. The query results are listed in two columns, corresponding to the two expressions in the ``select`` clause of the query. The first column corresponds to the expression ``ifstmt`` and is linked to the location in the source code of the project where ``ifstmt`` occurs. The second column is the alert message.
.. image:: ../images/codeql-for-visual-studio-code/basic-csharp-query-results-2.png
:align: center

➤ `Example query results <https://lgtm.com/query/1214010107827821393/>`__

.. pull-quote::

Note

An ellipsis (…) at the bottom of the table indicates that the entire list is not displayed—click it to show more results.

#. If any matching code is found, click a link in the ``ifstmt`` column to view the ``if`` statement in the code viewer.

The matching ``if`` statement is highlighted with a yellow background in the code viewer. If any code in the file also matches a query from the standard query library for that language, you will see a red alert message at the appropriate point within the code.
.. include:: ../reusables/vs-code-basic-instructions/note-store-quick-query.rst

About the query structure
~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -139,14 +112,23 @@ To exclude ``if`` statements that have an ``else`` branch:
block.isEmpty() and
not exists(ifstmt.getElse())

#. Click **Run**.
#. Re-run the query.

There are now fewer results because ``if`` statements with an ``else`` branch are no longer included.

➤ `See this in the query console <https://lgtm.com/query/6233102733683510530/>`__

Further reading
---------------

.. include:: ../reusables/csharp-further-reading.rst
.. include:: ../reusables/codeql-ref-tools-further-reading.rst

.. Article-specific substitutions for the reusables used in docs/codeql/reusables/vs-code-basic-instructions
.. |language-text| replace:: C#

.. |language-code| replace:: ``csharp``

.. |example-url| replace:: https://github.com/PowerShell/PowerShell

.. |image-quick-query| image:: ../images/codeql-for-visual-studio-code/quick-query-tab-csharp.png

.. |result-col-1| replace:: The first column corresponds to the expression ``ifstmt`` and is linked to the location in the source code of the project where ``ifstmt`` occurs.
Loading