Why introducing a static analysis tool?
------------------------------------------------
Static analysis tools can help to:
- catch bugs (e.g. null reference)
- maintain a certain level of code quality especially when the code base is large or when multiple contributors are implicated
Why Psalm [0] over any other static analysis tools available?
----------------------------------------------------------------------------
Psalm is not the only active static analysis tools you can find in the PHP community. PHPStan [1] and Phan [2] are also frequently encountered.
Psalm a bit easier to introduce to existing codebase thanks to its "baseline" feature [3] which allows to ignore existing errors. It also allows to select exactly which rules must applied.
Introduction into the Tuleap pipelines
----------------------------------------------
Proposal is to start small and only adds Psalm in the nightly test pipeline with a configuration quite permissive to see how well it plays with the code currently being integrated.
Depending on the results, the configuration could be tweaked to match our actual needs and Psalm and then integrated into the main Tuleap test pipeline.
Over time, the configuration should be made stricter and the issues in the existing code could be fixed (or the code removed, that works too).
Some plugins could be developed to improve our confidence on some security sensitive tasks. For example we could ensure that the only thing concatenated to SQL queries are instances of ParagonIE\EasyDB\EasyStatement which would make hard to introduce SQL injections.
[0]
https://psalm.dev/
[1]
https://github.com/phpstan/phpstan
[2]
https://github.com/phan/phan
[3]
https://psalm.dev/docs/dealing_with_code_issues/#using-a-baseline-file