noverify

command module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: MIT Imports: 2 Imported by: 0

README

NoVerify Build Status

NoVerify is a PHP linter: it finds possible bugs and style violations in your code.

  • NoVerify has no config: any reported issue in your PHPDoc or PHP code must be fixed.
  • NoVerify aims to understand PHP code at least as well as PHPStorm does. If it behaves incorrectly or suboptimally, please report issue.
  • This tool is written in Go and uses z7zmey/php-parser.

Features

  1. Fast: analyze ~100k LOC/s (lines of code per second) on Core i7
  2. Incremental: can analyze changes in git and show only new reports. Indexing speed is ~1M LOC/s.
  3. Experimental language server for VS Code and other editors that support language server protocol.

Default lints

NoVerify by default has the following checks:

  • Unreachable code
  • Array access to non-array type (beta)
  • Too few arguments when calling a function/method
  • Call to undefined function/method
  • Fetching of undefined constant/class property
  • Class not found
  • PHPDoc is incorrect
  • Undefined variable
  • Variable not always defined
  • Case without "break;"
  • Syntax error
  • Unused variable
  • Incorrect access to private/protected elements
  • Incorrect implementation of IteratorAggregate interface
  • Incorrect array definition, e.g. duplicate keys

User Guide

Using NoVerify as linter:

Extending NoVerify:

Using NoVerify as PHP language server:

Contribute

Just find good first issue, fix it and make pull request.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
example
src
cmd
cmd/stubs
Package stubs Code generated by go-bindata.
Package stubs Code generated by go-bindata.
git
linttest
Package linttest provides linter testing utilities.
Package linttest provides linter testing utilities.
php/parser
A Parser for PHP written in Go Features: * Fully support PHP5 and PHP7 syntax * Abstract syntax tree representation * Traversing AST * Namespace resolver Install: go get github.com/z7zmey/php-parser CLI dumper: $GOPATH/bin/php-parser -php5 /path/to/file/or/dir Package usage example: package main import ( "fmt" "bytes" "os" "github.com/VKCOM/noverify/src/php/parser/php7" "github.com/VKCOM/noverify/src/php/parser/visitor" ) func main() { src := bytes.NewBufferString(`<? echo "Hello world";`) parser := php7.NewParser(src, "example.php") parser.Parse() for _, e := range parser.GetErrors() { fmt.Println(e) } visitor := visitor.Dumper{ Writer: os.Stdout, Indent: "", Comments: parser.GetComments(), Positions: parser.GetPositions(), } rootNode := parser.GetRootNode() rootNode.Walk(visitor) }
A Parser for PHP written in Go Features: * Fully support PHP5 and PHP7 syntax * Abstract syntax tree representation * Traversing AST * Namespace resolver Install: go get github.com/z7zmey/php-parser CLI dumper: $GOPATH/bin/php-parser -php5 /path/to/file/or/dir Package usage example: package main import ( "fmt" "bytes" "os" "github.com/VKCOM/noverify/src/php/parser/php7" "github.com/VKCOM/noverify/src/php/parser/visitor" ) func main() { src := bytes.NewBufferString(`<? echo "Hello world";`) parser := php7.NewParser(src, "example.php") parser.Parse() for _, e := range parser.GetErrors() { fmt.Println(e) } visitor := visitor.Dumper{ Writer: os.Stdout, Indent: "", Comments: parser.GetComments(), Positions: parser.GetPositions(), } rootNode := parser.GetRootNode() rootNode.Walk(visitor) }
php/parser/walker
Package walker declares walking behavior
Package walker declares walking behavior
phpgrep
Package phpgrep is a library for searching PHP code using syntax trees.
Package phpgrep is a library for searching PHP code using syntax trees.

Jump to

Keyboard shortcuts

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