commentpolicy

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcknowledgementExcerpt

func AcknowledgementExcerpt(content []byte, comment SourceComment) (string, error)

AcknowledgementExcerpt selects a unique anchor that contains the retained comment.

func IsCommentIntent

func IsCommentIntent(comment SourceComment) bool

IsCommentIntent distinguishes prose from text that parses as Go statements.

Types

type Conversion

type Conversion struct {
	Content []byte
	Body    string
	Excerpt string
}

Conversion is the source edit and deterministic code anchor for comment intent.

func Convert

func Convert(content []byte, comment SourceComment) (Conversion, error)

Convert removes one comment and selects nearby code as its annotation anchor.

type SourceComment

type SourceComment struct {
	File  string
	Raw   string
	Body  string
	Line  int
	Start int
	End   int
}

SourceComment is an exact syntactic comment group in one source file.

func Find

func Find(file string, content []byte, excerpt string) (SourceComment, error)

Find returns the one comment group matching a verbatim excerpt.

type Violation

type Violation struct {
	Comment SourceComment
	Reason  string
}

Violation is a prohibited comment and the action that resolves it.

func Check

func Check(rootPath string, configured policy.Policy, requested []string) (_ []Violation, returnedError error)

Check scans supported source and returns every prohibited comment.

func CheckContent

func CheckContent(file string, content []byte, configured policy.Policy, records []store.Annotation) ([]Violation, error)

CheckContent applies comment policy to an in-memory source document.

Jump to

Keyboard shortcuts

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