Skip to content
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

LGTM deprecation: Update basic queries to use VS Code #11423

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

felicitymay
Copy link
Contributor

@felicitymay felicitymay commented Nov 24, 2022

This pull request updates the basic query introduction article for Python to use VS Code. I've raised this for discussion. Once we've agreed the updates, I'll apply them to the other basic query introductions.

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/setup-to-run-queries.rst
Copy link
Contributor Author

@felicitymay felicitymay Nov 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this placeholder here so that it's easy to update this as we steadily make it easier to get started with running CodeQL queries.


.. pull-quote::
#. Copy the URL for the repository into the field and press the keyboard **Enter** key.
Copy link
Contributor Author

@felicitymay felicitymay Nov 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to suggest an example repository here? For example, https://github.com/protocolbuffers/protobuf.

Copy link
Contributor

@jf205 jf205 Nov 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that's quite helpful 😄

#. In Visual Studio Code, create a new folder to store your experimental queries for C and C++ CodeQL databases. For example, ``cpp-experiments``.

#. Click **Run**.
#. Create a ``qlpack.yml`` file in your experiments folder with the contents shown below. This tells the CodeQL extension that any queries you create in the folder are intended to run on C or C++ CodeQL databases.

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:
.. code-block:: yaml
.. image:: ../images/query-progress.png
:align: center
name: github-owner/cpp-experiments
version: 0.0.1
dependencies:
codeql/cpp-all: ^0.1.2
.. pull-quote::
#. Create a second new file in your experiements folder with the ``.ql`` file extension. You will write your first query in this file.

Copy link
Contributor

@jf205 jf205 Nov 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For simplicity, we could point users to the quick query command here: https://codeql.github.com/docs/codeql-for-visual-studio-code/analyzing-your-projects/#running-a-quick-query

It would save folks having to create a new qlpack.yml file. However, they would have to copy the contents of the synthetic CodeQL pack to somewhere permanent if they wanted to retain their test queries, but that could be an optional extra step at the end of this procedure (and we could simply link to the docs).


.. pull-quote::
#. Copy the URL for the repository into the field and press the keyboard **Enter** key.
Copy link
Contributor

@jf205 jf205 Nov 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that's quite helpful 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants