---
url: /howto/customizing-comment-analysis.md
---

# How to Customize the Comment Analysis

To customize the *code entities* (e.g., methods or field declarations) for which Teamscale expects a comment, Teamscale
provides so-called **selection predicates** to specify code entities. This can be used to customize and fine-tune the
comment analysis to your needs.

### Supported Languages

The following languages support this feature:

* ABAP
* C
* C#
* C++
* Java
* JavaScript
* Kotlin
* MATLAB
* Python
* Swift
* Visual Basic

## Code Entity Selection Predicates

An entity selection predicate consists of primitives that can be connected using negation `!`, conjunction `&`,
disjunction `|`, and parentheses `(` and `)`. The primitives are listed in the following configuration boxes. Obviously,
not all predicates are applicable to all programming languages.

### Simple Example

An example that selects **all public simple getters and setters** would be

`public & (simpleGetter | simpleSetter)`

### Language-level examples

A good starting point are the following examples

### Predicate Reference

The following boxes provide an overview of the available predicates.

| Predicate              | Meaning                                                                                                                                                                                     |
|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `language(name)`       | Entities in files with the given language. If the given language name is invalid, no entities are matched. Valid names are for example `JAVA` and `CPP`.                                    |
| `module`               | Namespaces and modules.                                                                                                                                                                     |
| `type`                 | Types, such as classes or structs.                                                                                                                                                          |
| `method`               | Methods and functions.                                                                                                                                                                      |
| `declaration`          | Declarations of types and methods.                                                                                                                                                          |
| `internal`             | *Internal* entities (C# and Swift keyword).                                                                                                                                                 |
| `attribute`            | Attributes, fields and global variables.                                                                                                                                                    |
| `property`             | All properties: defined attributes that have only method children.                                                                                                                          |
| `statement`            | All statements.                                                                                                                                                                             |
| `meta`                 | All meta information (defines, annotations, etc.).                                                                                                                                          |
| `public`               | All *public* entities, as well as methods inside interfaces, which are considered public in most languages.                                                                                 |
| `protected`            | All *protected* entities.                                                                                                                                                                   |
| `override`             | All entities marked with *override* keyword.                                                                                                                                                |
| `private`              | All *private* entities.                                                                                                                                                                     |
| `fileprivate`          | All *fileprivate* entities (Swift keyword).                                                                                                                                                 |
| `default`              | All entities with default visibility.                                                                                                                                                       |
| `final`                | All *final* entities.                                                                                                                                                                       |
| `static`               | All *static* entities.                                                                                                                                                                      |
| `primitive`            | All primitive entities (i.e. those without children).                                                                                                                                       |
| `subtype(name)`        | Entities by their subtype. The name parameter can e.g., be `if` to target if-statements. Other examples for the name parameter are `constructor`, `destructor` or `while`.                  |
| `typeSubtype(name)`    | Entities by their parent type's subtype (e.g., to select all members of interfaces).                                                                                                        |
| `name(name)`           | Entities by their name. For example a method name.                                                                                                                                          |
| `nameRegex(regex)`     | Entities by their name using regular expression.                                                                                                                                            |
| `fileRegex(regex)`     | Entities by their containing file's unified path using regular expression, e.g. `fileRegex(.*\.ts)` matches all files with the extension ».ts«.                                             |
| `annotated(name)`      | All entities that are annotated with an annotation of given name (excluding the »@« sign).                                                                                                  |
| `simpleGetter`         | Simple getters, i.e. methods starting with »get« or »is« and containing at most one statement.                                                                                              |
| `simpleSetter`         | Simple setters, i.e. methods starting with »set« and containing at most one statement.                                                                                                      |
| `simpleMethod(prefix)` | Simple methods whose name starts with the given prefix. A method is simple, if it contains as most one statement. Use `simpleMethodCaseInsensitive(prefix)` for a case insensitive version. |
| `export`               | All entities with ES6's `export` visibility.                                                                                                                                                |
| `typeexported`         | All entities (e.g. methods, attributes) within types that have ES6's export visibility.                                                                                                     |
| `extendsType`          | Classes that extend a specific type directly (e.g. `extendsType(MyBaseClass)`). *Supported for: `Java`, `C#`, and `Visual Basic`.*                                                          |
| `isAbstract`           | All *abstract* entities.                                                                                                                                                                    |
| `redefinition`         | Only for ABAP: all entities with a redefinition modifier                                                                                                                                    |
