Commit graph

86 commits

Author SHA1 Message Date
Dreamy Jazz
e7393b3cc7 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
2024-08-27 13:22:29 +01:00
Timo Tijhof
582cf3399c build: Restore Doxygen output for MediaWiki release tags (take 3)
Follows-up:
* I696f1e7ede (60f106e112): Apply `vendor` and `node_modules` exclude
  patterns even when `--file` is used to generate docs for an extension
  or a subset of core.

* I9313457796 (eaf491b4f4): Use faster and upstream supported EXCLUDE
  instead of EXCLUDE_PATTERNS for skipping whole top-level dirs.

Neither of these addressed the fact that this `if` condition is not
actually possible to reach because `explode()` always returns an
array with at least one item. e.g. `exclude(',', '') == [ '' ]`.

Test plan:
* `php maintenance/mwdocgen.php --output ./docs/ --version whatever`
* Review the contents the mentioned `/tmp/MWDocGen-*` file that is
  auto-generated.

Before:
```
INPUT                  =  ""
…
EXCLUDE                =  cache images
```

After:
```
INPUT                  =
…
EXCLUDE                =  cache images extensions skins
```

Bug: T317451
Change-Id: I871b321fa9fdb2d763fba532ab6248b0fc4b1701
2024-03-27 19:39:35 +00:00
Timo Tijhof
d864855d5d docs: Remove use of $IP from mwdocgen.php
* Prefer the MW_INSTALL_PATH constant where possible.

* For input and output, there is no need to specify full paths,
  only to strip the prefix again afterwards.
  See also Doxyfile in any repo that is not mediawiki/core where we
  already set the path relative to the project directory, e.g.
  "src/" as input and "docs" as output.

  <https://codesearch.wmcloud.org/search/?q=INPUT%7COUTPUT&files=Doxyfile>

Test Plan:
* `php maintenance/mwdocgen.php --file docs,includes/libs/objectcache/`

Change-Id: I4119161accdc665d0e4d0d4e49d0c42c68f8e2a2
2024-03-26 23:30:10 +00:00
Timo Tijhof
eaf491b4f4 build: Restore Doxygen output for MediaWiki release tags
Bug: T292237
Bug: T317451
Change-Id: I9313457796cb0c515a52c1860abfd5f86704641a
2024-03-09 02:44:23 +00:00
Brooke Vibber
dcd9c3ae26 Update name & email for bvibber
Updating name & email addresses for Brooke Vibber.

Re-ran updateCredits.php as well so there are some new entries in
there as well.

There are a couple of files in resources/libs that will have to
be changed upstream to keep tests happy, I will do patches
later. :D

Change-Id: I2f2e75d3fa42e8cf6de19a8fbb615bac28efcd54
2024-02-08 17:02:16 -08:00
Timo Tijhof
c37437ff5e docs: Remove non-existent 'static' directory from Doxygen config
This was added for unknown reasons in 2011 with r81562 (35f83153c).

Change-Id: I8a9fd808494467bb7651b7832aa60d619e2bcec2
2022-09-10 01:18:18 +02:00
Timo Tijhof
60f106e112 docs: Apply excludes like 'vendor' and 'tests' to extensions as well
For reasons not yet understood, during CI jobs for Git release tags,
the doc publishing pipeline is scanning extensions directories even
on core-only builds.

This was realized when investigating an issue with a large fixture
file in extensions/CirrusSearch/tests/ ("interwiki.php") causing
Doxygen to crash.

When reproducing the issue locally, I found that numerous node_modules,
vendor were also being scanned that didn't need to be.

Also exclude the 'cache' dir from core $IP while at it.

Bug: T317451
Change-Id: I696f1e7edeaf7bf12fbf17613cc9ee5c8dd846b0
2022-09-10 01:18:06 +02:00
Matěj Suchánek
e47c441078 Fix many typos in comments
Found using IntelliJ's "Typo" code inspection.

Change-Id: I746220ebe6e1e39f6cb503390ec9053e6518cf16
2022-05-10 12:46:11 +00:00
Umherirrender
6ea3d6ac2c Add explicit casts between scalar types
php internal functions like floor/round/ceil documented to return
float, most cases the result is used as int, added casts

