validation

package
v0.0.36 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: Apache-2.0, NCSA Imports: 9 Imported by: 0

Documentation

Overview

Package validation contains logic for verifing the contents of a kzip. For now we consider a set of kzip files "valid" if they contain files covering all of a given source repo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coverage

type Coverage struct {
	// The missing paths.
	Paths []Dir
}

Coverage describes the missing subdirectories in a repo.

func (*Coverage) Len

func (c *Coverage) Len() int

Len reports the number of repo paths missing in the kzip archives. Len is part of sort.Interface.

func (*Coverage) Less

func (c *Coverage) Less(i, j int) bool

Less is part of sort.Interface. We sort based on number of files in the repo subdirectory that are missing from the corresponding kzip archives.

func (*Coverage) Swap

func (c *Coverage) Swap(i, j int)

Swap is part of sort.Interface.

type Dir

type Dir struct {
	// Path is a subdirectory from Repo root.
	Path string
	// Missing is the number of files in the Repo from the corresponding
	// subdirectory that were missing from the KZIP.
	Missing int
}

Dir describes a single missing subdirectory and how much is missing.

type Result

type Result struct {
	// Number of files in the kzip archives matching one of Langs extensions.
	NumArchiveFiles int
	// Number of files in the repo matching one of Langs extensions.
	NumRepoFiles int
	// Number of files in the repo that were not matched in the kzip.
	NumMissing int
	// A breakdown of subdirectories with the most missing files.
	TopMissing Coverage
	// Statistics on the count of archive source files by corpus and extension.
	Stats Statistics
}

Result explains a validation outcome.

type Settings

type Settings struct {
	// Path to the kzip files to validate.
	Compilations []string
	// Path to the root of the repo to compare the kzip against.
	Repo string
	// Language extensions to check, e.g. java, cpp, h.
	Langs stringset.Set
	// Optional file to output missing paths to.
	MissingOutput string
}

Settings encapsulates data for validation of a single kzip and repo.

func (Settings) Validate

func (s Settings) Validate() (*Result, error)

Validate opens a kzip file and compares all of its contained files with those present in the provided repo path. It returns results explaining what percentage of files are covered in the kzip.

type Statistics added in v0.0.31

type Statistics map[string]map[string]int

Statistics collects file count stats on the contents of an archive per corpus, a map from corpus to file extension to count.

Jump to

Keyboard shortcuts

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