jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/325731 )

Change subject: linter: Don't provide 'src'
......................................................................


linter: Don't provide 'src'

This isn't used by the Linter extension, so there's no need to increase
the request size by including it.

Change-Id: I9bbd5b743a9ef5146f03d9ea159387f822eda937
---
M lib/logger/linter.js
M lib/wt2html/pp/handlers/linter.js
M tests/mocha/linter.js
3 files changed, 5 insertions(+), 38 deletions(-)

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



diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index dd8d74b..5e35a06 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -70,15 +70,6 @@
                        msg.templateInfo = lintObj.templateInfo;
                }
 
-               var src = lintObj.src;
-               if (msg.type === 'fostered' ||
-                               msg.type === 'multi-template' ||
-                               msg.type === 'mixed-content') {
-                       msg.src = src;
-               } else if (dsr) {
-                       msg.src = src.substring(dsr[0], dsr[1]);
-               }
-
                this.buffer.push(msg);
        } catch (e) {
                this._env.log("error/linter", "Error in linterBackend: " + e);
diff --git a/lib/wt2html/pp/handlers/linter.js 
b/lib/wt2html/pp/handlers/linter.js
index d7ca19a..05973c3 100644
--- a/lib/wt2html/pp/handlers/linter.js
+++ b/lib/wt2html/pp/handlers/linter.js
@@ -34,7 +34,7 @@
                        var parts = dmw.parts;
                        var lintObj;
                        if (typeof parts[0] === 'string' || typeof 
parts[parts.length - 1] === 'string') {
-                               lintObj = {src: env.page.src, dsr: dsr };
+                               lintObj = { dsr: dsr };
                                env.log('lint/mixed-content', lintObj);
                        } else if (parts.length > 1) {
                                var targets = [];
@@ -44,7 +44,7 @@
                                        }
                                });
                                if (targets.length > 1) {
-                                       lintObj = { src: targets, dsr: dsr };
+                                       lintObj = { dsr: dsr };
                                        env.log('lint/multi-template', lintObj);
                                }
                        }
@@ -76,7 +76,7 @@
        if (DU.hasNodeName(c, 'meta')) {
                var type = c.getAttribute('typeof');
                if (type === 'mw:Placeholder/StrippedTag') {
-                       lintObj = { src: env.page.src, dsr: dsr, templateInfo: 
templateInfo };
+                       lintObj = { dsr: dsr, templateInfo: templateInfo };
                        env.log('lint/stripped-tag', lintObj);
                }
        }
@@ -98,7 +98,6 @@
 
                if (dp.selfClose && cNodeName !== 'meta') {
                        lintObj = {
-                               src: env.page.src,
                                dsr: dsr,
                                templateInfo: templateInfo,
                                params: { name: cNodeName },
@@ -110,7 +109,6 @@
 
                if (dp.autoInsertedEnd === true && (tplInfo || dsr[2] > 0)) {
                        lintObj = {
-                               src: env.page.src,
                                dsr: dsr,
                                templateInfo: templateInfo,
                                params: { name: cNodeName },
@@ -120,7 +118,6 @@
 
                if (dp.autoInsertedStart === true && (tplInfo ||  dsr[3] > 0)) {
                        lintObj = {
-                               src: env.page.src,
                                dsr: dsr,
                                templateInfo: templateInfo,
                        };
@@ -169,7 +166,7 @@
                                                                } else {
                                                                        dsr = 
dp.dsr;
                                                                }
-                                                               var lintObj = { 
src: env.page.src, dsr: dsr, templateInfo: templateInfo };
+                                                               var lintObj = { 
dsr: dsr, templateInfo: templateInfo };
                                                                
env.log('lint/ignored-table-attr', lintObj);
                                                        }
                                                }
@@ -195,10 +192,8 @@
  * Here 'foo' gets fostered out.
  */
 function logFosteredContent(env, node, dp, tplInfo) {
-       var fosteredSRC = node.innerHTML;
        var nextSibling = node.nextSibling;
        while (nextSibling && !DU.hasNodeName(nextSibling, 'table')) {
-               fosteredSRC += nextSibling.innerHTML;
                if (tplInfo && nextSibling === tplInfo.last) {
                        tplInfo.clear = true;
                }
@@ -212,7 +207,7 @@
        } else {
                dsr = DU.getDataParsoid(nextSibling).dsr;
        }
-       var lintObj = { src: fosteredSRC, dsr: dsr, templateInfo: templateInfo 
};
+       var lintObj = { dsr: dsr, templateInfo: templateInfo };
        env.log('lint/fostered', lintObj);
        return nextSibling;
 }
@@ -230,7 +225,6 @@
                        templateInfo = { name: 
DU.findEnclosingTemplateName(tplInfo) };
                }
                var lintObj = {
-                       src: env.page.src,
                        dsr: tplInfo ? tplInfo.dsr : dp.dsr,
                        templateInfo: templateInfo,
                        params: { name: c.nodeName.toLowerCase() },
@@ -257,7 +251,6 @@
                                templateInfo = { name: 
DU.findEnclosingTemplateName(tplInfo) };
                        }
                        env.log('lint/bogus-image-options', {
-                               src: env.page.src,
                                dsr: tplInfo ? tplInfo.dsr : dp.dsr,
                                templateInfo: templateInfo,
                                params: { items: items },
diff --git a/tests/mocha/linter.js b/tests/mocha/linter.js
index ed9bc44..f5a4b86 100644
--- a/tests/mocha/linter.js
+++ b/tests/mocha/linter.js
@@ -32,7 +32,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"missing-end-tag");
                                result[0].dsr.should.include.members([ 0, 8, 5, 
0 ]);
-                               result[0].should.have.a.property("src", 
"<div>foo");
                                result[0].should.have.a.property("params");
                                result[0].params.should.have.a.property("name", 
"div");
                        });
