Detect errors and potential problems (lint or code quality tool)

Asked

Viewed 118 times

2

  • Before giving a negative vote understand the community model, read: en.stackoverflow.com/help/self-answer and blog.stackoverflow.com/2012/05/Encyclopedia-stack-exchange and if you have any other reason to downvote please justify.

1 answer

2


PHP already provides this type of tool per command line, one can test the "code quality" per command line:

php -l <fileName>

An example in Windows would be:

D:\wamp\php\php.exe -l "D:\wamp\www\arquivo.php"

In addition to this tool there are other ways to do this as it is answered in Soen:

  1. PHP Metrics - Features an overview and overall quality charts, according to different metrics such as Index Maintainability, Halstead metrics, Coupling or Cyclomatic complexity.
  2. PHP Code Sniffer - Basically ensures that the PHP code complies with the standard. You can write your own "default".
  3. PHP Unit or atoum - Unit Testing (unit tests/Unit are tests for small parts of code).
  4. PHP Project Mess Detector - N-Path and other complex analyses to determine the complexity of parts of the code.
  5. PHP Depend - Perform static code analysis on a given base structure (this structure is usually called an AST (Abstract Syntax Tree)).
  6. Scrutinizerci (https://github.com/scrutinizer-ci) - List of tools described above

There is also a simple tool called Phplint and can be tested online, the problem is that for newer versions of PHP and phpDocumentor it has proven outdated, but is still useful for simpler testing.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.