Page MenuHomePhabricator

Investigate using psalm for static analysis
Open, Needs TriagePublic

Description

Psalm is a static analysis tool similar to and inspired by phan. I'd propose to investigate whether we'd benefit from running it (together with phan), to help catch even more possible bugs.

I don't really know the differences between the 2 tools (which one's "stronger", if any, the pros and cons of each, etc.); I skimmed through psalm docs and I notably found that:

  • psalm supports incremental analysis, i.e. it can limit the analysis to the files touched by a patch (and the files referenced by them)
  • directory- and file-related config settings seem to be more rough for psalm, so it could be a little more difficult to set it up for core/extension

Finally, I tried running it locally on core. The main thing I noticed is that there are some dependencies conflicts; for instance, with nikic/php-parser and sebastian/diff. Psalm requires newer version, that presumably we don't use because of HHVM.
So we should probably wait before experimenting with this tool.