@@ -42,7 +41,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"missing-end-tag");
                                result[0].dsr.should.include.members([ 0, 27, 
null, null ]);
-                               result[0].should.have.a.property("src", 
"{{1x|<div>foo<p>bar</div>}}");
                                
result[0].should.have.a.property("templateInfo");
                                
result[0].templateInfo.should.have.a.property("name", "1x");
                                result[0].should.have.a.property("params");
@@ -54,7 +52,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"stripped-tag");
                                result[0].dsr.should.include.members([ 3, 9, 
null, null ]);
-                               result[0].should.have.a.property("src", 
"</div>");
                        });
                });
                it('should lint stripped tags found in transclusions 
correctly', function() {
@@ -62,7 +59,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"stripped-tag");
                                result[0].dsr.should.include.members([ 0, 27, 
null, null ]);
-                               result[0].should.have.a.property("src", 
"{{1x|<div>foo</div></div>}}");
                        });
                });
                it('should lint obsolete tags correctly', function() {
@@ -70,7 +66,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"obsolete-tag");
                                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");
                        });
@@ -80,7 +75,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"obsolete-tag");
                                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");
                        });
@@ -92,7 +86,6 @@
                                result[0].should.have.a.property("type", 
"missing-end-tag");
                                result[1].should.have.a.property("type", 
"obsolete-tag");
                                result[1].dsr.should.include.members([ 0, 8, 5, 
0 ]);
-                               result[1].should.have.a.property("src", 
"<big>foo");
                                result[1].should.have.a.property("params");
                                result[1].params.should.have.a.property("name", 
"big");
                        });
@@ -102,7 +95,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"fostered");
                                result[0].dsr.should.include.members([ 0, 18, 
2, 2 ]);
-                               result[0].should.have.a.property("src", "foo");
                        });
                });
                it('should lint ignored table attributes Correctly', function() 
{
@@ -110,7 +102,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"ignored-table-attr");
                                result[0].dsr.should.include.members([ 3, 14, 
6, 0 ]);
-                               result[0].should.have.a.property("src", "|- 
foo\n|bar");
                        });
                });
                it('should lint ignored table attributes found in transclusions 
correctly', function() {
@@ -118,7 +109,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"ignored-table-attr");
                                result[0].dsr.should.include.members([ 0, 43, 
null, null]);
-                               result[0].should.have.a.property("src", 
"{{1x|\n{{{!}}\n{{!}}- foo\n{{!}} bar\n{{!}}}\n}}");
                        });
                });
                it('should not lint whitespaces as ignored table attributes', 
function() {
@@ -131,7 +121,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"ignored-table-attr");
                                result[0].dsr.should.include.members([ 3, 30, 
22, 0 ]);
-                               result[0].should.have.a.property("src", "|- 
<!--bad attr-->attr\n|bar");
                        });
                });
                it('should lint Bogus image options correctly', function() {
@@ -139,7 +128,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"bogus-image-options");
                                result[0].dsr.should.include.members([ 0, 22, 
null, null ]);
-                               result[0].should.have.a.property("src", 
"[[file:a.jpg|foo|bar]]");
                                result[0].should.have.a.property("params");
                                
result[0].params.should.have.a.property("items");
                                
result[0].params.items.should.include.members(["foo"]);
@@ -150,7 +138,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"bogus-image-options");
                                result[0].dsr.should.include.members([ 0, 29, 
null, null ]);
-                               result[0].should.have.a.property("src", 
"{{1x|[[file:a.jpg|foo|bar]]}}");
                                result[0].should.have.a.property("params");
                                
result[0].params.items.should.include.members(["foo"]);
                        });
@@ -160,7 +147,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"bogus-image-options");
                                result[0].dsr.should.include.members([ 0, 26, 
null, null ]);
-                               result[0].should.have.a.property("src", 
"[[file:a.jpg|foo|bar|baz]]");
                                result[0].should.have.a.property("params");
                                
result[0].params.items.should.include.members(["foo", "bar"]);
                        });
@@ -181,12 +167,10 @@
                                result.should.have.length(2);
                                result[0].should.have.a.property("type", 
"self-closed-tag");
                                result[0].dsr.should.include.members([ 3, 8, 5, 
0 ]);
-                               result[0].should.have.a.property("src", "<b 
/>");
                                result[0].should.have.a.property("params");
                                result[0].params.should.have.a.property("name", 
"b");
                                result[1].should.have.a.property("type", 
"self-closed-tag");
                                result[1].dsr.should.include.members([ 11, 19, 
8, 0 ]);
-                               result[1].should.have.a.property("src", "<span 
/>");
                                result[1].should.have.a.property("params");
                                result[1].params.should.have.a.property("name", 
"span");
                        });
@@ -196,7 +180,6 @@
                                result.should.have.length(1);
                                result[0].should.have.a.property("type", 
"self-closed-tag");
                                result[0].dsr.should.include.members([ 0, 31, 
null, null ]);
-                               result[0].should.have.a.property("src", 
'{{1x|<b /> <ref name="boo" />}}');
                                result[0].should.have.a.property("params");
                                result[0].params.should.have.a.property("name", 
"b");
                                
result[0].should.have.a.property("templateInfo");

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9bbd5b743a9ef5146f03d9ea159387f822eda937
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.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