lint

package
v0.1.0-dev.20260910225748 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package lint provides static analysis operations for Go, shell, and markdown files.

Index

Constants

View Source
const (
	EnsureTools op.ActionName = "lint.ensure_tools"
	Go          op.ActionName = "lint.go"
	Markdown    op.ActionName = "lint.markdown"
	Shell       op.ActionName = "lint.shell"
)

Action-name constants for the lint provider's plan-mode actions.

Each constant is the short dotted action label its method dispatches under. Pass these to plan.Plan, op.ReceiverRegistry().BuildAction, RuntimeEnvironment.ActionByName, or WithActionNamed in place of a string literal so a typo is a compile error and rename / find-references work through the constant.

Variables

This section is empty.

Functions

This section is empty.

Types

type FrontmatterIssue

type FrontmatterIssue struct {
	File    string `starlark:"file"`
	Message string `starlark:"message"`
}

FrontmatterIssue represents a frontmatter validation issue.

type GoIssue

type GoIssue struct {
	File        string   `starlark:"file"`
	Line        int      `starlark:"line"`
	Column      int      `starlark:"column"`
	Message     string   `starlark:"message"`
	Linter      string   `starlark:"linter"`
	Severity    string   `starlark:"severity"`
	SourceLines []string `starlark:"source_lines"`
}

GoIssue represents a single golangci-lint finding.

type GoResult

type GoResult struct {
	Issues         []GoIssue `starlark:"issues"`
	ErrorCount     int       `starlark:"error_count"`
	WarningCount   int       `starlark:"warning_count"`
	TotalCount     int       `starlark:"total_count"`
	Passed         bool      `starlark:"passed"`
	LintPassed     bool      `starlark:"lint_passed"`
	ConfigCreated  bool      `starlark:"config_created"`
	ModTidyPassed  bool      `starlark:"mod_tidy_passed"`
	ModTidyDetails string    `starlark:"mod_tidy_details"`
}

GoResult holds the outcome of a Go lint run.

type MarkdownIssue

type MarkdownIssue struct {
	File     string `starlark:"file"`
	Line     int    `starlark:"line"`
	Rule     string `starlark:"rule"`
	Message  string `starlark:"message"`
	Severity string `starlark:"severity"`
}

MarkdownIssue represents a single markdownlint finding.

type MarkdownResult

type MarkdownResult struct {
	Issues            []MarkdownIssue    `starlark:"issues"`
	FrontmatterIssues []FrontmatterIssue `starlark:"frontmatter_issues"`
	FilesChecked      int                `starlark:"files_checked"`
	IssueCount        int                `starlark:"issue_count"`
	LintPassed        bool               `starlark:"lint_passed"`
	FrontmatterPassed bool               `starlark:"frontmatter_passed"`
	Passed            bool               `starlark:"passed"`
}

MarkdownResult holds the outcome of a markdown lint run.

type Provider

type Provider struct {
	op.ProviderBase
}

Provider provides static analysis operations: Go linting (golangci-lint), shell linting (shellcheck + shfmt), markdown linting (markdownlint-cli2), and tool availability checking.

func NewProvider

func NewProvider(ctx *op.RuntimeEnvironment) *Provider

NewProvider creates a lint provider bound to the given context.

func (*Provider) EnsureTools

func (p *Provider) EnsureTools() (ToolsResult, error)

EnsureTools checks whether required development tools are installed.

Returns:

  • ToolsResult: installation status of each tool
  • error: never (always succeeds)

func (*Provider) Go

func (p *Provider) Go(paths []string, config string, skipModTidy bool) (GoResult, error)

Go runs golangci-lint on Go source files.

+devlore:defaults paths=nil,config="",skipModTidy=false

Parameters:

  • paths: Go package patterns to lint (default ["./..."])
  • config: path to golangci-lint config file (default: auto-detect or create)
  • skipModTidy: if true, skip go mod tidy verification

Returns:

  • GoResult: issues, counts, and pass/fail status
  • error: if golangci-lint is not installed

func (*Provider) Markdown

func (p *Provider) Markdown(files []string, fix bool) (MarkdownResult, error)

Markdown runs markdownlint-cli2 and frontmatter validation on markdown files.

+devlore:defaults files=nil,fix=false

Parameters:

  • files: markdown files to lint
  • fix: if true, apply automatic fixes

Returns:

  • MarkdownResult: lint issues, frontmatter issues, and pass/fail status
  • error: if markdownlint-cli2 is not installed

func (*Provider) Shell

func (p *Provider) Shell(files []string, severity string, indent int) (ShellResult, error)

Shell runs shellcheck and shfmt on shell scripts.

+devlore:defaults files=nil,severity="warning",indent=0

Parameters:

  • files: shell script files to lint
  • severity: minimum shellcheck severity (default "warning")
  • indent: shfmt indentation width (defaults to 4 when 0)

Returns:

  • ShellResult: lint issues, format issues, and pass/fail status
  • error: if shellcheck or shfmt is not installed

type ShellFormatIssue

type ShellFormatIssue struct {
	File string `starlark:"file"`
	Diff string `starlark:"diff"`
}

ShellFormatIssue represents a file that failed shfmt formatting check.

type ShellIssue

type ShellIssue struct {
	File    string `starlark:"file"`
	Line    int    `starlark:"line"`
	Column  int    `starlark:"column"`
	Level   string `starlark:"level"`
	Code    int    `starlark:"code"`
	Message string `starlark:"message"`
}

ShellIssue represents a single shellcheck finding in a lint context.

type ShellResult

type ShellResult struct {
	Issues       []ShellIssue       `starlark:"issues"`
	FormatIssues []ShellFormatIssue `starlark:"format_issues"`
	ErrorCount   int                `starlark:"error_count"`
	WarningCount int                `starlark:"warning_count"`
	FilesChecked int                `starlark:"files_checked"`
	LintPassed   bool               `starlark:"lint_passed"`
	FormatPassed bool               `starlark:"format_passed"`
	Passed       bool               `starlark:"passed"`
}

ShellResult holds the outcome of a combined shellcheck + shfmt lint run.

type ToolInfo

type ToolInfo struct {
	Name       string `starlark:"name"`
	Installed  bool   `starlark:"installed"`
	Path       string `starlark:"path"`
	InstallCmd string `starlark:"install_cmd"`
}

ToolInfo represents the installation status of a single tool.

type ToolsResult

type ToolsResult struct {
	AllInstalled bool       `starlark:"all_installed"`
	Tools        []ToolInfo `starlark:"tools"`
	InstallCmds  []string   `starlark:"install_cmds"`
}

ToolsResult holds the outcome of a tool availability check.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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