Legoktm has uploaded a new change for review.
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/lintertest.js
3 files changed, 5 insertions(+), 35 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/31/325731/1
diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index a594df9..e525717 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -68,7 +68,6 @@
try {
var logType = logData.logType;
var lintObj = logData.logObject[0];
- var src = lintObj.src;
var dsr = lintObj.dsr;
var templateInfo = lintObj.templateInfo;
var msg = {};
@@ -91,11 +90,6 @@
if (templateInfo) {
msg.templateInfo = templateInfo;
- }
- if (logType === 'lint/fostered' || logType ===
'lint/multi-template' || logType === 'lint/mixed-content') {
- msg.src = src;
- } else if (dsr) {
- msg.src = src.substring(dsr[0], dsr[1]);
}
this.buffer.push(msg);
diff --git a/lib/wt2html/pp/handlers/linter.js
b/lib/wt2html/pp/handlers/linter.js
index e5cf66d..82bab74 100644
--- a/lib/wt2html/pp/handlers/linter.js
+++ b/lib/wt2html/pp/handlers/linter.js
@@ -35,7 +35,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 = [];
@@ -45,7 +45,7 @@
}
});
if (targets.length > 1) {
- lintObj = { src: targets, dsr: dsr };
+ lintObj = { dsr: dsr };
env.log('lint/multi-template', lintObj);
}
}
@@ -77,7 +77,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);
}
}
@@ -93,7 +93,6 @@
if (dp.selfClose) {
lintObj = {
- src: env.page.src,
dsr: dsr,
templateInfo: templateInfo,
params: { name: cNodeName },
@@ -105,7 +104,6 @@
if (dp.autoInsertedEnd === true && (tplInfo || dsr[2] > 0)) {
lintObj = {
- src: env.page.src,
dsr: dsr,
templateInfo: templateInfo,
params: { name: cNodeName },
@@ -115,7 +113,6 @@
if (dp.autoInsertedStart === true && (tplInfo || dsr[3] > 0)) {
lintObj = {
- src: env.page.src,
dsr: dsr,
templateInfo: templateInfo,
};
@@ -164,7 +161,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);
}
}
@@ -190,10 +187,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;
}
@@ -207,7 +202,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;
}
@@ -227,7 +222,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() },
@@ -256,7 +250,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/lintertest.js b/tests/mocha/lintertest.js
index 9ff1e83..7aa3d64 100644
--- a/tests/mocha/lintertest.js
+++ b/tests/mocha/lintertest.js
@@ -32,7 +32,6 @@
result[0].should.have.a.property("type",
"missing-end-tag");
result[0].should.have.a.property("wiki",
"enwiki");
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");
});
@@ -43,7 +42,6 @@
result[0].should.have.a.property("type",
"missing-end-tag");
result[0].should.have.a.property("wiki",
"enwiki");
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");
@@ -56,7 +54,6 @@
result[0].should.have.a.property("type",
"stripped-tag");
result[0].should.have.a.property("wiki",
"enwiki");
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() {
@@ -65,7 +62,6 @@
result[0].should.have.a.property("type",
"stripped-tag");
result[0].should.have.a.property("wiki",
"enwiki");
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() {
@@ -74,7 +70,6 @@
result[0].should.have.a.property("type",
"obsolete-tag");
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");
});
@@ -85,7 +80,6 @@
result[0].should.have.a.property("type",
"obsolete-tag");
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");
});
@@ -98,7 +92,6 @@
result[1].should.have.a.property("type",
"obsolete-tag");
result[1].should.have.a.property("wiki",
"enwiki");
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");
});
@@ -109,7 +102,6 @@
result[0].should.have.a.property("type",
"fostered");
result[0].should.have.a.property("wiki",
"enwiki");
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()
{
@@ -118,7 +110,6 @@
result[0].should.have.a.property("type",
"ignored-table-attr");
result[0].should.have.a.property("wiki",
"enwiki");
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() {
@@ -127,7 +118,6 @@
result[0].should.have.a.property("type",
"ignored-table-attr");
result[0].should.have.a.property("wiki",
"enwiki");
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() {
@@ -141,7 +131,6 @@
result[0].should.have.a.property("type",
"ignored-table-attr");
result[0].should.have.a.property("wiki",
"enwiki");
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() {
@@ -150,7 +139,6 @@
result[0].should.have.a.property("type",
"bogus-image-options");
result[0].should.have.a.property("wiki",
"enwiki");
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"]);
@@ -162,7 +150,6 @@
result[0].should.have.a.property("type",
"bogus-image-options");
result[0].should.have.a.property("wiki",
"enwiki");
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"]);
});
@@ -173,7 +160,6 @@
result[0].should.have.a.property("type",
"bogus-image-options");
result[0].should.have.a.property("wiki",
"enwiki");
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"]);
});
@@ -188,12 +174,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");
});
@@ -203,7 +187,6 @@
result.should.have.length(1);
result[0].should.have.a.property("type",
"self-closed-tag");
result[0].dsr.should.include.members([ 0, 12,
null, null ]);
- result[0].should.have.a.property("src",
"{{1x|<b />}}");
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: newchange
Gerrit-Change-Id: I9bbd5b743a9ef5146f03d9ea159387f822eda937
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits