tricium

package
v0.0.0-...-c1f61f0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

README

Tricium API .proto files

This directory includes the protocol buffer service and message definitions for the public API of Tricium.

To regenerate, run go generate; the behavior of this command depends on the directives in gen.go.

Documentation

Index

Constants

View Source
const (
	// GitFileDetailsPath stores the path to the GIT_FILE_DETAILS data type file.
	GitFileDetailsPath = "tricium/data/git_file_details.json"
	// FilesPath stores the path to the FILES data type file.
	FilesPath = "tricium/data/files.json"
	// ResultsPath stores the path to the RESULTS data type file.
	ResultsPath = "tricium/data/results.json"
)

Variables

View Source
var (
	Data_Type_name = map[int32]string{
		0: "NONE",
		1: "GIT_FILE_DETAILS",
		2: "FILES",
		4: "RESULTS",
	}
	Data_Type_value = map[string]int32{
		"NONE":             0,
		"GIT_FILE_DETAILS": 1,
		"FILES":            2,
		"RESULTS":          4,
	}
)

Enum value maps for Data_Type.

View Source
var (
	Data_Status_name = map[int32]string{
		0: "MODIFIED",
		1: "ADDED",
		2: "DELETED",
		3: "RENAMED",
		4: "COPIED",
		5: "REWRITTEN",
	}
	Data_Status_value = map[string]int32{
		"MODIFIED":  0,
		"ADDED":     1,
		"DELETED":   2,
		"RENAMED":   3,
		"COPIED":    4,
		"REWRITTEN": 5,
	}
)

Enum value maps for Data_Status.

View Source
var File_go_chromium_org_infra_tricium_api_v1_data_proto protoreflect.FileDescriptor

Functions

func GetPathForDataType

func GetPathForDataType(t interface{}) (string, error)

GetPathForDataType returns the file path to use for the provided Tricium data type.

func ReadDataType

func ReadDataType(prefix string, t proto.Message) error

ReadDataType reads a Tricium data type to the provided type.

func WriteDataType

func WriteDataType(prefix string, t proto.Message) (string, error)

WriteDataType writes a Tricium data type to the file path assigned to the type.

Types

type Data

type Data struct {
	// contains filtered or unexported fields
}

Tricium data types.

Any data type provided or needed by a Tricium function.

func (*Data) Descriptor deprecated

func (*Data) Descriptor() ([]byte, []int)

Deprecated: Use Data.ProtoReflect.Descriptor instead.

func (*Data) ProtoMessage

func (*Data) ProtoMessage()

func (*Data) ProtoReflect

func (x *Data) ProtoReflect() protoreflect.Message

func (*Data) Reset

func (x *Data) Reset()

func (*Data) String

func (x *Data) String() string

type Data_Comment

type Data_Comment struct {

	// Comment ID.
	//
	// This is an UUID generated by the Tricium service and used for tracking
	// of comment feedback. Analyzers should leave this field empty.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Category of the result, encoded as a path with the analyzer name as the
	// root, followed by an arbitrary number of subcategories, for example
	// "ClangTidy/llvm-header-guard".
	Category string `protobuf:"bytes,2,opt,name=category,proto3" json:"category,omitempty"`
	// Comment message. This should be a short message suitable as a code
	// review comment.
	Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
	// Path to the file this comment is for.
	//
	// If this path is the empty string, then the comment is on the commit
	// message text, rather than an actual file.
	Path string `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"`
	// Position information. If start_line is omitted, then the comment
	// will be a file-level comment.
	StartLine int32 `protobuf:"varint,6,opt,name=start_line,json=startLine,proto3" json:"start_line,omitempty"` // 1-based, inclusive.
	EndLine   int32 `protobuf:"varint,7,opt,name=end_line,json=endLine,proto3" json:"end_line,omitempty"`       // 1-based, inclusive.
	StartChar int32 `protobuf:"varint,8,opt,name=start_char,json=startChar,proto3" json:"start_char,omitempty"` // 0-based, inclusive.
	EndChar   int32 `protobuf:"varint,9,opt,name=end_char,json=endChar,proto3" json:"end_char,omitempty"`       // 0-based, exclusive.
	// Suggested fixes for the identified issue.
	Suggestions []*Data_Suggestion `protobuf:"bytes,10,rep,name=suggestions,proto3" json:"suggestions,omitempty"`
	// When true, show on both changed and unchanged lines.
	// When false, only show on changed lines.
	ShowOnUnchangedLines bool `` /* 127-byte string literal not displayed */
	// contains filtered or unexported fields
}

Results.Comment, results as comments.

Similar content as that needed to provide robot comments in Gerrit, https://gerrit-review.googlesource.com/Documentation/config-robot-comments.html

func (*Data_Comment) Descriptor deprecated

func (*Data_Comment) Descriptor() ([]byte, []int)

