lint

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallFuncForEveryAsset added in v0.6.6

func CallFuncForEveryAsset(callable AssetValidator) func(pipeline *pipeline.Pipeline) ([]*Issue, error)

func EnsureNoNestedPipelines added in v0.4.1

func EnsureNoNestedPipelines(pipelinePaths []string) error

Types

type AssetValidator added in v0.5.6

type AssetValidator func(ctx context.Context, pipeline *pipeline.Pipeline, asset *pipeline.Asset) ([]*Issue, error)

func EnsureExecutableFileIsValidForASingleAsset added in v0.5.6

func EnsureExecutableFileIsValidForASingleAsset(fs afero.Fs) AssetValidator

type Issue

type Issue struct {
	Task        *pipeline.Asset
	Description string
	Context     []string
}

func EnsureDependencyExistsForASingleAsset added in v0.5.6

func EnsureDependencyExistsForASingleAsset(ctx context.Context, p *pipeline.Pipeline, task *pipeline.Asset) ([]*Issue, error)

func EnsureIngestrAssetIsValidForASingleAsset added in v0.6.6

func EnsureIngestrAssetIsValidForASingleAsset(ctx context.Context, p *pipeline.Pipeline, asset *pipeline.Asset) ([]*Issue, error)

func EnsureMaterializationValuesAreValidForSingleAsset added in v0.5.6

func EnsureMaterializationValuesAreValidForSingleAsset(ctx context.Context, p *pipeline.Pipeline, asset *pipeline.Asset) ([]*Issue, error)

func EnsurePipelineHasNoCycles

func EnsurePipelineHasNoCycles(p *pipeline.Pipeline) ([]*Issue, error)

EnsurePipelineHasNoCycles ensures that the pipeline is a DAG, and contains no cycles. Since the pipelines are directed graphs, strongly connected components mean cycles, therefore they would be considered invalid for our pipelines. Strong connectivity wouldn't work for tasks that depend on themselves, therefore there's a specific check for that.

func EnsurePipelineNameIsValid

func EnsurePipelineNameIsValid(pipeline *pipeline.Pipeline) ([]*Issue, error)

func EnsurePipelineScheduleIsValidCron

func EnsurePipelineScheduleIsValidCron(p *pipeline.Pipeline) ([]*Issue, error)

func EnsureSlackFieldInPipelineIsValid

func EnsureSlackFieldInPipelineIsValid(p *pipeline.Pipeline) ([]*Issue, error)

func EnsureSnowflakeSensorHasQueryParameterForASingleAsset added in v0.5.6

func EnsureSnowflakeSensorHasQueryParameterForASingleAsset(ctx context.Context, p *pipeline.Pipeline, asset *pipeline.Asset) ([]*Issue, error)

func EnsureTaskNameIsUnique

func EnsureTaskNameIsUnique(p *pipeline.Pipeline) ([]*Issue, error)

func EnsureTaskNameIsUniqueForASingleAsset added in v0.5.6

func EnsureTaskNameIsUniqueForASingleAsset(ctx context.Context, p *pipeline.Pipeline, asset *pipeline.Asset) ([]*Issue, error)

func EnsureTaskNameIsValidForASingleAsset added in v0.5.6

func EnsureTaskNameIsValidForASingleAsset(ctx context.Context, p *pipeline.Pipeline, asset *pipeline.Asset) ([]*Issue, error)

func EnsureTypeIsCorrectForASingleAsset added in v0.5.6

func EnsureTypeIsCorrectForASingleAsset(ctx context.Context, p *pipeline.Pipeline, asset *pipeline.Asset) ([]*Issue, error)

func (*Issue) MarshalJSON added in v0.6.8

func (i *Issue) MarshalJSON() ([]byte, error)

type Level added in v0.5.6

type Level int
const (
	LevelPipeline Level = iota
	LevelAsset
)

type Linter

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

func NewLinter

func NewLinter(findPipelines pipelineFinder, builder pipelineBuilder, rules []Rule, logger *zap.SugaredLogger) *Linter

func (*Linter) Lint

func (l *Linter) Lint(rootPath, pipelineDefinitionFileName string) (*PipelineAnalysisResult, error)

