issue

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PENDING_ISSUE   = "pending"
	PROCESSED_ISSUE = "processed"
)
View Source
const (
	SINGLE_LINE_COMMENT = "s"
	MULTI_LINE_COMMENT  = "m"
)

Variables

View Source
var CommentNotations = map[string]CommentNotation{

	"default": {
		SingleLinePrefixRe: regexp.MustCompile(`#`),
	},
	// contains filtered or unexported fields
}

Functions

func PrintIssueDetails added in v0.8.5

func PrintIssueDetails(issues []Issue, keyStyle, valStyle lipgloss.Style)

Types

type CommentManager added in v0.8.5

type CommentManager interface {
	ParseComment(startLineNumber int) ([]Issue, error)
}

func NewCommentManager added in v0.8.5

func NewCommentManager(arg NewCommentManagerParams) (CommentManager, error)

type CommentNotation

type CommentNotation struct {
	SingleLinePrefixRe *regexp.Regexp
	SingleLineSuffixRe *regexp.Regexp
	MultiLinePrefixRe  *regexp.Regexp
	MultiLineSuffixRe  *regexp.Regexp
	NewLinePrefixRe    *regexp.Regexp
}

func NewCommentNotation

func NewCommentNotation(ext string) CommentNotation

func (*CommentNotation) FindPrefixLocations added in v0.8.5

func (cn *CommentNotation) FindPrefixLocations(line []byte) ([]int, string)

type Issue

type Issue struct {
	ID                   string
	Title                string
	Description          string
	FilePath             string
	FileName             string
	StartLineNumber      int
	EndLineNumber        int
	AnnotationLineNumber int
	ColumnLocations      [][]int
}

type IssueManager

type IssueManager interface {
	GetIssues() []Issue
	Scan(r io.Reader, path string) error
	Walk(root string, ignore []regexp.Regexp) (int, error)
}

func NewIssueManager

func NewIssueManager(issueType string, annotation string) (IssueManager, error)

NewIssueManager will return either a PendingIssue struct or ProcessedIssue struct that satisfies the methods defined in the IssueManager interface. The methods in said interface are used to report new issues an SCM or locate issues that have been reported to an SCM. Each struct will implement methods for walking the project directory and parsing source code files. The main difference is that pending issues will have an annotation with no id, since they haven't been pushed to an scm yet, and processed issues will have their original annotation plus an id so they can be located and removed from the source code file at a later time.

type NewCommentManagerParams added in v0.8.5

type NewCommentManagerParams struct {
	Annotation      string
	CommentType     string
	FilePath        string
	FileName        string
	StartLineNumber int
	Locations       []int
	PrefixRe        *regexp.Regexp
	SuffixRe        *regexp.Regexp
	Scanner         *bufio.Scanner
}

type PendingIssue

type PendingIssue struct {
	Annotation string
	Issues     []Issue
}

func (*PendingIssue) GetIssues

func (pi *PendingIssue) GetIssues() []Issue

func (*PendingIssue) Scan

func (pi *PendingIssue) Scan(r io.Reader, path string) error

func (*PendingIssue) Walk

func (pi *PendingIssue) Walk(root string, gitIgnore []regexp.Regexp) (int, error)

type ProcessedIssue

type ProcessedIssue struct {
	Annotation string
	Issues     []Issue
}

func (*ProcessedIssue) GetIssues

func (pi *ProcessedIssue) GetIssues() []Issue

func (*ProcessedIssue) Scan

func (pi *ProcessedIssue) Scan(r io.Reader, path string) error

func (*ProcessedIssue) Walk

func (pi *ProcessedIssue) Walk(root string, ignore []regexp.Regexp) (int, error)

type SingleLineComment added in v0.8.5

type SingleLineComment struct {
	Annotation               string
	AnnotationIndicator      bool
	FileName                 string
	FilePath                 string
	PrefixRe                 *regexp.Regexp
	SuffixRe                 *regexp.Regexp
	Scanner                  *bufio.Scanner
	CommentNotationLocations []int
}

func (*SingleLineComment) FindCutLocations added in v0.8.5

func (slc *SingleLineComment) FindCutLocations(line []byte) ([]int, error)

func (*SingleLineComment) FindSuffixLocations added in v0.8.5

func (slc *SingleLineComment) FindSuffixLocations(line []byte) []int

func (*SingleLineComment) NewIssue added in v0.8.5

func (slc *SingleLineComment) NewIssue(buf *bytes.Buffer, lineNumber int) *Issue

func (*SingleLineComment) ParseComment added in v0.8.5

func (slc *SingleLineComment) ParseComment(start int) ([]Issue, error)

func (*SingleLineComment) Slice added in v0.8.5

func (slc *SingleLineComment) Slice(line []byte, indices []int) ([]byte, error)

func (*SingleLineComment) Write added in v0.8.5

func (slc *SingleLineComment) Write(wr io.Writer, field []byte) (int, error)

Jump to

Keyboard shortcuts

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