1
0
mirror of synced 2025-12-21 10:57:10 -05:00

Fix for blank lines around code fences (#38255)

This commit is contained in:
Grace Park
2023-06-26 10:21:48 -07:00
committed by GitHub
parent a4913b5935
commit a8a6e4554a
272 changed files with 1552 additions and 2 deletions

View File

@@ -77,6 +77,7 @@ The following properties are supported in `qlpack.yml` files.
- Required by all packs.
- Defines the scope of the pack, where the {% data variables.product.prodname_codeql %} pack is published, and the name of the pack defined using alphanumeric characters and hyphens. It must be unique as {% data variables.product.prodname_codeql %} cannot differentiate between {% data variables.product.prodname_codeql %} packs with identical names. Use the pack name to specify queries to run using `database analyze` and to define dependencies between {% data variables.product.prodname_codeql %} packs (see examples below). For example:
```yaml
name: octo-org/security-queries
```
@@ -85,6 +86,7 @@ The following properties are supported in `qlpack.yml` files.
- Required by all packs that are published.
- Defines a semantic version for this {% data variables.product.prodname_codeql %} pack that must adhere to the [SemVer v2.0.0 specification](https://semver.org/spec/v2.0.0.html). For example:
```yaml
version: 0.0.0
```
@@ -93,6 +95,7 @@ The following properties are supported in `qlpack.yml` files.
- Required by packs that define {% data variables.product.prodname_codeql %} package dependencies on other packs.
- Defines a map from pack references to the semantic version range that is compatible with this pack. Supported for {% data variables.product.prodname_codeql_cli %} versions v2.6.0 and later. For example:
```yaml
dependencies:
codeql/cpp-all: ^0.0.2
@@ -102,6 +105,7 @@ The following properties are supported in `qlpack.yml` files.
- Required by packs that export a set of default queries to run.
- Defines the path to a query suite file relative to the package root, containing all of the queries that are run by default when this pack is passed to the `codeql database analyze` command. Supported from CLI version v2.6.0 and onwards. Only one of `defaultSuiteFile` or `defaultSuite` can be defined. For example:
```yaml
defaultSuiteFile: cpp-code-scanning.qls
```
@@ -110,6 +114,7 @@ The following properties are supported in `qlpack.yml` files.
- Required by packs that export a set of default queries to run.
- Defines an inlined query suite containing all of the queries that are run by default when this pack is passed to the `codeql database analyze` command. Supported from CLI version v2.6.0 and onwards. Only one of `defaultSuiteFile` or `defaultSuite` can be defined. For example:
```yaml
defaultSuite:
queries: .
@@ -121,6 +126,7 @@ The following properties are supported in `qlpack.yml` files.
- Required by library packs.
- Defines a boolean value that indicates whether or not this pack is a library pack. Library packs do not contain queries and are not compiled. Query packs can ignore this field or explicitly set it to `false`. For example:
```yaml
library: true
```
@@ -129,6 +135,7 @@ The following properties are supported in `qlpack.yml` files.
- Optional for packs that define query suites.
- Defines the path to a directory in the pack that contains the query suites you want to make known to the {% data variables.product.prodname_codeql_cli %}, defined relative to the pack directory. {% data variables.product.prodname_codeql %} pack users can run "well-known" suites stored in this directory by specifying the pack name, without providing their full path. This is not supported for {% data variables.product.prodname_codeql %} packs downloaded from the Container registry. For more information about query suites, see "[Creating {% data variables.product.prodname_codeql %} query suites](/code-security/codeql-cli/using-the-codeql-cli/creating-codeql-query-suites)." For example:
```yaml
suites: octo-org-query-suites
```
@@ -136,6 +143,7 @@ The following properties are supported in `qlpack.yml` files.
#### `tests`
- Optional for packs containing {% data variables.product.prodname_codeql %} tests. Ignored for packs without tests.
- Defines the path to a directory within the pack that contains tests, defined relative to the pack directory. Use `.` to specify the whole pack. Any queries in this directory are run as tests when `test run` is run with the `--strict-test-discovery` option. These queries are ignored by query suite definitions that use `queries` or `qlpack` instructions to ask for all queries in a particular pack. If this property is missing, then `.` is assumed. For example:
```yaml
tests: .
```
@@ -143,6 +151,7 @@ The following properties are supported in `qlpack.yml` files.
#### `extractor`
- Required by all packs containing {% data variables.product.prodname_codeql %} tests.
- Defines the {% data variables.product.prodname_codeql %} language extractor to use when running the {% data variables.product.prodname_codeql %} tests in the pack. For more information about testing queries, see "[Testing custom queries](/code-security/codeql-cli/using-the-codeql-cli/testing-custom-queries)." For example:
```yaml
extractor: javascript
```
@@ -150,6 +159,7 @@ The following properties are supported in `qlpack.yml` files.
#### `authors`
- Optional.
- Defines metadata that will be displayed on the packaging search page in the packages section of the account that the {% data variables.product.prodname_codeql %} pack is published to. For example:
```yaml
authors: author1@github.com,author2@github.com
```
@@ -157,6 +167,7 @@ The following properties are supported in `qlpack.yml` files.
#### `license`
- Optional.
- Defines metadata that will be displayed on the packaging search page in the packages section of the account that the {% data variables.product.prodname_codeql %} pack is published to. For a list of allowed licenses, see [SPDX License List](https://spdx.org/licenses/) in the SPDX Specification. For example:
```yaml
license: MIT
```
@@ -164,6 +175,7 @@ The following properties are supported in `qlpack.yml` files.
#### `description`
- Optional.
- Defines metadata that will be displayed on the packaging search page in the packages section of the account that the {% data variables.product.prodname_codeql %} pack is published to. For example:
```yaml
description: Human-readable description of the contents of the {% data variables.product.prodname_codeql %} pack.
```
@@ -171,6 +183,7 @@ The following properties are supported in `qlpack.yml` files.
#### `libraryPathDependencies`
- Optional, deprecated. Use the `dependencies` property instead.
- Previously used to define the names of any {% data variables.product.prodname_codeql %} packs that this {% data variables.product.prodname_codeql %} pack depends on, as an array. This gives the pack access to any libraries, database schema, and query suites defined in the dependency. For example:
```yaml
libraryPathDependencies: codeql/javascript-all
```
@@ -178,12 +191,15 @@ The following properties are supported in `qlpack.yml` files.
#### `dbscheme`
- Required by core language packs only.
- Defines the path to the [database schema](https://codeql.github.com/docs/codeql-overview/codeql-glossary/#codeql-database-schema) for all libraries and queries written for this {% data variables.product.prodname_codeql %} language (see example below). For example:
```yaml
dbscheme: semmlecode.python.dbscheme
```
#### `upgrades`
- Required by core language packs only.
- Defines the path to a directory within the pack that contains database upgrade scripts, defined relative to the pack directory. Database upgrades are used internally to ensure that a database created with a different version of the {% data variables.product.prodname_codeql_cli %} is compatible with the current version of the CLI. For example:
```yaml
upgrades: .
```
@@ -191,6 +207,7 @@ The following properties are supported in `qlpack.yml` files.
#### `warnOnImplicitThis`
- Optional. Defaults to `false` if the `warnOnImplicitThis` property is not defined.
- Defines a boolean that specifies whether or not the compiler should emit warnings about member predicate calls with implicit `this` call receivers, that is, without an explicit receiver. Supported from {% data variables.product.prodname_codeql_cli %} version 2.13.2 and onwards. For example:
```yaml
warnOnImplicitThis: true
```

View File

@@ -240,6 +240,7 @@ The following examples are designed to give you an idea of some of the build com
```
codeql database create -l swift -c "./scripts/build.sh" swift-database
```
{% endif %}
- Project built using Bazel:

View File

@@ -51,6 +51,7 @@ files:
```
- query: <path-to-query>
```
The argument must be one or more file paths, relative to the {% data variables.product.prodname_codeql %} pack containing
the suite definition.

View File

@@ -79,6 +79,7 @@ To analyze a {% data variables.product.prodname_codeql %} database with a {% dat
```
codeql database analyze <database> <scope>/<pack>@x.x.x:<path>
```
- `<database>`: the {% data variables.product.prodname_codeql %} database to be analyzed.
- `<scope>`: the name of the {% data variables.product.prodname_dotcom %} organization that the pack is published to.
- `<pack>`: the name for the pack that you are using.
@@ -110,14 +111,18 @@ It can also be assumed that a pack published by the _latest_ public release of {
As an exception to the above, packs published with versions of {% data variables.product.prodname_codeql %} _earlier than 2.12.0_ are not compatible with any earlier or later versions. These old versions did not write pre-compiled queries in a format that supported compatibility between releases. Packs published by these versions can still be _used_ by newer versions, but the analysis will be slower because the queries have to be recompiled first.
As a user of a published query pack, you can check that the {% data variables.product.prodname_codeql %} makes use of the precompiled queries in it by inspecting the terminal output from an analysis runs that uses the query pack. If it contains lines looking like the following, then the precompiled queries were used successfully:
```
[42/108] Loaded /long/path/to/query/Filename.qlx.
```
However, if they instead look like the following, then usage of the precompiled queries failed:
```
Compiling query plan for /long/path/to/query/Filename.ql.
[42/108 comp 25s] Compiled /long/path/to/query/Filename.ql.
```
The results of the analysis will still be good in this case, but to get optimal performance you may need to upgrade to a newer version of the {% data variables.product.prodname_codeql %} CLI and/or of the query pack.
If you publish query packs on the {% data variables.product.prodname_container_registry %} on {% data variables.product.prodname_dotcom_the_website %} for others to use, we recommend that you use a recent release of {% data variables.product.prodname_codeql %} to run `codeql pack publish`, and that you publish a fresh version of your pack with an updated {% data variables.product.prodname_codeql %} version before the version you used turns 6 months old. That way you can ensure that users of your pack who keep _their_ {% data variables.product.prodname_codeql %} up to date will benefit from the pre-compiled queries in your pack.

View File

@@ -158,6 +158,7 @@ which is declared as a dependency for `my-query-tests`. Therefore, `EmptyThen.ql
8. Create a code snippet to test. The following Java code contains an empty `if` statement on the third line. Save it in `custom-queries/java/tests/EmptyThen/Test.java`.
```java
class Test {
public void problem(String arg) {
if (arg.isEmpty())
@@ -173,6 +174,7 @@ class Test {
}
}
}
```
### Execute the test
@@ -211,7 +213,9 @@ query.
In this case, the failure was expected and is easy to fix. If you open the `EmptyThen.actual` file, you can see the results of the test:
```
| Test.java:3:5:3:22 | stmt | This if statement has an empty then. |
```
This file contains a table, with a column for the location of the result,