Data Classes#
- class AzureDevOpsGitSourceCodeConnectorConfiguration(repository_name, default_branch_name, account, include_submodules=False, submodule_recursion_depth=10, connector_type=ConnectorType.ADO_GIT, enable_findings_in_merge_requests=False, enable_tga_in_merge_requests=False, enable_commit_alerts_in_merge_requests=False, *args, **kwargs)[source]#
Represents a Teamscale Azure DevOps Git connector configuration.
- Parameters:
repository_name (str) – Name of the repository. In the form “<Project-Name>/<Repository-Name>”, also if Project- and Repository-Name are the same.
enable_findings_in_merge_requests (Optional[bool]=False) – Whether to enable findings integration in merge requests. False by default.
enable_tga_in_merge_requests (Optional[bool]=False) – Whether to enable Test Gap integration in merge requests. False by default.
enable_commit_alerts_in_merge_requests (Optional[bool]=False) – Whether to enable Commit Alerts in merge requests. False by default.
- class Baseline(name, description, date=None, timestamp=None)[source]#
Represents a Teamscale baseline. Either the date or the timestamp must be given
- Parameters:
name (str) – The baseline’s name
description (str) – The baseline’s description
date (Optional[int]) – The date for which the baseline is set
date – The timestamp (in ms) for which the baseline is set
- property date#
- class Comment(author, date, text, changeComment=False)[source]#
Represents a comment on a Task in Teamscale
- Parameters:
author (str) – The author of this comment
date (long) – Creation date in ms
text (str) – The comment’s text
changeComment (bool) – Whether this is a system generated change comment
- class ConnectorConfiguration(connector_type)[source]#
Represents a Teamscale connector configuration. Connectors allow to attach external tools such as source code repositories.
- Parameters:
connector_type (ConnectorType) – The connector type of this configuration
- class FileFindings(findings, path, content=None)[source]#
Representation of a file and its findings.
- Parameters:
findings (List[
Finding
]) – A list containing all findings that are present in this file.path (str) – The path to the file in Teamscale.
content (Optional[str]) – The content of the file (can be left empty).
- class FileSystemSourceCodeConnectorConfiguration(input_directory, *args, **kwargs)[source]#
Represents a Teamscale file system connector configuration.
- Parameters:
input_directory (str) – Path to the directory that should be analyzed
- class Finding(finding_type_id, message, assessment=Assessment.YELLOW, start_offset=None, end_offset=None, start_line=None, end_line=None, identifier=None, uniform_path=None, finding_properties=None, finding_id=None)[source]#
Representation of a finding in Teamscale.
- Parameters:
finding_type_id (str) – The type id that this finding belongs to.
message (str) – The main finding message
assesssment (Assessment) – The assessment this finding should have. Default is YELLOW. This value is only important if in Teamscale the finding enablement is set to auto, otherwise the setting from Teamscale will be used.
start_offset (int) – Offset from the beginning of the file, where the finding area starts (zero-based, inclusive). Can be left blank, if the start/endline are given. It has to point to the beginning of a token (e.g., a keyword). (See also: FAQ - Offsets).
end_offset (int) – Offset from the beginning of the file, where the finding area ends (zero-based, inclusive). Can be left blank, if the start/endline are given. It has to point to the end of a token (e.g., a keyword). (See also: FAQ - Offsets).
start_line (int) – The finding’s first line (one-based, inclusive). Can be left blank, if the offsets are given.
end_line (int) – The finding’s last line (one-based, inclusive). Can be left blank, if the offsets or start_line are given.
identifier (Optional[str]) – Advanced usage! Path to special elements in Teamscale, e.g. Simulink model parts. If this is given, offsets and lines do not need to be filled.
uniform_path (Optional[str]) – The path of the file where the finding is located.
properties (Optional[dict]) – A map of String->Object properties associated with this finding.
finding_id (str) – The Teamscale internal id of this finding. Can be left empty for findings that do not yet have an id.
- class FindingDescription(typeid, description, enablement, name=None)[source]#
Description of a finding type to be added at configuration time.
- Parameters:
typeid (str) – The id used to reference the finding type.
name (str) – Some UI friendly name for this description.
description (str) – The text to display that explains what this finding type is about (and ideally how to fix it). This text will be the same for each concrete instance of the finding.
enablement (Enablement) – Describes the default enablement setting for this finding type, used when it is added to the analysis profile.
- class GerritSourceCodeConnectorConfiguration(project_name, enable_voting=False, enable_detailed_line_comments=True, ignore_yellow_findings_for_votes=False, ignore_yellow_findings_for_comments=False, number_of_ref_batches_for_updates=1, review_label='Code-Review', *args, **kwargs)[source]#
Represents a Teamscale Gerrit connector configuration.
- Parameters:
project_name (str) – Used to reference the project.
enable_voting (str) – Enables Teamscale voting on Gerrit reviews.
enable_detailed_line_comments (str) – When enabled, a Teamscale vote will carry a detailed comment for each generated finding that is annotated to the relevant line in the reviewed file.
ignore_yellow_findings_for_votes (str) – When enabled, Teamscale will only consider red findings when voting.
ignore_yellow_findings_for_comments (str) – When enabled, Teamscale will only consider red findings when commenting.
number_of_ref_batches_for_updates (str) – Defines the number of seperate parts the refs are fetched from Gerrit. Can be between 1-100, but 100 must be cleanly dividable by the given number. DO NOT CHANGE THIS, unless you know exactly what you are doing.
review_label (str) – The review label used to upload feedback to Gerrit.
- class GitSourceCodeConnectorConfiguration(default_branch_name, account, path_suffix='', include_submodules=False, submodule_recursion_depth=10, connector_type=ConnectorType.GIT, *args, **kwargs)[source]#
Represents a Teamscale Git connector configuration.
- Parameters:
default_branch_name (str) – Name of the branch that should be analyzed. If not provided, the master branch will be used. If enable_branch_analysis is set to True, this becomes the default branch.
account (str) – Name of the Teamscale account to use to connect to the repository.
path_suffix (Optional[str]) – The suffix to append to the base URL of the repository. Empty by default.
include_submodules (Optional[bool]) – Whether to transparently analyze submodules. Defaults to False.
submodule_recursion_depth (Optional[int]) – The maximum recursion depth when analyzing submodules. Defaults to 10.
- class MetricDescription(metric_id, display_name, description, group_id, aggregation=MetricAggregation.SUM, value_type=MetricValueType.NUMERIC, properties=(MetricProperties.SIZE_METRIC,))[source]#
Description of a metric type to be addded at configuration time.
- Parameters:
metric_id (str) – The globally unique metric id.
display_name (str) – The metric’s name that is displayed in the UI.
description (str) – A description explaining what this metric means.
group_id (str) – the name of an analysis group under which the metric is placed (used to group the metrics in the analysis profile).
aggregation (MetricAggregation) – How this metric is supposed to be aggregated up the directory hierarchy. Defaults to
SUM
.value_type (MetricValueType) – Determines the metric’s type. Defaults to
NUMERIC
.properties (set[MetricProperties]) – Determines the metric’s properties. This has effects on how/if the metric is displayed and assessed. Defaults to
(SIZE_METRIC, )
.
- class MetricEntry(path, metrics)[source]#
A container for adding metric values to a file.
- Parameters:
path (str) – Path to a resource in Teamscale (usually a file). This can also point to architecture components using the following syntax:
-architectures-/<architecture-name>/path/to/component/
metrics (dict[str, object]) – A dictionary mapping from metric_id to metric value. The value depends on the metric type: Numeric:
double
, Timestamp:int - unix timestamp in milliseconds
, Assessment:[<GREENVALUE>,<YELLOWVALUE>,<REDVALUE>]
- class MultiVersionFileSystemSourceCodeConnectorConfiguration(input_directory, *args, **kwargs)[source]#
Represents a Teamscale multiversion file system connector configuration.
- Parameters:
input_directory (str) – Path to the directory that should be analyzed
- class NonCodeMetricEntry(path, content='', count=1, assessment={}, time=0.0)[source]#
A container for adding non-code metrics to a project.
- Parameters:
path (str) – Arbitrary path to which the non-code metrics shall be attached.
content (str) – The content displayed as content for the path.
count (int) – The count value.
assessment (dict[
constants.AssessmentMetricColors
, int]) – The assessment distribution for this path.time (double) – The time used to create this result (e.g. unit test run time, or build duration).
- class ProjectConfiguration(name, project_id, profile, connectors, alias=None)[source]#
Represents a Teamscale project configuration. This is used to create new and update existing projects in Teamscale.
- Parameters:
name (str) – The project’s name
project_id (List[str]) – The project’s public id
profile (str) – The name of the profile used to analyse the project
connectors (List[
ConnectorConfiguration
]) – List of all connectors used in the project configuration
- class ProjectInfo(internal_project_id, public_project_ids, name, description=None, creation_timestamp=None, alias=None, deleting=False, reanalyzing=False)[source]#
Represents information about a Teamscale project. When querying information about a project in Teamscale, the result is an instance of this class.
- Parameters:
internal_project_id (str) – The project’s id
public_project_ids (List[str]) – The project’s id
name (str) – The project’s name
description (Optional[str]) – The project’s description
creation_timestamp (Optional[long]) – The project’s creation timestamp (in ms)
deleting (Optional[bool]) – Whether the project is currently being deleted
reanalyzing (Optional[bool]) – Whether the project is currently being reanalyzed
- classmethod from_json(json_data: Dict) ProjectInfo [source]#
Parses a single JSON encoded baseline.
- Parameters:
json_data – The json object encoding the baseline.
- Returns:
The baseline that was parsed from the JSON object
- Return type:
- class SourceCodeConnectorConfiguration(connector_type, included_file_names, excluded_file_names='', repository_identifier='repository1', enable_branch_analysis=False, included_branches='.*', excluded_branches='_anon.*', start_revision='', content_exclude='', polling_interval=60, prepend_repository_identifier=False, end_revision='', text_filter='', source_library_connector=False, run_to_exhaustion=False, delta_size=500, path_prefix_transformation='', path_transformation='', encoding='', author_transformation='', branch_transformation='', preserve_empty_commits=False)[source]#
Represents a Teamscale source code connector configuration.
- Parameters:
connector_type (ConnectorType) – The connector type of this configuration.
included_file_names (str) – Ant patterns describing the files to be read from the repository.
excluded_file_names (Optional[str]) – Ant patterns describing the files to be excluded from the repository.
repository_identifier (Optional[str]) – A unique identifier used to reference the repository. This is also shown in the UI and should have a meaningful value. Defaults to ‘repository1’.
enable_branch_analysis (Optional[bool]) – Whether not only the main line but also branches should be analyzed. Defaults to False.
included_branches (Optional[str]) – Regex patterns describing the branches to be read from the repository. All branches are included by default.
excluded_branches (Optional[str]) – Regex patterns describing the branches to be excluded from the repository. Defaults to _anon.*.
start_revision (Optional[str]) – The first date or revision to be read. If left empty, the entire history will be read.
content_exclude (Optional[str]) – A comma-separated list of filters that removes the complete content of a file (i.e. treating it as an empty file) based on a regular expression matched against the file’s content.
polling_interval (Optional[int]) – Delay used for polling the repository in seconds (default is 60 seconds).
prepend_repository_identifier (Optional[bool]) – Whether to include the repository identifier as a prefix for the created file paths. Defaults to False.
end_revision (Optional[str]) – The last date or revision to be read. If left empty, the history up to the latest revision is read.
text_filter (Optional[str]) – A comma-separated list of regular expressions describing what parts of a file should be excluded from analysis, e.g. generated code.
source_library_connector (Optional[bool]) – If this is true, the contained files will only be used for source library lookup, but not for analysis. Defaults to False.
run_to_exhaustion (Optional[bool]) – If this is true, the repository will not be polled after the current head is reached. Defaults to False.
delta_size (Optional[int]) – Adjusts the size of deltas produced by the connector (experts only, default is 500).
path_prefix_transformation (Optional[str]) – Prefix transformations that are applied to the paths from the repository. Empty by default.
path_transformation (Optional[str]) – Regex transformations that are applied to the paths from the repository. Empty by default.
encoding (Optional[str]) – This can be used to set the encoding used (e.g. UTF-8, latin1) when reading files. Empty by default.
author_transformation (Optional[str]) – Regex transformations that are applied to the authors of the repository. Empty by default.
branch_transformation (Optional[str]) – Regex transformations that are applied to the branch names of the repository. Empty by default.
- class SubversionSourceCodeConnectorConfiguration(account, enable_externals=False, externals_includes='', externals_excludes='', path_suffix='', *args, **kwargs)[source]#
Represents a Teamscale Subversion connector configuration.
- Parameters:
account (str) – Name of the Teamscale account to use to connect to the repository.
enable_externals (Optional[bool]) – Whether to also parse and interpret svn:externals properties. Defaults to False.
externals_includes (Optional[str]) – Ant patterns describing the directories that are checked for svn:externals. Empty by default.
externals_excludes (Optional[str]) – Ant patterns describing the directories that are not checked for svn:externals. Empty by default.
path_suffix (Optional[str]) – Path suffix that is to be appended to the repository’s base path. Empty by default.
- class TFSSourceCodeConnectorConfiguration(account, branch_path_suffix='', path_suffix='', branch_lookup_paths='', *args, **kwargs)[source]#
Represents a Teamscale TFS connector configuration.
- Parameters:
account (str) – Name of the Teamscale account to use to connect to the repository.
branch_path_suffix (Optional[str]) – The suffix to append to the branch name. Empty by default.
path_suffix (Optional[str]) – The suffix to append to the base URL of the repository. Empty by default.
branch_lookup_paths (Optional[str]) – Sub paths in which to look for branches. Empty by default.
- class Task(id, subject, author, description, assignee, status, resolution, findings, comments, tags, created, updated, updatedBy)[source]#
Represents a task in Teamscale
- Parameters:
id (int) – The task’s id
subject (str) – The task’s subject
author (str) – The task author’s name
description (str) – The task’s description
assignee (str) – The assigned user’s name
status (TaskStatus) – The task’s status
resolution (Optional[TaskResolution]) – The task’s resolution
findings (Optional[List[str]]) – The findings attached to this task
comments (Optional[List[Comment]]) – Comments attached to this task
tags (List[str]) – Tags that have been added to this task