diff options
author | Dreamy Jazz <wpgbrown@wikimedia.org> | 2024-08-27 13:00:25 +0100 |
---|---|---|
committer | Dreamy Jazz <wpgbrown@wikimedia.org> | 2024-08-27 13:22:29 +0100 |
commit | e7393b3cc7ade5ccc44bf5b466f26d3c51063fff (patch) | |
tree | 13350294b27d26aa87611189907be81e74ec7978 /maintenance/getLagTimes.php | |
parent | be2bef0de5c1e59ba7f25a672349f0915b1c4d33 (diff) | |
download | mediawikicore-e7393b3cc7ade5ccc44bf5b466f26d3c51063fff.tar.gz mediawikicore-e7393b3cc7ade5ccc44bf5b466f26d3c51063fff.zip |
Exclude boilerplate maintenance code from code coverage reports
Why:
* Maintenance scripts in core have bolierplate code that is
added before and after the class to allow directly running
the maintenance script.
* Running the maintenance script directly has been deprecated
since 1.40, so this boilerplate code is only to support a now
deprecated method of running maintenance scripts.
* This code cannot also be marked as covered, due to PHPUnit
not recognising code coverage for files.
* Therefore, it is best to ignore this boilerplate code in code
coverage reports as it cannot be marked as covered and also
is for deprecated code.
What:
* Wrap the boilerplate code (requiring Maintenance.php and then
later defining the maintenance script class and running if the
maintenance script was called directly) with @codeCoverageIgnore
comments.
* Some files use a different boilerplate code, however, these
should also be marked as ignored for coverage for the same
reason that coverage is not properly reported for files.
Bug: T371167
Change-Id: I32f5c6362dfb354149a48ce9c28da9a7fc494f7c
Diffstat (limited to 'maintenance/getLagTimes.php')
-rw-r--r-- | maintenance/getLagTimes.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/maintenance/getLagTimes.php b/maintenance/getLagTimes.php index 5fdf0d229657..1147763c2c4f 100644 --- a/maintenance/getLagTimes.php +++ b/maintenance/getLagTimes.php @@ -21,7 +21,9 @@ * @ingroup Maintenance */ +// @codeCoverageIgnoreStart require_once __DIR__ . '/Maintenance.php'; +// @codeCoverageIgnoreEnd use Wikimedia\IPUtils; @@ -92,5 +94,7 @@ class GetLagTimes extends Maintenance { } } +// @codeCoverageIgnoreStart $maintClass = GetLagTimes::class; require_once RUN_MAINTENANCE_IF_MAIN; +// @codeCoverageIgnoreEnd |