jenkins-bot has submitted this change and it was merged. Change subject: linter: Use already-configured MW API URL ......................................................................
linter: Use already-configured MW API URL Parsoid already knows the MediaWiki API URL for the current wiki, so use that instead of hardcoding it in the configuration. Instead, have a "linterSendAPI" variable that controls whether lint errors are sent to the API or not. Change-Id: I85fde69ac712ec04f6a3ea73669c06200638df6f --- M config.example.yaml M lib/config/MWParserEnvironment.js M lib/config/ParsoidConfig.js M lib/logger/linter.js M lib/utils/Util.js M tests/mocha/apitest.localsettings.js M tests/rttest.localsettings.js 7 files changed, 17 insertions(+), 13 deletions(-) Approvals: Arlolra: Looks good to me, approved jenkins-bot: Verified diff --git a/config.example.yaml b/config.example.yaml index daafcc8..fff190d 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -81,8 +81,10 @@ #serverPort: 8000 #serverInterface: '127.0.0.1' - # The URL of your LintBridge API endpoint - #linterAPI: 'http://lintbridge.wmflabs.org/add' + # Enable linting of some wikitext errors to the log + #linting: true + # Send lint errors to MW API instead of to the log + #linterSendAPI: false # Require SSL certificates to be valid (default true) # Set to false when using self-signed SSL certificates diff --git a/lib/config/MWParserEnvironment.js b/lib/config/MWParserEnvironment.js index d25f2e7..6e88edd 100644 --- a/lib/config/MWParserEnvironment.js +++ b/lib/config/MWParserEnvironment.js @@ -259,7 +259,7 @@ "fatal", "error", "warning", "info", ]; - if (this.conf.parsoid.linting && !this.conf.parsoid.linterAPI) { + if (this.conf.parsoid.linting && !this.conf.parsoid.linterSendAPI) { defaultLogLevels.push("lint"); } diff --git a/lib/config/ParsoidConfig.js b/lib/config/ParsoidConfig.js index 337923c..66e291a 100644 --- a/lib/config/ParsoidConfig.js +++ b/lib/config/ParsoidConfig.js @@ -226,10 +226,12 @@ ParsoidConfig.prototype.linting = false; /** - * @property {String|null} linterAPI - * The URL for LintBridge API endpoint + * @property {boolean} linterSendAPI + * Whether to send lint errors to the MW API + * Requires the MW Linter extension to be installed + * and configured. */ -ParsoidConfig.prototype.linterAPI = null; +ParsoidConfig.prototype.linterSendAPI = false; /** * @property {number} linterSampling diff --git a/lib/logger/linter.js b/lib/logger/linter.js index b446ff1..a594df9 100644 --- a/lib/logger/linter.js +++ b/lib/logger/linter.js @@ -33,12 +33,12 @@ } try { - if (env.conf.parsoid.linterAPI) { + if (env.conf.parsoid.linterSendAPI) { // Only send the request if it is // the latest revision if (env.page.meta.revision.revid === env.page.latest) { request.post( - env.conf.parsoid.linterAPI, + env.conf.wiki.apiURI, { form: { data: JSON.stringify(enabledBuffer), page: env.page.name, diff --git a/lib/utils/Util.js b/lib/utils/Util.js index bcdfb93..e08430a 100644 --- a/lib/utils/Util.js +++ b/lib/utils/Util.js @@ -223,7 +223,7 @@ } if (opts.lint) { parsoidConfig.linting = true; - parsoidConfig.linterAPI = null; + parsoidConfig.linterSendAPI = false; } if (opts.useBatchAPI !== null) { parsoidConfig.useBatchAPI = Util.booleanOption(opts.useBatchAPI); diff --git a/tests/mocha/apitest.localsettings.js b/tests/mocha/apitest.localsettings.js index 0a45c19..d99ee0f 100644 --- a/tests/mocha/apitest.localsettings.js +++ b/tests/mocha/apitest.localsettings.js @@ -39,8 +39,8 @@ // parsoidConfig.serverPort = 8000; // parsoidConfig.serverInterface = '127.0.0.1'; - // The URL of your LintBridge API endpoint - // parsoidConfig.linterAPI = 'http://lintbridge.wmflabs.org/add'; + // Send lint errors to MW API + // parsoidConfig.linterSendAPI = false; // Require SSL certificates to be valid (default true) // Set to false when using self-signed SSL certificates diff --git a/tests/rttest.localsettings.js b/tests/rttest.localsettings.js index 4a92840..133f848 100644 --- a/tests/rttest.localsettings.js +++ b/tests/rttest.localsettings.js @@ -42,8 +42,8 @@ // parsoidConfig.serverPort = 8000; // parsoidConfig.serverInterface = '127.0.0.1'; - // The URL of your LintBridge API endpoint - // parsoidConfig.linterAPI = 'http://lintbridge.wmflabs.org/add'; + // Send lint errors to MW API + // parsoidConfig.linterSendAPI = false; // Require SSL certificates to be valid (default true) // Set to false when using self-signed SSL certificates -- To view, visit https://gerrit.wikimedia.org/r/316215 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I85fde69ac712ec04f6a3ea73669c06200638df6f 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: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits