Hygiene: fix line length violators

Change-Id: Ie1619acf5f319dafc2c9dc612335c1208522dab8
This commit is contained in:
Stephen Niedzielski 2018-09-13 09:33:20 -06:00
parent 4c05ae758f
commit ba17b11987
13 changed files with 89 additions and 60 deletions

View File

@ -149,7 +149,8 @@
// For now, we are going to ignore which editor is set as the default for the
// wiki and always default to the source editor. Once we decide to honor the
// default editor setting for the wiki, we'll want to use:
// visualEditorDefault = veConfig && veConfig.defaultUserOptions && veConfig.defaultUserOptions.enable;
// visualEditorDefault = veConfig && veConfig.defaultUserOptions &&
// veConfig.defaultUserOptions.enable;
// return visualEditorDefault ? 'VisualEditor' : 'SourceEditor';
return 'SourceEditor';
}
@ -289,7 +290,8 @@
},
drawer = new CtaDrawer( drawerOptions );
// use preventDefault() and not return false to close other open drawers or anything else.
// use preventDefault() and not return false to close other open
// drawers or anything else.
ev.preventDefault();
drawer.show();
} );
@ -305,8 +307,8 @@
addEditButton( 0, '#ca-edit' );
} else if ( leadSection !== null ) {
// if lead section is empty open editor with first section
// be careful not to do this when leadSection is null as this means MobileFormatter has not
// been run and thus we could not identify the lead
// be careful not to do this when leadSection is null as this means MobileFormatter
// has not been run and thus we could not identify the lead
addEditButton( 1, '#ca-edit' );
}
}

View File

@ -23,7 +23,8 @@
/**
* @cfg {object} defaults Default options hash.
* @cfg {string} defaults.activator selector for element that when clicked can open or close the menu
* @cfg {string} defaults.activator selector for element that when clicked can open or
* close the menu
*/
defaults: {
activator: undefined
@ -80,7 +81,8 @@
self.openNavigationDrawer();
}
ev.preventDefault();
// Stop propagation, otherwise the Skin will close the open menus on page center click
// Stop propagation, otherwise the Skin will close the open menus on page center
// click
ev.stopPropagation();
} );
},

View File

