reviewdiff

package
v0.8.27 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxTotalDiffBytes        = 180000
	DefaultMaxFileDiffBytes         = 40000
	DefaultMaxIncludedFiles         = 80
	DefaultMaxOmittedSummaryEntries = 100
	LargeLockfileDiffBytes          = 20000
)
View Source
const GitHubRawDiffSource = "github-raw-diff"
View Source
const LocalGitSource = "local-git"

Variables

This section is empty.

Functions

func FormatCoverageSummary

func FormatCoverageSummary(diff DiffSet, rendered RenderResult, maxOmittedEntries int) string

func HasGeneratedHeader

func HasGeneratedHeader(patch string) bool

func IsGeneratedPath

func IsGeneratedPath(path string) bool

func IsLargeLockfile

func IsLargeLockfile(path string, diffBytes int) bool

func IsLikelyBinaryPath

func IsLikelyBinaryPath(path string) bool

Types

type ChangeStatus

type ChangeStatus string
const (
	ChangeAdded       ChangeStatus = "added"
	ChangeModified    ChangeStatus = "modified"
	ChangeDeleted     ChangeStatus = "deleted"
	ChangeRenamed     ChangeStatus = "renamed"
	ChangeCopied      ChangeStatus = "copied"
	ChangeTypeChanged ChangeStatus = "type_changed"
	ChangeUnknown     ChangeStatus = "unknown"
)

type ChangedFile

type ChangedFile struct {
	Path         string
	OldPath      string
	Status       ChangeStatus
	Additions    int
	Deletions    int
	Changes      int
	Patch        string
	Binary       bool
	Generated    bool
	Large        bool
	Truncated    bool
	Omitted      bool
	OmitReason   string
	PreviousMode string
	CurrentMode  string
}

func MarkGeneratedAndLarge

func MarkGeneratedAndLarge(file ChangedFile, opts RenderOptions) ChangedFile

type CollectRequest

type CollectRequest struct {
	PRNumber int
	BaseRef  string
	HeadRef  string
	BaseSHA  string
	HeadSHA  string
}

type DiffSet

type DiffSet struct {
	PRNumber int
	BaseSHA  string
	HeadSHA  string
	Source   string
	Files    []ChangedFile
	Warnings []string
}

func FromPlatformFiles

func FromPlatformFiles(prNumber int, baseSHA string, headSHA string, files []*platform.PullRequestFile) DiffSet

type LocalCollector

type LocalCollector struct {
	Git    *git.Git
	Remote string
}

func (LocalCollector) Collect

func (c LocalCollector) Collect(ctx context.Context, req CollectRequest) (DiffSet, error)

type PrepareRequest

type PrepareRequest struct {
	PRNumber     int
	BaseRef      string
	HeadRef      string
	BaseSHA      string
	HeadSHA      string
	RepoRoot     string
	Git          *git.Git
	PullRequests platform.PullRequestService
}

type PreparedDiff

type PreparedDiff struct {
	DiffSet  DiffSet
	Rendered RenderResult
}

func PrepareForReview

func PrepareForReview(ctx context.Context, req PrepareRequest) (PreparedDiff, error)

type RenderOptions

type RenderOptions struct {
	MaxTotalDiffBytes        int
	MaxFileDiffBytes         int
	MaxIncludedFiles         int
	MaxOmittedSummaryEntries int
}

func DefaultRenderOptions

func DefaultRenderOptions() RenderOptions

type RenderResult

type RenderResult struct {
	Text           string
	IncludedFiles  []ChangedFile
	OmittedFiles   []ChangedFile
	TruncatedFiles []ChangedFile
	Warnings       []string
	WasLimited     bool
}

func RenderForReview

func RenderForReview(diff DiffSet, opts RenderOptions) RenderResult

Jump to

Keyboard shortcuts

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