Found by phan strict checks

Change-Id: I92daeb0f7be8a0566fd9258f66ed3aced9a7b792
2022-03-08 16:59:01 +00:00
Umherirrender
b4bd3d4ee8 Remove dead variables and functions and unneeded parenthesis
Found by sonarqube

Change-Id: I3464d25e94d98aaca55d9209d5175542b335f994
2021-08-13 21:41:59 +02:00
Timo Tijhof
ea79a23e56 docs: Ignore extensions/ and skins/ in mwdocgen.php by default
The default was previously to index all of core and extensions,
which is likely not the intent of someone running this for the
first time (which can then easily take over half an hour).

Even in CI, we never do this, and we never have afaik.

Generally, local use is to replicate CI (all of core), or a subset
of core by passing e.g. '--file includes/libs' or some such.

Indexing an extension is still possible, same way as before,
by passing '--file extensions/FooBar'. And, if one really wants
to index all of core and all extensions, the new '--extensions'
option allows one to opt back in to the old behaviour.

Also:
* Exclude all of 'resources/'. There are no PHP or Markdown files
  here that need to be indexed.

Bug: T232104
Change-Id: I55617776ac86f3fdcb6c1ba1eebe892edcb5fafb
2019-09-14 21:58:03 +01:00
Timo Tijhof
9696b1d800 docs: Ignore README.md by default
This makes it more future-proof so that when more files are
added, they are excluded by default. If and when we do get a file
that is intended for this, it's likely such commit will test it
and find it doesn't work and then whitelist accordingly.

Change-Id: I3b8e421724d45e6aaecea58238f430a87cbbe977
2019-09-14 19:35:45 +01:00
apaskulin
fec6692394 docs: Exclude extra markdown files from Doxygen
Cleans up the Doxygen file list by excluding markdown
files other than the intro, main code of conduct, and
/docs directory.

docs: Add heading to code of conduct

Adds an h1 heading to use as the file listing
in Doxygen instead of the file name.

Change-Id: Id13eec2670aa4b96275f1e688a29c22c3f38a859
2019-09-13 16:35:49 +00:00
Daimona Eaytoy
5d40cff293 maintenance: Explicitly declare all used properties
All uses were checked with codesearch, and the visibility was chosen as
strict as possible.

Change-Id: I56666299cc04ccc418e05949422876583982eb3c
2019-09-09 09:47:41 +00:00
Timo Tijhof
853838a322 docs: Remove GENERATE_MAN support from Doxyfile
Also remove redundant sections from the config file that all
relate to features that are unconditionally disabled for us
and by default. They were all no-ops because the corresponding
"GENERATE_"- config is NO by default as well.

Per <http://www.doxygen.nl/manual/config.html>.

Bug: T232104
Change-Id: Ibd81f23922f1994be6579fcd8e1ece5e9f995905
2019-09-06 16:06:11 +01:00
Timo Tijhof
0b1d48db42 docs: Ignore .md from resources/lib in Doxyfile
Follows-up b7c5acd419, which started indexing .md files
anywhere in core. While these are harmless to analyse (they're
not going to find any meaningful doc blocks), it just adds
more noise to the file listing.

Bug: T232104
Change-Id: Ibd2010010872d42dc3d52139305c87fcfc547477
2019-09-05 14:52:08 +00:00
Derick Alangi
84292b7728 Replace deprecated function wfEscapeShellArg with Shell::escape()
Change-Id: I4046d593d1450cfffc489ca2abadba1084a540e4
2019-04-07 20:17:39 +01:00
Umherirrender
ad776c7d5f Use ::class to resolve class names in maintenance scripts
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: I1d4567f47f93eb1436cb98558388e48d35258666
2018-01-23 17:40:16 +00:00
Bryan Davis
9e34eeff23 Maintenance: add fatalError() method
Deprecate the second argument to Maintenance::error() in favor of a new
Maintenance::fatalError() method. This is intended to make it easier to
review flow control in maintenance scripts.

