web

package
v0.0.0-...-0eb6aec Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2017 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeType

type ChangeType string

ChangeType is type of change that affects a line, such as added or removed.

const (
	// ChangeAdd means a line was added.
	ChangeAdd ChangeType = "add"
	// ChangeRemove means a line was removed.
	ChangeRemove ChangeType = "remove"
	// ChangeNone means a line was unchanged.
	ChangeNone ChangeType = "none"
)

type Hunk

type Hunk struct {
	Range string
	Lines []Line
}

A Hunk represents a single hunk of changed lines.

type Line

type Line struct {
	Line       string
	ChangeType ChangeType
	LineNo     int
	Issues     []db.Issue
}

A Line represents a single line in a diff.

type Patch

type Patch struct {
	Path  string
	Hunks []Hunk
}

A Patch represents a single file's patch.

func DiffIssues

func DiffIssues(ctx context.Context, diffReader io.Reader, issues []db.Issue) ([]Patch, error)

DiffIssues reads a diff and adds the issues to the lines affected. Only hunks with issues will be returned.

type VCSReader

type VCSReader interface {
	// Diff returns a multi file unified diff as an io.ReadCloser, return nil
	// if no diff could be found or returns an error if an error is found.
	Diff(ctx context.Context, repositoryID int, commitFrom string, commitTo string, requestNumber int) (io.ReadCloser, error)
}

A VCSReader reads information about a completed analysis.

func NewVCS

func NewVCS(github *github.GitHub, analysis *db.Analysis) (VCSReader, error)

NewVCS returns a VCSReader for a given analysis.

type Web

type Web struct {
	// contains filtered or unexported fields
}

Web handles general web/html responses (not API hooks).

func NewWeb

func NewWeb(logger logger.Logger, db db.DB, gh *github.GitHub) (*Web, error)

NewWeb returns a new Web instance, or an error.

func (*Web) AnalysisHandler

func (web *Web) AnalysisHandler(w http.ResponseWriter, r *http.Request)

AnalysisHandler displays a single analysis.

func (*Web) NotFoundHandler

func (web *Web) NotFoundHandler(w http.ResponseWriter, r *http.Request)

NotFoundHandler displays a 404 not found error

Jump to

Keyboard shortcuts

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