Skip to main content

T-SQL (Beta)

This article shows you how to analyze Transact-SQL (T-SQL) using Qwiet AI by Harness. It assumes that you have already set up and authenticated with Qwiet.

Requirements​

See Prerequisites for more information.

Analyzing your T-SQL code​

To analyze T-SQL scripts, run:

sl analyze --app <name> --tsql [<path>]
ParameterDescription
--app <name>The name of the application to be analyzed (maximum length: 100 characters)
--tsqlThe flag identifying the code as T-SQL
<path>The path to the directory containing your T-SQL source files (defaults to the current directory if omitted)

The path must be a directory. Qwiet AI by Harness scans T-SQL source files (for example, .sql) under that directory.

You must pass --tsql explicitly. T-SQL is not selected automatically during language detection.

See the CLI reference for additional sl analyze options.

T-SQL Rules scanner​

Qwiet AI by Harness uses the T-SQL Rules scanner (tsql-rules) to check your scripts and report findings. The scanner is downloaded automatically the first time you run an analysis. To check for updates manually, run:

sl update tsql-rules

You can point to a local copy of the scanner with --tsql-rules-binary or the SHIFTLEFT_TSQL_RULES_BINARY environment variable if your environment cannot download it automatically.

Qwiet AI by Harness uploads matching source files so that autofix can be generated for supported findings.

Sample usage​

sl analyze --app shiftleft-tsql-example --tsql .

Tagging results with your branch name​

To include the branch name in your Qwiet AI by Harness results, allowing you to distinguish one set of results from another, add the following to your invocation of Qwiet:

sl analyze --app shiftleft-tsql-example --tsql --tag branch=`git symbolic-ref --short HEAD` .

If you're working in a GitHub environment (e.g., GitHub Actions), you can also use --tag branch=${{ github.head_ref }} to populate your branch name.

If you don't provide a branch name, but Qwiet detects one available in your environment, it will use that name.

Troubleshooting​

If you have any issues scanning your project, please see our general troubleshooting page.