analyzer

package
v0.0.0-...-96c19a0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package analyzer implements the main logic of an analysis determining if two versions of files in a modified files set (described by two different diffs) are semantically equivalent despite not being (syntactically) identical. The analyzer determines if a diff should be auto-approved, so the worst case scenario of the analyzer rejecting auto-approval or altogether failing is that the diff will have to be approved manually.

Index

Constants

View Source
const (
	Approve = 0
	Reject  = 1
	Failure = -1
)

Status (exit) codes

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer struct {
	// BaseDiff is location of the base diff file
	BaseDiff string
	// LastDiff is location of the last diff file
	LastDiff string

	// SubAnalyzers contains all available sub-analyzers for different
	// file formats, other than the fallback analyzer.
	SubAnalyzers []common.Analyzer

	// FallbackAnalyzer handles all files not handled by more
	// specialized analyzers
	FallbackAnalyzer fallback.Analyzer
}

Analyzer contains analyzer-specific data.

func (*Analyzer) Analyze

func (a *Analyzer) Analyze() (int, error)

Analyze analyzes diffs and (if necessary) source files after the all the intermediate representation needed for analysis is already constructed.

func (*Analyzer) Run

func (a *Analyzer) Run(baseDir string, lastDir string) (int, error)

Run is the main driver function for the analyzer assuming that source files representing base diff and last diff are located in separate directories. It compares the files reflecting changes in the base diff and the last diff to determine if the files are equivalent (in which case the function returns const value Approve) or not (in which case the function returns const value Reject). If function call result in an error, for convenience, const value Failure will be return as a result.

func (*Analyzer) Setup

func (a *Analyzer) Setup() (int, []string)

Setup sets up the analyzer before the analysis can commence.

Directories

Path Synopsis
Package bazel implements the main logic of the analysis for Bazel-related files.
Package bazel implements the main logic of the analysis for Bazel-related files.
Package common provides support shared by various parts of the analyzer.
Package common provides support shared by various parts of the analyzer.
Package core implements the main logic of the analysis for "core" source files, that is source files that can be translated into the same meta-IR and are therefore subject to uniform equivalence analysis.
Package core implements the main logic of the analysis for "core" source files, that is source files that can be translated into the same meta-IR and are therefore subject to uniform equivalence analysis.
Package gomod implements the main logic of the analysis for go.mod files.
Package gomod implements the main logic of the analysis for go.mod files.
Package protobuf implements the main logic of the analysis for protobuf files.
Package protobuf implements the main logic of the analysis for protobuf files.
Package sql implements the main logic of the analysis for sql files.
Package sql implements the main logic of the analysis for sql files.
Package starlark implements the main logic of the analysis for starlark files.
Package starlark implements the main logic of the analysis for starlark files.
Package thrift implements the main logic of the analysis for thrift files.
Package thrift implements the main logic of the analysis for thrift files.
Package yaml implements the main logic of the analysis for yaml files.
Package yaml implements the main logic of the analysis for yaml files.

Jump to

Keyboard shortcuts

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