func (*Linter) LintAsset added in v0.5.6

func (l *Linter) LintAsset(rootPath, pipelineDefinitionFileName, assetNameOrPath string) (*PipelineAnalysisResult, error)

func (*Linter) LintPipeline added in v0.4.1

func (l *Linter) LintPipeline(p *pipeline.Pipeline) (*PipelineIssues, error)

func (*Linter) LintPipelines

func (l *Linter) LintPipelines(pipelines []*pipeline.Pipeline) (*PipelineAnalysisResult, error)

type PipelineAnalysisResult

type PipelineAnalysisResult struct {
	Pipelines []*PipelineIssues `json:"pipelines"`
}

func (*PipelineAnalysisResult) ErrorCount

func (p *PipelineAnalysisResult) ErrorCount() int

ErrorCount returns the number of errors found in an analysis result.

func (*PipelineAnalysisResult) MarshalJSON added in v0.6.8

func (p *PipelineAnalysisResult) MarshalJSON() ([]byte, error)

type PipelineIssues

type PipelineIssues struct {
	Pipeline *pipeline.Pipeline
	Issues   map[Rule][]*Issue
}

func RunLintRulesOnPipeline added in v0.4.1

func RunLintRulesOnPipeline(p *pipeline.Pipeline, rules []Rule) (*PipelineIssues, error)

func (*PipelineIssues) MarshalJSON added in v0.6.8

func (p *PipelineIssues) MarshalJSON() ([]byte, error)

type PipelineValidator

type PipelineValidator func(pipeline *pipeline.Pipeline) ([]*Issue, error)

type Printer

type Printer struct {
	RootCheckPath string
}

func (*Printer) PrintIssues

func (l *Printer) PrintIssues(analysis *PipelineAnalysisResult)

func (*Printer) PrintJSON added in v0.6.8

func (l *Printer) PrintJSON(analysis *PipelineAnalysisResult) error

type QueryValidatorRule

type QueryValidatorRule struct {
	Identifier  string
	TaskType    pipeline.AssetType
	Connections connectionManager
	Extractor   queryExtractor
	WorkerCount int
	Logger      *zap.SugaredLogger
}

func (*QueryValidatorRule) GetApplicableLevels added in v0.5.6

func (q *QueryValidatorRule) GetApplicableLevels() []Level

func (*QueryValidatorRule) Name

func (q *QueryValidatorRule) Name() string

func (*QueryValidatorRule) Validate

func (q *QueryValidatorRule) Validate(p *pipeline.Pipeline) ([]*Issue, error)

func (*QueryValidatorRule) ValidateAsset added in v0.5.6

func (q *QueryValidatorRule) ValidateAsset(ctx context.Context, p *pipeline.Pipeline, asset *pipeline.Asset) ([]*Issue, error)

type Rule

type Rule interface {
	Name() string
	Validate(pipeline *pipeline.Pipeline) ([]*Issue, error)
	ValidateAsset(ctx context.Context, pipeline *pipeline.Pipeline, asset *pipeline.Asset) ([]*Issue, error)
	GetApplicableLevels() []Level
}

func FilterRulesByLevel added in v0.5.6

func FilterRulesByLevel(rules []Rule, level Level) []Rule

func GetRules

func GetRules(fs afero.Fs) ([]Rule, error)

type SimpleRule

type SimpleRule struct {
	Identifier       string
	Validator        PipelineValidator
	AssetValidator   AssetValidator
	ApplicableLevels []Level
}

func (*SimpleRule) GetApplicableLevels added in v0.5.6

func (g *SimpleRule) GetApplicableLevels() []Level

func (*SimpleRule) Name

func (g *SimpleRule) Name() string

func (*SimpleRule) Validate

func (g *SimpleRule) Validate(pipeline *pipeline.Pipeline) ([]*Issue, error)

func (*SimpleRule) ValidateAsset added in v0.5.6

func (g *SimpleRule) ValidateAsset(ctx context.Context, pipeline *pipeline.Pipeline, asset *pipeline.Asset) ([]*Issue, error)

Jump to

Keyboard shortcuts

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