Skip to content

CLI Overview

The dbLinter Command Line Interface (CLI) can start a language server and run checks and SQL-based tests, producing various output formats.

The CLI is included in the VS Code Extension, but it can also be used standalone, for example within a CI/CD pipeline.

Releases of the dbLinter CLI are published in the Releases section of the dbLinter GitHub repository.

  1. Download dblinter-x.y.z.zip from https://github.com/Grisselbav/dbLinter/releases.

  2. Extract the contents of the ZIP file to a folder of your choice. This will create a folder with the same name as the ZIP file. This folder will contain the following files:

    FileDescription
    dblinterExecutable shell script for macOS, Linux
    dblinter.cmdExecutable Windows batch file
    dblinter-cli.jarExecutable JAR file, requiring JDK 17 or newer
    LICENSE.mddbLinter License document
    THIRD-PARTY.txtList of all third party components and their licenses
    THIRD-PARTY-TREE.txtList of all direct and transitive dependencies and their versions
  3. Add the folder containing the dbLinter executable files to your operating system’s path.

  4. Optionally set the JAVA_HOME environment variable before calling dblinter to control the Java version to use.

  5. Optionally set the JAVA_OPTS environment variable before calling dblinter to control the JVM options to use.

Usage: dblinter [<options>] <command> [<args>]
Options:
--workspace=<dir> Working directory for the command.
--repoUrl=<url> Repository URL.
--tenantName=<tenant> Tenant for authentication.
--userName=<e-mail> E-mail address for authentication.
--accessToken=<token> Access token for authentication.
--configName=<config> Configuration for checks and SQL-based tests.
--connJdbcUrl=<jdbcUrl> JDBC URL for read-only database access.
--connUserName=<user> JDBC user for read-only database access.
--connPassword=<password> JDBC password for read-only database access.
--logLevel=<level> Log level (off, error, warning, info, debug, trace).
--logFile=<logFile> Name of the log file.
--logFormat=<format> Log format (short, ext1, ext2, ext3).
--clearCacheThreshold=<mb> ANTLR memory threshold in megabytes.
--pretty=<boolean> Pretty print JSON output (true, false).
--indent=<spaces> Number of spaces for pretty printing.
--options=<properties> Load options from file.
Commands:
ls Start language server.
check [<args>] Run static code analysis in current directory.
--outputFormats=<formats> Comma-separated list of output formats (vscode,
sonarqube, sarif, checkstyle, github, gitlab).
--outputName=<name> Base name of the output files.
--parallel=<n> Number of files analysed in parallel.
<paths...> Files and directories to analyse.
test [<args>] Run SQL-based tests.
--outputFormats=<formats> Comma-separated list of output formats (vscode,
junit).
--outputName=<name> Base name of the output files without file extension.
--parallel=<n> Number of SQL-based tests executed in parallel.
gen-java [<args>] Generate custom validator Java project using Maven.
--outputName=<name> Root directory name for the Maven project.
--tenantFilter=<regEx> Regular expression to filter tenant names.
--ruleFilter=<regEx> Regular expression to filter rule names.
--groupId=<name> Group ID for the project (e.g. com.company)
--packageName=<name> Root package name for the project (e.g. com.company.dblinter)
gen-utplsql [<args>] Generate utPLSQL PL/SQL package for SQL-based tests.
--outputName=<name> Base name of the output file(s).
--specExt=<ext> File extension for the package specification (.sql, .pks)
--bodyExt=<ext> File extension for the package body (.sql, .pkb)
--packageName=<name> Name of the PL/SQL package.
--suitePath=<path> Name of the utPLSQL suite-path.
export-tenants [<args>] Export tenants to a JSON file.
--outputName=<name> Name of the output file.
--tenantFilter=<regEx> Regular expression to filter tenant names.
--planFilter=<regEx> Regular expression to filter plan names (Free,
Essential, Professional)
import-tenants [<args>] Import tenants from a JSON file.
--inputName=<name> Name of the input file.
--tenantFilter=<regEx> Regular expression to filter tenant names.
version Show version information.
help Show help message.

You can save options and command arguments in a property file.

dblinter.properties
# Remote access to the dbLinter repository to read the configuration
tenantName=Demo
userName=philipp.salvisberg+42@gmail.com
accessToken=***
configName=Demo
# Read-only access to database within checks and tests
connJdbcUrl=jdbc:oracle:thin:@localhost:1521/freepdb1
connUserName=dbl_read
connPassword=***
Terminal window
dblinter --options=dblinter.properties check

The check and test CLI commands are demonstrated in the dbLinter-Demo GitHub repository.