Page MenuHomePhabricator

Remove almost all uses of recursiveTagParse from Cite
Open, Needs TriagePublic

Description

There are several calls to $parser->recursiveTagParse which we believe are unnecessary. For example, error messages are recursively parsed rather than using simple Message#parse. Error messages have no business including further tags.

Once these usages are removed, the code complexity is reduced because we don't need to pass the Parser object around, and don't have to consider edge cases with parser-function tags in customized messages.

The only legitimate usage is probably when we recurse into the content of a references section produced by {{#tag.

It's worthwhile to study the git history for each usage to reverse-engineer why this function was chosen.

Event Timeline

@Lucas_Werkmeister_WMDE helped find this tool to review overridden error messages. We can use fine-tuned regexes to quickly check for specific content.

1awight@mwmaint1002:~$ mwgrep --etitle 'Cite (error|warning) [a-z].*' '.*'
2
3alswiki MediaWiki:Cite error refs without references
4avwiki MediaWiki:Cite error references no text
5be_x_oldwiki MediaWiki:Cite error references invalid input
6cswiktionary MediaWiki:Cite error references no text
7cswiktionary MediaWiki:Cite error refs without references
8cvwiki MediaWiki:Cite error ref no input
9dewiki MediaWiki:Cite error group refs without references/de-at
10dewiki MediaWiki:Cite error group refs without references/de-ch
11dewiki MediaWiki:Cite error group refs without references/de-formal
12dewiki MediaWiki:Cite error ref no input/de-at
13dewiki MediaWiki:Cite error ref no input/de-formal
14dewiki MediaWiki:Cite error ref no key
15dewiki MediaWiki:Cite error ref no key/de-ch
16dewiki MediaWiki:Cite error ref no key/de-formal
17dewiki MediaWiki:Cite error references invalid parameters
18dewiki MediaWiki:Cite error references invalid parameters group
19dewiki MediaWiki:Cite error references invalid parameters group/de-at
20dewiki MediaWiki:Cite error references invalid parameters group/de-formal
21dewiki MediaWiki:Cite error references invalid parameters/de-at
22dewiki MediaWiki:Cite error references invalid parameters/de-ch
23dewiki MediaWiki:Cite error references no text
24dewiki MediaWiki:Cite error references no text/de-ch
25dewikisource MediaWiki:Cite error empty references define
26dewikisource MediaWiki:Cite error group refs without references
27dewikisource MediaWiki:Cite error included ref
28dewikisource MediaWiki:Cite error ref no input
29dewikisource MediaWiki:Cite error ref no key
30dewikisource MediaWiki:Cite error ref numeric key
31dewikisource MediaWiki:Cite error ref too many keys
32dewikisource MediaWiki:Cite error references group mismatch
33dewikisource MediaWiki:Cite error references invalid input
34dewikisource MediaWiki:Cite error references invalid parameters
35dewikisource MediaWiki:Cite error references invalid parameters group
36dewikisource MediaWiki:Cite error references missing group
37dewikisource MediaWiki:Cite error references missing key
38dewikisource MediaWiki:Cite error references no backlink label
39dewikisource MediaWiki:Cite error references no key
40dewikisource MediaWiki:Cite error references no text
41dewikisource MediaWiki:Cite error refs without references
42enwikivoyage MediaWiki:Cite error refs without references
43fawiktionary MediaWiki:Cite error group refs without references
44fawiktionary MediaWiki:Cite error included ref
45fawiktionary MediaWiki:Cite error key str invalid
46fawiktionary MediaWiki:Cite error ref no input
47fawiktionary MediaWiki:Cite error references invalid input
48fawiktionary MediaWiki:Cite error references no text
49fawiktionary MediaWiki:Cite error refs without references
50fiwiki MediaWiki:Cite error refs without references
51hewikisource MediaWiki:Cite error refs without references
52hewikivoyage MediaWiki:Cite error refs without references
53hiwiki MediaWiki:Cite error references no text
54ilowiki MediaWiki:Cite error refs without references category
55kshwiki MediaWiki:Cite error refs without references
56lmowiki MediaWiki:Cite error group refs without references
57lvwiki MediaWiki:Cite error ref too many keys
58lvwiki MediaWiki:Cite error references missing key
59lvwiki MediaWiki:Cite error references no text
60lvwiki MediaWiki:Cite error refs without references
61mrwiki MediaWiki:Cite error included ref
62mtwiki MediaWiki:Cite error ref no input
63mtwiki MediaWiki:Cite error references no text
64nvwiki MediaWiki:Cite error empty references define
65nvwiki MediaWiki:Cite error group refs without references
66nvwiki MediaWiki:Cite error included ref
67nvwiki MediaWiki:Cite error ref no input
68nvwiki MediaWiki:Cite error ref no key
69nvwiki MediaWiki:Cite error ref numeric key
70nvwiki MediaWiki:Cite error references invalid parameters group
71nvwiki MediaWiki:Cite error references no text
72nvwiki MediaWiki:Cite error refs without references
73ruwiki MediaWiki:Cite error references invalid parameters
74sawiki MediaWiki:Cite error key str invalid
75sawiki MediaWiki:Cite error ref no input
76sawiki MediaWiki:Cite error ref no key
77sawiki MediaWiki:Cite error ref numeric key
78slwiki MediaWiki:Cite error key str invalid
79slwiki MediaWiki:Cite error references invalid parameters
80slwiki MediaWiki:Cite error references invalid parameters group
81slwiki MediaWiki:Cite error references missing group
82slwiki MediaWiki:Cite error references no key
83testwiki MediaWiki:Cite error group refs without references
84testwiki MediaWiki:Cite error ref no input
85testwiki MediaWiki:Cite error refs without references
86testwiki MediaWiki:Cite error refs without references category
87tlwiki MediaWiki:Cite error key str invalid
88tlwiki MediaWiki:Cite error ref no input
89tlwiki MediaWiki:Cite error ref no key
90tlwiki MediaWiki:Cite error ref numeric key
91tlwiki MediaWiki:Cite error ref too many keys
92tlwiki MediaWiki:Cite error references invalid input
93tlwiki MediaWiki:Cite error references invalid parameters
94tlwiki MediaWiki:Cite error references invalid parameters group
95tlwiki MediaWiki:Cite error references no backlink label
96tlwiki MediaWiki:Cite error references no text
97tlwiki MediaWiki:Cite error stack invalid input
98zhwiki MediaWiki:Cite error empty references define/zh
99zhwiki MediaWiki:Cite error empty references define/zh-mo
100zhwiki MediaWiki:Cite error no link label group/zh-hk
101zhwiki MediaWiki:Cite error references duplicate key/zh-tw
102zhwikivoyage MediaWiki:Cite error refs without references
103```

Here's a WIP patch once we verify that the error messages can be parsed more simply? https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Cite/ /552019/

Change 562484 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/Cite@master] Remove not needed Parser::recursiveTagParse() calls

https://gerrit.wikimedia.org/r/562484

Change 567983 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/Cite@master] Rewrite ErrorReporter for performance and separation of concerns

https://gerrit.wikimedia.org/r/567983

Change 567983 merged by jenkins-bot:
[mediawiki/extensions/Cite@master] Rewrite ErrorReporter for performance and separation of concerns

https://gerrit.wikimedia.org/r/567983

Change 562484 abandoned by Thiemo Kreuz (WMDE):
Remove not needed Parser::recursiveTagParse() calls

https://gerrit.wikimedia.org/r/562484

Change 998778 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Cite@master] [POC] Call Parser::recursiveTagParse as early as possible

https://gerrit.wikimedia.org/r/998778

Change #1000931 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Cite@master] Do not parse the outer <ol> as wikitext

https://gerrit.wikimedia.org/r/1000931

Change #1000931 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Do not parse the outer <ol> as wikitext

https://gerrit.wikimedia.org/r/1000931