jenkins-bot has submitted this change and it was merged.

Change subject: linter: Provide name of obsolete HTML element in question
......................................................................


linter: Provide name of obsolete HTML element in question

Individual lint checks can provide additional parameters to provide more
specific information about the error.

Bug: T148071
Change-Id: I48662442d4cb868cdc939cb4785d71e93e96b212
---
M lib/logger/linter.js
M lib/wt2html/pp/handlers/linter.js
M tests/mocha/lintertest.js
3 files changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Subramanya Sastry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index e72224c..3d0cdf7 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -61,6 +61,7 @@
                msg.type = logType.match(re)[1];
                msg.wiki = wiki;
                msg.wikiurl = 
url.resolve(this._env.conf.parsoid.mwApiMap.get(wiki).uri, '/');
+               msg.params = lintObj.params || {};
 
                if (logData.locationData) {
                        msg.location = logData.locationData.toString();
diff --git a/lib/wt2html/pp/handlers/linter.js 
b/lib/wt2html/pp/handlers/linter.js
index 0d9739e..246c909 100644
--- a/lib/wt2html/pp/handlers/linter.js
+++ b/lib/wt2html/pp/handlers/linter.js
@@ -218,7 +218,12 @@
        }
 
        if (re.test(c.nodeName)) {
-               var lintObj = { src: env.page.src, dsr: dsr, inTransclusion: 
inTransclusion };
+               var lintObj = {
+                       src: env.page.src,
+                       dsr: dsr,
+                       inTransclusion: inTransclusion,
+                       params: { name: c.nodeName.toLowerCase() },
+               };
                env.log('lint/obsolete-tag', lintObj);
        }
 }
diff --git a/tests/mocha/lintertest.js b/tests/mocha/lintertest.js
index c57752c..3b9a4c6 100644
--- a/tests/mocha/lintertest.js
+++ b/tests/mocha/lintertest.js
@@ -68,6 +68,8 @@
                                result[0].should.have.a.property("wiki", 
"enwiki");
                                result[0].dsr.should.include.members([ 0, 14, 
5, 6 ]);
                                result[0].should.have.a.property("src", 
"<big>foo</big>");
+                               result[0].should.have.a.property("params");
+                               result[0].params.should.have.a.property("name", 
"big");
                        });
                });
                it('should lint obsolete tags found in transclusions 
correctly', function() {
@@ -77,6 +79,8 @@
                                result[0].should.have.a.property("wiki", 
"enwiki");
                                result[0].dsr.should.include.members([ 0, 32, 
null, null ]);
                                result[0].should.have.a.property("src", 
"{{1x|<div><big>foo</big></div>}}");
+                               result[0].should.have.a.property("params");
+                               result[0].params.should.have.a.property("name", 
"big");
                        });
                });
                it('should lint fostered content correctly', function() {

-- 
To view, visit https://gerrit.wikimedia.org/r/315738
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I48662442d4cb868cdc939cb4785d71e93e96b212
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to