formatters

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coverage

type Coverage []nulls.Int

func (Coverage) MarshalJSON

func (c Coverage) MarshalJSON() ([]byte, error)

MarshalJSON marshals the coverage into JSON. Since the Code Climate API requires this as a string "[1,2,null]" and not just a straight JSON array we have to do a bunch of work to coerce into that format

func (*Coverage) UnmarshalJSON

func (c *Coverage) UnmarshalJSON(text []byte) error

type Formatter

type Formatter interface {
	Search(...string) (string, error)
	Parse() error
	Format() (Report, error)
}

type LineCounts

type LineCounts struct {
	Missed  int `json:"missed"`
	Covered int `json:"covered"`
	Total   int `json:"total"`
}

func (LineCounts) CoveredPercent

func (lc LineCounts) CoveredPercent() float64

type Report

type Report struct {
	CIService       env.Environment `json:"ci_service"`
	Environment     ccEnvironment   `json:"environment"`
	Git             ccGit           `json:"git"`
	CoveredPercent  float64         `json:"covered_percent"`
	CoveredStrength int             `json:"covered_strength"`
	LineCounts      LineCounts      `json:"line_counts"`
	SourceFiles     SourceFiles     `json:"source_files"`
	RepoToken       string          `json:"repo_token"`
}

func NewReport

func NewReport() (Report, error)

func (*Report) AddSourceFile

func (rep *Report) AddSourceFile(sf SourceFile) error

func (*Report) Merge

func (a *Report) Merge(reps ...*Report) error

func (Report) Save

func (r Report) Save(w io.Writer) error

type SourceFile

type SourceFile struct {
	BlobID          string     `json:"blob_id"`
	Coverage        Coverage   `json:"coverage"`
	CoveredPercent  float64    `json:"covered_percent"`
	CoveredStrength int        `json:"covered_strength"`
	LineCounts      LineCounts `json:"line_counts"`
	Name            string     `json:"name"`
}

func NewSourceFile

func NewSourceFile(name string) (SourceFile, error)

func (*SourceFile) CalcLineCounts

func (sf *SourceFile) CalcLineCounts()

func (SourceFile) Merge

func (a SourceFile) Merge(b SourceFile) (SourceFile, error)

type SourceFiles

type SourceFiles map[string]SourceFile

func (SourceFiles) MarshalJSON

func (sf SourceFiles) MarshalJSON() ([]byte, error)

func (SourceFiles) UnmarshalJSON

func (sf SourceFiles) UnmarshalJSON(text []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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