apidiff

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package apidiff contains the code used for computing FIDL API differences.

The functions in this package operate on an API summary and produces a diff-like report and classification of changes.

Package apidiff contains the code used for computing FIDL API differences.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Classification

type Classification int

Classification is used to classify the API differences according to their safety.

const (
	// UnsetClassification is the default field value. It should *never*
	// appear as a valid Classification, and if it does it means that
	// something should have set the field but didn't.
	UnsetClassification Classification = iota
	// Undetermined is some sort of a change, but an additional pass is needed
	// to determine what exactly it should be.  It should not appear in the the
	// serialized output at all, we expect to backfill it once we know its
	// enclosing declaration.
	Undetermined
	// APIBreaking change will break compilation for clients.
	APIBreaking
	// Transitionable change can be made as a sequence of SourceCompatible
	// changes.
	Transitionable
	// SourceCompatible change does not break compilation.
	SourceCompatible
)

func ToClassification

func ToClassification(s string) Classification

ToClassification converts the supplied stirng into a Classification.

func (Classification) MarshalJSON

func (c Classification) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Classification) MarshalYAML

func (c Classification) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (Classification) String

func (c Classification) String() string

func (*Classification) UnmarshalJSON

func (c *Classification) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Classification) UnmarshalYAML

func (c *Classification) UnmarshalYAML(u func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type Report

type Report struct {
	// ApiDiff has the report items for each individual change of the API
	// surface for a FIDL library.
	ApiDiff []ReportItem `json:"api_diff,omitempty" yaml:"api_diff,omitempty"`
	// contains filtered or unexported fields
}

Report is a top-level wrapper for the API diff result.

func Compute

func Compute(before, after []summarize.ElementStr) (Report, error)

Compute computes the API difference between before and after.

func (*Report) BackfillForParentStrictness

func (r *Report) BackfillForParentStrictness(isStrict bool)

BackfillForParentStrictness backfills all ApiDiff indexes based on the appropriate strictness.

func (Report) WriteJSON

func (r Report) WriteJSON(w io.Writer) error

WriteJSON is a format function that writes JSON format from the given report items.

func (Report) WriteText

func (r Report) WriteText(w io.Writer) error

WriteText is a format function that writes the text format of the given report items.

type ReportItem

type ReportItem struct {
	// Name is the fully qualified name that this report item
	// pertains to.
	Name summarize.Name `json:"name" yaml:"name"`
	// Before is what the API summary used to look like.
	Before string `json:"before,omitempty" yaml:"before,omitempty"`
	// After is what the API summary looks like now.
	After string `json:"after,omitempty" yaml:"after,omitempty"`
	// Conclusion is the finding.
	Conclusion Classification `json:"conclusion" yaml:"conclusion"`
}

ReportItem is a single line item of the API diff report.

func (ReportItem) IsAdd

func (r ReportItem) IsAdd() bool

func (ReportItem) IsChange

func (r ReportItem) IsChange() bool

func (ReportItem) IsRemove

func (r ReportItem) IsRemove() bool

Jump to

Keyboard shortcuts

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