Deprecated: Use Data_Comment.ProtoReflect.Descriptor instead.

func (*Data_Comment) GetCategory

func (x *Data_Comment) GetCategory() string

func (*Data_Comment) GetEndChar

func (x *Data_Comment) GetEndChar() int32

func (*Data_Comment) GetEndLine

func (x *Data_Comment) GetEndLine() int32

func (*Data_Comment) GetId

func (x *Data_Comment) GetId() string

func (*Data_Comment) GetMessage

func (x *Data_Comment) GetMessage() string

func (*Data_Comment) GetPath

func (x *Data_Comment) GetPath() string

func (*Data_Comment) GetShowOnUnchangedLines

func (x *Data_Comment) GetShowOnUnchangedLines() bool

func (*Data_Comment) GetStartChar

func (x *Data_Comment) GetStartChar() int32

func (*Data_Comment) GetStartLine

func (x *Data_Comment) GetStartLine() int32

func (*Data_Comment) GetSuggestions

func (x *Data_Comment) GetSuggestions() []*Data_Suggestion

func (*Data_Comment) ProtoMessage

func (*Data_Comment) ProtoMessage()

func (*Data_Comment) ProtoReflect

func (x *Data_Comment) ProtoReflect() protoreflect.Message

func (*Data_Comment) Reset

func (x *Data_Comment) Reset()

func (*Data_Comment) String

func (x *Data_Comment) String() string

type Data_File

type Data_File struct {

	// Relative file path.
	//
	// The path is relative to the root of the repository being analyzed,
	// and the path separator character is "/".
	Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	// Whether or not this file contains binary content (not text).
	IsBinary bool `protobuf:"varint,2,opt,name=is_binary,json=isBinary,proto3" json:"is_binary,omitempty"`
	// How the file was changed.
	Status Data_Status `protobuf:"varint,3,opt,name=status,proto3,enum=tricium.Data_Status" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func FilterFiles

func FilterFiles(files []*Data_File, filters ...string) ([]*Data_File, error)

FilterFiles returns files whose basename matches any of the given patterns.

func (*Data_File) Descriptor deprecated

func (*Data_File) Descriptor() ([]byte, []int)

Deprecated: Use Data_File.ProtoReflect.Descriptor instead.

func (*Data_File) GetIsBinary

func (x *Data_File) GetIsBinary() bool

func (*Data_File) GetPath

func (x *Data_File) GetPath() string

func (*Data_File) GetStatus

func (x *Data_File) GetStatus() Data_Status

func (*Data_File) ProtoMessage

func (*Data_File) ProtoMessage()

func (*Data_File) ProtoReflect

func (x *Data_File) ProtoReflect() protoreflect.Message

func (*Data_File) Reset

func (x *Data_File) Reset()

func (*Data_File) String

func (x *Data_File) String() string

type Data_Files

type Data_Files struct {
	Platforms     int64        `protobuf:"varint,1,opt,name=platforms,proto3" json:"platforms,omitempty"`
	Files         []*Data_File `protobuf:"bytes,3,rep,name=files,proto3" json:"files,omitempty"`
	CommitMessage string       `protobuf:"bytes,4,opt,name=commit_message,json=commitMessage,proto3" json:"commit_message,omitempty"`
	// contains filtered or unexported fields
}

List of paths included in the analyzer input.

PATH: tricium/data/files.json

func (*Data_Files) Descriptor deprecated

func (*Data_Files) Descriptor() ([]byte, []int)

Deprecated: Use Data_Files.ProtoReflect.Descriptor instead.

func (*Data_Files) GetCommitMessage

func (x *Data_Files) GetCommitMessage() string

func (*Data_Files) GetFiles

func (x *Data_Files) GetFiles() []*Data_File

func (*Data_Files) GetPlatforms

func (x *Data_Files) GetPlatforms() int64

func (*Data_Files) ProtoMessage

func (*Data_Files) ProtoMessage()

func (*Data_Files) ProtoReflect

func (x *Data_Files) ProtoReflect() protoreflect.Message

func (*Data_Files) Reset

func (x *Data_Files) Reset()

func (*Data_Files) String

func (x *Data_Files) String() string

type Data_GitFileDetails

type Data_GitFileDetails struct {

	// The platforms this data is tied to encoded as a bitmap.
	//
	// The bit number for each platform should correspond to the enum
	// position number of the same platform in the Platform.Name enum.
	//
	// This includes the ANY platform, encoded as zero, which should
	// be used for any data that is not platform-specific.
	Platforms     int64        `protobuf:"varint,1,opt,name=platforms,proto3" json:"platforms,omitempty"`
	Repository    string       `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"`
	Ref           string       `protobuf:"bytes,3,opt,name=ref,proto3" json:"ref,omitempty"`
	Files         []*Data_File `protobuf:"bytes,4,rep,name=files,proto3" json:"files,omitempty"`
	CommitMessage string       `protobuf:"bytes,5,opt,name=commit_message,json=commitMessage,proto3" json:"commit_message,omitempty"`
	// contains filtered or unexported fields
}

