codeql

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Resolves the latest CodeQL release versions from GitHub's redirect headers, avoiding the rate-limited JSON API.

Index

Constants

View Source
const (
	FallbackCLIVersion    = "2.25.1"
	FallbackBundleVersion = "codeql-bundle-v2.25.1"
)

Variables

This section is empty.

Functions

func Download

func Download(version, platform string) (p string, err error)

func Install

func Install(base, platform string) error

Install downloads and installs the CodeQL CLI or bundle based on config. When EnableCustomCodeQLBundles is true in config, the bundle is installed; otherwise the standalone CLI is used. version overrides the config value for CLI installs.

func LatestBundleVersion

func LatestBundleVersion() string

LatestBundleVersion returns the latest bundle tag (e.g. "codeql-bundle-v2.25.1"). Falls back to FallbackBundleVersion on any error.

func LatestCLIVersion

func LatestCLIVersion() string

LatestCLIVersion returns the latest CodeQL CLI version string (e.g. "2.25.1"). Falls back to FallbackCLIVersion on any error.

Types

type CLI

type CLI struct {
	// contains filtered or unexported fields
}

CLI is a typed wrapper around the codeql binary. It owns an executil.Runner and exposes one method per codeql subcommand that qlt invokes.

func NewCLI

func NewCLI(binary string) *CLI

func (*CLI) Binary

func (c *CLI) Binary() string

func (*CLI) DatabaseAnalyze

func (c *CLI) DatabaseAnalyze(opts DatabaseAnalyzeOptions) (*executil.Result, error)

DatabaseAnalyze runs `codeql database analyze --format=... --output=... --threads=N --rerun [--additional-packs=...] <db> <query>`.

func (*CLI) PackBundle

func (c *CLI) PackBundle(dir, output, commonCaches string) (*executil.Result, error)

PackBundle runs `codeql pack bundle --format=json --output=<output> [--common-caches=<caches>] <dir>`.

func (*CLI) PackCreate

func (c *CLI) PackCreate(dir, output, commonCaches string) (*executil.Result, error)

PackCreate runs `codeql pack create --format=json --output=<output> [--common-caches=<caches>] <dir>`.

func (*CLI) PackInstall

func (c *CLI) PackInstall(target, commonCaches string) (*executil.Result, error)

PackInstall runs `codeql pack install [--format=json --common-caches=<caches>] <target>`. When commonCaches is "" the plain form is emitted; otherwise the cached form used by bundle assembly is emitted.

func (*CLI) PackLs

func (c *CLI) PackLs(dir string) (*executil.Result, error)

PackLs runs `codeql pack ls --format=json <dir>`.

func (*CLI) PackPublish

func (c *CLI) PackPublish(dir string) (*executil.Result, error)

PackPublish runs `codeql pack publish <dir>`.

func (*CLI) QueryCompile

func (c *CLI) QueryCompile(threads int, files []string) (*executil.Result, error)

QueryCompile runs `codeql query compile [--threads=N] -- <files>`.

func (*CLI) ResolveLanguages

func (c *CLI) ResolveLanguages() (*executil.Result, error)

ResolveLanguages runs `codeql resolve languages --format=json`.

func (*CLI) ResolveTests

func (c *CLI) ResolveTests(dir string) (*executil.Result, error)

ResolveTests runs `codeql resolve tests --strict-test-discovery --format json <dir>`.

func (*CLI) Run

func (c *CLI) Run(args ...string) (*executil.Result, error)

Run is an escape hatch for codeql invocations not yet modelled here.

func (*CLI) TestRun

func (c *CLI) TestRun(threads int, extraArgs, testFile string) (*executil.Result, error)

TestRun runs `codeql test run --threads N --format betterjson --quiet [extraArgs] <testFile>`.

type DatabaseAnalyzeOptions

type DatabaseAnalyzeOptions struct {
	Database        string
	QueryFile       string
	Format          string
	Output          string
	Threads         int
	AdditionalPacks string
}

DatabaseAnalyzeOptions collects the flags used by RunQuery.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL