tsqllint
tsqllint documentation
- Version in MegaLinter: 1.15.3.0
- Visit Official Web Site
- See How to configure tsqllint rules
- See How to disable tsqllint rules in files
- See Index of problems detected by tsqllint
Configuration in MegaLinter
- Enable tsqllint by adding
SQL_TSQLLINT
in ENABLE_LINTERS variable - Disable tsqllint by adding
SQL_TSQLLINT
in DISABLE_LINTERS variable
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 |
list_of_files |
SQL_TSQLLINT_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".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_UNSECURED_ENV_VARIABLES | List of env variables explicitly not filtered before calling SQL_TSQLLINT and its pre/post commands | None |
SQL_TSQLLINT_CONFIG_FILE | tsqllint configuration file nameUse LINTER_DEFAULT to let the linter find it |
.tsqllintrc |
SQL_TSQLLINT_RULES_PATH | Path where to find linter configuration file | Workspace folder, then MegaLinter 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 |
SQL_TSQLLINT_CLI_EXECUTABLE | Override CLI executable | ['tsqllint'] |
IDE Integration
Use tsqllint in your favorite IDE to catch errors before MegaLinter !
IDE | Extension Name | Install | |
---|---|---|---|
Visual Studio Code | TSQL Lint |
MegaLinter Flavours
This linter is available in the following flavours
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default MegaLinter Flavor | 117 | ||
dotnet | Optimized for C, C++, C# or VB based projects | 63 | ||
dotnetweb | Optimized for C, C++, C# or VB based projects with JS/TS | 72 |
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 (
list_of_files
CLI lint mode)
Example calls
tsqllint myfile.sql
tsqllint myfile.sql myfile2.sql
Help content
running tsqllint
tsqllint [options] [file.sql] | [dir] | [file.sql | dir]
-c, --config Used to specify a .tsqllintrc file path other than the
default
-g, --ignorelist Used to specify a .tsqllintignore file path other than
the default
-f, --force Used to force generation of default config file when
one already exists
-x, --fix Used to fix some of the common linting errors if
possible
-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 wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
RUN dotnet tool install --global TSQLLint