Documentation
¶
Overview ¶
Package lint provides static analysis operations for Go, shell, and markdown files.
Index ¶
- Constants
- type FrontmatterIssue
- type GoIssue
- type GoResult
- type MarkdownIssue
- type MarkdownResult
- type Provider
- func (p *Provider) EnsureTools() (ToolsResult, error)
- func (p *Provider) Go(paths []string, config string, skipModTidy bool) (GoResult, error)
- func (p *Provider) Markdown(files []string, fix bool) (MarkdownResult, error)
- func (p *Provider) Shell(files []string, severity string, indent int) (ShellResult, error)
- func (p *Provider) Starlark(files []string) (StarlarkResult, error)
- type ShellFormatIssue
- type ShellIssue
- type ShellResult
- type StarlarkIssue
- type StarlarkResult
- type ToolInfo
- type ToolsResult
Constants ¶
const ( EnsureTools op.ActionName = "lint.ensure_tools" Go op.ActionName = "lint.go" Markdown op.ActionName = "lint.markdown" Shell op.ActionName = "lint.shell" Starlark op.ActionName = "lint.starlark" )
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 ¶
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 ¶
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 ¶
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
func (*Provider) Starlark ¶
func (p *Provider) Starlark(files []string) (StarlarkResult, error)
Starlark resolves every `plan.*` call in the given files against the action surface devlore actually has, and checks each package phase script against its lifecycle's phase order.
The checker is embedded rather than shelled out to, so there is no tool to install and no tool to be missing. Findings are resolution errors -- wrong namespace, absent method, wrong keyword -- and phase mistakes, which is what #721 established a syntax checker structurally cannot see.
+devlore:defaults files=nil
Parameters:
- files: Starlark files to check
Returns:
- StarlarkResult: findings and pass/fail status
- error: if a file cannot be read
type ShellFormatIssue ¶
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 StarlarkIssue ¶
type StarlarkIssue struct {
File string `starlark:"file"`
Line int `starlark:"line"`
Rule string `starlark:"rule"`
Call string `starlark:"call"`
Message string `starlark:"message"`
}
StarlarkIssue represents a single `lint.starlark` finding.
type StarlarkResult ¶
type StarlarkResult struct {
Issues []StarlarkIssue `starlark:"issues"`
FilesChecked int `starlark:"files_checked"`
IssueCount int `starlark:"issue_count"`
Passed bool `starlark:"passed"`
}
StarlarkResult holds the outcome of a Starlark lint run.
Unlike every other result here there is no tool to be missing: the checker is embedded. That is the point of #721 -- buildifier is installable today and would have caught none of the seven defects that motivated the work, because they are resolution errors against devlore's own provider surface rather than syntax.
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.