CodeQL documentation

CodeQL for PythonΒΆ

Experiment and learn how to write effective and efficient queries for CodeQL databases generated from Python codebases.

  • Basic query for Python code: Learn to write and run a simple CodeQL query using LGTM.
  • CodeQL library for Python: When you need to analyze a Python program, you can make use of the large collection of classes in the CodeQL library for Python.
  • Analyzing data flow in Python: You can use CodeQL to track the flow of data through a Python program to places where the data is used.
  • Using API graphs in Python: API graphs are a uniform interface for referring to functions, classes, and methods defined in external libraries.
  • Functions in Python: You can use syntactic classes from the standard CodeQL library to find Python functions and identify calls to them.
  • Expressions and statements in Python: You can use syntactic classes from the CodeQL library to explore how Python expressions and statements are used in a codebase.
  • Analyzing control flow in Python: You can write CodeQL queries to explore the control-flow graph of a Python program, for example, to discover unreachable code or mutually exclusive blocks of code.