CodeQL Databases¶
This is the CodeQL databases API which allows you to load, run, and a number of other things on CodeQL databases.
CodeQL Database¶
- class ghastoolkit.CodeQLDatabase(name: str, language: str, repository: Repository | None = None, path: str | None = None, path_download: str | None = None, loc_baseline: int = 0, created: datetime | None = None)¶
CodeQL Database Abstraction to make our lives easier
- check() bool ¶
Check if the current database path is a real CodeQL DB
- createDownloadPath(root: str | None = None) str ¶
Find a path where
- createPath() str | None ¶
Create a path for CodeQL Database
- created: datetime | None = None¶
Created datetime infomation
- property database_folder: str¶
Get CodeQL Database folder
- property default_pack: str¶
Gets the default query pack for language
- display_name(owner: str | None = None) str ¶
Get the display name
- downloadDatabase(output: str | None = None, use_cache: bool = True) str ¶
Download CodeQL Database.
- exists() bool ¶
Checks if the CodeQL Database exists
- getSuite(name: str) str ¶
Gets suite based on default pack
- language: str¶
CodeQL Langauge
- loadDatabaseYml(path: str)¶
Load content from YML file.
- static loadFromYml(path: str) CodeQLDatabase ¶
Load from YAML / YML file.
Example: >>> db = CodeQLDatabase.loadFromYml(“codeql-db”)
- loc_baseline: int = 0¶
Lines of Code baseline in DB
- name: str¶
Name
- path: str | None = None¶
Path to the CodeQL Database
- path_download: str | None = None¶
Path to download CodeQL DB if not path is set
- repository: Repository | None = None¶
GitHub Repository (optional)
- property root: str¶
Get the standard root location.
CodeQL Databases¶
- class ghastoolkit.CodeQLDatabases(iterable=(), /)¶
List of CodeQL Databases.
- downloadDatabases()¶
Download all databases from GitHub.
- findDatabases(path: str)¶
Find databases based on a path (recursive).
- get(name: str) CodeQLDatabase | None ¶
Get a database by name.
- getLanguages(language: str) CodeQLDatabases ¶
Get a list of databases by language.
- getRemoteDatabases(repository: Repository)¶
Find all remote databases and return a list of them.
- loadDefault()¶
Load Databases from standard locations.
- static loadLocalDatabase() CodeQLDatabases ¶
Load all Local Databases.
- static loadRemoteDatabases(repository: Repository) CodeQLDatabases ¶
Use API to find all the databases and return a list of them.