Details for retrieval of file content from a Git repository.

In practice this was only used as an input to GitFileDetails, and is now DEPRECATED.

PATH: tricium/data/git_file_details.json

func (*Data_GitFileDetails) Descriptor deprecated

func (*Data_GitFileDetails) Descriptor() ([]byte, []int)

Deprecated: Use Data_GitFileDetails.ProtoReflect.Descriptor instead.

func (*Data_GitFileDetails) GetCommitMessage

func (x *Data_GitFileDetails) GetCommitMessage() string

func (*Data_GitFileDetails) GetFiles

func (x *Data_GitFileDetails) GetFiles() []*Data_File

func (*Data_GitFileDetails) GetPlatforms

func (x *Data_GitFileDetails) GetPlatforms() int64

func (*Data_GitFileDetails) GetRef

func (x *Data_GitFileDetails) GetRef() string

func (*Data_GitFileDetails) GetRepository

func (x *Data_GitFileDetails) GetRepository() string

func (*Data_GitFileDetails) ProtoMessage

func (*Data_GitFileDetails) ProtoMessage()

func (*Data_GitFileDetails) ProtoReflect

func (x *Data_GitFileDetails) ProtoReflect() protoreflect.Message

func (*Data_GitFileDetails) Reset

func (x *Data_GitFileDetails) Reset()

func (*Data_GitFileDetails) String

func (x *Data_GitFileDetails) String() string

type Data_Replacement

type Data_Replacement struct {

	// Path to the file for this replacement.
	//
	// An empty string indicates the commit message.
	Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
	// A replacement string.
	Replacement string `protobuf:"bytes,2,opt,name=replacement,proto3" json:"replacement,omitempty"`
	// A continuous section of the file to replace.
	StartLine int32 `protobuf:"varint,3,opt,name=start_line,json=startLine,proto3" json:"start_line,omitempty"` // 1-based, inclusive.
	EndLine   int32 `protobuf:"varint,4,opt,name=end_line,json=endLine,proto3" json:"end_line,omitempty"`       // 1-based, inclusive.
	StartChar int32 `protobuf:"varint,5,opt,name=start_char,json=startChar,proto3" json:"start_char,omitempty"` // 0-based, inclusive.
	EndChar   int32 `protobuf:"varint,6,opt,name=end_char,json=endChar,proto3" json:"end_char,omitempty"`       // 0-based, exclusive.
	// contains filtered or unexported fields
}

A suggested replacement.

The replacement should be for one continuous section of a file.

func (*Data_Replacement) Descriptor deprecated

func (*Data_Replacement) Descriptor() ([]byte, []int)

Deprecated: Use Data_Replacement.ProtoReflect.Descriptor instead.

func (*Data_Replacement) GetEndChar

func (x *Data_Replacement) GetEndChar() int32

func (*Data_Replacement) GetEndLine

func (x *Data_Replacement) GetEndLine() int32

func (*Data_Replacement) GetPath

func (x *Data_Replacement) GetPath() string

func (*Data_Replacement) GetReplacement

func (x *Data_Replacement) GetReplacement() string

func (*Data_Replacement) GetStartChar

func (x *Data_Replacement) GetStartChar() int32

func (*Data_Replacement) GetStartLine

func (x *Data_Replacement) GetStartLine() int32

func (*Data_Replacement) ProtoMessage

func (*Data_Replacement) ProtoMessage()

func (*Data_Replacement) ProtoReflect

func (x *Data_Replacement) ProtoReflect() protoreflect.Message

func (*Data_Replacement) Reset

func (x *Data_Replacement) Reset()

func (*Data_Replacement) String

func (x *Data_Replacement) String() string

type Data_Results

type Data_Results struct {
	Platforms int64 `protobuf:"varint,1,opt,name=platforms,proto3" json:"platforms,omitempty"`
	// Zero or more results found as comments, either inline comments or change
	// comments (comments without line positions).
	Comments []*Data_Comment `protobuf:"bytes,2,rep,name=comments,proto3" json:"comments,omitempty"`
	// contains filtered or unexported fields
}

Results from running a Tricium analyzer.

Results are returned to the Tricium service from Buildbucket properties on executed Tricium recipes.

PATH: tricium/data/results.json BUILDBUCKET PROPERTIES: output.properties.comments

output.properties.num_comments

func (*Data_Results) Descriptor deprecated

func (*Data_Results) Descriptor() ([]byte, []int)

Deprecated: Use Data_Results.ProtoReflect.Descriptor instead.

func (*Data_Results) GetComments

