-
Notifications
You must be signed in to change notification settings - Fork 0
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
Step 3 - Your first query #3
Comments
Submission: Commit your query via a Pull RequestThe first method to submit your query is via a Pull Request. Using a Pull request has several advantages:
However this workflow is bit more involved than just directly committing to the default branch for the purposes of this course. To submit this query via Pull Request, you can follow the following workflow:
|
Submission: Commit your query directly to the default branchThis method is simpler. You won't have to juggle between branches, rebase onto the default branch, or create Pull Requests. However, merging directly to the default branch is not a good practice when you are contributing to a shared code base, so if you choose this method, please don't take this bad habit home with you! To submit this query via a direct commit to the default branch, you can follow this workflow:
|
Step 3: Finding calls to the jQuery
$
functionYou will now run a simple CodeQL query, to understand its basic concepts and get familiar with your IDE.
⌨️ Activity: Run a CodeQL query
Edit the file
calls-to-dollar.ql
with the following contents:Don't copy / paste this code, but instead type it slowly. You will see the CodeQL auto-complete suggestions in your IDE as you type.
from
and the first letters ofCallExpr
, the IDE will propose a list of available classes from the CodeQL library for JavaScript. This is a good way to discover what classes are available to represent standard patterns in the source code.where dollarCall.
the IDE will propose a list of available predicates that you can call on the variabledollarCall
.getCalleeName()
to narrow down the list.CallExpr
in the CodeQL JavaScript library.=
operator to assert that two values are equal.Run this query: Right-click on the query editor, then click CodeQL: Run Query.
Inspect the results appearing in the results panel. Click on the result hyperlinks to navigate to the corresponding locations in the Bootstrap code. Do you understand what this query does? You probably guessed it! This query finds all calls to the function named
$
.Now it's time to submit your query. You will have 2 choices to do that, and we'll explain both of them in the comments below. Once you have chosen your method, submit your answer!
Read carefully: you will need to follow the same steps to submit your answers to later steps. You can always come back to this issue later to check the submission instructions.
The text was updated successfully, but these errors were encountered: