breaking

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AllCheckers are all known Checkers.
	//
	// Purposely not configurable - there are some dependencies between linters, for example if a message is deleted,
	// ENUMS_NOT_DELETED will not print out any nested enums that were deleted.
	AllCheckers = []Checker{
		{
			ID:      "ENUMS_NOT_DELETED",
			Purpose: "Checks that no enums have been deleted.",
			Check:   checkEnumsNotDeleted,
		},
		{
			ID:      "ENUM_VALUES_NOT_DELETED",
			Purpose: "Checks that no enum values have been deleted.",
			Check:   checkEnumValuesNotDeleted,
		},
		{
			ID:      "ENUM_VALUES_SAME_NAME",
			Purpose: "Checks that enum values have the same name.",
			Check:   checkEnumValuesSameName,
		},
		{
			ID:      "MESSAGES_NOT_DELETED",
			Purpose: "Checks that no messages have been deleted.",
			Check:   checkMessagesNotDeleted,
		},
		{
			ID:      "MESSAGE_FIELDS_NOT_DELETED",
			Purpose: "Checks that no message fields have been deleted.",
			Check:   checkMessageFieldsNotDeleted,
		},
		{
			ID:      "MESSAGE_FIELDS_SAME_LABEL",
			Purpose: "Checks that message fields have the same label.",
			Check:   checkMessageFieldsSameLabel,
		},
		{
			ID:      "MESSAGE_FIELDS_SAME_NAME",
			Purpose: "Checks that message fields have the same name.",
			Check:   checkMessageFieldsSameName,
		},
		{
			ID:      "MESSAGE_FIELDS_SAME_ONEOF",
			Purpose: "Checks that message fields that were not in a oneof are not now in a oneof.",
			Check:   checkMessageFieldsSameOneof,
		},
		{
			ID:      "MESSAGE_FIELDS_SAME_TYPE",
			Purpose: "Checks that message fields have the same type.",
			Check:   checkMessageFieldsSameType,
		},
		{
			ID:      "MESSAGE_ONEOFS_NOT_DELETED",
			Purpose: "Checks that no message oneofs have been deleted.",
			Check:   checkMessageOneofsNotDeleted,
		},
		{
			ID:      "MESSAGE_ONEOFS_FIELDS_NOT_REMOVED",
			Purpose: "Checks that no message oneofs have fields removed.",
			Check:   checkMessageOneofsFieldsNotRemoved,
		},
		{
			ID:      "PACKAGES_NOT_DELETED",
			Purpose: "Checks that no packages have been deleted.",
			Check:   checkPackagesNotDeleted,
		},
		{
			ID:      "SERVICES_NOT_DELETED",
			Purpose: "Checks that no services have been deleted.",
			Check:   checkServicesNotDeleted,
		},
		{
			ID:      "SERVICE_METHODS_NOT_DELETED",
			Purpose: "Checks that no service methods have been deleted.",
			Check:   checkServiceMethodsNotDeleted,
		},
		{
			ID:      "SERVICE_METHODS_SAME_CLIENT_STREAMING",
			Purpose: "Checks that service methods have the same client streaming.",
			Check:   checkServiceMethodsSameClientStreaming,
		},
		{
			ID:      "SERVICE_METHODS_SAME_REQUEST_TYPE",
			Purpose: "Checks that service methods have the same request type.",
			Check:   checkServiceMethodsSameRequestType,
		},
		{
			ID:      "SERVICE_METHODS_SAME_RESPONSE_TYPE",
			Purpose: "Checks that service methods have the same response type.",
			Check:   checkServiceMethodsSameResponseType,
		},
		{
			ID:      "SERVICE_METHODS_SAME_SERVER_STREAMING",
			Purpose: "Checks that service methods have the same server streaming.",
			Check:   checkServiceMethodsSameServerStreaming,
		},
	}

	// PackagesNoBetaDepsChecker is a special checker that verifies no stable packages
	// import beta packages.
	PackagesNoBetaDepsChecker = Checker{
		ID:      "PACKAGES_NO_BETA_DEPS",
		Purpose: "Checks that stable packages do not have beta dependencies.",
		Check:   checkPackagesNoBetaDeps,
	}
)

Functions

This section is empty.

Types

type Checker

type Checker struct {
	// The ID of this Checker. This should be all UPPER_SNAKE_CASE.
	ID string
	// The purpose of this Checker. This should be a human-readable string.
	Purpose string
	// Check the compatibility of from and to.
	//
	// Returns an error only if there is a system error.
	Check func(addFailure func(*text.Failure), from *extract.PackageSet, to *extract.PackageSet) error
}

Checker checks compatibility.

type Runner

type Runner interface {
	// Run runs Check on all the associated Checkers.
	//
	// Returns Failures if there are incompatibilities, or error if there is
	// a system error
	Run(config settings.BreakConfig, from *extract.PackageSet, to *extract.PackageSet) ([]*text.Failure, error)
}

Runner runs a series of Checkers.

func NewRunner

func NewRunner(options ...RunnerOption) Runner

NewRunner returns a new Runner.

type RunnerOption

type RunnerOption func(*runner)

RunnerOption is an option for a new Runner.

func RunnerWithLogger

func RunnerWithLogger(logger *zap.Logger) RunnerOption

RunnerWithLogger returns a RunnerOption that uses the given logger.

The default is to use zap.NewNop().

Jump to

Keyboard shortcuts

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