jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/379429 )
Change subject: Move linter config properties to the linter config object
..
Move linter config properties to the linter config object
Change-Id: Ic198d3833ea849cee07b6298cfb6724bb1e6b0e1
---
M config.example.yaml
M lib/config/ParsoidConfig.js
M lib/logger/LintLogger.js
M lib/utils/Util.js
4 files changed, 27 insertions(+), 21 deletions(-)
Approvals:
jenkins-bot: Verified
Arlolra: Looks good to me, approved
diff --git a/config.example.yaml b/config.example.yaml
index e74103a..1fd7077 100644
--- a/config.example.yaml
+++ b/config.example.yaml
@@ -84,8 +84,9 @@
# Enable linting of some wikitext errors to the log
#linting: true
-# Send lint errors to MW API instead of to the log
-#linterSendAPI: false
+#linter:
+# sendAPI: false # Send lint errors to MW API instead of to the log
+# apiSampling: 10 # Sampling rate (1 / 10)
# Require SSL certificates to be valid (default true)
# Set to false when using self-signed SSL certificates
diff --git a/lib/config/ParsoidConfig.js b/lib/config/ParsoidConfig.js
index 359dc2e..7f6a364 100644
--- a/lib/config/ParsoidConfig.js
+++ b/lib/config/ParsoidConfig.js
@@ -233,25 +233,25 @@
*/
ParsoidConfig.prototype.linting = false;
-/**
- * @property {boolean} linterSendAPI
- * Whether to send lint errors to the MW API
- * Requires the MW Linter extension to be installed
- * and configured.
- */
-ParsoidConfig.prototype.linterSendAPI = false;
-
-/**
- * @property {number} linterSampling
- *
- * Ratio at which to sample linter errors, per page.
- * This is deterministic and based on page_id.
- */
-ParsoidConfig.prototype.linterAPISampling = 1;
-
// FIXME: Fold other linter config options into this.
ParsoidConfig.prototype.linter = {
/**
+* @property {boolean} sendAPI
+* Whether to send lint errors to the MW API
+* Requires the MW Linter extension to be installed
+* and configured.
+*/
+ sendAPI: false,
+
+ /**
+* @property {number} apiSampling
+*
+* Ratio at which to sample linter errors, per page.
+* This is deterministic and based on page_id.
+*/
+ apiSampling: 1,
+
+ /**
* @property {number} tidyWhiteSpaceBugMaxLength
*
* Max length of content covered by 'white-space:nowrap' CSS
diff --git a/lib/logger/LintLogger.js b/lib/logger/LintLogger.js
index 0297233..89f1c6e 100644
--- a/lib/logger/LintLogger.js
+++ b/lib/logger/LintLogger.js
@@ -38,7 +38,7 @@
this.buffer = [];
- if (env.page.id % env.conf.parsoid.linterAPISampling !== 0) {
+ if (env.page.id % env.conf.parsoid.linter.apiSampling !== 0) {
return;
}
@@ -47,7 +47,7 @@
return;
}
- if (!env.conf.parsoid.linterSendAPI) {
+ if (!env.conf.parsoid.linter.sendAPI) {
enabledBuffer.forEach(function(item) {
// Call this async, since recursive sync calls
to the logger
// are suppressed. This messes up the
ordering, as you'd
diff --git a/lib/utils/Util.js b/lib/utils/Util.js
index 232d2ac..6511186 100644
--- a/lib/utils/Util.js
+++ b/lib/utils/Util.js
@@ -242,7 +242,12 @@
}
if (opts.lint) {
parsoidConfig.linting = true;
- parsoidConfig.linterSendAPI = false;
+ if (!parsoidConfig.linter) {
+ // Late require since we have a circular
require involved
+ var ParsoidConfig =
require('../config/ParsoidConfig.js').ParsoidConfig;
+ parsoidConfig.linter =
Util.clone(ParsoidConfig.prototype.linter);
+ }
+ parsoidConfig.linter.sendAPI = false;
}
if (opts.useBatchAPI !== null) {
parsoidConfig.useBatchAPI =
Util.booleanOption(opts.useBatchAPI);
--
To view, visit https://gerrit.wikimedia.org/r/379429
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic198d3833ea849cee07b6298cfb6724bb1e6b0e1
Gerrit-PatchSet: 10
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry
Gerrit-Reviewer: Arlolra
Gerrit-Reviewer: C. Scott Ananian
Gerrit-Reviewer: Legoktm
Gerrit-Reviewer: Subramanya Sastry
Gerrit-Reviewer: jenkins-bot <>
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits