ade_linter

package module
v0.0.0-...-3379f05 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 9 Imported by: 1

README ¶

ade-linter 🧼

This go package detects errors in ADE, the excel document used to build the backend.

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	PacketTable      = "Packets"
	MeasurementTable = "Measurements"
	Structures       = "Structures"
)
View Source
const (
	Addresses  = "addresses"
	Units      = "units"
	Ports      = "ports"
	BoardIds   = "board_ids"
	MessageIds = "message_ids"
	BackendKey = "Backend"
)
View Source
const (
	GLOBAL_INFO  = "GLOBAL INFO"
	BOARD_PREFIX = "BOARD "
)
View Source
const TablePrefix = "[TABLE]"

Variables ¶

View Source
var (
	UnitExp = regexp.MustCompile(fmt.Sprintf(`^(?:[/+*\-]%s+)+$`, FloatExp))
	IpExp   = regexp.MustCompile(`^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$`)
	IdExp   = regexp.MustCompile(`^\d+$`)
)
View Source
var FloatExp = `(?:\-?\d+(?:\.\d+)?)`
View Source
var Log = NewLogger()
View Source
var (
	RangeExp = regexp.MustCompile(fmt.Sprintf(`^\[(?:(?:%s,%s)|(?:,%s)|(?:%s,))\]$`, FloatExp, FloatExp, FloatExp, FloatExp))
)

Functions ¶

func CheckAll ¶

func CheckAll(tests []Test) bool

func CheckBoardIds ¶

func CheckBoardIds(boardIds map[string]string, addresses map[string]string) error

func CheckId ¶

func CheckId(id string) bool

func CheckIp ¶

func CheckIp(ipStr string) bool

func CheckMeasurementUnits ¶

func CheckMeasurementUnits(unitStr string) bool

func CheckMessageId ¶

func CheckMessageId(id string) bool

func CheckPacketType ¶

func CheckPacketType(kind string) bool

func CheckPort ¶

func CheckPort(portStr string) bool

func CheckRange ¶

func CheckRange(rangeStr string) bool

func CheckUnit ¶

func CheckUnit(unitStr string) bool

func Every ¶

func Every[T any](slice []T, predicate func(T) bool) bool

func EveryMap ¶

func EveryMap[K comparable, V any](m map[K]V, predicate func(key K, value V) bool) bool

func IsEnum ¶

func IsEnum(kind string) bool

func Keys ¶

func Keys[K comparable, V any](m map[K]V) []K

func Lint ¶

func Lint(file *excelize.File) bool

func Map ¶

func Map[T any, U any](slice []T, mapFn func(T) U) []U

func NewMap ¶

func NewMap[K comparable, V any](oldMap map[K]V) map[K]V

func Reverse ¶

func Reverse[T any](slice []T) []T

func Some ¶

func Some[T any](slice []T, predicate func(T) bool) bool

Types ¶

type Board ¶

type Board struct {
	Packets      Table
	Measurements Table
	Structures   Table
	// contains filtered or unexported fields
}

func (Board) Run ¶

func (board Board) Run() bool

type Cell ¶

type Cell = string

type Document ¶

type Document struct {
	Sheets map[string]Sheet
}

func NewDocument ¶

func NewDocument() Document

type FalseTest ¶

type FalseTest struct{}

func (FalseTest) Run ¶

func (test FalseTest) Run() bool

type GlobalInfo ¶

type GlobalInfo struct {
	Addresses  map[string]string
	Units      map[string]string
	Ports      map[string]string
	BoardIds   map[string]string
	MessageIds map[string]string
}

type Logger ¶

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

func NewLogger ¶

func NewLogger() Logger

func (Logger) AddEntry ¶

func (logger Logger) AddEntry(kind string, name string) Logger

func (Logger) Error ¶

func (logger Logger) Error(err error)

func (Logger) Pass ¶

func (logger Logger) Pass(msg string)

func (Logger) Warn ¶

func (logger Logger) Warn(err error)

type Measurement ¶

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

func (Measurement) Run ¶

func (m Measurement) Run() bool

type Packet ¶

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

func (Packet) Run ¶

func (packet Packet) Run() bool

type Sheet ¶

type Sheet = [][]Cell

type StackEntry ¶

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

type Structure ¶

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

type Table ¶

type Table = [][]Cell

type Tables ¶

type Tables = map[string]Table

type Test ¶

type Test interface {
	Run() bool
}

Directories ¶

Path Synopsis

Jump to

Keyboard shortcuts

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