Change-Id: I75699008638f7e99b11210c7bb9e2e131fca7c9e
2017-11-21 21:34:16 -07:00
Matthew Flaschen
5e6a3a418c Use shell_exec instead of backtick
They are exactly equivalent, but shell_exec is more readable.
We just imported a sniff to forbid backtick into mediawiki-codesniffer.

It's not deployed here yet, but this will facilitate it.

Change-Id: I4b58ed78e1792ff83e1bf99425f8f19123cfe911
2017-07-06 19:14:38 -04:00
Matthew Flaschen
b510edbda1 Revert "Convert mwdoc-filter.php to Maintenance", rm wfShellWikiCmd
Revert a58948d64 and instead remove wfShellWikiCmd and escape
shell arguments directly.

This should be fine since mwdoc-filter.php does not depend on per-wiki
state.

Change-Id: Id9c6ca84bab827675b71ca16bf688fd3f5c993a1
2017-05-04 00:15:22 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Max Semenik
59db24e90b Use addDescription() instead of accessing mDescription directly
Change-Id: I0e2aa83024b8abf5298cfea4b21bf45722ad3103
2016-01-30 01:28:32 -08:00
Timo Tijhof
ff39e4022d Doxygen: Disable verbose output
https://www.stack.nl/~dimitri/doxygen/manual/config.html#cfg_quiet

* To make the standard output in Jenkins more useful,
  disable the verbose messages about "Loading file .." in between
  all the errors.

* Remove obsolete config options XML_SCHEMA and XML_DTD that were
  producing warnings. We weren't using these anyway (set to their default
  blank value).

Change-Id: I6876cf4d783f7795a12d99623c8ce3717e9a51f5
2015-11-23 20:33:01 +00:00
Timo Tijhof
f62b4a8bf0 mwdocgen: Exclude node_modules from Doxygen
So that local runs don't take forever and won't recurse into unrelated
php files in some npm package.

Change-Id: Ic8068fa048075584c9334d0c21fb4efd87eade02
2015-04-01 00:44:53 +01:00
Siebrand Mazeland
5a77286a1e Update formatting in maintenance/ (3/4)
Change-Id: I4390c4ea12a6a626b0e6817b6446635116ca9fe3
2014-04-23 20:09:13 +02:00
umherirrender
24bfde2710 Fix spacing and break some lines
Change-Id: Ia57685d8858e02e399ad5c75ce64d12609d340ac
2013-08-24 17:06:25 +02:00
Antoine Musso
11624828bd mwdocgen: support multiple --file values
It is sometimes useful to generate documentation for multiple files or
directories. Doxygen INPUT statement supports multiple space separated
paths. Example usage:

 php maintenance/mwdocgen.php --file docs,input

Change-Id: I66a805d80307c6502e9b440df63a37bb13093d84
2013-06-26 13:00:15 +00:00
Daniel Friesen
6cc372c9b6 Add vendor to mwdocgen's excludes list.
Now that we support composer libraries we should exclude vendor/
so that our Doxygen script doesn't go generating documentation
for 3rd party libraries we use.

Change-Id: I40502015820f0b9b4b1ef5810bcddcc5970134c5
2013-06-08 04:07:57 -07:00
Antoine Musso
e289bf7908 overhaul maintenance/mwdocgen.php
Now based on Maintenance class.
Reinstate {{EXCLUDE}} which got removed by 8199984

This is roughly back compatible.

bug: 34436
Change-Id: Ic1a2b2c29718054ec740b2ffb90350af700a6a58
2013-05-29 15:56:15 +02:00
Timo Tijhof
beb1c4a0ec phpcs: More require/include is not a function
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.

