phpcs

package
v0.0.0-...-e49a3f0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCancelled = errors.New("cancelled")

Functions

This section is empty.

Types

type ExitCode

type ExitCode int
const (
	ExitCodeKilled ExitCode = iota - 1
	ExitCodeNoIssues
	ExitCodeIssues
	ExitCodeFixableIssues
	ExitCodeProcessingError
)

type Instance

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

Instance is a wrapper around the 'phpcs' cli for formatting code. This implementation preemptively starts an instance of the command, So that each call to Format does not need to wait for php and the phpcs bootstrap. This does mean that there will always be a 'phpcs' process instance running.

func New

func New(executable string) *Instance

New initializes a new instance.

func (*Instance) Check

func (p *Instance) Check(ctx context.Context, code []byte) (*Report, error)

func (*Instance) Close

func (p *Instance) Close()

func (*Instance) Init

func (p *Instance) Init()

type Report

type Report struct {
	Totals struct {
		Errors   int
		Warnings int
		Fixable  int
	}
	Files map[string]struct {
		Errors   int
		Warnings int
		Messages []*ReportMessage
	}
}

type ReportMessage

type ReportMessage struct {
	Msg      string `json:"message"`
	Source   string
	Severity int // TODO: enum
	Fixable  bool
	Type     Severity
	Row      int `json:"line"`
	Column   int
}

type Severity

type Severity string
const (
	Warning Severity = "WARNING"
	Error   Severity = "ERROR"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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