validate

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package validate registers and implements the "validate" apic command.

The validate command analyses the specified API for correctness, reporting errors if any problems are found.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrUnreachable

type ErrUnreachable struct {
	analysis.Unreachable
}

ErrUnreachable is the error raised for unreachable code. It wraps an analysis.Unreachable with an error interface.

func (ErrUnreachable) Error

func (e ErrUnreachable) Error() string

type Issue

type Issue struct {
	At      cst.Fragment
	Problem interface{}
}

Issue holds details of a problem found when validating an API file.

func (Issue) String

func (i Issue) String() string

type Issues

type Issues []Issue

Issues is a list of issues.

func Inspect

func Inspect(api *semantic.API, mappings *semantic.Mappings) Issues

Inspect checks the following: * There are no unreachable blocks. TODO: Check map indices are properly guarded by a check.

func Validate

func Validate(api *semantic.API, mappings *semantic.Mappings, options *Options) Issues

Validate performs a number of checks on the api file for correctness. If any problems are found then they are returned as errors. If options is nil then full validation is performed.

func WithAnalysis

func WithAnalysis(api *semantic.API, mappings *semantic.Mappings, options *Options, analysis *analysis.Results) Issues

WithAnalysis performs a number of checks on the api file for correctness using pre-built analysis results. If any problems are found then they are returned as errors. If options is nil then full validation is performed.

func (Issues) Len

func (l Issues) Len() int

func (Issues) Less

func (l Issues) Less(i, j int) bool

func (Issues) String

func (l Issues) String() string

func (Issues) Swap

func (l Issues) Swap(i, j int)

type Options

type Options struct {
	CheckUnused bool // Should unused types, fields, etc be reported?
}

Options controls the validation that's performed.

Jump to

Keyboard shortcuts

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