This section describes the additional configurations you can apply to the Multi-Language Pack. In this section:
When an analyzer extension sends results to DTP, you will be able to view violations from the DTP web application, as well as in your IDE (e.g., Eclipse, Visual Studio, etc.). DTP can also display the third-party documentation for individual rules, making it easier to understand the violations. Once the rule documentation is installed in DTP, it will be accessible in DTP and your IDE.
The rule documentation will be available in DTP's Violation Explorer, as well as when results are reviewed in a supported IDE.
The <DTP_HOME>/tomcat/webapps/grs/rulesdoc directory is removed when DTP is upgraded. Be sure to recopy the entire contents of the <ANALYZER_HOME>/ruledoc directory back to the <DTP_HOME>/tomcat/webapps/grs/ruledoc directory after upgrading DTP. |
You can customize the details and metadata associated with the code analysis rules. This enables you to implement a code analysis policy that meets your organization's specific needs. The configurations detailed in this section are typically performed by your Parasoft representative.
Parasoft DTP displays code analysis violations according to severity level, rule category, and other characteristics according to a rule map XML file. You can edit the rule map to change the default rule settings, as well determine how new rules that are not yet defined in the rule map are categorized and tagged in DTP.
The Parasoft Multi-Language Pack extensions ship with example rule map files for each language (e.g., swiftlint-rulesmap.xml) in the <INSTALL >/rules/builtin directory. Rules are specified using the following format:
<builtin> <category name="Analyzer_name"> <category name="Category_name"> <rule id="rule_id" severity="sev"/> |
You can modify this file to change mappings and add new rules:
name
property is required for category
tags.id
and severity
properties are required for the rule element. Each id
value must be unique within a given rule map file.id
in the same rule map file, even if the rules are under different categories or analyzers, are not allowed.<builtin>
element.As an example of how to add a new rule to the rule map, assume that the following results XML file contains a violation for a rule that has not yet been referenced in your rule map file:
<?xml version="1.0" encoding="utf-8"?> <checkstyle version="4.3"> <file name="/surveyproject/example.swift"> <error line="3" column="40" severity="warning" message="There should be no space before and one after any comma."source="swiftlint.rules.comma" /> |
The error element shows the following information:
Below is the rule map XML file excerpt that defines the custom "COMMA" rule referenced above.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <rules> <builtin> <category description=" SwiftLint" name="SWIFTLINT"> <category description=" Lint" name="LINT"> <rule header=" There should be no space before and one after any comma." id="COMMA"severity="2"/> |
The builtin
element is provided for your convenience. For custom rules, you can create any tag you like (i.e., custom
).
The category element specifies SWIFTLINT
as the primary category. The subcategory is defined in a child category element (name="LINT"
) category, which is a category used by SwiftLint.
The rule
tag is the child of the subcategory, which contains the following properties:
header
- describes the use of the ruleid
- matches the source attribute in the error tag of the results xmlseverity
– describes the criticality you want to assign to this violation.The error's severity is "warning"
, but Parasoft uses a scale of 1 (highest) to 5 (lowest) to indicate severity levels. You can change the severity level to any value within that range.
The full ID of this rule is SWIFTLINT. LINT.COMMA.
You can modify the settings.properties file located in the installation directory to configure additional settings. The settings file is a plain text configuration file containing general properties (DTP settings, reporting preferences, logging preferences, etc.), as well as settings specific to the particular extension that you're using.
General Extension OptionsEvery extension defines several core settings in <ANALYZER_HOME>/etc/default-settings.properties. If you want to change the default values for these options, we recommend overriding them in your settings file, rather than editing the default-settings.properties file. You can configure the following settings: rule.violation.limit.enabledSet this option to rule.violations.limitIf rule.violation.limit.enabled is set to scope.path.reject.wildcardSpecify a comma-separated list of file names, types, or extensions for which you don’t want to report violations. The following list is the default value for this property: Any values specified are appended to the default setting. The default setting cannot be completely overridden. scope.path.reject.regexpSpecify a regular expression that defines file names, types, or extensions for which you don’t want to report violations. There is no default setting. Example:
scope.path.accept.wildcardSpecify a comma-delimited list of wildcards that defines which files will be accepted by the scope filter. The default settings for each analyzer include the appropriate filter options by default. For instance, the following setting is configured in the etc/tslint-settings.properties file by default:
The following settings is configured in the etc/jshint-settings.properties file by default:
You can set this property in the localsettings.properties file to override the default settings for each analyzer. Example:
scope.path.accept.regexpSpecifies a regular expression that defines which files will be accepted by the scope filter. There is no default setting. Example:
dtp.autoconfigSet to Rules SettingsYou can configure the following settings related to code analysis rules. rules.provider_<analyzer>.dataSpecify the path to the code analysis rules used by the analyzer. The path will vary depending on the analyzer associated with the extension. OCLint example:
tslint example:
Scope and Authorship SettingsThese settings enable the system to correlate violations with information from source control. scope.localEnables/disables code authorship computation based on the local user and system files modification time. Default is scope.scontrolEnables/disables code authorship computation based on data from a supported source control system. Default is scope.xmlmapEnables/disables task assignment based on an XML mapping file. The mapping file defines how tasks should be assigned for particular files or sets of files. Default is scope.xmlmap.fileIf scope.xmlmap is enabled, the setting specifies the path to the XML mapping file. authors.ignore.caseEnables/disables author name case sensitivity. Default is authors.mappings.locationSpecifies where the authorship mapping file is stored. Default is See authors.user and authors.mapping options for details. If set to shared, you can define a path to the file in with the authors.shared.path setting. This enables you to specify a file location on DTP share. authors.shared.pathSpecifies the location of authors mapping file in DTP share. Example:
authors.user<n>Specifies an author by user name, email, and full name. Examples:
authors.mapping<n>Specifies a specific author mapping. Examples:
Report SettingsThe following settings define the information presented in reports and the metadata associated with analysis results. report.dtp.publishSet to report.dtp.publish.srcDetermines whether tested source code is published to DTP server. You can use the following values:
The default is dtp.share.enabledEnables/disables the connection to Team Server. The default is session.tagSpecifies a tag for the results from a code analysis/test session. The tag is a unique identifier for the specified analysis process made on a specified module. Reports for different sessions should be marked with different session tags. build.idSpecifies a build identifier used to label results. It may be unique for each build but may also label more than one test sessions that were executed during a specified build. The default settings is report.assoc.url.<tag>Generates links inside the HTML report that link associations. The URL is a query string containing an report.partialEnables/disables report generation when the full scope of the analysis is partially complete. The default settings is Setting to report.formatSpecifies the report format. Use a comma separated list of formats to generate multiple formats. Default is report.custom.extensionSpecifies the report file extension of the XSL file for a custom format. To configure this property, set report.format to report.custom.xsl.fileSpecifies the location of the XSL file for a custom format. To configure this property, set the report.format to custom and specify a file extension using the report.custom.extension property. report.locationSpecifies the directory where report should be created. report.developer_errorsDetermines whether manager reports include details about developer errors. The default is report.developer_reportsDetermines whether the system generates detailed reports for all developers (in addition to a summary report for managers). The default is report.authors_detailsDetermines whether the report includes an overview of the number and type of tasks assigned to each developer. The default is report.contexts_detailsDetermines whether the report includes an overview of the files that were checked or executed during testing. The default is report.associationsEnables/disables showing requirements, defects, tasks, and feature requests associated with a test in the report. The default is report.suppressed_msgsDetermines whether report includes suppressed messages. The default setting is report.metadataDetermines whether additional metadata about findings should be downloaded from DTP. Only findings that are already present on DTP are affected. The DTP server must also support the metadata service for this setting to have an effect. Default is report.active_rulesDetermines if report contains a list of the rules that were enabled for the test. The default setting is report.rulesSpecifies a directory for storing static analysis rules HTML files (retrieved by clicking the Printable Docs button in the Test Configuration's Static Analysis tab). Examples:
report.scontrolConfigures the level of additional information from source control that should be included in the report. The property accepts the following values:
Default is report.test_paramsDetermines whether report includes test parameter details. The default setting is report.graph.start_dateSpecifies start date for trend graphs that track static analysis task, test execution, and coverage. Use with report.graph.period. report.graph.periodDetermines the duration from the start date for trend graphs that track static analysis task, test execution, and coverage. Use with report.graph.start_date. report.mail.enabledEnables/disables report emails to developers and additional recipients specified with the report.mail.cc setting. If enabled, all developers that worked on project code will automatically be sent a report that contains the errors/results related to his or her work. The default setting is report.mail.serverSpecifies the mail server used to send reports. report.mail.subjectSpecifies the subject line of the emails sent. report.mail.usernamereport.mail.passwordreport.mail.realmSpecifies the settings for SMTP server authentication. The realm value is required only for those servers that authenticate using SASL realm. report.mail.domainSpecifies the mail domain used to send reports. report.mail.time_delaySpecifies a time delay between emailing reports (to avoid bulk email restrictions). report.mail.fromSpecifies the "from" line of the emails sent. report.mail.attachmentsEnables/disables sending reports as attachments. All components are included as attachments; before you can view a report with images, all attachments must be saved to the disk. report.mail.compactSpecifies how report information is delivered in the email. You can specify the following values.
This setting is not configured by default. report.mail.formatSpecifies content type for the email. The default setting is report.mail.ccSpecifies email address for sending comprehensive manager reports. Multiple addresses must be separated with a semicolon. This setting is commonly used to send reports to managers or architects, as well as select developers. report.mail.includeSpecifies the email addresses of developers that you want to receive developer reports. Multiple addresses must be separated with a semicolon. This setting is commonly used to send developer reports to developers if developer reports are not sent automatically (e.g., because the team is not using a supported source control system). This setting overrides addresses specified in report.mail.exclude. report.mail.excludeSpecifies email addresses that should be excluded from automatically receiving reports. report.mail.exclude.developersEnables/disables report emails to developers not explicitly listed in the report.mail.cc setting. This setting is used to prevent reports from being mailed to individual developers. The default setting is report.mail.unknownSpecifies where to email reports for errors assigned to "unknown". report.mail.on.error.onlyEnables/disables email reports to the manager when an error is found or a fatal exception occurs. Developer emails are not affected by this setting; developer emails are sent only to developers who are responsible for reported errors. The default setting is report.setup.problemsDetermines placement of setup problems section in report. The default setting is report.setup.problems.consoleDetermines whether setup problems will be printed on the console. The default setting is report.separate_vmSpecifies to generate reports is separate virtual machine. The default setting is report.separate_vm.launch.fileSpecifies path to launch file which should be used during reports generation. scontrol.timeoutSpecifies timeout value for operations with source control. The default value is scontrol.branchEnables you to specify a custom name for the tested branch. This setting may be used to describe unique runs. If it is not specified, the tested branch is detected automatically based on code provided to analysis. Console and Logging SettingsThe following options enable you to specify the level of debugging information generated. local.storage.dirSpecifies the temporary directory to save logs for debugging errors. console.verbosity.levelSpecifies the verbosity level for debugging. We recommend setting to logging.verboseEnables/disables verbose logs. Verbose logs are stored in the xtest.log file in the location specified with the local.storage.dir setting. Verbose logging state persists across sessions (restored on application startup). The log is a rolling file with a fixed maximum size. A backup is created whenever the max size is reached. Default is logging.scontrol.verboseEnables/disables output from source control commands in verbose logs. The output from source control may include fragments of analyzed source code. Default is Git Source Control Settingsscontrol.rep<n>.typeGit repository type identifier. scontrol.git.execPath to git executable. If not set, assumes git command is on the path. scontrol.rep<n>.git.urlThe remote repository URL (e.g., git://hostname/repo.git). scontrol.rep<n>.git.workspaceThe directory containing the local git repository. Mercurial Source Control Settingsscontrol.rep<n>.typeMercurial reposity type identifyer. scontrol.hg.execPath to external client executable. Devault is scontrol.rep<n>.hg.urlThe remote repository URL (e.g., http://hostname/path). scontrol.rep<n>.hg.workspaceThe directory containing the local Mercurial repository. Perforce Source Control Settingsscontrol.rep<n>.typePerforce repository type identifier. scontrol.perforce.execPath to external client executable (p4). scontrol.rep<n>.perforce.hostPerforce server host. scontrol.rep<n>.perforce.portPerforce server port. Default port is scontrol.rep.perforce.loginPerforce user name. scontrol.rep.perforce.passwordPerforce password, optional if ticket is used for authentication. scontrol.rep.perforce.clientThe client workspace name as specified in the P4CLIENT environment variable or its equivalents. Root directory for specified workspace should be configured correctly for local machine. Subversion Source Control Settingsscontrol.rep<n>.typeSubversion repository type identifier. scontrol.svn.execPath to external client executable (svn). scontrol.rep<n>.svn.urlSubversion URL specifies protocol, server name, port and starting repository path. Example:
scontrol.rep<n>.svn.loginLogin name. scontrol.rep.svn.passwordPassword (not encoded). Microsoft Team Foundation Server Source Control Settingsscontrol.rep<n>.typeTFS repository type identifier. scontrol.rep<n>.tfs.urlURL to TFS repository, e.g., scontrol.rep<n>.tfs.loginTFS user name. scontrol.rep<n>.tfs.passwordTFS password. |