Page MenuHomePhabricator

Red-green in PHPUnit code coverage are hard to read
Open, LowPublic

Description

Inspired by T232893, this is something I've always wanted to report. Our coverage reports on doc.wikimedia.org (example) uses a red/green combination that's very hard to discern. As partly colorblind, I can guarantee that:

  • The page is hard to read on a decent monitor
  • The page is impossible to read on a monitor with not-so-good colors (I tried a cheap laptop, and there really was no difference between the colors)

The colors seem to be decided by a bootstrap CSS file included directly by PHPUnit; hence, I'm going to open an upstream bug report. Nevertheless, I wonder whether we can change the color for our reports, before we will eventually upgrade to a newer version of php-code-coverage.

Upstream task https://github.com/sebastianbergmann/php-code-coverage/issues/556

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.
StatusSubtypeAssignedTask
OpenNone
OpenNone

Event Timeline

FTR: https://github.com/sebastianbergmann/php-code-coverage/issues/698. Note that we use an old version of php-code-coverage, and the current one (7.0.7) is slightly different. Red and green are the same, though.

Krinkle renamed this task from Red-green in code coverage are hard to read to Red-green in PHPUnit code coverage are hard to read.Sep 14 2019, 3:30 PM
hashar updated the task description. (Show Details)

I didn't find the upstream response of allowing for custom CSS super satisfying, but I guess it's what we got. If someone writes a stylesheet, we just need to have CI copy it into .css/custom.css before rsyncing it to the docs server.

I used to have a stylesheet loaded via stylish or one of those browser extensions, but I lost that a while back and didn't really back it up.

hashar triaged this task as Low priority.May 3 2020, 9:21 AM
hashar subscribed.

Revisiting this task. From the upstream issue #556, php-code-coverage 6.0.5 now has an empty custom.css that one can override after the report has completed.

https://github.com/sebastianbergmann/php-code-coverage/commit/5626697ba169fc6bd56d38d83b478682f279bf7b

That is not really configurable, one has to manually copy the stylesheet after the report has been generated:

cp ./tests/coverage-style.css ./report/_css/custom.css

Quick note that in PHPUnit 10 we have config options for these colors: https://github.com/sebastianbergmann/phpunit/commit/68f929067281464087764b1533b31f9a098726cb

These can be specified in the PHPUnit config file, which presumably makes them easier to use.{{cn}}