•  


Query reference files - GitHub Docs
Skip to main content

Query reference files

You can use query reference files to define the location of a query you want to run in tests.

Who can use this feature?

GitHub CodeQL is licensed on a per-user basis upon installation. You can use CodeQL only for certain tasks under the license restrictions. For more information, see " About the CodeQL CLI ."

If you have a GitHub Advanced Security license, you can use CodeQL for automated analysis, continuous integration, and continuous delivery. For more information, see " About GitHub Advanced Security ."

About query reference files

A query reference file is text file that defines the location of one query to test.

You use a query reference file when you want to tell the test run subcommand to run a query that’s not part of a test directory. There are two ways to specify queries that you want to run as tests:

  1. Use a query reference file to specify the location of a query to test. This is useful when you create tests for alert and path queries that are intended to identify problems in real codebases. You might create several directories of test code, each focusing on different aspects of the query. Then you would add a query reference file to each directory of test code, to specify the query to test.
  2. Add the query directly to a directory of tests. These is typically useful when you’re writing queries explicitly to test the behavior of QL libraries. Often these queries contain just a few calls to library predicates, wrapping them in a select statement so their output can be tested.

Defining a query reference file

Each query reference file, .qlref , contains a single line that defines where to find one query. The location must be defined relative to the root of the CodeQL pack that contains the query. Usually, this is either the CodeQL pack that contains the .qlref , a CodeQL pack specified in the dependencies block for the test pack, or a transitive dependency of the CodeQL pack.

You should use forward slashes in the path on all operating systems to ensure compatibility between systems.

Example

A query reference file to test a JavaScript alert query: DeadAngularJSEventListener.qlref

The qlpack.yml file, https://github.com/github/codeql/blob/main/javascript/ql/test/qlpack.yml , for the CodeQL pack at javascript/ql/test defines codeql/javascript-queries as a dependency. So the query reference file defines the location of the query relative to the codeql/javascript-queries CodeQL pack:

AngularJS/DeadAngularJSEventListener.ql

For another example, see " Testing custom queries ."

- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본