Code Checker

The tool called Code-Checker checks and possibly repairs some of the formal errors in your source code.

Usage: php code-checker.php [options]

Options:
    -d <path>  folder to scan (optional)
    -i <mask>  files or directories to ignore (can be used multiple times)
    -f         fixes files
    -l         convert newline characters

Without parameters, it checks the current working directory in a read-only mode, with -f parameter it fixes files. Before you get to know the tool, be sure to backup your files first.

You can create a batch file, e.g. code.bat, for easier execution of Code-Checker under Windows:

php.exe path_to\Nette_tools\Code-Checker\code-checker.php %*

What Code-Checker does?

  • removes BOM
  • checks validity of Latte templates
  • checks for control characters
  • checks whether the file is encoded in UTF-8
  • controls misspelled /* @annotations */ (second asterisk missing)
  • removes PHP ending tags ?> in PHP files
  • removes trailing whitespace and unnecessary blank lines from the end of a file
  • normalizes line endings to system-default (with the -l parameter)