jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/381121 )
Change subject: Utils need to s/parsoidConfig/parsoidOptions/ ...................................................................... Utils need to s/parsoidConfig/parsoidOptions/ * Also, do s/opts/cliOpts/ to clarify where that's coming from. * This should have been part of 976b8950. Change-Id: I9a4d60713ba84ec80f21d0eb83d70b7990870b99 --- M lib/utils/Util.js 1 file changed, 44 insertions(+), 44 deletions(-) Approvals: Subramanya Sastry: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/utils/Util.js b/lib/utils/Util.js index efba925..f66f734 100644 --- a/lib/utils/Util.js +++ b/lib/utils/Util.js @@ -38,22 +38,22 @@ * * Set debugging flags on an object, based on an options object. * - * @param {Object} parsoidConfig The config to modify. - * @param {Object} opts The options object to use for setting the debug flags. + * @param {Object} parsoidOptions Object to be assigned to the ParsoidConfig. + * @param {Object} cliOpts The options object to use for setting the debug flags. * @return {Object} The modified object. */ - setDebuggingFlags: function(parsoidConfig, opts) { + setDebuggingFlags: function(parsoidOptions, cliOpts) { // Handle the --help options var exit = false; - if (opts.trace === 'help') { + if (cliOpts.trace === 'help') { console.error(Util.traceUsageHelp()); exit = true; } - if (opts.dump === 'help') { + if (cliOpts.dump === 'help') { console.error(Util.dumpUsageHelp()); exit = true; } - if (opts.debug === 'help') { + if (cliOpts.debug === 'help') { console.error(Util.debugUsageHelp()); exit = true; } @@ -62,37 +62,37 @@ } // Ok, no help requested: process the options. - if (opts.debug !== undefined) { + if (cliOpts.debug !== undefined) { // Continue to support generic debugging. - if (opts.debug === true) { + if (cliOpts.debug === true) { console.warn("Warning: Generic debugging, not handler-specific."); - parsoidConfig.debug = Util.booleanOption(opts.debug); + parsoidOptions.debug = Util.booleanOption(cliOpts.debug); } else { // Setting --debug automatically enables --trace - parsoidConfig.debugFlags = this.splitFlags(opts.debug); - parsoidConfig.traceFlags = parsoidConfig.debugFlags; + parsoidOptions.debugFlags = this.splitFlags(cliOpts.debug); + parsoidOptions.traceFlags = parsoidOptions.debugFlags; } } - if (opts.trace !== undefined) { - if (opts.trace === true) { + if (cliOpts.trace !== undefined) { + if (cliOpts.trace === true) { console.warn("Warning: Generic tracing is no longer supported. Ignoring --trace flag. Please provide handler-specific tracing flags, e.g. '--trace pre,html5', to turn it on."); } else { // Add any new trace flags to the list of existing trace flags (if // any were inherited from debug); otherwise, create a new list. - parsoidConfig.traceFlags = (parsoidConfig.traceFlags || []).concat(this.splitFlags(opts.trace)); + parsoidOptions.traceFlags = (parsoidOptions.traceFlags || []).concat(this.splitFlags(cliOpts.trace)); } } - if (opts.dump !== undefined) { - if (opts.dump === true) { + if (cliOpts.dump !== undefined) { + if (cliOpts.dump === true) { console.warn("Warning: Generic dumping not enabled. Please set a flag."); } else { - parsoidConfig.dumpFlags = this.splitFlags(opts.dump); + parsoidOptions.dumpFlags = this.splitFlags(cliOpts.dump); } } - return parsoidConfig; + return parsoidOptions; }, @@ -205,11 +205,11 @@ * Sets templating and processing flags on an object, * based on an options object. * - * @param {Object} parsoidConfig The config to modify. - * @param {Object} opts The options object to use for setting the debug flags. + * @param {Object} parsoidOptions Object to be assigned to the ParsoidConfig. + * @param {Object} cliOpts The options object to use for setting the debug flags. * @return {Object} The modified object. */ - setTemplatingAndProcessingFlags: function(parsoidConfig, opts) { + setTemplatingAndProcessingFlags: function(parsoidOptions, cliOpts) { [ 'fetchConfig', 'fetchTemplates', @@ -218,39 +218,39 @@ 'rtTestMode', 'addHTMLTemplateParameters', ].forEach(function(c) { - if (opts[c] !== undefined) { - parsoidConfig[c] = Util.booleanOption(opts[c]); + if (cliOpts[c] !== undefined) { + parsoidOptions[c] = Util.booleanOption(cliOpts[c]); } }); - if (opts.usePHPPreProcessor !== undefined) { - parsoidConfig.usePHPPreProcessor = parsoidConfig.fetchTemplates && - Util.booleanOption(opts.usePHPPreProcessor); + if (cliOpts.usePHPPreProcessor !== undefined) { + parsoidOptions.usePHPPreProcessor = parsoidOptions.fetchTemplates && + Util.booleanOption(cliOpts.usePHPPreProcessor); } - if (opts.maxDepth !== undefined) { - parsoidConfig.maxDepth = typeof (opts.maxdepth) === 'number' ? - opts.maxdepth : parsoidConfig.maxDepth; + if (cliOpts.maxDepth !== undefined) { + parsoidOptions.maxDepth = typeof (cliOpts.maxdepth) === 'number' ? + cliOpts.maxdepth : parsoidOptions.maxDepth; } - if (opts.apiURL) { - if (!Array.isArray(parsoidConfig.mwApi)) { - parsoidConfig.mwApi = []; + if (cliOpts.apiURL) { + if (!Array.isArray(parsoidOptions.mwApi)) { + parsoidOptions.mwApi = []; } - parsoidConfig.mwApi.push({ prefix: 'customwiki', uri: opts.apiURL }); + parsoidOptions.mwApi.push({ prefix: 'customwiki', uri: cliOpts.apiURL }); } - if (opts.addHTMLTemplateParameters !== undefined) { - parsoidConfig.addHTMLTemplateParameters = - Util.booleanOption(opts.addHTMLTemplateParameters); + if (cliOpts.addHTMLTemplateParameters !== undefined) { + parsoidOptions.addHTMLTemplateParameters = + Util.booleanOption(cliOpts.addHTMLTemplateParameters); } - if (opts.lint) { - parsoidConfig.linting = true; - if (!parsoidConfig.linter) { - parsoidConfig.linter = {}; + if (cliOpts.lint) { + parsoidOptions.linting = true; + if (!parsoidOptions.linter) { + parsoidOptions.linter = {}; } - parsoidConfig.linter.sendAPI = false; + parsoidOptions.linter.sendAPI = false; } - if (opts.useBatchAPI !== null) { - parsoidConfig.useBatchAPI = Util.booleanOption(opts.useBatchAPI); + if (cliOpts.useBatchAPI !== null) { + parsoidOptions.useBatchAPI = Util.booleanOption(cliOpts.useBatchAPI); } - return parsoidConfig; + return parsoidOptions; }, /** -- To view, visit https://gerrit.wikimedia.org/r/381121 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9a4d60713ba84ec80f21d0eb83d70b7990870b99 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Arlolra <abrea...@wikimedia.org> Gerrit-Reviewer: C. Scott Ananian <canan...@wikimedia.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