comment

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package comment maps review findings to inline diff positions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterMode

type FilterMode int

FilterMode controls which lines are eligible for comment placement. It determines how strictly findings must align with the diff to be included in the output.

const (
	// FilterAdded reports only on added lines (lines starting with +).
	// This is the most conservative mode and the default behavior.
	FilterAdded FilterMode = iota

	// FilterDiffContext reports on any line within the diff context,
	// including context lines (unchanged) surrounding the changes.
	FilterDiffContext

	// FilterFile reports on any line in a changed file, even lines
	// outside the diff hunks. Useful for whole-file analysis.
	FilterFile

	// FilterNone reports everything regardless of diff — no filtering
	// is applied. All findings are included as comments.
	FilterNone
)

type FindingInput

type FindingInput struct {
	Concern   string
	Severity  int
	File      string
	Line      int
	EndLine   int
	Message   string
	Fix       string
	Reasoning string
}

FindingInput is the input format for MapToInline.

type Inline

type Inline struct {
	Path       string
	StartLine  int
	EndLine    int
	Body       string
	Suggestion string
}

Inline represents a comment positioned on a specific line in a diff.

func MapToInline

func MapToInline(findings []FindingInput, files []diff.File) []Inline

MapToInline converts findings to positioned inline comments. Only includes findings that map to valid positions in the diff. Uses FilterAdded mode (only added lines) for backward compatibility.

func MapToInlineFiltered

func MapToInlineFiltered(findings []FindingInput, files []diff.File, mode FilterMode) []Inline

MapToInlineFiltered converts findings to positioned inline comments using the specified FilterMode to control which findings are included.

Jump to

Keyboard shortcuts

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