shellcheck

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	File      string `json:"file"`
	Line      int    `json:"line"`
	EndLine   int    `json:"endLine"`
	Column    int    `json:"column"`
	EndColumn int    `json:"endColumn"`
	Level     string `json:"level"`
	Code      int    `json:"code"`
	Message   string `json:"message"`
	Fix       Fix    `json:"fix"`
}

type Fix

type Fix struct {
	Replacements []struct {
		Column         int    `json:"column"`
		EndColumn      int    `json:"endColumn"`
		EndLine        int    `json:"endLine"`
		InsertionPoint string `json:"insertionPoint"`
		Line           int    `json:"line"`
		Precedence     int    `json:"precedence"`
		Replacement    string `json:"replacement"`
	} `json:"replacements"`
}

type Result

type Result struct {
	ExitCode  int
	RawResult []byte
	Findings  []Finding
}

func NewResult

func NewResult(exitCode int, output []byte) (*Result, error)

type ShellChecker

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

ShellChecker provides API access to the bundled shellcheck binary

func NewShellChecker

func NewShellChecker() (*ShellChecker, error)

NewShellChecker instantiates a new shellcheck instance and loads the binary

func (*ShellChecker) AnalyzeFile

func (s *ShellChecker) AnalyzeFile(path string, extraFlags string) (*Result, error)

AnalyzeFile for a given path

func (*ShellChecker) AnalyzeSnippet added in v0.0.2

func (s *ShellChecker) AnalyzeSnippet(snippet []byte, extraFlags string) (*Result, error)

AnalyzeSnippet writes the snippet to a temporary file, analyzes it with shellcheck, and returns the result

func (*ShellChecker) Close

func (s *ShellChecker) Close() error

Close handle to shellcheck

func (*ShellChecker) Version

func (s *ShellChecker) Version() string

Version of shellcheck bundled with the application

Jump to

Keyboard shortcuts

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