stable

Clone or download

Read-only

request #13038: Introduce static analysis with Psalm

The overall goal of adding a static analysis tool is to help contributors to write better code and gain confidence when doing refactoring, especially the ones affecting a large part of the codebase. Psalm [0] is introduced to observe how it behaves with the contributions currently integrated in Tuleap. The configuration is based on the "level 3" [1] issues proposed by Psalm, it is still quite a permissive configuration but it should catch most issues. The complete list of issues Psalm is capable to find can be seen here [2]. The stage is only played in the nightly pipeline and errors will not mark the pipeline has failed, it's only an observation phase for now. Only new errors should be found by Psalm thanks to its baseline file, the existing issues are marked with the level INFO. Some files have been ignored from the analysis to not vaste resources on code that should be removed and/or because Psalm crash when trying to analyze them. A small wrapper to launch the tools has been developped so that contributors with external plugins are not polluted by existing errors in those plugins. External plugins should define their own configuration and (if needed) generate their own baseline file [3] if they want to set up the analysis. [0] https://github.com/vimeo/psalm/ [1] https://github.com/vimeo/psalm/blob/3.0.17/assets/config_levels/3.xml [2] https://github.com/vimeo/psalm/blob/3.0.17/docs/issues.md [3] https://github.com/vimeo/psalm/blob/3.0.17/docs/dealing_with_code_issues.md#using-a-baseline-file Change-Id: Iec7edc618d5b260a131229741f9e1fd5a0997b84

Modified Files

Name
M Makefile +16 −0 Go to diff View file
M plugins/docman/include/Docman_Widget_MyDocman.class.php +3 −1 Go to diff View file
M plugins/tracker/include/PermissionsPerGroup/TrackerPermissionPerGroupRepresentationBuilder.php +4 −2 Go to diff View file
M src/common/Project/Admin/ProjectMembers/ProjectMembersController.php +4 −3 Go to diff View file
M src/common/Project/Admin/ProjectUGroup/DynamicUGroupMembersUpdater.php +3 −2 Go to diff View file
M src/common/widget/Widget_MyArtifacts.class.php +2 −0 Go to diff View file
M src/composer.json +13 −2 Go to diff View file
M src/composer.lock +688 −1 Go to diff View file
M src/www/cvs/admin_commit.php +3 −1 Go to diff View file
M src/www/cvs/browse_commit.php +3 −1 Go to diff View file
M src/www/cvs/cvs_intro.php +3 −1 Go to diff View file
M src/www/include/pre.php +1 −22 Go to diff View file
M src/www/project/admin/permissions.php +4 −4 Go to diff View file
M src/www/project/admin/project_admin_utils.php +2 −7 Go to diff View file
M src/www/project/admin/ugroup_utils.php +4 −4 Go to diff View file
M tests/Jenkinsfile +2 −1 Go to diff View file
M tests/Jenkinsfile-nightly +15 −0 Go to diff View file
M tests/actions.groovy +9 −0 Go to diff View file
A tests/lib/Psalm/Dockerfile +4 −0 Go to diff View file
A tests/lib/Psalm/PsalmCommandLauncherWithIgnoreDirectory.php +124 −0 Go to diff View file
A tests/lib/Psalm/PsalmIgnoreDirectory.php +31 −0 Go to diff View file
A tests/lib/Psalm/PsalmIgnoreGitExcludedTuleapPlugins.php +44 −0 Go to diff View file
M tests/phpunit/bootstrap.php +5 −6 Go to diff View file
A tests/phpunit/tests/Psalm/PsalmCommandLauncherWithIgnoreDirectoryTest.php +178 −0 Go to diff View file
A tests/phpunit/tests/Psalm/PsalmIgnoreGitExcludedTuleapPluginsTest.php +40 −0 Go to diff View file
A tests/psalm/Dockerfile +4 −0 Go to diff View file
A tests/psalm/bootstrap.php +34 −0 Go to diff View file
A tests/psalm/psalm-config-plugins-git-ignore.php +38 −0 Go to diff View file
A tests/psalm/psalm.xml +60 −0 Go to diff View file
A tests/psalm/tuleap-baseline.xml +23902 −0 Go to diff View file