As a developer, it's helpful to be able to run checks on my code before I push it to gerrit. For example, I can run phpcs locally and know that Jenkins is not going to complain that my code doesn't pass PHP code sniffer checks.
In a similar way, I'd like to know about code coverage increase/decrease before I push a commit. The process to do this is manual:
- If working on a core file, I need to edit tests/phpunit/suite.xml per these instructions https://www.mediawiki.org/wiki/Manual:PHP_unit_testing/Code_coverage#Coverage_scope
- If working on an extension, I need to make a few more modifications to tests/phpunit/suite.xml https://www.mediawiki.org/wiki/Continuous_integration/Tutorials/Generating_PHP_test_coverage_for_a_MediaWiki_extension#Running_locally
I then need to stash these changes as I work across various directories throughout the day.
A related point is that some IDEs (PhpStorm, for example) allow you to ingest the code coverage reports and will highlight blocks of code that are covered or not covered (docs. However, because we run php tests/phpunit/phpunit.php as the entrypoint instead of vendor/bin/phpunit {some-directory-with-a-phpunit.xml, it doesn't appear to be possible to set up PhpStorm with a Run/Debug configuration (which also includes an option to generate code coverage and apply highlighting to code).
Is there anything we can do to reduce the friction here and make running code coverage, and importing the results, as painless as possible?