Command Line Tool – AnalyzeFiles

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

This topic contains the following sections:

Usage
 1Enlight analyzeFiles 
 2      --inputPath=<paths>
 3    [ --includeRules=<rules> ]
 4    [ --excludeRules=<rules> ]
 5    [ --reportOutput=<reportPath>]
 6    [ --reportStylesheet=<stylesheetpath>]
 7    [ --contextFile=<contextfilePath>]
 8    [ --connectionString=<connectionString> ] | [ --server=<servername> --database=<databasename> [ --user=<username>  --password=<password> ] ]
 9    [ --templateFile=<analysisTemplateFile>]
10    [ --maxAge=<maxAge>]
11    [ --settings=<settingsFile>]
12    [ --properties=propertyName=value;propertyName;value]
13    [ --includeFilesPattern=<regular expression pattern>]
14    [ --excludeFilesPattern=<regular expression pattern>]
15    [ --whitelistFile=<whitelist file>]
16    [ --exitCodeOnViolations= <exitCode>]

Parameters

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.

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 | [d.]hh: mm[:ss]”.

settings

A settings file which to override the current user’s settings XML file.

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.

Examples

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

1Enlight analyzeFiles 
2        --contextFile=E:ProjectsMyProjectBuildContextAdventureWorks.xml 
3        --includeRules=design,performance,sa001,sa030,sa033 
4        --inputPath="E:ProjectsMyProjectSQL Script***.sql" 
5        --reportOutput="F:analysis reportsmy-project-analysis-report1.html"
6        --reportStylesheet="C:Program FilesYubitsoftSQL EnlightXsltSqlEnlightReport.xslt" 
7        --templateFile="c:sql enlightmy-custom-analysis-template.xml"

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

1Enlight analyzeFiles 
2        --contextFile=E:ProjectsMyProjectBuildContextAdventureWorks.xml
3        --includeRules=design,performance,sa001,sa030,sa033
4        --inputPath="E:ProjectsMyProjectSQL Script*.sql;-E:ProjectsMyProjectSQL ScriptB*.sql"
5        --reportOutput="F:analysis reportsmy-project-analysis-report1.html"
6        --reportStylesheet="C:Program FilesYubitsoftSQL EnlightXsltSqlEnlightReport.xslt"
7        --templateFile="c:sql enlightmy-custom-analysis-template.xml"

Analyze all `*.sql` with a context loaded using a database connection.

1Enlight analyzeFiles
2        --database=sqldb01
3        --includeRules=performance,sa001,sa030,sa033
4        --inputPath="E:ProjectsMyProjectSQL Script***.sql"
5        --reportOutput="f:analysis reportsmy-project-analysis-report1.html"
6        --reportStylesheet="C:Program FilesYubitsoftSQL EnlightXsltSqlEnlightReport.xslt"
7        --server=sqlsrvtesttest1

See Also

Other Resources