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.
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.
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. Use simpleGetterCaseInsensitive for a case insensitive version.
simpleSetter
Simple setters, i.e. methods starting with »set« and containing at most one statement. Use simpleSetterCaseInsensitive for a case insensitive version.
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))
isAbstract
All abstract entities.
redefinition
Only for ABAP: all entities with a redefinition modifier
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:
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
public & (type | method | attribute) & !(simpleGetter | simpleSetter | annotated(Override) | override)
public & (type | method | property) & !(simpleGetter | simpleSetter | annotated(Override) | override)
(Comments expected in Headers)
type | (public & (attribute | (method & declaration)))
(Comments expected at Implementation)
type | (public & (attribute | (method & !declaration)))
(public & (type | method | attribute | declaration | property) & !(simpleGetter | simpleSetter | annotated(Override) | override))
Predicate Reference
The following boxes provide an overview of the available predicates.
language(name)
If the given language name is invalid, no entities are matched. Valid names are for example
JAVA
andCPP
.module
type
method
declaration
internal
attribute
property
statement
meta
public
protected
override
private
fileprivate
default
final
static
primitive
subtype(name)
if
to target if-statements. Other examples for the name parameter areconstructor
,destructor
orwhile
.typeSubtype(name)
name(name)
nameRegex(regex)
fileRegex(regex)
fileRegex(.*\.ts)
matches all files with the extension ».ts«.annotated(name)
simpleGetter
simpleGetterCaseInsensitive
for a case insensitive version.simpleSetter
simpleSetterCaseInsensitive
for a case insensitive version.simpleMethod(prefix)
simpleMethodCaseInsensitive(prefix)
for a case insensitive version.export
export
visibility.typeexported
extendsType
extendsType(MyBaseClass)
)isAbstract
redefinition