@ -22,12 +22,14 @@
* @cfg {string} defaults.isCompact whether the pointer overlay should be compact
* @cfg {number} defaults.timeout in milliseconds. If not zero the pointer overlay will
* hide after this duration of time.
* @cfg {string} defaults.isTutorial whether the pointer overlay contains tutorial like instructions
* @cfg {string} defaults.isTutorial whether the pointer overlay contains tutorial like
* instructions
* @cfg {string} defaults.summary Message describing thing being pointed to.
* @cfg {string} defaults.cancelMsg Cancel message.
* @cfg {string} defaults.appendToElement Where pointer overlay should be appended to.
* @cfg {string} defaults.target jQuery selector to point tutorial at
* @cfg {string} [defaults.alignment] Determines where the pointer should point to. Valid values 'left' or 'center'
* @cfg {string} [defaults.alignment] Determines where the pointer should point to. Valid
* values 'left' or 'center'
* @cfg {string} [defaults.confirmMsg] Label for a confirm message.
* @memberof PointerOverlay
* @instance
@ -129,8 +131,8 @@
left: left
} ).appendTo( this.$el );
// Since the positioning of this overlay is dependent on the current viewport it makes sense to
// use a global window event so that on resizes it is correctly positioned.
// Since the positioning of this overlay is dependent on the current viewport it makes
// sense to use a global window event so that on resizes it is correctly positioned.
M.on(
'resize',
$.proxy( this, 'refreshPointerArrow', this.options.target )

View File

@ -128,8 +128,8 @@
*/
onClickBadge: function () {
this.options.router.navigate( '#/notifications' );
// Important that we also prevent propagation to avoid interference with events that may be
// binded on #mw-mf-page-center that close overlay
// Important that we also prevent propagation to avoid interference with events that may
// be binded on #mw-mf-page-center that close overlay
return false;
},
/**

View File

@ -48,7 +48,8 @@
// the possibility of invoking the filter from outside the Special page in future.
// Once the 'ext.echo.special.onInitialize' hook has fired, load notification filter.
mw.hook( 'ext.echo.special.onInitialize' ).add( function () {
// The 'ext.echo.special.onInitialize' hook is fired whenever special page notification changes display on click of a filter.
// The 'ext.echo.special.onInitialize' hook is fired whenever special page notification
// changes display on click of a filter.
// Hence the hook is restricted from firing more than once.
if ( initialized ) {
return;

View File

@ -37,11 +37,11 @@
/**
* Gets the users AB-test bucket.
*
* A boolean instead of an enum is usually a code smell. However, the nature of A/B testing is
* to compare an A group's performance to a B group's so a boolean seems natural, even in the
* long term, and preferable to showing bucketing encoding ("A", "B", "control") to callers
* which is necessary if getBucket(). The downside is that now two functions exist where one
* would suffice.
* A boolean instead of an enum is usually a code smell. However, the nature of A/B testing
* is to compare an A group's performance to a B group's so a boolean seems natural, even
* in the long term, and preferable to showing bucketing encoding ("A", "B", "control") to
* callers which is necessary if getBucket(). The downside is that now two functions exist
* where one would suffice.
*
* @return {string} AB-test bucket, bucket.CONTROL_BUCKET by default, bucket.A or bucket.B
* buckets otherwise.

View File

@ -20,8 +20,9 @@
function PageIssuesOverlay( issues, logger, section, namespaceID ) {
var
options,
// Note only the main namespace is expected to make use of section issues, so the heading will
// always be minerva-meta-data-issues-section-header regardless of namespace.
// Note only the main namespace is expected to make use of section issues, so the
// heading will always be minerva-meta-data-issues-section-header regardless of
// namespace.
headingText = section === '0' || section === KEYWORD_ALL_SECTIONS ?
getNamespaceHeadingText( namespaceID ) :
mwMsg( 'minerva-meta-data-issues-section-header' );
@ -90,8 +91,9 @@
issuesSeverity: this.issues.map( issueSummaryToSeverity )
},
currentSection = this.section;
// When users close the modal, `sectionNumbers` should correlate to each visible issue in
// the modal, provided that this.section is a valid number and not `KEYWORD_ALL_SECTIONS`.
// When users close the modal, `sectionNumbers` should correlate to each visible issue
// in the modal, provided that this.section is a valid number and not
// `KEYWORD_ALL_SECTIONS`.
if ( this.section !== KEYWORD_ALL_SECTIONS ) {
logData.sectionNumbers = this.issues.map( function () {
return currentSection;
@ -101,9 +103,9 @@
},
/**
* Event that is triggered when an internal link inside the overlay is clicked. This event will
* not be triggered if the link contains the edit keyword, in which case onEditClick will be
* fired. This is primarily used for instrumenting page issues (see
* Event that is triggered when an internal link inside the overlay is clicked. This event
* will not be triggered if the link contains the edit keyword, in which case onEditClick
* will be fired. This is primarily used for instrumenting page issues (see
* https://meta.wikimedia.org/wiki/Schema:PageIssues).
* @param {JQuery.Event} ev
* @memberof PageIssuesOverlay
@ -118,8 +120,9 @@
},
/**
* Event that is triggered when an edit link inside the overlay is clicked. This is primarily
* used for instrumenting page issues (see https://meta.wikimedia.org/wiki/Schema:PageIssues).
* Event that is triggered when an edit link inside the overlay is clicked. This is
* primarily used for instrumenting page issues (see
* https://meta.wikimedia.org/wiki/Schema:PageIssues).
* @param {JQuery.Event} ev
* @memberof PageIssuesOverlay
* @instance

View File

@ -37,8 +37,8 @@
userUrl: window.location.href,
errorUrl: errorUrl,
errorMessage: errorMessage,
// Due to concerns for the length of the stack trace and going over the limit for URI length
// this is currently set to empty string.
// Due to concerns for the length of the stack trace and going over the
// limit for URI length this is currently set to empty string.
errorStackTrace: '',
errorLineNumber: lineNumber || 0,
errorColumnNumber: columnNumber || 0
@ -56,4 +56,12 @@
handleError( error.errorMessage, error.lineNumber, error.columnNumber, error.url );
} );
} );
}( mw.mobileFrontend, mw.requestIdleCallback, mw.track, mw.config, mw.trackSubscribe, mw.user, mw.experiments ) );
}(
mw.mobileFrontend,
mw.requestIdleCallback,
mw.track,
mw.config,
mw.trackSubscribe,
mw.user,
mw.experiments
) );

View File

@ -122,7 +122,8 @@
* @param {string} labelText what the label of the page issues banner should say
* @param {string} section that the banner and its issues belong to.
* If string KEYWORD_ALL_SECTIONS banner should apply to entire page.
* @param {boolean} inline - if true the first ambox in the section will become the entry point for the issues overlay
* @param {boolean} inline - if true the first ambox in the section will become the entry point
* for the issues overlay
* and if false, a link will be rendered under the heading.
* @param {OverlayManager} overlayManager
* @ignore
@ -220,8 +221,8 @@
/**
* Obtains the list of issues for the current page and provided section
* @param {number|string} section either KEYWORD_ALL_SECTIONS or a number relating to the section
* the issues belong to
* @param {number|string} section either KEYWORD_ALL_SECTIONS or a number relating to the
* section the issues belong to
* @return {jQuery.Object[]} array of all issues.
*/
function getIssues( section ) {
@ -292,17 +293,20 @@
// parse lead
createBanner( page, label, '0', inline, overlayManager );
if ( newTreatmentEnabled ) {
// parse other sections but only in group B. In treatment A no issues are shown for sections.
// parse other sections but only in group B. In treatment A no issues are shown
// for sections.
page.$( Page.HEADING_SELECTOR ).each( function ( i, headingEl ) {
var $headingEl = $( headingEl ),
sectionNum = $headingEl.find( '.edit-page' ).data( 'section' );
// Note certain headings matched using Page.HEADING_SELECTOR may not be headings
// and will not have a edit link
// e.g. table of contents
// Note certain headings matched using Page.HEADING_SELECTOR may not be
// headings and will not have a edit link. E.g. table of contents.
if ( sectionNum ) {
// Render banner for sectionNum associated with headingEl inside Page
createBanner( page, label, sectionNum.toString(), inline, overlayManager );
// Render banner for sectionNum associated with headingEl inside
// Page
createBanner(
page, label, sectionNum.toString(), inline, overlayManager
);
}
} );
}
@ -329,15 +333,16 @@
// Setup the overlay route.
overlayManager.add( new RegExp( '^/issues/(\\d+|' + KEYWORD_ALL_SECTIONS + ')$' ), function ( section ) {
return new PageIssuesOverlay( getIssues( section ), pageIssuesLogger, section, CURRENT_NS );
return new PageIssuesOverlay(
getIssues( section ), pageIssuesLogger, section, CURRENT_NS );
} );
}
M.define( 'skins.minerva.scripts/pageIssues', {
init: initPageIssues,
// The logger requires initialization (subscription). Ideally, the logger would be initialized
// and passed to initPageIssues() by the client. Since it's not, expose a log method and hide
// the subscription call in cleanuptemplates.
// The logger requires initialization (subscription). Ideally, the logger would be
// initialized and passed to initPageIssues() by the client. Since it's not, expose a log
// method and hide the subscription call in cleanuptemplates.
log: pageIssuesLogger.log,
test: {
formatPageIssuesSeverity: formatPageIssuesSeverity,

View File

@ -12,7 +12,9 @@
*
* @return {Object} A Partial<Schema:PageIssues> Object meant to be mixed with track data.
*/
function newPageIssueSchemaData( newTreatmentEnabled, namespaceId, pageIssueSeverities, pageIssuesSections ) {
function newPageIssueSchemaData(
newTreatmentEnabled, namespaceId, pageIssueSeverities, pageIssuesSections
) {
return {
pageTitle: mwConfig.get( 'wgTitle' ),
namespaceId: namespaceId,
@ -29,7 +31,7 @@
/**
* Enable tracking and add page token to every logged event.
* @param {boolean} newTreatmentEnabled
* @param {Object} pageIssueSchemaData A Partial<Schema:PageIssues> Object that will be mixed with
* @param {Object} pageIssueSchemaData A Partial<Schema:PageIssues> Object that will be mixed
* with track data.
* @return {void}
*/
@ -43,9 +45,9 @@
// Although we use strings inside the issues code (due to the usage of the key word
// `all`) - these need to be numbers to be validated by the schema
mixedData.sectionNumbers = ( mixedData.sectionNumbers || [] ).map( function ( sectionStr ) {
return parseInt( sectionStr, 10 );
} );
mixedData.sectionNumbers = ( mixedData.sectionNumbers || [] ).map(
function ( sectionStr ) { return parseInt( sectionStr, 10 ); }
);
// Log readingDepth schema.(ReadingDepth is guarded against multiple enables).
// See https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WikimediaEvents/+/437686/

View File

@ -29,25 +29,25 @@
MEDIUM: 'mediumColor',
HIGH: 'highColor'
},
// How severities order and compare from least to greatest. For the multiple issues template,
// severity should be considered the maximum of all its contained issues.
// How severities order and compare from least to greatest. For the multiple issues
// template, severity should be considered the maximum of all its contained issues.
SEVERITY_LEVEL = {
DEFAULT: 0,
LOW: 1,
MEDIUM: 2,
HIGH: 3
},
// Match the template's color CSS selector to a severity level concept. Derived via the Ambox
// templates and sub-templates for the top five wikis and tested on page issues inventory:
// Match the template's color CSS selector to a severity level concept. Derived via the
// Ambox templates and sub-templates for the top five wikis and tested on page issues
// inventory:
// - https://people.wikimedia.org/~jdrewniak/page_issues_inventory
// - https://en.wikipedia.org/wiki/Template:Ambox
// - https://es.wikipedia.org/wiki/Plantilla:Metaplantilla_de_avisos
// - https://ja.wikipedia.org/wiki/Template:Ambox
// - https://ru.wikipedia.org/wiki/Шаблон:Ambox
// - https://it.wikipedia.org/wiki/Template:Avviso
// Severity is the class associated with the color. The ResourceLoader config mimics the idea by
// using severity for color variants.
// Severity is determined independently of icons.
// Severity is the class associated with the color. The ResourceLoader config mimics the
// idea by using severity for color variants. Severity is determined independently of icons.
// These selectors should be migrated to their templates.
SEVERITY_REGEX = {
LOW: /ambox-style|avviso-stile/, // en, it
@ -124,7 +124,8 @@
*/
function iconName( box, severity ) {
var nameSeverity = parseType( box, severity );
// The icon with color variant as expected by ResourceLoader, {iconName}-{severityColorVariant}.
// The icon with color variant as expected by ResourceLoader,
// {iconName}-{severityColorVariant}.
return nameSeverity.name + '-' + ICON_COLOR[nameSeverity.severity];
}

View File

@ -39,7 +39,8 @@
var talkOptions = {
api: new mw.Api(),
title: title,
// T184273 using `getCurrentPage` because 'wgPageName' contains underscores instead of spaces.
// T184273 using `getCurrentPage` because 'wgPageName' contains underscores instead of
// spaces.
currentPageTitle: M.getCurrentPage().title,
licenseMsg: skin.getLicenseMsg()
};
@ -81,8 +82,8 @@
var loadingOverlay = new LoadingOverlay();
window.location.hash = '';
// setTimeout to make sure, that loadingOverlay's overlayenabled class on html doesnt get removed by
// OverlayManager (who closes TalkSectionAddOverlay
// setTimeout to make sure, that loadingOverlay's overlayenabled class on html doesnt
// get removed by OverlayManager (who closes TalkSectionAddOverlay).
window.setTimeout( function () {
loadingOverlay.show();
window.location.reload();

View File

@ -22,7 +22,9 @@
i;
for ( i = 0; i < maxUsers; i++ ) {
config = util.extend( {}, defaultConfig, { sessionId: mw.user.generateRandomSessionId() } );
config = util.extend( {}, defaultConfig, {
sessionId: mw.user.generateRandomSessionId()
} );
bucketingTest = new AB( config );
if ( bucketingTest.isA() ) {
++userBuckets.A;