[English en-us] [Русский ru-ru]
A command-line utility for code linting with plugins support.
For example, IVNSTN/TeamTools.Linter.TSQL for static analysis of T‑SQL code. The list of plugins must be specified in the configuration file.
.\TeamTools.Linter.CommandLine.exe --dir "c:\source\my_project" --evaluateEvaluate-mode raises minimal severity to warning and forces EvaluateConfig.json to be used.
Use this mode to find significant violations in a project which has never been analyzed by this linter before
to test if the linter suffices your needs. Rules related to formatting standard, naming convention and such
are disabled in this mode.
.\TeamTools.Linter.CommandLine.exe --dir "c:\source\my_project" --diffThe diff is calculated via Git against the main branch; only modified files are scanned. The main branch name can be specified in the configuration file.
.\TeamTools.Linter.CommandLine.exe --file "c:\source\my_project\Stored procedures\dbo.my_proc.sql".\TeamTools.Linter.CommandLine.exe --dir "c:\source\my_project" --severity warningThe utility can be used directly via the terminal or integrated into various tools.
Lint the file open in the current SSMS tab using a custom menu item. To create a new menu item:
- Go to Tools → External Tools
- Add a new item and configure as follows:
Command = <path to exe>\TeamTools.Linter.CommandLine.exe
Arguments = --file $(ItemPath) --with-version
Initial directory = (leave empty)
Use output window = check this box- In Arguments, use the above line.
- In Initial directory, enter the path to the linter executable directory (same as Command, but without the
.exefilename). - Check Use output window; leave other options unchecked.
Now you can lint the open file: right‑click the tab header and select your custom External Tools menu item.
Configuration for linting a specific file is similar to SSMS. Below is an example for finding stoppers in the entire diff against the main branch in the current repository:
Command = <path to exe>\TeamTools.Linter.CommandLine.exe
Arguments = --diff --severity warning --with-version
Initial directory = $(SolutionDir)
Use output window = check this box- Open Tools → Options in SourceTree.
- Select the Custom actions tab and add a new item.
- Enter the full path to the linter executable in Script to run.
- Enter the following in Parameter:
--file "$REPO\$FILE" --severity warning --verboseNow you can lint a selected file directly from the SourceTree interface.
Automatically lint changed files before pushing or committing. Add a script call to the appropriate Git event. Example script below (accepts one parameter: the full path to the folder containing TeamTools.Linter.CommandLine.exe).
To match CI pipeline behavior, use --severity to limit findings.
#!/bin/bash
linter_folder="$1"
echo "linter: $linter_folder"
repo_path="$(git rev-parse --show-toplevel)"
echo "repository: $repo_path"
"$linter_folder/TeamTools.Linter.CommandLine.exe" \
--config "$linter_folder/DefaultConfig.json" \
--dir "$repo_path" \
--basepath "$repo_path" \
--output console \
--severity warning \
--diff \
--withversion
last_exit_code=$?
if [ $last_exit_code -ne 0 ]; then
echo "======="
echo "Linting failed. See errors and warnings above."
echo "All stoppers must be fixed before pushing the branch to the server."
echo "======="
exit $last_exit_code
fiIntegrate into your build pipeline by constructing a console call with required parameters and adding it as a pipeline step.
To prevent findings from failing the build (e.g., if using SonarQube Quality Gate), add --quiet to ensure the exit code is always 0.
