Bug 1468658 - Fix/enable eslint 'space-infix-ops'

https://eslint.org/docs/rules/space-infix-ops

Changes performed by `--fix`.
This commit is contained in:
Ed Morley 2018-06-13 17:20:43 -07:00
Родитель 3420c1685b
Коммит 9ac0d2b8f9
18 изменённых файлов: 31 добавлений и 32 удалений

Просмотреть файл

@ -55,7 +55,6 @@ module.exports = neutrino => {
'react/forbid-prop-types': 'off', 'react/forbid-prop-types': 'off',
'react/no-danger': 'off', 'react/no-danger': 'off',
'react/no-multi-comp': 'off', 'react/no-multi-comp': 'off',
'space-infix-ops': 'off',
}, },
} }
})); }));

Просмотреть файл

@ -163,7 +163,7 @@ export const getTimeFields = function getTimeFields(job) {
// If we have both starttime and endtime, then duration will be between those two // If we have both starttime and endtime, then duration will be between those two
const endtime = job.end_timestamp || Date.now() / 1000; const endtime = job.end_timestamp || Date.now() / 1000;
const starttime = job.start_timestamp || job.submit_timestamp; const starttime = job.start_timestamp || job.submit_timestamp;
const duration = `${Math.round((endtime - starttime)/60, 0)} minute(s)`; const duration = `${Math.round((endtime - starttime) / 60, 0)} minute(s)`;
if (job.start_timestamp) { if (job.start_timestamp) {
timeFields.startTime = toDateStr(job.start_timestamp); timeFields.startTime = toDateStr(job.start_timestamp);

Просмотреть файл

@ -159,7 +159,7 @@ export default class LineOption extends React.Component {
>[view]</a>} >[view]</a>}
</div>} </div>}
{option.type ==='ignore' && <span {option.type === 'ignore' && <span
className={`line-option-text ignore ${canClassify ? '' : 'hidden'}`} className={`line-option-text ignore ${canClassify ? '' : 'hidden'}`}
>Ignore line >Ignore line
<Select <Select

Просмотреть файл

@ -63,7 +63,7 @@ export default function StaticLineOption(props) {
{!!manualBugNumber && <span>No bug number specified</span>} {!!manualBugNumber && <span>No bug number specified</span>}
</span>} </span>}
{option.type==='ignore' && {option.type === 'ignore' &&
<span className="line-option-text">Ignore {ignoreAlwaysText}</span>} <span className="line-option-text">Ignore {ignoreAlwaysText}</span>}
{optionCount > 0 && <span>, {optionCount} other {optionCount === 1 ? 'option' : 'options'} {optionCount > 0 && <span>, {optionCount} other {optionCount === 1 ? 'option' : 'options'}

Просмотреть файл

@ -144,13 +144,13 @@ treeherder.component('distributionGraph', {
ctrl.maxValue = Math.max.apply(null, ctrl.replicates); ctrl.maxValue = Math.max.apply(null, ctrl.replicates);
ctrl.minValue = Math.min.apply(null, ctrl.replicates); ctrl.minValue = Math.min.apply(null, ctrl.replicates);
if (ctrl.maxValue - ctrl.minValue > 1) { if (ctrl.maxValue - ctrl.minValue > 1) {
ctrl.maxValue = Math.ceil(ctrl.maxValue*1.001); ctrl.maxValue = Math.ceil(ctrl.maxValue * 1.001);
ctrl.minValue = Math.floor(ctrl.minValue/1.001); ctrl.minValue = Math.floor(ctrl.minValue / 1.001);
} }
ctx.globalAlpha = 0.3; ctx.globalAlpha = 0.3;
ctrl.replicates.forEach((value) => { ctrl.replicates.forEach((value) => {
ctx.beginPath(); ctx.beginPath();
ctx.arc(180/(ctrl.maxValue - ctrl.minValue)*(value - ctrl.minValue) + 5, 18, 5, 0, 360); ctx.arc(180 / (ctrl.maxValue - ctrl.minValue) * (value - ctrl.minValue) + 5, 18, 5, 0, 360);
ctx.fillStyle = 'white'; ctx.fillStyle = 'white';
ctx.fill(); ctx.fill();
}); });

Просмотреть файл

@ -308,7 +308,7 @@ export const phCompareDefaultNewRepo = 'try';
export const phTimeRanges = [ export const phTimeRanges = [
{ value: 86400, text: 'Last day' }, { value: 86400, text: 'Last day' },
{ value: 86400*2, text: 'Last 2 days' }, { value: 86400 * 2, text: 'Last 2 days' },
{ value: 604800, text: 'Last 7 days' }, { value: 604800, text: 'Last 7 days' },
{ value: 1209600, text: 'Last 14 days' }, { value: 1209600, text: 'Last 14 days' },
{ value: 2592000, text: 'Last 30 days' }, { value: 2592000, text: 'Last 30 days' },

Просмотреть файл

@ -60,7 +60,7 @@ treeherder.controller('BugFilerCtrl', [
let thisFailure = ''; let thisFailure = '';
for (let i = 0; i < allFailures.length; i++) { for (let i = 0; i < allFailures.length; i++) {
for (let j=0; j < $scope.omittedLeads.length; j++) { for (let j = 0; j < $scope.omittedLeads.length; j++) {
if (allFailures[i][0].search($scope.omittedLeads[j]) >= 0 && allFailures[i].length > 1) { if (allFailures[i][0].search($scope.omittedLeads[j]) >= 0 && allFailures[i].length > 1) {
allFailures[i].shift(); allFailures[i].shift();
} }
@ -129,7 +129,7 @@ treeherder.controller('BugFilerCtrl', [
// contains any of the omittedLeads, that lead is needed // contains any of the omittedLeads, that lead is needed
// for the full string match, so don't omit it in this case. // for the full string match, so don't omit it in this case.
// If it's not needed, go ahead and omit it. // If it's not needed, go ahead and omit it.
for (let i=0; i < $scope.omittedLeads.length; i++) { for (let i = 0; i < $scope.omittedLeads.length; i++) {
if ($scope.search_terms.length > 0 && summary.length > 1 && if ($scope.search_terms.length > 0 && summary.length > 1 &&
!$scope.search_terms[0].includes($scope.omittedLeads[i]) && !$scope.search_terms[0].includes($scope.omittedLeads[i]) &&
summary[0].search($scope.omittedLeads[i]) >= 0) { summary[0].search($scope.omittedLeads[i]) >= 0) {

Просмотреть файл

@ -128,7 +128,7 @@ treeherderApp.controller('SearchCtrl', [
$scope.search = function (ev) { $scope.search = function (ev) {
// User hit enter // User hit enter
if (ev.keyCode === 13) { if (ev.keyCode === 13) {
const filterVal = $scope.searchQueryStr === ''? null: $scope.searchQueryStr; const filterVal = $scope.searchQueryStr === '' ? null : $scope.searchQueryStr;
thJobFilters.replaceFilter('searchStr', filterVal); thJobFilters.replaceFilter('searchStr', filterVal);
$rootScope.$broadcast('blur-this', 'quick-filter'); $rootScope.$broadcast('blur-this', 'quick-filter');
} }

Просмотреть файл

@ -23,7 +23,7 @@ logViewerApp.controller('LogviewerCtrl', [
} }
if (query_string.job_id !== '') { if (query_string.job_id !== '') {
$scope.job_id= query_string.job_id; $scope.job_id = query_string.job_id;
} }
$scope.loading = false; $scope.loading = false;

Просмотреть файл

@ -113,7 +113,7 @@ treeherderApp.controller('MainCtrl', [
} }
let title; let title;
for (let i=0; i<revisions.length; i++) { for (let i = 0; i < revisions.length; i++) {
title = _.unescape(revisions[i].comments); title = _.unescape(revisions[i].comments);
/* /*

Просмотреть файл

@ -30,7 +30,7 @@ perf.factory('PhBugs', [
alertSummary: alertSummary.getTextualSummary() alertSummary: alertSummary.getTextualSummary()
}); });
const pushDate = dateFilter( const pushDate = dateFilter(
alertSummary.resultSetMetadata.push_timestamp*1000, alertSummary.resultSetMetadata.push_timestamp * 1000,
'EEE MMM d yyyy'); 'EEE MMM d yyyy');
const bugTitle = alertSummary.getTitle() + const bugTitle = alertSummary.getTitle() +
' regression on push ' + ' regression on push ' +
@ -200,7 +200,7 @@ perf.controller('AlertsCtrl', [
$scope.getCappedMagnitude = function (percent) { $scope.getCappedMagnitude = function (percent) {
// arbitrary scale from 0-20% multiplied by 5, capped // arbitrary scale from 0-20% multiplied by 5, capped
// at 100 (so 20% regression === 100% bad) // at 100 (so 20% regression === 100% bad)
return Math.min(Math.abs(percent)*5, 100); return Math.min(Math.abs(percent) * 5, 100);
}; };
$scope.editAlertSummaryNotes = function (alertSummary) { $scope.editAlertSummaryNotes = function (alertSummary) {
@ -440,7 +440,7 @@ perf.controller('AlertsCtrl', [
(response) => { (response) => {
response.data.results.forEach((resultSet) => { response.data.results.forEach((resultSet) => {
resultSet.dateStr = dateFilter( resultSet.dateStr = dateFilter(
resultSet.push_timestamp*1000, thDateFormat); resultSet.push_timestamp * 1000, thDateFormat);
// want at least 14 days worth of results for relative comparisons // want at least 14 days worth of results for relative comparisons
const timeRange = phTimeRangeValues[repo] ? phTimeRangeValues[repo] : phDefaultTimeRangeValue; const timeRange = phTimeRangeValues[repo] ? phTimeRangeValues[repo] : phDefaultTimeRangeValue;
resultSet.timeRange = Math.max(timeRange, _.find( resultSet.timeRange = Math.max(timeRange, _.find(

Просмотреть файл

@ -116,11 +116,11 @@ perf.controller('GraphsCtrl', [
var firstResultSetIndex = phSeries.flotSeries.resultSetData.indexOf( var firstResultSetIndex = phSeries.flotSeries.resultSetData.indexOf(
dataPoint.resultSetId); dataPoint.resultSetId);
var prevResultSetId = (firstResultSetIndex > 0) ? var prevResultSetId = (firstResultSetIndex > 0) ?
phSeries.flotSeries.resultSetData[firstResultSetIndex- 1] : null; phSeries.flotSeries.resultSetData[firstResultSetIndex - 1] : null;
var retriggerNum = _.countBy(phSeries.flotSeries.resultSetData, var retriggerNum = _.countBy(phSeries.flotSeries.resultSetData,
function (resultSetId) { function (resultSetId) {
return resultSetId === dataPoint.resultSetId ? 'retrigger':'original'; return resultSetId === dataPoint.resultSetId ? 'retrigger' : 'original';
}); });
var prevFlotDataPointIndex = (flotData.pointIndex - 1); var prevFlotDataPointIndex = (flotData.pointIndex - 1);
var flotSeriesData = flotData.series.data; var flotSeriesData = flotData.series.data;
@ -148,7 +148,7 @@ perf.controller('GraphsCtrl', [
resultSetId: dataPoint.resultSetId, resultSetId: dataPoint.resultSetId,
jobId: dataPoint.jobId, jobId: dataPoint.jobId,
series: phSeries, series: phSeries,
value: Math.round(v*1000)/1000, value: Math.round(v * 1000) / 1000,
deltaValue: dv.toFixed(1), deltaValue: dv.toFixed(1),
deltaPercentValue: (100 * dvp).toFixed(1), deltaPercentValue: (100 * dvp).toFixed(1),
date: $.plot.formatDate(new Date(t), '%a %b %d, %H:%M:%S'), date: $.plot.formatDate(new Date(t), '%a %b %d, %H:%M:%S'),
@ -608,7 +608,7 @@ perf.controller('GraphsCtrl', [
seriesData[series.signature], seriesData[series.signature],
function (dataPoint) { function (dataPoint) {
return [ return [
new Date(dataPoint.push_timestamp*1000), new Date(dataPoint.push_timestamp * 1000),
dataPoint.value dataPoint.value
]; ];
}), }),

Просмотреть файл

@ -116,7 +116,7 @@ treeherder.factory('PhAlerts', [
const formatAlert = function (alert, alertList) { const formatAlert = function (alert, alertList) {
return _.padStart(alert.amount_pct.toFixed(0), 3) + '% ' + return _.padStart(alert.amount_pct.toFixed(0), 3) + '% ' +
_.padEnd(alert.title, _.max(alertList, function (alert) { return alert.title.length; }).title.length +5) + _.padEnd(alert.title, _.max(alertList, function (alert) { return alert.title.length; }).title.length + 5) +
displayNumberFilter(alert.prev_value) + ' -> ' + displayNumberFilter(alert.new_value); displayNumberFilter(alert.prev_value) + ' -> ' + displayNumberFilter(alert.new_value);
}; };

Просмотреть файл

@ -254,7 +254,7 @@ treeherder.factory('ThRepositoryModel', [
return this.pushlogURL + '?changeset=' + arg; return this.pushlogURL + '?changeset=' + arg;
} else if (arg && arg.from && arg.to) { } else if (arg && arg.from && arg.to) {
return this.pushlogURL + '?fromchange=' + return this.pushlogURL + '?fromchange=' +
arg.from +'&tochange=' + arg.to; arg.from + '&tochange=' + arg.to;
} }
} }

Просмотреть файл

@ -619,7 +619,7 @@ treeherder.factory('ThResultSetStore', [
var key = `${newJob.id}`; var key = `${newJob.id}`;
var loadedJobMap = repoData.jobMap[key]; var loadedJobMap = repoData.jobMap[key];
var loadedJob = loadedJobMap? loadedJobMap.job_obj: null; var loadedJob = loadedJobMap ? loadedJobMap.job_obj : null;
var rsMapElement = repoData.rsMap[newJob.result_set_id]; var rsMapElement = repoData.rsMap[newJob.result_set_id];
// We don't have this push id yet // We don't have this push id yet
@ -895,7 +895,7 @@ treeherder.factory('ThResultSetStore', [
var getJobCount = jobList => ( var getJobCount = jobList => (
jobList.reduce((memo, job) => ( jobList.reduce((memo, job) => (
job.result !== 'superseded' ? { ...memo, [job.state]: memo[job.state]+1 } : memo job.result !== 'superseded' ? { ...memo, [job.state]: memo[job.state] + 1 } : memo
), { running: 0, pending: 0, completed: 0 } ), { running: 0, pending: 0, completed: 0 }
) )
); );
@ -928,7 +928,7 @@ treeherder.factory('ThResultSetStore', [
if (jobList.length === 0) { return groupedJobs; } if (jobList.length === 0) { return groupedJobs; }
groupedJobs.id = jobList[0].result_set_id; groupedJobs.id = jobList[0].result_set_id;
var lastModified = ''; var lastModified = '';
for (var i=0; i<jobList.length; i++) { for (var i = 0; i < jobList.length; i++) {
// search for the right platform // search for the right platform
var job = jobList[i]; var job = jobList[i];
var platform = _.find(groupedJobs.platforms, function (platform) { var platform = _.find(groupedJobs.platforms, function (platform) {
@ -994,7 +994,7 @@ treeherder.factory('ThResultSetStore', [
groupedJobs.platforms = _.sortBy(groupedJobs.platforms, function (platform) { groupedJobs.platforms = _.sortBy(groupedJobs.platforms, function (platform) {
var priority = platformArray.indexOf(platform.name); var priority = platformArray.indexOf(platform.name);
if (priority >= 0) { if (priority >= 0) {
priority = priority*100 + thOptionOrder[platform.option]; priority = priority * 100 + thOptionOrder[platform.option];
} else { } else {
priority = NaN; priority = NaN;
} }

Просмотреть файл

@ -403,7 +403,7 @@ treeherder.factory('thJobFilters', [
function setOnlySuperseded() { function setOnlySuperseded() {
const locationSearch = _.clone($location.search()); const locationSearch = _.clone($location.search());
locationSearch[QS_RESULT_STATUS] = 'superseded'; locationSearch[QS_RESULT_STATUS] = 'superseded';
locationSearch[QS_CLASSIFIED_STATE]= DEFAULTS.classifiedState.slice(); locationSearch[QS_CLASSIFIED_STATE] = DEFAULTS.classifiedState.slice();
$location.search(locationSearch); $location.search(locationSearch);
} }
@ -440,7 +440,7 @@ treeherder.factory('thJobFilters', [
function getNonFieldFiltersArray() { function getNonFieldFiltersArray() {
return Object.entries($location.search()).reduce((acc, [key, value]) => ( return Object.entries($location.search()).reduce((acc, [key, value]) => (
NON_FIELD_FILTERS.includes(key) ? [...acc, { field: key, key, value }]: acc NON_FIELD_FILTERS.includes(key) ? [...acc, { field: key, key, value }] : acc
), []); ), []);
} }
@ -531,7 +531,7 @@ treeherder.factory('thJobFilters', [
} }
function _withPrefix(field) { function _withPrefix(field) {
return (!field.startsWith(PREFIX) && !NON_FIELD_FILTERS.includes(field)) ? PREFIX+field : field; return (!field.startsWith(PREFIX) && !NON_FIELD_FILTERS.includes(field)) ? PREFIX + field : field;
} }
function _withoutPrefix(field) { function _withoutPrefix(field) {

Просмотреть файл

@ -74,7 +74,7 @@ treeherder.factory('thNotify', [
* Delete the first non-sticky element from the notifications queue * Delete the first non-sticky element from the notifications queue
*/ */
shift: function () { shift: function () {
for (let i=0; i<thNotify.notifications.length; i++) { for (let i = 0; i < thNotify.notifications.length; i++) {
if (!thNotify.notifications[i].sticky) { if (!thNotify.notifications[i].sticky) {
thNotify.remove(i); thNotify.remove(i);
return; return;

Просмотреть файл

@ -151,7 +151,7 @@ treeherder.factory('PhCompare', [
cmap.deltaPercentage = math.percentOf(cmap.delta, cmap.originalValue); cmap.deltaPercentage = math.percentOf(cmap.delta, cmap.originalValue);
// arbitrary scale from 0-20% multiplied by 5, capped // arbitrary scale from 0-20% multiplied by 5, capped
// at 100 (so 20% regression === 100% bad) // at 100 (so 20% regression === 100% bad)
cmap.magnitude = Math.min(Math.abs(cmap.deltaPercentage)*5, 100); cmap.magnitude = Math.min(Math.abs(cmap.deltaPercentage) * 5, 100);
const abs_t_value = Math.abs(math.t_test(originalData.values, newData.values, STDDEV_DEFAULT_FACTOR)); const abs_t_value = Math.abs(math.t_test(originalData.values, newData.values, STDDEV_DEFAULT_FACTOR));
cmap.className = getClassName(cmap.newIsBetter, cmap.originalValue, cmap.newValue, abs_t_value); cmap.className = getClassName(cmap.newIsBetter, cmap.originalValue, cmap.newValue, abs_t_value);
@ -353,7 +353,7 @@ treeherder.factory('PhCompare', [
// arbitrary scale from 0-20% multiplied by 5, capped // arbitrary scale from 0-20% multiplied by 5, capped
// at 100 (so 20% regression === 100% bad) // at 100 (so 20% regression === 100% bad)
trendMap.magnitude = Math.min(Math.abs(trendMap.deltaPercentage)*5, 100); trendMap.magnitude = Math.min(Math.abs(trendMap.deltaPercentage) * 5, 100);
return trendMap; return trendMap;
} }