We welcome contributions to our CodeQL libraries and queries. Got an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request! Contributions to this project are released to the public under the project's open source license.
There is lots of useful documentation to help you write queries, ranging from information about query file structure to tutorials for specific target languages. For more information on the documentation available, see CodeQL queries on codeql.github.com.
Note that the CodeQL for Visual Studio Code documentation has been migrated to https://docs.github.com/en/code-security/codeql-for-vs-code/, but you can still contribute to it via a different repository. For more information, see Contributing to GitHub Docs documentation."
Any nontrivial user-visible change to a query pack or library pack should have a change note. For details on how to add a change note for your change, see this guide.
If you have an idea for a query that you would like to share with other CodeQL users, please open a pull request to add it to this repository. New queries start out in a <language>/ql/src/experimental directory, to which they can be merged when they meet the following requirements.
Directory structure
There are eight language-specific query directories in this repository:
Each language-specific directory contains further subdirectories that group queries based on their @tags or purpose.
Query metadata
For details, see the guide on query metadata.
Make sure the select statement is compatible with the query @kind. See About CodeQL queries on codeql.github.com.
Formatting
If you prefer, you can either:
See the pre-commit hook installation guide for instructions on the two approaches.
Compilation
Results
Query help files and unit tests
Experimental queries and libraries may not be actively maintained as the supported libraries evolve. They may also be changed in backwards-incompatible ways or may be removed entirely in the future without deprecation warnings.
After the experimental query is merged, we welcome pull requests to improve it. Before a query can be moved out of the experimental subdirectory, it must satisfy the requirements for being a supported query.
If you contribute to this project, we will record your name and email address (as provided by you with your contributions) as part of the code repositories, which are public. We might also use this information to contact you in relation to your contributions, as well as in the normal course of software development. We also store records of CLA agreements signed in the past, but no longer require contributors to sign a CLA. Under GDPR legislation, we do this on the basis of our legitimate interest in creating the CodeQL product.
Please do get in touch (privacy@github.com) if you have any questions about this or our data protection policies.
Please notice that any bazel targets and definitions in this repository are currently experimental and for internal use only.