Also updated usage in text in documentation and the
installer LocalSettingsGenerator.

Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;

Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
2013-05-21 23:26:28 +02:00
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
umherirrender
b114f5e1c1 Fixed some spacing in maintenance folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I9657f72996358f8c1c154cea1ea97970d973723c
2013-04-18 20:48:44 +02:00
jenkins-bot
ac1b5fd19b Merge "mwdocgen.php: Exit with exit code of passthru(doxygen)" 2013-03-15 07:57:14 +00:00
Timo Tijhof
0d76bceabd mwdocgen.php: Implement --version option.
So that the job that runs it can pass along what it should
display (e.g. branch, tag, hash etc. whatever is appropiate
for the context of that run).

Change-Id: I1d5b6266e49a71672b0a53069e6ea6bb4658c3d2
2013-03-15 07:10:04 +01:00
Timo Tijhof
5de8086d35 mwdocgen.php: Exit with exit code of passthru(doxygen)
Previously it just naturally exited which means even if the
doxygen bin doesn't exist, it'll return "success".

Bug: 46151
Change-Id: Ie1e3d956ce5d3e1f28c7c829bb57596113f07c4a
2013-03-15 06:43:56 +01:00
Antoine Musso
7006e1df93 style: fix up commas in function arguments
Fix up spaces in our function calls, we do not want spaces before a
comma and try to avoid multiple commas whenever possible.

Errors:

* No space found after comma in function call
* Space found before comma in function call

Change-Id: I51aec02016f742422fa60b92ad35ba3f0ef59ba3
2013-02-06 19:30:39 +01:00
Ori Livneh
6c163ad265 (Bug 37957) Replace php_sapi_name() with PHP_SAPI
The PHP_SAPI constant has been available since PHP 4.2.0. It's more
concise to use the constant and has less overhead than a function call.

Furthermore, PHP_SAPI rhymes with "happy", whereas "php_sapi_name"
rhymes with "lame". QED, etc.

Change-Id: Ie8c121cb8fcef50536af8d3f66723b458f0bf9af
2013-02-04 12:50:45 -08:00
Platonides
12fafe1944 Also pass $doxygenInputFilter as parameter instead of global.
Change-Id: I63fa0125576c4694f63d271f9824d783869f25d1
2012-12-06 23:29:44 +01:00
Reedy
8199984ed2 Remove svnstat stuff used in Doxygen generation
Change-Id: I9d8db5fae6e0c99d59fcb9a43d7ed4aab953c300
2012-09-27 00:14:20 +01:00
jeroendedauw
38c7f444e1 Use __DIR__ instead of dirname( __FILE__ )
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)

Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
2012-08-27 21:45:00 +02:00
Antoine Musso
e3716bbb7c doxygen filter need to use a full path
When running mwdocgen.php outside of maintenance, the input filter was
not found. Giving the full path fix the issue.

Issue introduced by I4ead1bd1 / ab59fad.

Change-Id: I5e28209eba1afd24d60b2dc940b9f5dfb1b4f34c
2012-08-02 16:20:52 +02:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Platonides
03b354368e Rename $exclude_patterns to $excludePatterns and
$wgDoxyGenerateMan to $doxyGenerateMan.

Change-Id: Id6d7d8202c6bdfd31d2bba5603e0682d35c76ad4
2012-06-03 15:38:51 +02:00
Sam Reed
315ddeaaa1 Fix switch fall through
Remove code for getting svn rev from SVN less than 1.4 - Ubuntu 8.04 LTS has 1.4.6 so should be pretty safe
2012-03-19 15:25:22 +00:00
Antoine Musso
6e5c5b4b80 always have $wgDoxyGenerateMan defined
r101807 introduced a new variable which was not always defined.
2012-02-16 08:36:36 +00:00
Antoine Musso
5fd4059ac1 add usage for --no-extensions 2011-11-23 21:02:59 +00:00
Antoine Musso
3b8aa71cf8 man page help pages generation
Tweaked mwdocgen.php to let us generates man pages. They will be saved to
./docs/man so make sure to update your MANPATH if you use this feature.

Usage:

 php mwdocgen.php --all --generate-man
or
 make man
2011-11-03 14:01:00 +00:00
Antoine Musso
c1f23144e1 using real identity for hashar
Converting my pseudonym to use my real identity instead:
Ashar Voultoiz -> Antoine Musso
2011-10-24 09:08:13 +00:00