diff --git a/docs/codeql/codeql-cli/codeql-cli-reference/about-ql-packs.rst b/docs/codeql/codeql-cli/codeql-cli-reference/about-ql-packs.rst index 942e6fe8157..39769f1f79c 100644 --- a/docs/codeql/codeql-cli/codeql-cli-reference/about-ql-packs.rst +++ b/docs/codeql/codeql-cli/codeql-cli-reference/about-ql-packs.rst @@ -145,7 +145,7 @@ the CodeQL repository. When you create a custom QL pack, it's usually a good idea to add it to the search path in your CodeQL configuration. This will ensure that any libraries the pack contains are available to the CodeQL CLI. - For more information, see ":doc:`Specifying command options in a CodeQL configuration file <../codeql-cli-reference/specifying-command-options-in-a-codeql-configuration-file>`." + For more information, see ":ref:`Specifying command options in a CodeQL configuration file `." QL packs for custom test files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/codeql/codeql-cli/codeql-cli-reference/index.rst b/docs/codeql/codeql-cli/codeql-cli-reference/index.rst index 69ed60a8546..10e97b715c2 100644 --- a/docs/codeql/codeql-cli/codeql-cli-reference/index.rst +++ b/docs/codeql/codeql-cli/codeql-cli-reference/index.rst @@ -12,7 +12,6 @@ Learn more about the files you can use when running CodeQL processes and the res about-ql-packs query-reference-files sarif-output - specifying-command-options-in-a-codeql-configuration-file exit-codes @@ -20,15 +19,13 @@ Learn more about the files you can use when running CodeQL processes and the res contain queries, library files, query suites, and important metadata. - :doc:`Query reference files `: A query reference file is text file that defines the location of one query to test. - :doc:`SARIF output `: CodeQL supports SARIF as an output format for sharing static analysis results. -- :doc:`Specifying command options in a CodeQL configuration file `: - You can save default or frequently used options for your commands in a per-user configuration file. - :doc:`Exit codes `: The CodeQL CLI reports the status of each command it runs as an exit code. This exit code provides information for subsequent commands or for other tools that rely on the CodeQL CLI. .. _cli-commands: -CodeQL CLI commands -------------------- +CodeQL CLI manual +----------------- To view provide detailed information about each CodeQL CLI command, including its usage and options, visit the "`CodeQL CLI manual <../codeql-cli-manual>`__." diff --git a/docs/codeql/codeql-cli/codeql-cli-reference/query-reference-files.rst b/docs/codeql/codeql-cli/codeql-cli-reference/query-reference-files.rst index 74cc1d9dd93..e4bea0df72f 100644 --- a/docs/codeql/codeql-cli/codeql-cli-reference/query-reference-files.rst +++ b/docs/codeql/codeql-cli/codeql-cli-reference/query-reference-files.rst @@ -40,7 +40,7 @@ A query reference file to test a JavaScript alert query: The `QL pack `__ for the ``javascript/ql/test`` directory defines the ``codeql-javascript`` queries as a dependency. So the query reference file defines the location of the query relative -to the ``codeql-javascript`` QL pack: +to the ``codeql-javascript`` QL pack:: AngularJS/DeadAngularJSEventListener.ql diff --git a/docs/codeql/codeql-cli/using-the-codeql-cli/getting-started-with-the-codeql-cli.rst b/docs/codeql/codeql-cli/using-the-codeql-cli/getting-started-with-the-codeql-cli.rst index cd0e4b560ae..1cd0ce63eee 100644 --- a/docs/codeql/codeql-cli/using-the-codeql-cli/getting-started-with-the-codeql-cli.rst +++ b/docs/codeql/codeql-cli/using-the-codeql-cli/getting-started-with-the-codeql-cli.rst @@ -184,7 +184,7 @@ executable in a couple of ways: can run the executable as just ``codeql``. At this point, you can execute CodeQL commands. For a full list of the CodeQL -CLI commands, see the ":ref:`CodeQL CLI reference `." +CLI commands, see the "`CodeQL CLI manual <../../codeql-cli-manual>`__." .. pull-quote:: Note diff --git a/docs/codeql/codeql-cli/using-the-codeql-cli/index.rst b/docs/codeql/codeql-cli/using-the-codeql-cli/index.rst index 88571662942..22bc64c4373 100644 --- a/docs/codeql/codeql-cli/using-the-codeql-cli/index.rst +++ b/docs/codeql/codeql-cli/using-the-codeql-cli/index.rst @@ -41,6 +41,9 @@ See the following links to learn how to get set up and run CodeQL commands: Test query help files by rendering them as markdown to ensure they are valid before uploading them to the CodeQL repository or using them in code scanning. +- :doc:`Specifying command options in a CodeQL configuration file `: + You can save default or frequently used options for your commands in a per-user configuration file. + .. toctree:: :titlesonly: :hidden: @@ -53,4 +56,5 @@ See the following links to learn how to get set up and run CodeQL commands: using-custom-queries-with-the-codeql-cli creating-codeql-query-suites testing-custom-queries - testing-query-help-files \ No newline at end of file + testing-query-help-files + Specifying command options \ No newline at end of file diff --git a/docs/codeql/codeql-cli/codeql-cli-reference/specifying-command-options-in-a-codeql-configuration-file.rst b/docs/codeql/codeql-cli/using-the-codeql-cli/specifying-command-options-in-a-codeql-configuration-file.rst similarity index 100% rename from docs/codeql/codeql-cli/codeql-cli-reference/specifying-command-options-in-a-codeql-configuration-file.rst rename to docs/codeql/codeql-cli/using-the-codeql-cli/specifying-command-options-in-a-codeql-configuration-file.rst diff --git a/docs/codeql/codeql-cli/using-the-codeql-cli/testing-custom-queries.rst b/docs/codeql/codeql-cli/using-the-codeql-cli/testing-custom-queries.rst index 4b561c797f3..5746158e1de 100644 --- a/docs/codeql/codeql-cli/using-the-codeql-cli/testing-custom-queries.rst +++ b/docs/codeql/codeql-cli/using-the-codeql-cli/testing-custom-queries.rst @@ -231,7 +231,7 @@ When the test runs it: ``codeql test run --search-path=java java/tests/EmptyThen`` For information about saving the search path as part of your configuration, see - ":doc:`Specifying command options in a CodeQL configuration file <../codeql-cli-reference/specifying-command-options-in-a-codeql-configuration-file>`." + ":ref:`Specifying command options in a CodeQL configuration file `." #. Executes the test by running the query and generating an ``EmptyThen.actual`` results file. #. Checks for an ``EmptyThen.expected`` file to compare with the ``.actual`` results file. #. Reports the results of the test --- in this case, a failure: ``0 tests passed; 1 tests failed:``. diff --git a/docs/codeql/codeql-language-guides/codeql-for-java/codeql-library-for-java.rst b/docs/codeql/codeql-language-guides/codeql-for-java/codeql-library-for-java.rst index 7a43149f745..242d00c3d08 100644 --- a/docs/codeql/codeql-language-guides/codeql-for-java/codeql-library-for-java.rst +++ b/docs/codeql/codeql-language-guides/codeql-for-java/codeql-library-for-java.rst @@ -198,7 +198,7 @@ The wildcards ``? extends Number`` and ``? super Float`` are represented by clas For dealing with generic methods, there are classes ``GenericMethod``, ``ParameterizedMethod`` and ``RawMethod``, which are entirely analogous to the like-named classes for representing generic types. -For more information on working with types, see the :doc:`article on Java types `. +For more information on working with types, see the :doc:`Types in Java `. Variables ~~~~~~~~~ diff --git a/docs/codeql/codeql-language-guides/codeql-for-java/types-in-java.rst b/docs/codeql/codeql-language-guides/codeql-for-java/types-in-java.rst index 275779c65c1..515bb2e7080 100644 --- a/docs/codeql/codeql-language-guides/codeql-for-java/types-in-java.rst +++ b/docs/codeql/codeql-language-guides/codeql-for-java/types-in-java.rst @@ -1,7 +1,7 @@ .. _types-in-java: -Java types -========== +Types in Java +============= You can use CodeQL to find out information about data types used in Java code. This allows you to write queries to identify specific type-related issues. diff --git a/docs/codeql/ql-language-reference/ql-language-specification.rst b/docs/codeql/ql-language-reference/ql-language-specification.rst index a37260ac317..45a2385f1f3 100644 --- a/docs/codeql/ql-language-reference/ql-language-specification.rst +++ b/docs/codeql/ql-language-reference/ql-language-specification.rst @@ -173,7 +173,7 @@ Module definitions A QL module definition has the following syntax: -.. code-block:: ql +:: module ::= annotation* "module" modulename "{" moduleBody "}" @@ -183,7 +183,7 @@ A module definition extends the current module's declared module environment wit QL files consist of simply a module body without a name and surrounding braces: -.. code-block:: ql +:: ql ::= moduleBody @@ -205,7 +205,7 @@ Import directives An import directive refers to a module identifier: -.. code-block:: ql +:: import ::= annotations "import" importModuleId ("as" modulename)? @@ -277,7 +277,7 @@ Type references With the exception of class domain types and character types (which cannot be referenced explicitly in QL source), a reference to a type is written as the name of the type. In the case of database types, the name includes the at sign (``@``, U+0040). -.. code-block:: ql +:: type ::= (moduleId "::")? classname | dbasetype | "boolean" | "date" | "float" | "int" | "string" @@ -374,7 +374,7 @@ A *named tuple* is a finite map of variables to values. Each variable in a named A *variable declaration list* provides a sequence of variables and a type for each one: -.. code-block:: ql +:: var_decls ::= var_decl ("," var_decl)* var_decl ::= type simpleId @@ -390,7 +390,7 @@ QL programs evaluate in the context of a *store*. This section specifies several A *fact* is a predicate or type along with an ordered tuple. A fact is written as the predicate name or type name followed immediately by the tuple. Here are some examples of facts: -.. code-block:: ql +:: successor(0, 1) Tree.toString(@method_tree(12), "def println") @@ -440,13 +440,13 @@ There are two kinds of comments in QL: one-line and multiline. A one-line comment is two slash characters (``/``, U+002F) followed by any sequence of characters other than line feeds (U+000A) and carriage returns (U+000D). Here is an example of a one-line comment: -.. code-block:: ql +:: // This is a comment A multiline comment is a *comment start*, followed by a *comment body*, followed by a *comment end*. A comment start is a slash (``/``, U+002F) followed by an asterisk (``*``, U+002A), and a comment end is an asterisk followed by a slash. A comment body is any sequence of characters that does not include a comment end. Here is an example multiline comment: -.. code-block:: ql +:: /* It was the best of code. @@ -459,7 +459,7 @@ Keywords The following sequences of characters are keyword tokens: -.. code-block:: ql +:: and any @@ -514,7 +514,7 @@ Operators The following sequences of characters are operator tokens: -.. code-block:: ql +:: < <= @@ -549,7 +549,7 @@ An identifier cannot have the same sequence of characters as a keyword, nor can Here are some examples of identifiers: -.. code-block:: ql +:: width Window_width @@ -568,7 +568,7 @@ There are several kinds of identifiers: Identifiers are used in following syntactic constructs: -.. code-block:: ql +:: simpleId ::= lowerId | upperId modulename ::= simpleId @@ -584,7 +584,7 @@ Integer literals (int) An integer literal is a possibly negated sequence of decimal digits (``0`` through ``9``, U+0030 through U+0039). Here are some examples of integer literals: -.. code-block:: ql +:: 0 42 @@ -596,7 +596,7 @@ Float literals (float) A floating-point literals is a possibly negated two non-negative integers literals separated by a dot (``.``, U+002E). Here are some examples of float literals: -.. code-block:: ql +:: 0.5 2.0 @@ -620,7 +620,7 @@ A string literal denotes a sequence of characters. It begins and ends with a dou Here are some examples of string literals: -.. code-block:: ql +:: "hello" "He said, \"Logic clearly dictates that the needs of the many...\"" @@ -630,7 +630,7 @@ Annotations Various kinds of syntax can have *annotations* applied to them. Annotations are as follows: -.. code-block:: ql +:: annotations ::= annotation* @@ -746,7 +746,7 @@ Non-member predicates A *predicate* is declared as a sequence of annotations, a head, and an optional body: -.. code-block:: ql +:: predicate ::= annotations head optbody @@ -758,13 +758,13 @@ A valid non-member predicate can be annotated with ``cached``, ``deprecated``, ` The head of the predicate gives a name, an optional *result type*, and a sequence of variables declarations that are *arguments*: -.. code-block:: ql +:: head ::= ("predicate" | type) predicateName "(" (var_decls)? ")" The body of a predicate is of one of three forms: -.. code-block:: ql +:: optbody ::= ";" | "{" formula "}" @@ -781,7 +781,7 @@ Classes A class definition has the following syntax: -.. code-block:: ql +:: class ::= annotations "class" classname "extends" type ("," type)* "{" member* "}" @@ -819,7 +819,7 @@ Members Each member of a class is either a *character*, a predicate, or a field: -.. code-block:: ql +:: member ::= character | predicate | field character ::= annotations classname "(" ")" "{" formula "}" @@ -871,7 +871,7 @@ Select clauses A QL file may include at most one *select clause*. That select clause has the following syntax: -.. code-block:: ql +:: select ::= ("from" var_decls)? ("where" formula)? "select" select_exprs ("order" "by" orderbys)? @@ -885,7 +885,7 @@ The ``where`` keyword, if present, is followed by the *formula* of the select cl The ``select`` keyword is followed by a number of *select expressions*. Select expressions have the following syntax: -.. code-block:: ql +:: as_exprs ::= as_expr ("," as_expr)* as_expr ::= expr ("as" simpleId)? @@ -894,7 +894,7 @@ The keyword ``as`` gives a *label* to the select expression it is part of. No tw The ``order`` keyword, if present, is followed by a number of *ordering directives*. Ordering directives have the following syntax: -.. code-block:: ql +:: orderbys ::= orderby ("," orderby)* orderby ::= simpleId ("asc" | "desc")? @@ -924,7 +924,7 @@ Given a named tuple and a store, each expression has one or more *values*. This There are several kinds of expressions: -.. code-block:: ql +:: exprs ::= expr ("," expr)* @@ -948,7 +948,7 @@ Parenthesized expressions A parenthesized expression is an expression surrounded by parentheses: -.. code-block:: ql +:: eparen ::= "(" expr ")" @@ -959,7 +959,7 @@ Don't-care expressions A don't-care expression is written as a single underscore: -.. code-block:: ql +:: dontcare ::= "_" @@ -970,7 +970,7 @@ Literals A literal expression is as follows: -.. code-block:: ql +:: literal ::= "false" | "true" | int | float | string @@ -981,7 +981,7 @@ Unary operations A unary operation is the application of ``+`` or ``-`` to another expression: -.. code-block:: ql +:: unop ::= "+" expr | "-" expr @@ -997,7 +997,7 @@ Binary operations A binary operation is written as a *left operand* followed by a *binary operator*, followed by a *right operand*: -.. code-block:: ql +:: binop ::= expr "+" expr | expr "-" expr @@ -1024,7 +1024,7 @@ Variables A variable has the following syntax: -.. code-block:: ql +:: variable ::= varname | "this" | "result" @@ -1037,7 +1037,7 @@ Super A super expression has the following syntax: -.. code-block:: ql +:: super_expr ::= "super" | type "." "super" @@ -1056,7 +1056,7 @@ Casts A cast expression is a type in parentheses followed by another expression: -.. code-block:: ql +:: cast ::= "(" type ")" expr @@ -1071,7 +1071,7 @@ Postfix casts A postfix cast is a primary expression followed by a dot and then a class or primitive type in parentheses: -.. code-block:: ql +:: postfix_cast ::= primary "." "(" type ")" @@ -1082,7 +1082,7 @@ Calls with results An expression for a call with results is of one of two forms: -.. code-block:: ql +:: callwithresult ::= predicateRef (closure)? "(" (exprs)? ")" | primary "." predicateName (closure)? "(" (exprs)? ")" @@ -1125,7 +1125,7 @@ Aggregations An aggregation can be written in one of two forms: -.. code-block:: ql +:: aggregation ::= aggid ("[" expr "]")? "(" (var_decls)? ("|" (formula)? ("|" as_exprs ("order" "by" aggorderbys)?)?)? ")" | aggid ("[" expr "]")? "(" as_exprs ("order" "by" aggorderbys)? ")" @@ -1219,7 +1219,7 @@ Any The ``any`` expression is a special kind of quantified expression. -.. code-block:: ql +:: any ::= "any" "(" var_decls ("|" (formula)? ("|" expr)?)? ")" @@ -1232,7 +1232,7 @@ Ranges Range expressions denote a range of values. -.. code-block:: ql +:: range ::= "[" expr ".." expr "]" @@ -1247,7 +1247,7 @@ Set literals Set literals denote a choice from a collection of values. -.. code-block:: ql +:: setliteral ::= "[" expr ("," expr)* "]" @@ -1276,7 +1276,7 @@ A formula is a form of syntax used to *match* a named tuple given a store. There are several kinds of formulas: -.. code-block:: ql +:: formula ::= fparen | disjunction @@ -1297,7 +1297,7 @@ Parenthesized formulas A parenthesized formula is a formula enclosed by a pair of parentheses: -.. code-block:: ql +:: fparen ::= "(" formula ")" @@ -1308,7 +1308,7 @@ Disjunctions A disjunction is two formulas separated by the ``or`` keyword: -.. code-block:: ql +:: disjunction ::= formula "or" formula @@ -1319,7 +1319,7 @@ Conjunctions A conjunction is two formulas separated by the ``and`` keyword: -.. code-block:: ql +:: conjunction ::= formula "and" formula @@ -1330,7 +1330,7 @@ Implications An implication formula is two formulas separated by the ``implies`` keyword: -.. code-block:: ql +:: implies ::= formula "implies" formula @@ -1343,7 +1343,7 @@ Conditional formulas A conditional formula has the following syntax: -.. code-block:: ql +:: ifthen ::= "if" formula "then" formula "else" formula @@ -1356,7 +1356,7 @@ Negations A negation formula is a formula preceded by the ``not`` keyword: -.. code-block:: ql +:: negated ::= "not" formula @@ -1367,7 +1367,7 @@ Quantified formulas A quantified formula has several syntaxes: -.. code-block:: ql +:: quantified ::= "exists" "(" expr ")" | "exists" "(" var_decls ("|" formula)? ("|" formula)? ")" @@ -1391,7 +1391,7 @@ Comparisons A comparison formula is two expressions separated by a comparison operator: -.. code-block:: ql +:: comparison ::= expr compop expr compop ::= "=" | "!=" | "<" | ">" | "<=" | ">=" @@ -1409,7 +1409,7 @@ Type checks A type check formula has the following syntax: -.. code-block:: ql +:: instanceof ::= expr "instanceof" type @@ -1424,7 +1424,7 @@ Range checks A range check has the following syntax: -.. code-block:: ql +:: inrange ::= expr "in" range @@ -1435,7 +1435,7 @@ Calls A call has the following syntax: -.. code-block:: ql +:: call ::= predicateRef (closure)? "(" (exprs)? ")" | primary "." predicateName (closure)? "(" (exprs)? ")" @@ -1472,7 +1472,7 @@ Aliases Aliases define new names for existing QL entities. -.. code-block:: ql +:: alias ::= annotations "predicate" literalId "=" predicateRef "/" int ";" | annotations "class" classname "=" type ";" @@ -1892,7 +1892,7 @@ Summary of syntax The complete grammar for QL is as follows: -.. code-block:: ql +:: ql ::= moduleBody diff --git a/docs/codeql/ql-language-reference/qldoc-comment-specification.rst b/docs/codeql/ql-language-reference/qldoc-comment-specification.rst index f61af5f7ad5..cb84d281c93 100644 --- a/docs/codeql/ql-language-reference/qldoc-comment-specification.rst +++ b/docs/codeql/ql-language-reference/qldoc-comment-specification.rst @@ -49,4 +49,4 @@ The content of a QLDoc comment is interpreted as standard Markdown, with the fol The content of a QLDoc comment may contain metadata tags as follows: -The tag begins with any number of whitespace characters, followed by an '@' sign. At this point there may be any number of non-whitespace characters, which form the key of the tag. Then, a single whitespace character which separates the key from the value. The value of the tag is formed by the remainder of the line, and any subsequent lines until another '@' tag is seen, or the end of the content is reached. +The tag begins with any number of whitespace characters, followed by an ``@`` sign. At this point there may be any number of non-whitespace characters, which form the key of the tag. Then, a single whitespace character which separates the key from the value. The value of the tag is formed by the remainder of the line, and any subsequent lines until another ``@`` tag is seen, or the end of the content is reached.