review

package
v0.0.0-...-3196316 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

The review package contains helper methods to create review requests to be sent to the bot endpoint layer, especially CLAIR.

Index

Constants

This section is empty.

Variables

View Source
var CLIApp = &flowutil.CLIApp{
	App: cli.App{

		Name:    "review",
		Usage:   "Review code following tenets in codelingo.yaml.",
		Version: "0.0.0",

		Flags: []cli.Flag{
			cli.StringFlag{
				Name:  util.DiffFlg.String(),
				Usage: "Review only unstaged changes in the working tree.",
			},
			cli.StringFlag{
				Name:  util.OutputFlg.String(),
				Usage: "File to save found issues to.",
			},
			cli.StringFlag{
				Name:  util.FormatFlg.String(),
				Value: "json-pretty",
				Usage: "How to format the found issues. Possible values are: json, json-pretty.",
			},
			cli.BoolFlag{
				Name:  util.KeepAllFlg.String(),
				Usage: "Keep all issues and don't be prompted to confirm each issue.",
			},
			cli.StringFlag{
				Name:  util.DirectoryFlg.String(),
				Usage: "Review a given directory.",
			},
			cli.BoolFlag{
				Name:  "debug",
				Usage: "Display debug messages",
			},
			cli.BoolFlag{
				Name:   "insecure",
				Hidden: true,
				Usage:  "Review without TLS",
			},
			cli.StringFlag{
				Name:  "repo",
				Usage: "Review a repo directly, e.g. github.com/some/repo",
			},
			cli.StringFlag{
				Name:  "commit",
				Usage: "With --repo, review a specific commit",
			},
		},
	},
	Tagline: "Automated Code Reviews",
	Request: reviewAction,
}
View Source
var DecoratorApp = &flowutil.DecoratorApp{
	App: cli.App{
		Name:  "review",
		Usage: "Comment on the decorated code.",
		Flags: []cli.Flag{},
	},
	ConfirmDecorated: decoratorAction,
	SetUserVar: func(v *flowutil.UserVar) {
		v.Set()
	},

	DecoratorUsage:   "<comment>",
	DecoratorExample: `"this is a review comment"`,
}

Functions

func MakeReport

func MakeReport(cliCtx *cli.Context, issues []*ReportStrt) (string, error)

func NewRange

func NewRange(filename string, startLine, endLine int) *flow.IssueRange

func ReadDotLingo

func ReadDotLingo(ctx *cli.Context) (string, error)

Read a codelingo.yaml file from a filepath argument

func RequestReview

func RequestReview(ctx context.Context, req *flow.ReviewRequest, insecure bool) (chan proto.Message, <-chan *flowutil.UserVar, chan error, error)

Types

type Options

type Options struct {
	// TODO(waigani) validate PullRequest
	PullRequest  string
	FilesAndDirs []string
	Diff         bool   // ctx.Bool("diff") TODO(waigani) this should be a sub-command which proxies to git diff
	SaveToFile   string // ctx.String("save")
	KeepAll      bool   // ctx.Bool("keep-all")
	DotLingo     string // ctx.Bool("lingo-file")

}

type PROpts

type PROpts struct {
	Host     string
	HostName string
	Owner    string
	Name     string
	PRID     int
}

func ParsePR

func ParsePR(urlStr string) (*PROpts, error)

ParsePR produces a set of PROpts to be sent to CLAIR in the bot endpoint layer

type ReportStrt

type ReportStrt struct {
	Name     string
	Comment  string
	Filename string
	Line     int
	Snippet  string
}

Jump to

Keyboard shortcuts

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