verifier

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTool

func AddTool(tool Tool)

func GetToolDirectory

func GetToolDirectory() string

func IsProject

func IsProject(root string) bool

func SetupTools

func SetupTools(ctx context.Context, currentVersion string) error

Types

type AdminTwigLinter

type AdminTwigLinter struct{}

func (AdminTwigLinter) Check

func (a AdminTwigLinter) Check(ctx context.Context, check *Check, config ToolConfig) error

func (AdminTwigLinter) Fix

func (a AdminTwigLinter) Fix(ctx context.Context, config ToolConfig) error

func (AdminTwigLinter) Format

func (a AdminTwigLinter) Format(ctx context.Context, config ToolConfig, dryRun bool) error

func (AdminTwigLinter) Name

func (a AdminTwigLinter) Name() string

type Check

type Check struct {
	Results []validation.CheckResult `json:"results"`
	// contains filtered or unexported fields
}

func NewCheck

func NewCheck() *Check

func (*Check) AddResult

func (c *Check) AddResult(result validation.CheckResult)

func (*Check) GetResults

func (c *Check) GetResults() []validation.CheckResult

func (*Check) HasErrors

func (c *Check) HasErrors() bool

func (*Check) RemoveByIdentifier

func (c *Check) RemoveByIdentifier(ignores []validation.ToolConfigIgnore) validation.Check

type Eslint

type Eslint struct{}

func (Eslint) Check

func (e Eslint) Check(ctx context.Context, check *Check, config ToolConfig) error

func (Eslint) Fix

func (e Eslint) Fix(ctx context.Context, config ToolConfig) error

func (Eslint) Format

func (e Eslint) Format(ctx context.Context, config ToolConfig, dryRun bool) error

func (Eslint) Name

func (e Eslint) Name() string

type EslintOutput

type EslintOutput []struct {
	FilePath string `json:"filePath"`
	Messages []struct {
		RuleID    string `json:"ruleId"`
		Severity  int    `json:"severity"`
		Message   string `json:"message"`
		Line      int    `json:"line"`
		Column    int    `json:"column"`
		NodeType  string `json:"nodeType"`
		EndLine   int    `json:"endLine"`
		EndColumn int    `json:"endColumn"`
		Fix       struct {
			Range []int  `json:"range"`
			Text  string `json:"text"`
		} `json:"fix,omitempty"`
		MessageID string `json:"messageId,omitempty"`
	} `json:"messages"`
	SuppressedMessages  []any  `json:"suppressedMessages"`
	ErrorCount          int    `json:"errorCount"`
	FatalErrorCount     int    `json:"fatalErrorCount"`
	WarningCount        int    `json:"warningCount"`
	FixableErrorCount   int    `json:"fixableErrorCount"`
	FixableWarningCount int    `json:"fixableWarningCount"`
	Source              string `json:"source"`
	UsedDeprecatedRules []any  `json:"usedDeprecatedRules"`
}

type FrontendTwigLinter added in v0.0.3

type FrontendTwigLinter struct{}

func (FrontendTwigLinter) Check added in v0.0.3

func (s FrontendTwigLinter) Check(ctx context.Context, check *Check, config ToolConfig) error

func (FrontendTwigLinter) Fix added in v0.0.3

func (s FrontendTwigLinter) Fix(ctx context.Context, config ToolConfig) error

func (FrontendTwigLinter) Format added in v0.0.3

func (a FrontendTwigLinter) Format(ctx context.Context, config ToolConfig, dryRun bool) error

func (FrontendTwigLinter) Name added in v0.0.3

func (s FrontendTwigLinter) Name() string

type PHPCSFixer

type PHPCSFixer struct{}

func (PHPCSFixer) Check

func (p PHPCSFixer) Check(ctx context.Context, check *Check, config ToolConfig) error

func (PHPCSFixer) Fix

func (p PHPCSFixer) Fix(ctx context.Context, config ToolConfig) error

func (PHPCSFixer) Format

func (p PHPCSFixer) Format(ctx context.Context, config ToolConfig, dryRun bool) error

func (PHPCSFixer) Name

func (p PHPCSFixer) Name() string

type PhpStan

type PhpStan struct{}

func (PhpStan) Check

func (p PhpStan) Check(ctx context.Context, check *Check, config ToolConfig) error

func (PhpStan) Fix

func (p PhpStan) Fix(ctx context.Context, config ToolConfig) error

func (PhpStan) Format

func (p PhpStan) Format(ctx context.Context, config ToolConfig, dryRun bool) error

func (PhpStan) Name

func (p PhpStan) Name() string

