Commit graph

2189 commits

Author SHA1 Message Date
Thiemo Kreuz eb12e48b14 Add test cases for (almost) all possible parsing errors
"Almost" because I found at least one that appears to be
unreachable (the very first check for null). But changing this
code is out of scope of this patch.

This also updates some of the error messages to explain the
location of the error better. It appears like the incomplete
paths are copy-paste mistakes.

I also found one duplicate test case and removed it.

Change-Id: Ic0ee9d04f5cd1060ade385ef308e70d221dd2f18
2021-08-30 15:17:21 +00:00
Thiemo Kreuz 696e3ed98f Make all tests use dummy language qqx instead of en
I find this good practice. It makes the tests more robust (e.g.
changes to a text don't make the test fail) and is potentially
faster, as no localization needs to be loaded.

Change-Id: I6c6342c80a40ab7260c35e7f1e3052aa4a9b9358
2021-08-30 17:15:41 +02:00
jenkins-bot 9afc5ef9fb Merge "Dramatically improve performance of random string generator" 2021-08-30 13:49:05 +00:00
Translation updater bot 3cfc425728 Localisation updates from https://translatewiki.net.
Change-Id: Iecd7824ac493e7978b02ed582b0028a9712f2d3e
2021-08-30 08:20:40 +02:00
Thiemo Kreuz 2232a44638 Dramatically improve performance of random string generator
This test was reported as being slow (approx. 0.1s, but still).
This new implementation is 10 times faster, while still
fulfilling the requirements. While the new algorithm is more
predictable (every chunk is guaranteed to contain every
character exactly onece), it's obviously still good enough.

Neither the exact length of the generated string nor the exact
length of the gzipped string matter. PHP's random number
generator might be different – possibly generating a string
that compresses different. Newer versions of the gzip library
possibly save an extra byte. Who knows. This test shouldn't
care, as long as the gzipped string is long enough.

Compatibility with PHP 7.1 can be dropped as it is not
supported any more since MediaWiki 1.34, as far as I can tell.

Change-Id: I8d63390c9f4baa6084f932fa34068f606696cafc
2021-08-29 14:21:52 +02:00
Thiemo Kreuz 4766216948 Remove small pieces of unused code
Mostly unused variable initializations. Note I'm inlining some
`var` keywords in this patch. This is in line with the current
style guides. See for example the discussion in I4f198e2 (search
for "hoisted" in the comments). However, I'm not changing the
entire codebase, as this is not the goal of this patch and also
just not necessary at this point.

Change-Id: Ibd80566c44584851ee2530d6b16dd28eb3db6bfe
2021-08-28 12:10:22 +02:00
Thiemo Kreuz 2cb03827cc Fix several type hints in JavaScript code
Two main mistakes:
* The {...foo} syntax is for a variable number of parameters.
  But this is not the case here.
* Optional parameters should be marked as such via [foo].

Change-Id: I0c26ea44fab6094616443ce8fae4fd47c61fd7c4
2021-08-28 12:08:28 +02:00
Thiemo Kreuz aca2722af3 Use more generic @covers tags in Serialization test
This is covering parts of the TemplateDataHooks class. This
class does have a rather simple structure:

Either hook handlers are independent from each other. We don't
need to worry about accidental coverage then and can go with a
trivial top-level @covers tag.

Or some small helper methods are called. These are parts of
what's tested and should count as covered as well, I would
argue.

Change-Id: I6f419ae80b9ad78ff86ef2922db3178b29e244a4
2021-08-28 11:12:41 +02:00
Thiemo Kreuz 930edf2419 Use more strict assertSame() when comparing strings
assertEquals() does have weird effects, like not reporting a
method that is expected to return null but returns an empty
string, and such. While it's usually not a problem, I learned
to avoid it.

Change-Id: I4f27ed5b200278021e051f1ab4d272f48e0bf344
2021-08-28 11:08:24 +02:00
Translation updater bot 8e66412aff Localisation updates from https://translatewiki.net.
Change-Id: I5e3512ae54cc20c569f94b3cb3250351972957f6
2021-08-26 08:36:59 +02:00
Translation updater bot 26cdb75a8c Localisation updates from https://translatewiki.net.
Change-Id: Ifd709246d13167a00ff38e2938fdd9d22783b19f
2021-08-23 09:04:25 +02:00
Translation updater bot ea1375237f Localisation updates from https://translatewiki.net.
Change-Id: I6975c696dc846450ec1646572e957967496b0743
2021-08-19 08:13:55 +02:00
Translation updater bot fbf070a68a Localisation updates from https://translatewiki.net.
Change-Id: Iec0cbf6a7e395740fd7a1709b897900332c6fa28
2021-08-16 08:16:55 +02:00
Translation updater bot e56d2000d1 Localisation updates from https://translatewiki.net.
Change-Id: I4afe049f142073074905558a3f472955283212a7
2021-08-13 08:19:14 +02:00
Translation updater bot c210d3da3d Localisation updates from https://translatewiki.net.
Change-Id: I77c14b4e625474dba7e457172ad4c5a150de6d2e
2021-08-12 08:09:52 +02:00
Translation updater bot 5610bb38bd Localisation updates from https://translatewiki.net.
Change-Id: Ibe441fbfca6a7fad25e7aa82581f847baaaf1e96
2021-08-11 08:19:37 +02:00
Translation updater bot db2ac0172d Localisation updates from https://translatewiki.net.
Change-Id: I9f188b4ef03ad32b38428a094e24114ff7797370
2021-08-09 08:25:17 +02:00
Translation updater bot b0cd82c211 Localisation updates from https://translatewiki.net.
Change-Id: Icab9d488756704478a3fb31e7645fe987a35d8e5
2021-08-06 08:14:00 +02:00
Translation updater bot d51d63ab9c Localisation updates from https://translatewiki.net.
Change-Id: Ibb6b3ebe3cae128603f823b944c94f9c0d25d384
2021-08-04 08:15:23 +02:00
jenkins-bot b745f0961a Merge "Make parameter order when sorting by status independent of language" 2021-08-02 12:51:37 +00:00
jenkins-bot 73d5a6504d Merge "Change param duplicate numbering to start with 2" 2021-07-30 14:17:47 +00:00
jenkins-bot ffeaea6921 Merge "Fix handling of duplicate parameter names" 2021-07-30 14:11:09 +00:00
jenkins-bot 6871af2766 Merge "Remove unused pieces of code from API module" 2021-07-30 13:45:49 +00:00
Thiemo Kreuz c2508a78ad Make parameter order when sorting by status independent of language
At the moment, when the user clicks the "Status" column to
sort by status, the statuses are ordered alphabetically,
which gives widely varying results depending on the language.
But there is an inherent order for these, even hard-coded in
the code: When a parameter is deprecated, nothing else matters.
Otherwise it's required → suggested → optional. Doesn't it
make much more sense to order the column this way? Especially
because there are never more than these 4 hard-coded values.

This is one of the (few remaining) issues mentioned on
https://de.wikipedia.org/wiki/Vorlage:TemplateData#Vorlagendokumentationsseite_verbessern_%E2%80%93_MediaWiki_ungen%C3%BCgend

This patch also makes it so that a CSS class name is always
added to all status fields, not only to the required ones.
This allows for per-wiki or per-user styling.

Change-Id: Id3f1ffafe09a3817972a4ee4bd4a3ded7be6f039
2021-07-30 13:42:00 +00:00
jenkins-bot 654e1ba037 Merge "Render docs with HTML5 <section>/<header> markup" 2021-07-30 13:40:14 +00:00
Translation updater bot 415c683a0d Localisation updates from https://translatewiki.net.
Change-Id: I2c2411d5721cd5980edfb4d20d1aefea5d83d0e9
2021-07-30 08:28:04 +02:00
Translation updater bot 96cbce6595 Localisation updates from https://translatewiki.net.
Change-Id: I912b320fb2de18afe30aedfbc7a04bb93bbf0dcf
2021-07-26 08:12:44 +02:00
libraryupgrader a09e939fe7 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* glob-parent: 5.1.0 → 5.1.2
  * https://npmjs.com/advisories/1751 (CVE-2020-28469)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)

Change-Id: I23a441a089501a97f329b7b6d37bc658481e682f
2021-07-24 02:43:18 +00:00
Translation updater bot d652a36772 Localisation updates from https://translatewiki.net.
Change-Id: I7f2cddb1f345ce41da028e93f6260d6f66962c99
2021-07-22 08:13:38 +02:00
Translation updater bot 2c71754671 Localisation updates from https://translatewiki.net.
Change-Id: I9550ab669b06c333ea5c1c286aaebfe9cb73780d
2021-07-20 08:21:05 +02:00
jenkins-bot 48388125a2 Merge "Add maintenance script to validate TemplateData pages" 2021-07-15 09:24:37 +00:00
jenkins-bot a325ded23e Merge "ApiTemplateData: Fix ORDER BY" 2021-07-15 09:19:37 +00:00
Reedy 249c2b2ffb Add maintenance script to validate TemplateData pages
Outputs page titles where the TemplateData is invalid JSON.

Change-Id: I0862dd5e3e466f85c4d1307cd630116258d3d3b4
2021-07-15 09:05:25 +00:00
Translation updater bot 2464ea6ebd Localisation updates from https://translatewiki.net.
Change-Id: I39c33ffb1038225f782c049506011c7af203522b
2021-07-15 08:12:35 +02:00
Reedy 6e4902fd72 ApiTemplateData: Fix ORDER BY
Change-Id: Ife2b6b5792e6c4312774fc42d073a663f19051ea
2021-07-15 01:01:30 +01:00
jenkins-bot 2839e6a9c0 Merge "Various minor JSDoc/PHPDoc documentation fixes" 2021-07-13 09:16:58 +00:00
Translation updater bot f4e8c425d7 Localisation updates from https://translatewiki.net.
Change-Id: Icdc41eb6b101456015a81557c4e5fc018a0e1614
2021-07-13 08:12:04 +02:00
Thiemo Kreuz 4b110c6c85 Render docs with HTML5 <section>/<header> markup
Change-Id: I91083561f7c4bcd3ee7184aee114a735de153fc4
2021-07-12 12:13:34 +02:00
Thiemo Kreuz f6e1004720 Various minor JSDoc/PHPDoc documentation fixes
Change-Id: I537bf4086058a7e18c9118f7433090c4bfaf98e7
2021-07-12 11:47:55 +02:00
Translation updater bot 9b19215e12 Localisation updates from https://translatewiki.net.
Change-Id: I8da979330c482f62f3b7192cffb0dab4c5895933
2021-07-05 08:07:21 +02:00
Translation updater bot e16de1b2dd Localisation updates from https://translatewiki.net.
Change-Id: I8bffdf6448f68e0d0534e6a380dc0b498899f762
2021-07-01 08:09:52 +02:00
Translation updater bot c4fef38770 Localisation updates from https://translatewiki.net.
Change-Id: I007eeb992cfa835d03a57b7bac7f87c8b210bdc2
2021-06-30 08:26:24 +02:00
Arlo Breault 03d838ab4a Omit the newline from EndFormat if no parameters are present
Bug: T282031
Change-Id: I631ca08e6e7717e72978debc496ac2ebac21133f
2021-06-29 13:49:49 -04:00
Arlo Breault 920dd0c438 Update FormatString spec to match Parsoid's implementation
This should have been done following
T128319 / I24aa1b7eda6103f54371aca7249d46c3e8bf7349

Note that if the format string specifies indentation before each
paramater (ex. `{{_\n |_ = _\n}}`) that's going to be added in addition
to the whitespace/comments preserved.  That doesn't seem great.  Maybe
everything up to the pipe should be removed?

Change-Id: I2186a09cd8ed4c6b1698a5707de0f22c8207d516
2021-06-29 13:47:50 -04:00
Translation updater bot f34c2906e7 Localisation updates from https://translatewiki.net.
Change-Id: I46e06e0a7e7257ace372896b8bf3625b09d2192f
2021-06-29 08:13:56 +02:00
Translation updater bot da3aacad35 Localisation updates from https://translatewiki.net.
Change-Id: I5fcbf7a546ee6337e2a02dbc2a34d63d9ee0d9f9
2021-06-24 08:27:20 +02:00
Translation updater bot b390e84ec6 Localisation updates from https://translatewiki.net.
Change-Id: I413c03ab59d86b9c7916c20b9aea261e3921f6d3
2021-06-22 08:09:57 +02:00
jenkins-bot fc779a6de7 Merge "Fix TemplateData API not properly working with a generator" 2021-06-17 07:42:17 +00:00
Translation updater bot e5b210df43 Localisation updates from https://translatewiki.net.
Change-Id: I7476ee448f8ea962bacd2a87f5f2f6aaef98c622
2021-06-14 08:38:28 +02:00
Thiemo Kreuz e70251a949 Remove unused pieces of code from API module
This is all unused, e.g. because it just repeats a default
value. All verified by my PHPStorm IDE.

Change-Id: I69665e07ca2d04016dc16e93290ef276f6b2cd95
2021-06-11 09:33:37 +00:00