func (x *Data_Results) GetComments() []*Data_Comment

func (*Data_Results) GetPlatforms

func (x *Data_Results) GetPlatforms() int64

func (*Data_Results) ProtoMessage

func (*Data_Results) ProtoMessage()

func (*Data_Results) ProtoReflect

func (x *Data_Results) ProtoReflect() protoreflect.Message

func (*Data_Results) Reset

func (x *Data_Results) Reset()

func (*Data_Results) String

func (x *Data_Results) String() string

type Data_Status

type Data_Status int32

File change status.

This corresponds to the status field provided by Gerrit in FileInfo: https://goo.gl/ABFHDg

const (
	Data_MODIFIED  Data_Status = 0
	Data_ADDED     Data_Status = 1
	Data_DELETED   Data_Status = 2
	Data_RENAMED   Data_Status = 3
	Data_COPIED    Data_Status = 4
	Data_REWRITTEN Data_Status = 5
)

func (Data_Status) Descriptor

func (Data_Status) Enum

func (x Data_Status) Enum() *Data_Status

func (Data_Status) EnumDescriptor deprecated

func (Data_Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use Data_Status.Descriptor instead.

func (Data_Status) Number

func (x Data_Status) Number() protoreflect.EnumNumber

func (Data_Status) String

func (x Data_Status) String() string

func (Data_Status) Type

type Data_Suggestion

type Data_Suggestion struct {

	// A brief description of the suggested fix.
	Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
	// Fix as a list of replacements.
	Replacements []*Data_Replacement `protobuf:"bytes,2,rep,name=replacements,proto3" json:"replacements,omitempty"`
	// contains filtered or unexported fields
}

Suggested fix.

A fix may include replacements in any file in the same repo as the file of the corresponding comment.

func (*Data_Suggestion) Descriptor deprecated

func (*Data_Suggestion) Descriptor() ([]byte, []int)

Deprecated: Use Data_Suggestion.ProtoReflect.Descriptor instead.

func (*Data_Suggestion) GetDescription

func (x *Data_Suggestion) GetDescription() string

func (*Data_Suggestion) GetReplacements

func (x *Data_Suggestion) GetReplacements() []*Data_Replacement

func (*Data_Suggestion) ProtoMessage

func (*Data_Suggestion) ProtoMessage()

func (*Data_Suggestion) ProtoReflect

func (x *Data_Suggestion) ProtoReflect() protoreflect.Message

func (*Data_Suggestion) Reset

func (x *Data_Suggestion) Reset()

func (*Data_Suggestion) String

func (x *Data_Suggestion) String() string

type Data_Type

type Data_Type int32

Available data types should be listed in this enum and have a corresponding nested message with a mandatory platforms fields, see GitFileDetails for field details.

const (
	Data_NONE             Data_Type = 0
	Data_GIT_FILE_DETAILS Data_Type = 1
	Data_FILES            Data_Type = 2
	Data_RESULTS          Data_Type = 4
)

func (Data_Type) Descriptor

func (Data_Type) Descriptor() protoreflect.EnumDescriptor

func (Data_Type) Enum

func (x Data_Type) Enum() *Data_Type

func (Data_Type) EnumDescriptor deprecated

func (Data_Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Data_Type.Descriptor instead.

func (Data_Type) Number

func (x Data_Type) Number() protoreflect.EnumNumber

func (Data_Type) String

func (x Data_Type) String() string

func (Data_Type) Type

type Data_TypeDetails

type Data_TypeDetails struct {
	Type               Data_Type `protobuf:"varint,1,opt,name=type,proto3,enum=tricium.Data_Type" json:"type,omitempty"`
	IsPlatformSpecific bool      `protobuf:"varint,2,opt,name=is_platform_specific,json=isPlatformSpecific,proto3" json:"is_platform_specific,omitempty"`
	// contains filtered or unexported fields
}

Details for supported types, specifically whether a type is tied to a platform.

These type details are used to resolve data dependencies when generating workflows.

func (*Data_TypeDetails) Descriptor deprecated

func (*Data_TypeDetails) Descriptor() ([]byte, []int)

Deprecated: Use Data_TypeDetails.ProtoReflect.Descriptor instead.

func (*Data_TypeDetails) GetIsPlatformSpecific

func (x *Data_TypeDetails) GetIsPlatformSpecific() bool

func (*Data_TypeDetails) GetType

func (x *Data_TypeDetails) GetType() Data_Type

func (*Data_TypeDetails) ProtoMessage

func (*Data_TypeDetails) ProtoMessage()

func (*Data_TypeDetails) ProtoReflect

func (x *Data_TypeDetails) ProtoReflect() protoreflect.Message

func (*Data_TypeDetails) Reset

func (x *Data_TypeDetails) Reset()

func (*Data_TypeDetails) String

func (x *Data_TypeDetails) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL