Skip to content

Command Line Tool - AnalyzeFiles

The command runs analysis of the T-SQL script files and generates report.

Enlight analyzeFiles
--inputPath=<paths>
[ --includeRules=<rules> ]
[ --excludeRules=<rules> ]
[ --reportOutput=<reportPath>]
[ --reportStylesheet=<stylesheetpath>]
[ --contextFile=<contextfilePath>]
[ --connectionString=<connectionString> ] | [ --server=<servername> --database=<databasename> [ --user=<username> --password=<password> ] ]
[ --templateFile=<analysisTemplateFile>]
[ --maxAge=<maxAge>]
[ --settings=<settingsFile>]
[ --properties=propertyName=value;propertyName;value]
[ --includeFilesPattern=<regular expression pattern>]
[ --excludeFilesPattern=<regular expression pattern>]
[ --whitelistFile=<whitelist file>]
[ --qualityGate=<qualityGatePath>]
[ --failOn=QualityGateFail|QualityGateFailOrWarn|AnyIssue]
[ --exitCodeOnViolations= <exitCode>]
Parameters Description
inputPath Required. Source directory or a response file containing a line per source file.
includeFilesPattern Pattern matching files, which to be processed by the task.
excludeFilesPattern Pattern matching files, which to be excluded from the analysis.
nologo Do not show header and copyright info.
verbosity Output verbosity level. Valid values: Normal, Quiet, Detail
connectionString SQL connection string to the target context database.
username Username for accessing the database.
password SQL connection string.
database Target database name.
server Target SQL Server name and instance name.
contextFile Optional analysis context file.
reportOutput Output file for the generated report.
reportStylesheet Xml Stylesheet, which to be used for styling the report. Can be path to XSLT stylesheet, or one of the known stylesheet names: HTML, JSON, JUNIT, CSV or VSTESTS
templateFile Analysis template with rules file, which to be used instead of the standard set of rules.
properties Custom properties, which to be provided to the generated report.
includeRules A comma separated list of rules, which to be enabled during the analysis.
excludeRules A comma separated list of rules, which to be disabled during the analysis.
whitelistFile Optional whitelist file containing entries of objects that to be removed form the analysis results.
maxAge MAXimum file or database object AGE - exclude objects older than given date or time interval. When date is provided, can be any valid culture specific date time string(e.g. “2 / 16 / 2015 12:15:12 PM”).If age is provided in time interval, the valid format is “d” or “[d.]hh: mm[:ss]”.
settings A settings file which to override the current user’s settings XML file.
qualityGate Optional path to quality gate definition JSON or XML.
failOn (Default: AnyIssue) Optional flag to exit with error code when the Quality Gate fails. Valid values: QualityGateFail, QualityGateFailOrWarn, AnyIssue

Build Machines edition specific parameters:

Parameters Description
licenseData Required. License data or activation response file path.
exitCodeOnViolations The argument can be used to return custom exit code in case when there are analysis rule violations. The exit code can be used in CI to fail or flag the build as unstable.
reportPerTarget Create own report file for each analyzed file or SQL module.
demoMode Run analysis in a demo mode with limited results.

Analyze target T-SQL script files using specific analysis rules and create HTML report using provided stylesheet.

Enlight analyzeFiles
--contextFile=E:\Projects\MyProject\Build\Context\AdventureWorks.xml
--includeRules=design,performance,sa001,sa030,sa033
--inputPath="E:\Projects\MyProject\SQL Script\**\*.sql"
--reportOutput="F:\analysis reports\my-project-analysis-report1.html"
--reportStylesheet="C:Program Files\Yubitsoft\SQL Enlight\Xslt\SqlEnlightReport.xslt"
--templateFile="c:\sql enlight\my-custom-analysis-template.xml"

Analyze all *.sql files except the B*.sql files and create HTML report.

Enlight analyzeFiles
--contextFile=E:\Projects\MyProject\Build\Context\AdventureWorks.xml
--includeRules=design,performance,sa001,sa030,sa033
--inputPath="E:\Projects\MyProject\SQL Script\*.sql;-E:\Projects\MyProject\SQL Script\B*.sql"
--reportOutput="F:\analysis reports\my-project-analysis-report1.html"
--reportStylesheet=HTML
--templateFile="c:\sql enlight\my-custom-analysis-template.xml"

Analyze all *.sql with a context loaded using a database connection and generate standalone HTML report.

Enlight analyzeFiles
--database=sqldb01
--includeRules=performance,sa001,sa030,sa033
--inputPath="E:\Projects\MyProject\SQL Script\**\*.sql"
--reportOutput="f:\analysis reports\my-project-analysis-report1.html"
--server=sqlsrvtest\test1

Command Line Interface