Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetInclude ¶ added in v0.5.0
func SetInclude(path string)
SetInclude names a file to run against the name registry before any file is checked, which is what lets the linter see an application rather than one file of it.
Without it every check runs against the standard library alone: a class composer autoloads and a helper bootstrap.php registers are both unknown, so the findings are mostly false and a true one cannot be told from them. With `--include vendor/autoload.php` the autoloader is registered and the classmap is what a name resolves against.
It must be called before the first File(), which is what the command does: the registry is built once per process, because registration is deterministic and nothing executes against it afterwards.
Types ¶
type Diagnostic ¶
type Diagnostic struct {
File string
Line int
Message string
// Fatal marks a finding the program cannot survive, as against one it
// might: a call to a function some host registers is a warning because the
// linter cannot see every binding, but a redeclaration is refused by the
// runtime whatever is registered. A fatal finding fails the lint run.
Fatal bool
}
Diagnostic is one lint finding.
func File ¶
func File(name, src string) ([]Diagnostic, error)
File parses and lints one PHP source file.
func FlatstackFile ¶ added in v0.2.1
func FlatstackFile(name, src string) (Diagnostic, error)
FlatstackFile checks whether a single PHP source file is compatible with flatstack engine.
func FlatstackPaths ¶ added in v0.2.1
func FlatstackPaths(paths []string) ([]Diagnostic, error)
FlatstackPaths checks flatstack compatibility for all files matched by paths.
func Paths ¶
func Paths(paths []string) ([]Diagnostic, error)
Paths lints each file selected by the provided Go-style path patterns.
func (Diagnostic) String ¶
func (d Diagnostic) String() string