reviewdiff

package
v0.8.30 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 11 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 FormatChunkedCoverageSummary

func FormatChunkedCoverageSummary(plan ChunkPlan, chunksReviewed int, maxEntries int) string

func FormatCoverageSummary

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

func FormatInteractivePromptCoverageSummary

func FormatInteractivePromptCoverageSummary(plan ChunkPlan, chunksIncluded int, maxEntries int) string

func HasGeneratedHeader

func HasGeneratedHeader(patch string) bool

func IsAllowableNotReviewedFile

func IsAllowableNotReviewedFile(file FileCoverage) bool

IsAllowableNotReviewedFile reports whether an unreviewed file is explicitly non-material.

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 ChunkOptions

type ChunkOptions struct {
	MaxChunkBytes            int
	MaxFileDiffBytes         int
	MaxFilesPerChunk         int
	MaxChunks                int
	MaxOmittedSummaryEntries int
}

func DefaultChunkOptions

func DefaultChunkOptions() ChunkOptions

type ChunkPlan

type ChunkPlan struct {
	DiffSet  DiffSet
	Chunks   []ReviewChunk
	Coverage CoverageSummary
	Warnings []string
}

func ChunkForReview

func ChunkForReview(diff DiffSet, opts ChunkOptions) ChunkPlan

type CollectRequest

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

type CoverageMode

type CoverageMode string
const (
	CoverageModeFull    CoverageMode = "full"
	CoverageModeChunked CoverageMode = "chunked"
	CoverageModePartial CoverageMode = "partial"
)

type CoverageSummary

type CoverageSummary struct {
	Source                          string
	TotalFiles                      int
	ReviewMode                      CoverageMode
	ChunksPlanned                   int
	ChunksReviewed                  int
	FilesReviewed                   int
	FilesReviewedWithTruncatedDiffs int
	FilesSummarizedNotReviewed      int
	FilesNotReviewed                int
	OmittedByReason                 map[string]int
	NotReviewedFiles                []FileCoverage
	ReviewedFiles                   []FileCoverage
	TruncatedFiles                  []FileCoverage
	Warnings                        []string
	Complete                        bool
	PartialReason                   string
	ExceededMaxChunks               bool
	RequiredChunks                  int
	MaxChunks                       int
}

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 FileCoverage

type FileCoverage struct {
	File        ChangedFile
	Path        string
	Status      string
	Reviewed    bool
	Truncated   bool
	NotReviewed bool
	Reason      string
	ChunkIndex  int
}

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
	Chunks   []ReviewChunk
	Coverage CoverageSummary
}

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

type ReviewChunk

type ReviewChunk struct {
	Index          int
	Total          int
	Text           string
	IncludedFiles  []ChangedFile
	OmittedFiles   []ChangedFile
	TruncatedFiles []ChangedFile
	Warnings       []string
	UsedDiffBytes  int
	WasLimited     bool
}

Jump to

Keyboard shortcuts

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