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

Change subject: Re-implement linter logging for a MediaWiki extension
......................................................................


Re-implement linter logging for a MediaWiki extension

This re-implements the linter logging for a MediaWiki extension that
creates an API module named 'record-lint', and takes the logs as a JSON
POST parameter.

Additionally, also send requests for changes that don't have any issues
so that the extension could remove fixed issues.

Change-Id: I45600afed59027479c37be99c39ca5b2ad50661d
---
M lib/logger/linter.js
1 file changed, 18 insertions(+), 19 deletions(-)

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



diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index bb584ec..e72224c 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -16,25 +16,26 @@
 
 Linter.prototype.logLintOutput = function(logData, cb) {
        try {
-               if (this.buffer.length > 0) {
-                       if (!this._env.conf.parsoid.linterAPI) {
-                               console.log(this.buffer);
-                       } else {
-                               request.post(
-                                       this._env.conf.parsoid.linterAPI,
-                                       { json: this.buffer },
-                                       function(error, response, body) {
-                                               if (!error && 
response.statusCode === 200) {
-                                                       console.log(body);
-                                               }
-                                       }
-                               );
-                       }
-                       this.buffer = [];
-                       return;
+               if (!this._env.conf.parsoid.linterAPI) {
+                       console.log(this.buffer);
                } else {
-                       console.log("No Issues found");
+                       request.post(
+                               this._env.conf.parsoid.linterAPI,
+                               { form: {
+                                       data: JSON.stringify(this.buffer),
+                                       page: this._env.page.name,
+                                       revision: 
this._env.page.meta.revision.revid,
+                                       action: 'record-lint',
+                                       format: 'json',
+                                       formatversion: 2,
+                               }, },
+                               function(error, response, body) {
+                                       console.log(body);
+                               }
+                       );
                }
+               this.buffer = [];
+               return;
        } catch (e) {
                console.error("Error in logLintOutput: " + e);
                return;
@@ -59,8 +60,6 @@
 
                msg.type = logType.match(re)[1];
                msg.wiki = wiki;
-               msg.page = this._env.page.name;
-               msg.revision = this._env.page.meta.revision.revid;
                msg.wikiurl = 
url.resolve(this._env.conf.parsoid.mwApiMap.get(wiki).uri, '/');
 
                if (logData.locationData) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I45600afed59027479c37be99c39ca5b2ad50661d
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: Legoktm <legoktm.wikipe...@gmail.com>
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