# How to Create an Analysis Profile
Teamscale comes with pre-configured analysis profiles for all supported languages. These provide sane default values for all analyses. Not all available analyses are enabled by default, though. When starting out, it is usually a good idea to start with the default profile for a language and customize it later to fit your needs. Each project uses exactly one such profile.
A single analysis profile can cover multiple programming languages.
# Step 1: Choosing Programming Language(s)
In the left sidebar, click on Projects → Analysis Profile .
To create a new analysis profile from scratch, use
Create analysis profile or import an
existing (previously exported) XML file by using
Import analysis profile.
To edit an existing analysis profile, click on
next to its name. The other buttons in this row can be used to duplicate
a configuration ,
or download it as an XML file
To use one of the default profiles as basis for configuring a custom one, we recommend to copy the default profile, and then edit the copied version afterwards.
The next screen will look like this:
The first section of this screen allows you to specify a name for the profile and select all the programming languages that should be analyzed. Each project you configure in Teamscale can only have a single analysis profile. Thus, if your project contains code written in more than one language, you must select all of these languages in the analysis profile to have them analyzed.
If you click on
Continue, the next
section will appear:
# Step 2: Configure Tools
In this section, you can select additional analysis tools that should be integrated with Teamscale. These include internal and external tools.
Internal tools, like StyleCop for C#, are run by Teamscale itself. In addition, there are external tools, like FindBugs and SpotBugs for Java, which must be run by your nightly build, for example. Internal tools are run incrementally (i.e. with each commit), while the results of the external tools are only updated when you run them yourself (e.g., nightly) and upload the results to Teamscale. You may also select the tools for which you would like to upload test coverage. If you select none, test coverage metrics will be disabled for this project. The Custom External Findings and non-code metrics features enable users to upload their own findings using a python API.
After another click on
will be taken to the
quality indicator configuration screen:
# Step 3: Configure Checks & Severities
All analyses in Teamscale belong to so-called analysis groups which are in turn aggregated into quality indicators, allowing you to combine related groups. A common use case is to combine several formatting-related groups (e.g. spacing and layouting analyses) into one quality indicator called Formatting. All findings generated by these analyses will then show up under that name in Teamscale and can easily be filtered or grouped together.
You may create any number of such quality indicators by using the button
Add Quality Indicator. To add or remove analysis groups
to/from them, simply drag the group's name between the indicators and
the section Inactive Analysis Groups .
Groups and indicators all have their own set of options, which can be accessed via the small next to their name.
- For a quality indicator, you can configure its name and which metrics should be calculated for this indicator.
- For the lower-level analysis groups, you can configure options that determine the behavior of the analyses as well as the severity of the findings produced by the analyses. Teamscale comes with a variety of pre-written checks for various languages. To match your individual analysis needs, the analysis groups can also contain custom checks.
In the analysis group options, you can freely configure the severity ("yellow" or "red") of each check (or check group), or turn it off completely.
Since these dialogs often contain many options, you can use the filter text box at the top of the dialog to quickly locate certain options. Be careful with options that are marked as expert options. We recommend to not change these unless you have a deep understanding of the implications. Finally, the screen contains a section for Other Options . These global options do not affect a single quality indicator but rather the entire analyzed project, e.g. whether to enable searching.
# Other Options for Analysis Profiles
|Disable clone-based move tracking||Tick to disable tracking of moving or renaming files|
|C/C++ predefined macros||Here you can specify macros which are not defined in the project source code. If those macros are not defined, Teamscale might issue warnings about undefined macros.|
|Enable search||Should Teamscale enable users to search in the project source code, commits, and issues?|
|Enable Redundant Literal Analysis||Enables the analysis of redundant literals in the source code. If enabled, teamscale generates findings for often-occurring string literals.|
|Test identification patterns||This enables to analyze tests implemented in a custom test framework, where the test entities can be detected via comments above the test. A list of mappings from test properties to regular expressions should be provided. There must be at least one mapping for the test's name i.e. `Name -> @test: ID-(.*)`. The regular expressions are matched against all comments within and above functions/methods. The left side of the mappings specifies the name of a test's property. The first capture group in the regular expression should match the value of the corresponding field. Make sure to escape reserved characters like '(', ')' or '.' as well as commas properly with the escape character '\'. Lines starting with '##' are ignored.|
# Step 4: Saving your Profile
Once you are satisfied with your analysis profile, click Save Profile. You will be directed to a page that shows a summary of the configuration you made. You can now create a project with that profile. Please note that editing an existing analysis profile will not change any settings for existing projects that reference this profile. If you want to not only update the profile but also all projects using it, please select to reanalyze those projects when prompted. Note, though, that the reanalysis might take a while, depending on the length of your project's code history.