Skip to content

tsqllint

tsqllint documentation

tsqllint - GitHub

Configuration in Mega-Linter

Variable Description Default value
SQL_TSQLLINT_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
SQL_TSQLLINT_FILTER_REGEX_INCLUDE Custom regex including filter
Ex: (src\|lib)
Include every file
SQL_TSQLLINT_FILTER_REGEX_EXCLUDE Custom regex excluding filter
Ex: (test\|examples)
Exclude no file
SQL_TSQLLINT_CLI_LINT_MODE Override default CLI lint mode
- file: Calls the linter for each file
- list_of_files: Call the linter with the list of files as argument
- project: Call the linter from the root of the project
{linter.cli_lint_mode}
SQL_TSQLLINT_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
[".sql"]
SQL_TSQLLINT_FILE_NAMES_REGEX File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files
Ex: ["Dockerfile(-.+)?", "Jenkinsfile"]
Include every file
SQL_TSQLLINT_PRE_COMMANDS List of bash commands to run before the linter None
SQL_TSQLLINT_POST_COMMANDS List of bash commands to run after the linter None
SQL_TSQLLINT_CONFIG_FILE tsqllint configuration file name
Use LINTER_DEFAULT to let the linter find it
.tsqllintrc
SQL_TSQLLINT_RULES_PATH Path where to find linter configuration file Workspace folder, then Mega-Linter default rules
SQL_TSQLLINT_DISABLE_ERRORS Run linter but consider errors as warnings false
SQL_TSQLLINT_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0

IDE Integration

Use tsqllint in your favorite IDE to catch errors before Mega-Linter !

IDE Extension Name Install
Visual Studio Code TSQL Lint Install in VsCode

Mega-Linter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default Mega-Linter Flavor 94 Docker Image Size (tag) Docker Pulls
dotnet Optimized for C, C++, C# or VB based projects 47 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .sql

How the linting is performed

  • tsqllint is called once with the list of files as arguments

Example calls

tsqllint myfile.sql
tsqllint myfile.sql myfile2.sql

Help content


tsqllint [options] [file.sql] | [dir] | [file.sql | dir]

  -c, --config          Used to specify a .tsqllintrc file path other than the
                        default
  -f, --force           Used to force generation of default config file when
                        one already exists
  -i, --init            Generate default .tsqllintrc config file
  -p, --print-config    Print path to config file
  -l, --list-plugins    List the loaded plugins
  -v, --version         Display tsqllint version
  -h, --help            Display this help dialog

Installation on mega-linter Docker image

  • Dockerfile commands :
RUN dotnet tool install --global TSQLLint