instance

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address      string   `json:"address"`
	Username     string   `json:"username"`
	Password     string   `json:"password"`
	Organization string   `json:"organization"`
	MetricKeys   []string `json:"metricKeys"`
}

Config is the structure of the configuration for a single SonarQube instance.

type Instance

type Instance interface {
	GetName() string
	GetProjects(ctx context.Context, query, pageSize, pageNumber string) (*ResponseProjects, error)
	GetProjectMeasures(ctx context.Context, project string, metricKeys []string) (*ResponseProjectMeasures, error)
}

Instance is the interface which must be implemented by a single SonarQube instance.

func New

func New(name string, options map[string]any) (Instance, error)

New returns a new Elasticsearch instance for the given configuration.

type Metric

type Metric struct {
	Key                   string `json:"key"`
	Name                  string `json:"name"`
	Description           string `json:"description"`
	Domain                string `json:"domain"`
	Type                  string `json:"type"`
	HigherValuesAreBetter bool   `json:"higherValuesAreBetter"`
	Qualitative           bool   `json:"qualitative"`
	Hidden                bool   `json:"hidden"`
	DecimalScale          int    `json:"decimalScale,omitempty"`
	BestValue             string `json:"bestValue,omitempty"`
	WorstValue            string `json:"worstValue,omitempty"`
}

type MockInstance

type MockInstance struct {
	mock.Mock
}

MockInstance is an autogenerated mock type for the Instance type

func NewMockInstance

func NewMockInstance(t NewMockInstanceT) *MockInstance

NewMockInstance creates a new instance of MockInstance. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockInstance) GetName

func (_m *MockInstance) GetName() string

GetName provides a mock function with given fields:

func (*MockInstance) GetProjectMeasures

func (_m *MockInstance) GetProjectMeasures(ctx context.Context, project string, metricKeys []string) (*ResponseProjectMeasures, error)

GetProjectMeasures provides a mock function with given fields: ctx, project, metricKeys

func (*MockInstance) GetProjects

func (_m *MockInstance) GetProjects(ctx context.Context, query string, pageSize string, pageNumber string) (*ResponseProjects, error)

GetProjects provides a mock function with given fields: ctx, query, pageSize, pageNumber

type NewMockInstanceT

type NewMockInstanceT interface {
	mock.TestingT
	Cleanup(func())
}

type Paging

type Paging struct {
	PageIndex int64 `json:"pageIndex"`
	PageSize  int64 `json:"pageSize"`
	Total     int64 `json:"total"`
}

type Project

type Project struct {
	Key              string `json:"key"`
	Name             string `json:"name"`
	Qualifier        string `json:"qualifier"`
	Visibility       string `json:"visibility"`
	LastAnalysisDate string `json:"lastAnalysisDate"`
	Revision         string `json:"revision"`
}

type ProjectMeasures

type ProjectMeasures struct {
	Key         string `json:"key"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Qualifier   string `json:"qualifier"`
	Measures    []struct {
		Metric    string `json:"metric"`
		Value     string `json:"value"`
		BestValue bool   `json:"bestValue,omitempty"`
	} `json:"measures"`
}

type ResponseError

type ResponseError struct {
	Errors []struct {
		Msg string `json:"msg"`
	} `json:"errors"`
}

ResponseError is the structure for a failed SonarQube API request.

type ResponseProjectMeasures

type ResponseProjectMeasures struct {
	Component ProjectMeasures `json:"component"`
	Metrics   []Metric        `json:"metrics"`
}

type ResponseProjects

type ResponseProjects struct {
	Paging     Paging    `json:"paging"`
	Components []Project `json:"components"`
}

Jump to

Keyboard shortcuts

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