Skip to content

Commit 29eed68

Browse files
authored
Merge pull request github#3409 from jf205/sd-68
"CodeQL for X" docs: update "Further reading" sections
2 parents 7327df0 + 28f51d9 commit 29eed68

Some content is hidden

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

49 files changed

+144
-150
lines changed

docs/language/learn-ql/cpp/conversions-classes.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,5 @@ There is a similar built-in `query <https://lgtm.com/rules/2158670642/>`__ on LG
223223
Further reading
224224
---------------
225225

226-
- Explore other ways of querying classes using examples from the `C/C++ cookbook <https://help.semmle.com/wiki/label/CBCPP/class>`__.
227-
- Take a look at the :doc:`Analyzing data flow in C and C++ <dataflow>` tutorial.
228-
- Try the worked examples in the following topics: :doc:`Refining a query to account for edge cases <private-field-initialization>`, and :doc:`Detecting a potential buffer overflow <zero-space-terminator>`.
229-
- Find out more about QL in the `QL language reference <https://help.semmle.com/QL/ql-handbook/index.html>`__.
230-
- Learn more about the query console in `Using the query console <https://lgtm.com/help/lgtm/using-query-console>`__ on LGTM.com.
226+
.. include:: ../../reusables/cpp-further-reading.rst
227+
.. include:: ../../reusables/codeql-ref-tools-further-reading.rst

docs/language/learn-ql/cpp/dataflow.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,6 @@ Exercise 3: Write a class that represents flow sources from ``getenv``. (`Answer
299299

300300
Exercise 4: Using the answers from 2 and 3, write a query which finds all global data flows from ``getenv`` to ``gethostbyname``. (`Answer <#exercise-4>`__)
301301

302-
Further reading
303-
---------------
304-
305-
- Try the worked examples in the following topics: :doc:`Refining a query to account for edge cases <private-field-initialization>` and :doc:`Detecting a potential buffer overflow <zero-space-terminator>`.
306-
- Find out more about QL in the `QL language reference <https://help.semmle.com/QL/ql-handbook/index.html>`__.
307-
- Learn more about the query console in `Using the query console <https://lgtm.com/help/lgtm/using-query-console>`__ on LGTM.com.
308-
309302
Answers
310303
-------
311304

@@ -393,3 +386,11 @@ Exercise 4
393386
from DataFlow::Node getenv, FunctionCall fc, GetenvToGethostbynameConfiguration cfg
394387
where cfg.hasFlow(getenv, DataFlow::exprNode(fc.getArgument(0)))
395388
select getenv.asExpr(), fc
389+
390+
Further reading
391+
---------------
392+
393+
- `Exploring data flow with path queries <https://help.semmle.com/codeql/codeql-for-vscode/procedures/exploring-paths.html>`__
394+
395+
.. include:: ../../reusables/cpp-further-reading.rst
396+
.. include:: ../../reusables/codeql-ref-tools-further-reading.rst

docs/language/learn-ql/cpp/expressions-types.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,5 @@ Note that we replaced ``e.getEnclosingStmt()`` with ``e.getEnclosingStmt().getPa
132132
Further reading
133133
---------------
134134

135-
- Explore other ways of finding types and statements using examples from the C/C++ cookbook for `types <https://help.semmle.com/wiki/label/CBCPP/type>`__ and `statements <https://help.semmle.com/wiki/label/CBCPP/statement>`__.
136-
- Take a look at the :doc:`Conversions and classes in C and C++ <conversions-classes>` and :doc:`Analyzing data flow in C and C++ <dataflow>` tutorials.
137-
- Find out more about QL in the `QL language reference <https://help.semmle.com/QL/ql-handbook/index.html>`__.
138-
- Learn more about the query console in `Using the query console <https://lgtm.com/help/lgtm/using-query-console>`__ on LGTM.com.
135+
.. include:: ../../reusables/cpp-further-reading.rst
136+
.. include:: ../../reusables/codeql-ref-tools-further-reading.rst

docs/language/learn-ql/cpp/function-classes.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,5 @@ The LGTM version of this query is considerably more complicated, but if you look
9292
Further reading
9393
---------------
9494

95-
- Explore other ways of finding functions using examples from the `C/C++ cookbook <https://help.semmle.com/wiki/label/CBCPP/function>`__.
96-
- Take a look at some other tutorials: :doc:`Expressions, types and statements in C and C++ <introduce-libraries-cpp>`, :doc:`Conversions and classes in C and C++ <conversions-classes>`, and :doc:`Analyzing data flow in C and C++ <dataflow>`.
97-
- Find out more about QL in the `QL language reference <https://help.semmle.com/QL/ql-handbook/index.html>`__.
98-
- Learn more about the query console in `Using the query console <https://lgtm.com/help/lgtm/using-query-console>`__ on LGTM.com.
95+
.. include:: ../../reusables/cpp-further-reading.rst
96+
.. include:: ../../reusables/codeql-ref-tools-further-reading.rst

docs/language/learn-ql/cpp/guards.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,9 @@ The ``comparesLt`` predicate
9393

9494
``comparesLt(left, right, k, isLessThan, testIsTrue)`` holds if ``left < right + k`` evaluates to ``isLessThan`` when the expression evaluates to ``testIsTrue``.
9595

96+
Further reading
97+
---------------
98+
99+
.. include:: ../../reusables/cpp-further-reading.rst
100+
.. include:: ../../reusables/codeql-ref-tools-further-reading.rst
101+

docs/language/learn-ql/cpp/introduce-libraries-cpp.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,5 @@ This table lists `Preprocessor <https://help.semmle.com/qldoc/cpp/semmle/code/cp
525525
Further reading
526526
---------------
527527

528-
- Experiment with the worked examples in the CodeQL for C and C++ topics: :doc:`Functions in C and C++ <function-classes>`, :doc:`Expressions, types, and statements in C and C++ <expressions-types>`, :doc:`Conversions and classes in C and C++ <conversions-classes>`, and :doc:`Analyzing data flow in C and C++ <dataflow>`.
529-
- Find out more about QL in the `QL language reference <https://help.semmle.com/QL/ql-handbook/index.html>`__.
530-
- Learn more about the query console in `Using the query console <https://lgtm.com/help/lgtm/using-query-console>`__ on LGTM.com.
528+
.. include:: ../../reusables/cpp-further-reading.rst
529+
.. include:: ../../reusables/codeql-ref-tools-further-reading.rst

docs/language/learn-ql/cpp/private-field-initialization.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,5 @@ Finally we can simplify the query by using the transitive closure operator. In t
149149
Further reading
150150
---------------
151151

152-
- Take a look at another example: :doc:`Detecting a potential buffer overflow <zero-space-terminator>`.
153-
- Find out more about QL in the `QL language reference <https://help.semmle.com/QL/ql-handbook/index.html>`__.
154-
- Learn more about the query console in `Using the query console <https://lgtm.com/help/lgtm/using-query-console>`__ on LGTM.com.
152+
.. include:: ../../reusables/cpp-further-reading.rst
153+
.. include:: ../../reusables/codeql-ref-tools-further-reading.rst

docs/language/learn-ql/cpp/ql-for-cpp.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,3 @@ Experiment and learn how to write effective and efficient queries for CodeQL dat
3939
- :doc:`Using range analysis for C and C++ <range-analysis>`: You can use range analysis to determine the upper or lower bounds on an expression, or whether an expression could potentially over or underflow.
4040

4141
- :doc:`Hash consing and value numbering <value-numbering-hash-cons>`: You can use specialized CodeQL libraries to recognize expressions that are syntactically identical or compute the same value at runtime in C and C++ codebases.
42-
43-
Further reading
44-
---------------
45-
46-
- For examples of how to query common C/C++ elements, see the `C/C++ cookbook <https://help.semmle.com/wiki/display/CBCPP>`__.
47-
- For the queries used in LGTM, display a `C/C++ query <https://lgtm.com/search?q=language%3Acpp&t=rules>`__ and click **Open in query console** to see the code used to find alerts.
48-
- For more information about the library for C/C++ see the `CodeQL library for C/C++ <https://help.semmle.com/qldoc/cpp>`__.

docs/language/learn-ql/cpp/range-analysis.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,9 @@ This query uses ``upperBound`` to determine whether the result of ``snprintf`` i
4141
convSink = call.getArgument(1).getFullyConverted()
4242
4343
select call, upperBound(call.getArgument(1).getFullyConverted())
44+
45+
Further reading
46+
---------------
47+
48+
.. include:: ../../reusables/cpp-further-reading.rst
49+
.. include:: ../../reusables/codeql-ref-tools-further-reading.rst

docs/language/learn-ql/cpp/value-numbering-hash-cons.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,9 @@ Example query
110110
hashCons(outer.getCondition()) = hashCons(inner.getCondition())
111111
select inner.getCondition(), "The condition of this if statement duplicates the condition of $@",
112112
outer.getCondition(), "an enclosing if statement"
113+
114+
Further reading
115+
---------------
116+
117+
.. include:: ../../reusables/cpp-further-reading.rst
118+
.. include:: ../../reusables/codeql-ref-tools-further-reading.rst

0 commit comments

Comments
 (0)