Page MenuHomePhabricator

Tag functions that always return a specific value (regardless of class, execution, etc) with @codeCoverageIgnore
Open, Needs TriagePublic

Description

Problem statement:
When looking at https://doc.wikimedia.org/cover/mediawiki-core/, it seems that mediawiki has fairly poor code coverage. However, when looking at specific files, its clear that part of the lack of code coverage stems from the fact that specific types of functions are rarely tested. These include

  • Some API classes' ::getExamplesMessages and ::getHelpUrls
  • Some SpecialPage classes` ::getDisplayFormat, ::doesWrites, ::requiresUnblock, ::isIncludable, ::getGroupName, ::isListed, ::isCached
  • Some QueryPage classes' ::isExpensive, ::isSyndicated, ::sortDescending, ::getOrderFields, ::isCacheable,
  • Some ResourceLoader ::getGroup, ::supportsURLLoading, ::enableModuleContentVersion, ::getDependencies

By highlighting these methods as missing tests, it is harder to find where tests are truly needed

Proposal:
Any function that contains only a return statement, and that returns a set value (not a variable, no function calls) may be marked as @codeCoverageIgnore at a method level