-
Notifications
You must be signed in to change notification settings - Fork 205
Scheck
Contents
-
Bugs finder
- Introduction
- Motivations
- Synopsis
-
Features
- Use of undeclared variable
- Unused variable
- Use of undefined entity (class, function, constant)
- Mutiple definitions of entity
- Wrong number of arguments in a call
- Wrong order of arguments in a call
- TODO Use of undefined member
- TODO Use of undefined method
- TODO Incompatible type
- Ugly code (use of dynamic features)
- Dead statement
- Dead entity
- Other analysis
- Examples
- FAQ
- Future work
- Related work
The goal of scheck
is to find stupid mistakes
like typo in your code. For instance on this code:
function foo($avar) { return $avarr; }
scheck
will complain with:
demos/scheck.php:4:9: CHECK: use of undefined variable $avarr demos/scheck.php:3:13: CHECK: unused Param variable $avar
See https://github.com/facebook/pfff/blob/master/main_scheck.ml
Many programming language compilers offer strong type-checking as well as static detection of certain mistakes like the use of undeclared variables. This is not the case in many dynamic languages like PHP or Javascript. Fortunately one can write programming language frontend a la lint that detect those mistakes.
The synopsis is:
$ scheck [-strict] <files_or_dirs>
Here are the checks currently done by scheck
:
This requires a class analysis
This requires a class analysis.
This requires a sophisticated type inference analysis.
This uses a control flow graph analysis.
This uses a simple global use/def analysis. This requires to have access to the whole codebase.
research: - Dawson Engler work - YuanYuan Zhou work
tools: - JSLint