type PhpStanOutput

type PhpStanOutput struct {
	Totals struct {
		Errors     int `json:"errors"`
		FileErrors int `json:"file_errors"`
	} `json:"totals"`
	Files map[string]struct {
		Errors   int `json:"errors"`
		Messages []struct {
			Message    string `json:"message"`
			Line       int    `json:"line"`
			Ignorable  bool   `json:"ignorable"`
			Identifier string `json:"identifier"`
		} `json:"messages"`
	} `json:"files"`
	Errors []string `json:"errors"`
}

type Prettier

type Prettier struct{}

func (Prettier) Check

func (b Prettier) Check(ctx context.Context, check *Check, config ToolConfig) error

func (Prettier) Fix

func (b Prettier) Fix(ctx context.Context, config ToolConfig) error

func (Prettier) Format

func (b Prettier) Format(ctx context.Context, config ToolConfig, dryRun bool) error

func (Prettier) Name

func (b Prettier) Name() string

type Rector

type Rector struct{}

func (Rector) Check

func (r Rector) Check(ctx context.Context, check *Check, config ToolConfig) error

func (Rector) Fix

func (r Rector) Fix(ctx context.Context, config ToolConfig) error

func (Rector) Format

func (r Rector) Format(ctx context.Context, config ToolConfig, dryRun bool) error

func (Rector) Name

func (r Rector) Name() string

type SWCLI

type SWCLI struct{}

func (SWCLI) Check

func (s SWCLI) Check(ctx context.Context, check *Check, config ToolConfig) error

func (SWCLI) Fix

func (s SWCLI) Fix(ctx context.Context, config ToolConfig) error

func (SWCLI) Format

func (s SWCLI) Format(ctx context.Context, config ToolConfig, dryRun bool) error

func (SWCLI) Name

func (s SWCLI) Name() string

type StyleLint

type StyleLint struct{}

func (StyleLint) Check

func (s StyleLint) Check(ctx context.Context, check *Check, config ToolConfig) error

func (StyleLint) Fix

func (s StyleLint) Fix(ctx context.Context, config ToolConfig) error

func (StyleLint) Format

func (s StyleLint) Format(ctx context.Context, config ToolConfig, dryRun bool) error

func (StyleLint) Name

func (s StyleLint) Name() string

type StylelintOutput

type StylelintOutput []struct {
	Source                string         `json:"source"`
	Deprecations          []StylintError `json:"deprecations"`
	InvalidOptionWarnings []any          `json:"invalidOptionWarnings"`
	ParseErrors           []any          `json:"parseErrors"`
	Errored               bool           `json:"errored"`
	Warnings              []StylintError `json:"warnings"`
}

type StylintError

type StylintError struct {
	Line     int    `json:"line"`
	Column   int    `json:"column"`
	Rule     string `json:"rule"`
	Severity string `json:"severity"`
	Text     string `json:"text"`
}

type Tool

type Tool interface {
	Name() string
	Check(ctx context.Context, check *Check, config ToolConfig) error
	Fix(ctx context.Context, config ToolConfig) error
	Format(ctx context.Context, config ToolConfig, dryRun bool) error
}

type ToolConfig

type ToolConfig struct {
	// Path to the tool directory
	ToolDirectory string

	InputWasDirectory bool

	// The minimum version of HeyFrame that is supported
	MinHeyFrameVersion string
	// The maximum version of HeyFrame that is supported
	MaxHeyFrameVersion string
	// The version of HeyFrame that is checked against
	CheckAgainst string
	// The root directory of the extension/project
	RootDir string
	// Contains a list of directories that are considered as source code
	SourceDirectories []string
	// Contains a list of identifiers that are ignored
	ValidationIgnores []validation.ToolConfigIgnore
	// Contains a list of directories that are considered as admin code
	AdminDirectories []string
	// Contains a list of directories that are considered as frontend code
	FrontendDirectories []string

	Extension extension.Extension
}

func ConvertExtensionToToolConfig

func ConvertExtensionToToolConfig(ext extension.Extension) (*ToolConfig, error)

func GetConfigFromProject

func GetConfigFromProject(root string) (*ToolConfig, error)

type ToolList

type ToolList []Tool

func GetTools

func GetTools() ToolList

func (ToolList) Exclude

func (tl ToolList) Exclude(exclude string) (ToolList, error)

Exclude filters out tools listed in the comma-separated exclude string. Returns an error if any specified tool name does not exist in the current list.

func (ToolList) Only

func (tl ToolList) Only(only string) (ToolList, error)

func (ToolList) PossibleString

func (tl ToolList) PossibleString() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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