diff --git a/neutrino-custom/lint.js b/neutrino-custom/lint.js index 0d041df9d..823d76ef9 100644 --- a/neutrino-custom/lint.js +++ b/neutrino-custom/lint.js @@ -38,12 +38,17 @@ module.exports = neutrino => { 'block-spacing': ['error', 'always'], 'comma-spacing': 'error', 'comma-style': 'error', + 'curly': ['error', 'multi-line', 'consistent'], 'eol-last': 'error', 'eqeqeq': 'error', 'guard-for-in': 'error', 'indent': ['error', 4, { 'SwitchCase': 1 }], + 'key-spacing': ['error', { + beforeColon: false, + afterColon: true + }], 'keyword-spacing': 'error', 'linebreak-style': 'error', 'new-cap': 'error', @@ -89,6 +94,7 @@ module.exports = neutrino => { 'no-useless-call': 'error', 'no-void': 'error', 'no-with': 'error', + 'object-curly-spacing': ['error', 'always'], 'semi': 'error', 'space-before-blocks': 'error', 'space-before-function-paren': ['error', { @@ -97,6 +103,11 @@ module.exports = neutrino => { asyncArrow: 'always' }], 'strict': ['error', 'global'], + 'quote-props': ['error', 'as-needed', { + keywords: false, + unnecessary: true, + numbers: false + }], 'yoda': 'error' }, globals: ['angular', '$', '_', 'treeherder', 'perf', @@ -108,4 +119,3 @@ module.exports = neutrino => { } })); }; - diff --git a/ui/js/components/auth.js b/ui/js/components/auth.js index 35b08992e..862315627 100644 --- a/ui/js/components/auth.js +++ b/ui/js/components/auth.js @@ -48,7 +48,7 @@ treeherder.component("login", { var ctrl = this; ctrl.user = {}; // "clears out" the user when it is detected to be logged out. - var loggedOutUser = {is_staff: false, username: "", email: "", loggedin: false}; + var loggedOutUser = { is_staff: false, username: "", email: "", loggedin: false }; ctrl.userLoggingIn = $location.path() === '/login'; @@ -123,7 +123,7 @@ treeherder.component("login", { newUser.loggedin = true; localStorageService.set("user", newUser); ctrl.user = newUser; - ctrl.onUserChange({$event: {user: newUser}}); + ctrl.onUserChange({ $event: { user: newUser } }); }; @@ -131,7 +131,7 @@ treeherder.component("login", { localStorageService.set("user", loggedOutUser); localStorageService.set('taskcluster.credentials', {}); ctrl.user = loggedOutUser; - ctrl.onUserChange({$event: {user: loggedOutUser}}); + ctrl.onUserChange({ $event: { user: loggedOutUser } }); }; }] }); @@ -166,7 +166,7 @@ treeherder.component("loginCallback", { const results = $location.search(); if (results.certificate) { results.certificate = JSON.parse(results.certificate); - payload.ext = hawk.utils.base64urlEncode(JSON.stringify({"certificate": results.certificate})); + payload.ext = hawk.utils.base64urlEncode(JSON.stringify({ certificate: results.certificate })); } const header = hawk.client.header(loginUrl, 'GET', payload); @@ -174,7 +174,7 @@ treeherder.component("loginCallback", { // send a request from client side to TH server signed with TC // creds from login.taskcluster.net $http.get(loginUrl, - {headers: {"tcauth": header.field}}) + { headers: { tcauth: header.field } }) .then(function (resp) { var user = resp.data; user.loggedin = true; diff --git a/ui/js/components/perf/compare.js b/ui/js/components/perf/compare.js index 34650354b..9cf402777 100644 --- a/ui/js/components/perf/compare.js +++ b/ui/js/components/perf/compare.js @@ -2,8 +2,9 @@ treeherder.component('phCompareTable', { templateUrl: ['$element', '$attrs', function ($element, $attrs) { - if ($attrs.type === 'trend') + if ($attrs.type === 'trend') { return 'partials/perf/trendtable.html'; + } return 'partials/perf/comparetable.html'; }], bindings: { @@ -51,8 +52,9 @@ treeherder.component('phCompareTable', { return _.filter(results, function (result) { var testCondition = `${key} ${($attrs.type === 'trend') ? result.trendResult.name : result.name}`; return _.every(ctrl.filterOptions.filter.split(' '), function (matchText) { - if ($attrs.type === 'trend') + if ($attrs.type === 'trend') { return filter(testCondition, matchText) && shouldBeShown(result.trendResult); + } return filter(testCondition, matchText) && shouldBeShown(result); }); }); @@ -67,7 +69,7 @@ treeherder.component('phCompareTable', { } }); ctrl.filteredResultList = _.map(_.keys(ctrl.filteredResultList), function (testName) { - return {'testName': testName, 'results': ctrl.filteredResultList[testName]}; + return { testName: testName, results: ctrl.filteredResultList[testName] }; }); }; @@ -110,7 +112,7 @@ treeherder.component('compareError', { }); treeherder.component('distributionGraph', { - template:` + template: ` diff --git a/ui/js/controllers/admin/admin.js b/ui/js/controllers/admin/admin.js index 989b49ade..6b24cb182 100644 --- a/ui/js/controllers/admin/admin.js +++ b/ui/js/controllers/admin/admin.js @@ -98,7 +98,7 @@ admin.controller('AdminCtrl', [ } }; - $scope.master_profile = {name: '', exclusions: []}; + $scope.master_profile = { name: '', exclusions: [] }; // the promises may not yet have returned, but this just tells // us that we don't need to re-run this function. diff --git a/ui/js/controllers/bugfiler.js b/ui/js/controllers/bugfiler.js index f755ca930..b3feb76ef 100644 --- a/ui/js/controllers/bugfiler.js +++ b/ui/js/controllers/bugfiler.js @@ -227,9 +227,9 @@ treeherder.controller('BugFilerCtrl', [ $scope.searching = "DXR & Mercurial"; const dxrlink = `${dxrBaseUrl}mozilla-central/search?q=file:${$uibModalInstance.possibleFilename}&redirect=false&limit=5`; // Bug 1358328 - We need to override headers here until DXR returns JSON with the default Accept header - $http.get(dxrlink, {"headers": { - "Accept": "application/json" - }}).then((secondRequest) => { + $http.get(dxrlink, { headers: { + Accept: "application/json" + } }).then((secondRequest) => { const results = secondRequest.data.results; var resultsCount = results.length; // If the search returns too many results, this probably isn't a good search term, so bail @@ -375,19 +375,19 @@ treeherder.controller('BugFilerCtrl', [ "Content-Type": "application/json; charset=utf-8" }, data: { - "product": productString, - "component": componentString, - "summary": summarystring, - "keywords": keywords, - "version": version.name, - "blocks": blocks, - "depends_on": dependsOn, - "see_also": seeAlso, - "crash_signature": crashSignature, - "severity": severity, - "priority": priority, - "comment": descriptionStrings, - "comment_tags": "treeherder" + product: productString, + component: componentString, + summary: summarystring, + keywords: keywords, + version: version.name, + blocks: blocks, + depends_on: dependsOn, + see_also: seeAlso, + crash_signature: crashSignature, + severity: severity, + priority: priority, + comment: descriptionStrings, + comment_tags: "treeherder" } }); }) diff --git a/ui/js/controllers/filters.js b/ui/js/controllers/filters.js index 871bb6dc1..47d6b7e38 100644 --- a/ui/js/controllers/filters.js +++ b/ui/js/controllers/filters.js @@ -113,7 +113,7 @@ treeherderApp.controller('FilterPanelCtrl', [ }; $scope.createFieldFilter = function () { - $scope.newFieldFilter = {field: "", value: ""}; + $scope.newFieldFilter = { field: "", value: "" }; }; $scope.cancelFieldFilter = function () { $scope.newFieldFilter = null; diff --git a/ui/js/controllers/jobs.js b/ui/js/controllers/jobs.js index 4cd773290..dc2809ed4 100644 --- a/ui/js/controllers/jobs.js +++ b/ui/js/controllers/jobs.js @@ -178,8 +178,7 @@ treeherderApp.controller('ResultSetCtrl', [ $scope.cancelAllJobs = function (revision) { $scope.showConfirmCancelAll = false; - if (!$scope.canCancelJobs()) - return; + if (!$scope.canCancelJobs()) return; ThResultSetModel.cancelAll($scope.resultset.id, $scope.repoName).then(function () { return thBuildApi.cancelAll($scope.repoName, revision); diff --git a/ui/js/controllers/logviewer.js b/ui/js/controllers/logviewer.js index 44063aca5..781e0ddb4 100644 --- a/ui/js/controllers/logviewer.js +++ b/ui/js/controllers/logviewer.js @@ -122,15 +122,15 @@ logViewerApp.controller('LogviewerCtrl', [ } // set the result value and shading color class - $scope.result = {label: 'Result', value: job.result}; + $scope.result = { label: 'Result', value: job.result }; $scope.resultStatusShading = $scope.getShadingClass(job.result); // other properties, in order of appearance $scope.logProperties = [ - {label: 'Job', value: $scope.logViewerTitle}, - {label: 'Machine', value: job.machine_name}, - {label: 'Start', value: dateFilter(job.start_timestamp * 1000, thDateFormat)}, - {label: 'End', value: dateFilter(job.end_timestamp * 1000, thDateFormat)} + { label: 'Job', value: $scope.logViewerTitle }, + { label: 'Machine', value: job.machine_name }, + { label: 'Start', value: dateFilter(job.start_timestamp * 1000, thDateFormat) }, + { label: 'End', value: dateFilter(job.end_timestamp * 1000, thDateFormat) } ]; // Test to disable successful steps checkbox on taskcluster jobs @@ -150,10 +150,10 @@ logViewerApp.controller('LogviewerCtrl', [ ThResultSetModel.getResultSet($scope.repoName, job.result_set_id).then((data) => { const revision = data.data.revision; - $scope.logProperties.push({label: 'Revision', value: revision}); + $scope.logProperties.push({ label: 'Revision', value: revision }); }); - ThJobDetailModel.getJobDetails({job_guid: job.job_guid}).then((jobDetails) => { + ThJobDetailModel.getJobDetails({ job_guid: job.job_guid }).then((jobDetails) => { $scope.job_details = jobDetails; }); }, () => { diff --git a/ui/js/controllers/main.js b/ui/js/controllers/main.js index d430faf72..e566c00d9 100644 --- a/ui/js/controllers/main.js +++ b/ui/js/controllers/main.js @@ -677,7 +677,7 @@ treeherderApp.controller('MainCtrl', [ $scope.changeRepo = function (repo_name) { // preserves filter params as the user changes repos and revisions $location.search(_.extend({ - "repo": repo_name + repo: repo_name }, thJobFilters.getActiveFilters())); }; diff --git a/ui/js/controllers/perf/alerts.js b/ui/js/controllers/perf/alerts.js index 61b362085..751fc05f0 100644 --- a/ui/js/controllers/perf/alerts.js +++ b/ui/js/controllers/perf/alerts.js @@ -165,7 +165,7 @@ perf.controller('AlertsCtrl', [ // can filter by alert statuses or just show everything $scope.statuses = _.map(phAlertSummaryStatusMap); - $scope.statuses = $scope.statuses.concat({id: -1, text: "all"}); + $scope.statuses = $scope.statuses.concat({ id: -1, text: "all" }); $scope.changeAlertSummaryStatus = function (alertSummary, open) { PhAlerts.changeAlertSummaryStatus( @@ -368,7 +368,7 @@ perf.controller('AlertsCtrl', [ // We need to update not only the summary when resetting the alert, // but other summaries affected by the change var summariesToUpdate = [alertSummary].concat(_.flatten(_.map( - _.filter(alertSummary.alerts, {'selected': true}), + _.filter(alertSummary.alerts, { selected: true }), function (alert) { return _.find($scope.alertSummaries, function (alertSummary) { return alertSummary.id === alert.related_summary_id; @@ -406,8 +406,7 @@ perf.controller('AlertsCtrl', [ [alertSummary.push_id, alertSummary.prev_push_id], function (resultSetId) { // skip nulls - if (resultSetId === null) - return; + if (resultSetId === null) return; var repoMap = resultSetToSummaryMap[alertSummary.repository]; // initialize map for this result set, if not already // initialized diff --git a/ui/js/controllers/perf/compare.js b/ui/js/controllers/perf/compare.js index b60761178..4871b2aa8 100644 --- a/ui/js/controllers/perf/compare.js +++ b/ui/js/controllers/perf/compare.js @@ -18,10 +18,11 @@ perf.controller('CompareChooserCtrl', [ $scope.revisionComparison = false; var getParameter = function (paramName, defaultValue) { - if ($stateParams[paramName]) + if ($stateParams[paramName]) { return $stateParams[paramName]; - else if (localStorageService.get(paramName)) + } else if (localStorageService.get(paramName)) { return localStorageService.get(paramName); + } return defaultValue; }; @@ -94,7 +95,7 @@ perf.controller('CompareChooserCtrl', [ $scope.newRevision ).then(function (revision) { return { - revision:revision, + revision: revision, project: $scope.newProject }; }); @@ -281,8 +282,9 @@ perf.controller('CompareResultsCtrl', [ } cmap.name = platform; - if (Object.keys($scope.compareResults).indexOf(testName) < 0) + if (Object.keys($scope.compareResults).indexOf(testName) < 0) { $scope.compareResults[testName] = []; + } $scope.compareResults[testName].push(cmap); }); }); @@ -309,7 +311,7 @@ perf.controller('CompareResultsCtrl', [ PhSeries.getSeriesList( $scope.originalProject.name, - {interval: timeRange, subtests: 0, + { interval: timeRange, subtests: 0, framework: $scope.filterOptions.framework.id }).then( function (originalSeriesList) { @@ -319,7 +321,7 @@ perf.controller('CompareResultsCtrl', [ _.map(originalSeriesList, 'name')); return PhCompare.getResultsMap($scope.originalProject.name, originalSeriesList, - {pushIDs: resultSetIds}); + { pushIDs: resultSetIds }); }).then(function (resultMaps) { var originalResultsMap = resultMaps[$scope.originalResultSet.id]; var newResultsMap = resultMaps[$scope.newResultSet.id]; @@ -345,7 +347,7 @@ perf.controller('CompareResultsCtrl', [ return PhCompare.getResultsMap($scope.newProject.name, newSeriesList, - {pushIDs: [$scope.newResultSet.id]}); + { pushIDs: [$scope.newResultSet.id] }); }).then(function (resultMaps) { $scope.dataLoading = false; displayResults(originalResultsMap, resultMaps[$scope.newResultSet.id]); @@ -366,7 +368,7 @@ perf.controller('CompareResultsCtrl', [ $scope.testList = _.uniq(_.map(originalSeriesList, 'name')); return PhCompare.getResultsMap($scope.originalProject.name, originalSeriesList, - {interval: $scope.selectedTimeRange}); + { interval: $scope.selectedTimeRange }); }).then(function (resultsMap) { var originalResultsMap = resultsMap; PhSeries.getSeriesList( @@ -380,7 +382,7 @@ perf.controller('CompareResultsCtrl', [ _.uniq(_.map(newSeriesList, 'name'))); return PhCompare.getResultsMap($scope.newProject.name, newSeriesList, - {pushIDs: [$scope.newResultSet.id]}); + { pushIDs: [$scope.newResultSet.id] }); }).then(function (resultMaps) { var newResultsMap = resultMaps[$scope.newResultSet.id]; $scope.dataLoading = false; @@ -740,7 +742,7 @@ perf.controller('CompareSubtestResultsCtrl', [ $scope.platformList = _.uniq(_.map(originalSubtestList, 'platform')); return PhCompare.getResultsMap($scope.originalProject.name, originalSubtestList, - {pushIDs: resultSetIds}); + { pushIDs: resultSetIds }); }) ]).then(function (results) { var originalSeriesMap = results[1][$scope.originalResultSet.id]; @@ -778,7 +780,7 @@ perf.controller('CompareSubtestResultsCtrl', [ return PhCompare.getResultsMap($scope.newProject.name, newSeriesList, - {pushIDs: [$scope.newResultSet.id]}); + { pushIDs: [$scope.newResultSet.id] }); }).then(function (newSeriesMaps) { var newSeriesMap = newSeriesMaps[$scope.newResultSet.id]; // There is a chance that we haven't received data for the given signature/resultSet yet @@ -821,7 +823,7 @@ perf.controller('CompareSubtestResultsCtrl', [ $scope.platformList = _.uniq(_.map(originalSubtestList, 'platform')); return PhCompare.getResultsMap($scope.originalProject.name, originalSubtestList, - {interval: $scope.selectedTimeRange}); + { interval: $scope.selectedTimeRange }); }) ]).then( function (originalResults) { @@ -841,7 +843,7 @@ perf.controller('CompareSubtestResultsCtrl', [ return PhCompare.getResultsMap($scope.newProject.name, newSeriesList, - {pushIDs: [$scope.newResultSet.id]}); + { pushIDs: [$scope.newResultSet.id] }); }).then(function (newSeriesMaps) { var newSeriesMap = newSeriesMaps[$scope.newResultSet.id]; // There is a chance that we haven't received data for the given signature/resultSet yet @@ -894,7 +896,7 @@ perf.controller('CompareSubtestDistributionCtrl', ['$scope', '$stateParams', '$q } const numRuns = perfDatumList[subtestSignature].length; let replicatePromises = perfDatumList[subtestSignature].map( - value => PhSeries.getReplicateData({job_id: value.job_id})); + value => PhSeries.getReplicateData({ job_id: value.job_id })); return $q.all(replicatePromises).then((replicateData) => { let replicateValues = replicateData.concat.apply([], replicateData.map((data) => { @@ -905,8 +907,8 @@ perf.controller('CompareSubtestDistributionCtrl', ['$scope', '$stateParams', '$q ); //metrics-graphics doesn't accept "0" as x_accesor replicateValues = replicateValues.map((value, index) => ({ - "replicate": (index + 1).toString(), - "value": value + replicate: (index + 1).toString(), + value: value })); metricsgraphics.data_graphic({ title: `${target} replicates over ${numRuns} run${(numRuns > 1) ? 's' : ''}`, @@ -942,7 +944,7 @@ perf.controller('CompareSubtestDistributionCtrl', ['$scope', '$stateParams', '$q $stateParams.originalProject); $scope.newProject = ThRepositoryModel.getRepo( $stateParams.newProject); - PhSeries.getSeriesList($scope.originalProject.name, {signature: $scope.originalSubtestSignature}).then( + PhSeries.getSeriesList($scope.originalProject.name, { signature: $scope.originalSubtestSignature }).then( (seriesData) => { $scope.testSuite = seriesData[0].suite; $scope.subtest = seriesData[0].test; @@ -955,8 +957,6 @@ perf.controller('CompareSubtestDistributionCtrl', ['$scope', '$stateParams', '$q }).then((result) => { $scope.originalResultSet = result.resultSet; $scope.originalReplicateError = result.replicateDataError; - if ($scope.originalReplicateError) - $scope.noResult = "base"; return fetchAndDrawReplicateGraph($scope.newProject.name, $scope.newRevision, $scope.newSubtestSignature, @@ -964,8 +964,6 @@ perf.controller('CompareSubtestDistributionCtrl', ['$scope', '$stateParams', '$q }).then((result) => { $scope.newResultSet = result.resultSet; $scope.newReplicateError = result.replicateDataError; - if ($scope.newReplicateError) - $scope.noResult = "new"; window.document.title = `${$scope.platform}: ${$scope.testName}`; $scope.dataLoading = false; }); diff --git a/ui/js/controllers/perf/dashboard.js b/ui/js/controllers/perf/dashboard.js index a60551c3d..20caa9061 100644 --- a/ui/js/controllers/perf/dashboard.js +++ b/ui/js/controllers/perf/dashboard.js @@ -61,7 +61,7 @@ perf.controller('dashCtrl', [ getSeriesList = PhSeries.getSeriesList($scope.selectedRepo.name, { interval: $scope.selectedTimeRange.value, subtests: 0, - framework: $scope.framework}).then(function (seriesList) { + framework: $scope.framework }).then(function (seriesList) { return _.filter(seriesList, function (series) { return filterSeriesByTopic(series); }); diff --git a/ui/js/controllers/perf/e10s-trend.js b/ui/js/controllers/perf/e10s-trend.js index 01ed758a7..55cf913e6 100644 --- a/ui/js/controllers/perf/e10s-trend.js +++ b/ui/js/controllers/perf/e10s-trend.js @@ -47,7 +47,7 @@ perf.controller('e10sTrendCtrl', [ if (!$scope.compareResults[baseTestName]) { $scope.compareResults[baseTestName] = []; } - $scope.compareResults[baseTestName].push({baseResult: baseResult, newResult: newResult, trendResult: trendResult}); + $scope.compareResults[baseTestName].push({ baseResult: baseResult, newResult: newResult, trendResult: trendResult }); } } }); @@ -298,7 +298,7 @@ perf.controller('e10sTrendSubtestCtrl', [ if (!$scope.compareResults[baseTestName]) { $scope.compareResults[baseTestName] = []; } - $scope.compareResults[baseTestName].push({baseResult: baseResult, newResult: newResult, trendResult: trendResult}); + $scope.compareResults[baseTestName].push({ baseResult: baseResult, newResult: newResult, trendResult: trendResult }); } } }); diff --git a/ui/js/controllers/perf/graphs.js b/ui/js/controllers/perf/graphs.js index 109d4725f..ad27c55d2 100644 --- a/ui/js/controllers/perf/graphs.js +++ b/ui/js/controllers/perf/graphs.js @@ -287,7 +287,7 @@ perf.controller('GraphsCtrl', [ opts.min = ranges.yaxis.from; opts.max = ranges.yaxis.to; }); - $scope.zoom = {'x': [ranges.xaxis.from, ranges.xaxis.to], 'y': [ranges.yaxis.from, ranges.yaxis.to]}; + $scope.zoom = { x: [ranges.xaxis.from, ranges.xaxis.to], y: [ranges.yaxis.from, ranges.yaxis.to] }; $scope.plot.setupGrid(); $scope.plot.draw(); @@ -442,7 +442,7 @@ perf.controller('GraphsCtrl', [ { xaxis: { mode: 'time' }, series: { shadowSize: 0 }, - selection: { mode: 'xy', color: '#97c6e5'}, + selection: { mode: 'xy', color: '#97c6e5' }, lines: { show: false }, points: { show: true }, legend: { show: false }, @@ -476,8 +476,7 @@ perf.controller('GraphsCtrl', [ $("#graph").on("plothover", function (event, pos, item) { // if examining an item, disable this behaviour - if ($scope.selectedDataPoint) - return; + if ($scope.selectedDataPoint) return; $('#graph').css({ cursor: item ? 'pointer' : '' }); @@ -536,8 +535,9 @@ perf.controller('GraphsCtrl', [ $scope.seriesList[0].platform + " (" + $scope.seriesList[0].projectName + ")"); - if ($scope.seriesList.length > 1) + if ($scope.seriesList.length > 1) { window.document.title += " and others"; + } } else { window.document.title = $state.current.title; } @@ -623,7 +623,7 @@ perf.controller('GraphsCtrl', [ function addSeriesList(partialSeriesList) { $scope.loadingGraphs = true; return $q.all(partialSeriesList.map(function (partialSeries) { - let params = {framework: partialSeries.frameworkId}; + let params = { framework: partialSeries.frameworkId }; if (partialSeries.id) { params.id = partialSeries.id; } @@ -723,11 +723,11 @@ perf.controller('GraphsCtrl', [ ThRepositoryModel.load().then(function () { if ($stateParams.timerange) { var timeRange = _.find(phTimeRanges, - {'value': parseInt($stateParams.timerange)}); + { value: parseInt($stateParams.timerange) }); $scope.myTimerange = timeRange; } else { $scope.myTimerange = _.find(phTimeRanges, - {'value': phDefaultTimeRangeValue}); + { value: phDefaultTimeRangeValue }); } $scope.timeRangeChanged = function () { $scope.loadingGraphs = true; @@ -746,8 +746,8 @@ perf.controller('GraphsCtrl', [ var zoomString = decodeURIComponent($stateParams.zoom).replace(/[\[\{\}\]"]+/g, ''); var zoomArray = zoomString.split(","); var zoomObject = { - "x": zoomArray.slice(0, 2), - "y": zoomArray.slice(2, 4) + x: zoomArray.slice(0, 2), + y: zoomArray.slice(2, 4) }; $scope.zoom = (zoomString) ? zoomObject : []; } else { @@ -778,8 +778,8 @@ perf.controller('GraphsCtrl', [ var partialSeriesString = decodeURIComponent(encodedSeries).replace(/[\[\]"]/g, ''); var partialSeriesArray = partialSeriesString.split(","); var partialSeriesObject = { - project: partialSeriesArray[0], - signature: partialSeriesArray[1].length === 40 ? partialSeriesArray[1] : undefined, + project: partialSeriesArray[0], + signature: partialSeriesArray[1].length === 40 ? partialSeriesArray[1] : undefined, id: partialSeriesArray[1].length === 40 ? undefined : partialSeriesArray[1], visible: partialSeriesArray[2] !== 0, frameworkId: partialSeriesArray[3] @@ -815,7 +815,7 @@ perf.controller('GraphsCtrl', [ } if (option !== undefined) { - var series = _.find($scope.seriesList, {signature: seriesSignature}); + var series = _.find($scope.seriesList, { signature: seriesSignature }); options = { option: option, relatedSeries: series }; } @@ -987,7 +987,7 @@ perf.controller('TestChooserCtrl', ['$scope', '$uibModalInstance', '$http', var branchList = []; thPerformanceBranches.forEach(function (branch) { if (branch !== originalSeries.projectName) { - branchList.push(_.find($scope.projects, {name: branch})); + branchList.push(_.find($scope.projects, { name: branch })); } }); // get each project's series data from remote and use promise to diff --git a/ui/js/controllers/tcjobactions.js b/ui/js/controllers/tcjobactions.js index b66696bec..b49406eac 100644 --- a/ui/js/controllers/tcjobactions.js +++ b/ui/js/controllers/tcjobactions.js @@ -64,7 +64,7 @@ treeherder.controller('TCJobActionsCtrl', [ ThJobDetailModel.getJobDetails({ job_id: decisionTask.id, title: 'artifact uploaded', - value: 'actions.json'}).then(function (details) { + value: 'actions.json' }).then(function (details) { if (!details.length) { alert("Could not find actions.json"); return; diff --git a/ui/js/directives/treeherder/bottom_nav_panel.js b/ui/js/directives/treeherder/bottom_nav_panel.js index b46a9973c..b4068d4e3 100644 --- a/ui/js/directives/treeherder/bottom_nav_panel.js +++ b/ui/js/directives/treeherder/bottom_nav_panel.js @@ -84,12 +84,12 @@ treeherder.directive('thSimilarJobs', [ }); scope.similar_jobs = []; scope.similar_jobs_filters = { - "machine_id": true, - "job_type_id": true, - "build_platform_id": true + machine_id: true, + job_type_id: true, + build_platform_id: true }; scope.update_similar_jobs = function (job) { - var options = {result_set_id__ne: job.result_set_id}; + var options = { result_set_id__ne: job.result_set_id }; angular.forEach(scope.similar_jobs_filters, function (elem, key) { if (elem) { options[key] = job[key]; diff --git a/ui/js/directives/treeherder/clonejobs.js b/ui/js/directives/treeherder/clonejobs.js index ecd2a322c..b1e5a6903 100644 --- a/ui/js/directives/treeherder/clonejobs.js +++ b/ui/js/directives/treeherder/clonejobs.js @@ -773,7 +773,7 @@ treeherder.directive('thCloneJobs', [ //Add platforms platformTdEl = $(platformInterpolator( - {'name':platformName, 'option':option, 'id':platformId} + { name: platformName, option: option, id: platformId } )); rowEl.append(platformTdEl); @@ -810,7 +810,7 @@ treeherder.directive('thCloneJobs', [ scrollOffset = -200; } if (!isOnScreen(el)) { - $('.th-global-content').scrollTo(el, duration, {offset: scrollOffset}); + $('.th-global-content').scrollTo(el, duration, { offset: scrollOffset }); } } @@ -975,15 +975,15 @@ treeherder.directive('thCloneJobs', [ // We first determine whether the row has some visible element var anyVisible = _.some(platform.groups, function (jobGroup) { - return _.some(jobGroup.jobs, {visible: true}); + return _.some(jobGroup.jobs, { visible: true }); }); var display_style = anyVisible ? "table-row" : "none"; var rowHtml = ''; //Add platforms rowHtml += platformInterpolator( { - 'name':thPlatformName(platform.name), 'option':platform.option, - 'id':thAggregateIds.getPlatformRowId( + name: thPlatformName(platform.name), option: platform.option, + id: thAggregateIds.getPlatformRowId( resultset.id, platform.name, platform.option @@ -1015,7 +1015,7 @@ treeherder.directive('thCloneJobs', [ ); var targetEl = $( - tableInterpolator({ aggregateId:resultsetAggregateId }) + tableInterpolator({ aggregateId: resultsetAggregateId }) ); addRevisions(scope, targetEl); @@ -1036,15 +1036,15 @@ treeherder.directive('thCloneJobs', [ } return { - link:linker, - replace:true + link: linker, + replace: true }; }; return { - link:linker, - replace:true + link: linker, + replace: true }; } ]); diff --git a/ui/js/directives/treeherder/main.js b/ui/js/directives/treeherder/main.js index 808013b4d..7e482433f 100755 --- a/ui/js/directives/treeherder/main.js +++ b/ui/js/directives/treeherder/main.js @@ -8,7 +8,7 @@ treeherder.directive('ngRightClick', [ element.on('contextmenu', function (event) { scope.$apply(function () { event.preventDefault(); - fn(scope, {$event:event}); + fn(scope, { $event: event }); }); }); }; diff --git a/ui/js/directives/treeherder/top_nav_bar.js b/ui/js/directives/treeherder/top_nav_bar.js index 4ca4d157a..ab2d2ae10 100644 --- a/ui/js/directives/treeherder/top_nav_bar.js +++ b/ui/js/directives/treeherder/top_nav_bar.js @@ -20,7 +20,7 @@ treeherder.directive('thWatchedRepo', [ var $log = new ThLog("thWatchedRepo"); var statusInfo = { - "open": { + open: { icon: "fa-circle-o", color: "tree-open", btnClass: "btn-view-nav" @@ -30,12 +30,12 @@ treeherder.directive('thWatchedRepo', [ color: "tree-approval", btnClass: "btn-view-nav" }, - "closed": { + closed: { icon: "fa-times-circle", color: "tree-closed", btnClass: "btn-view-nav-closed" }, - "unsupported": { + unsupported: { icon: "fa-question", color: "tree-unavailable", btnClass: "btn-view-nav" @@ -46,7 +46,7 @@ treeherder.directive('thWatchedRepo', [ color: "tree-unavailable", btnClass: "btn-view-nav" }, - "error": { + error: { icon: "fa-question", color: "tree-unavailable", btnClass: "btn-view-nav" @@ -136,7 +136,7 @@ treeherder.directive('thCheckboxDropdownContainer', [ }); $('.checkbox-dropdown-menu').on({ - "click": function (ev) { + click: function (ev) { if ($(ev.target).hasClass("dropdown-link") || $(ev.target).parent().hasClass("dropdown-link")) { scope.closeable = false; diff --git a/ui/js/models/classified_failure.js b/ui/js/models/classified_failure.js index a0ae994a6..e094fc952 100644 --- a/ui/js/models/classified_failure.js +++ b/ui/js/models/classified_failure.js @@ -50,7 +50,7 @@ treeherder.factory('ThClassifiedFailuresModel', [ ThClassifiedFailuresModel.create = function (bug_number) { return $http.post(ThClassifiedFailuresModel.get_url(), - {bug_number: bug_number} + { bug_number: bug_number } ); }; @@ -65,7 +65,7 @@ treeherder.factory('ThClassifiedFailuresModel', [ var classified_failure = this; classified_failure.bug_number = bug_number; return $http.put(ThClassifiedFailuresModel.get_url() + classified_failure.id + "/", - {bug_number: bug_number}); + { bug_number: bug_number }); }; ThClassifiedFailuresModel.updateMany = function (data) { diff --git a/ui/js/models/failure_lines.js b/ui/js/models/failure_lines.js index ddb4d5180..7217438ca 100644 --- a/ui/js/models/failure_lines.js +++ b/ui/js/models/failure_lines.js @@ -33,7 +33,7 @@ treeherder.factory('ThFailureLinesModel', [ ThFailureLinesModel.verify = function (line_id, best_classification) { return $http.put(thUrl.getRootUrl("/failure-line/" + line_id + "/"), - {best_classification: best_classification}); + { best_classification: best_classification }); }; ThFailureLinesModel.verifyMany = function (data) { diff --git a/ui/js/models/job.js b/ui/js/models/job.js index d27168c14..7e899c7bc 100644 --- a/ui/js/models/job.js +++ b/ui/js/models/job.js @@ -102,7 +102,7 @@ treeherder.factory('ThJobModel', [ var timeout = config.timeout || null; return $http.get(ThJobModel.get_uri(repoName)+pk+"/", - {timeout:timeout}) + { timeout: timeout }) .then(function (response) { return new ThJobModel(response.data); }); @@ -121,7 +121,7 @@ treeherder.factory('ThJobModel', [ var timeout = config.timeout || null; return $http.post(ThJobModel.get_uri(repoName)+"retrigger/", - {job_id_list:job_id_list, timeout:timeout}) + { job_id_list: job_id_list, timeout: timeout }) .then(function (response) { return new ThJobModel(response.data); }); @@ -132,7 +132,7 @@ treeherder.factory('ThJobModel', [ var timeout = config.timeout || null; return $http.post(ThJobModel.get_uri(repoName)+pk+"/backfill/", - {timeout:timeout}); + { timeout: timeout }); }; ThJobModel.cancel = function (repoName, jobIds, config) { @@ -140,7 +140,7 @@ treeherder.factory('ThJobModel', [ var timeout = config.timeout || null; return $http.post(ThJobModel.get_uri(repoName) + "cancel/", - {job_id_list: jobIds, timeout:timeout}) + { job_id_list: jobIds, timeout: timeout }) .then(function (response) { return new ThJobModel(response.data); }); diff --git a/ui/js/models/job_log_url.js b/ui/js/models/job_log_url.js index 5df4fe83a..84d0b9a7c 100644 --- a/ui/js/models/job_log_url.js +++ b/ui/js/models/job_log_url.js @@ -22,7 +22,7 @@ treeherder.factory('ThJobLogUrlModel', [ config = config || {}; var timeout = config.timeout || null; - var params = {job_id: job_id}; + var params = { job_id: job_id }; return $http.get(ThJobLogUrlModel.get_uri(), { params: params, timeout: timeout diff --git a/ui/js/models/perf/alerts.js b/ui/js/models/perf/alerts.js index 7471c8d93..120da2361 100644 --- a/ui/js/models/perf/alerts.js +++ b/ui/js/models/perf/alerts.js @@ -10,10 +10,10 @@ treeherder.factory('PhAlerts', [ _.assign(this, alertData); this.title = PhSeries.getSeriesName( this.series_signature, optionCollectionMap, - {includePlatformInName: true}); + { includePlatformInName: true }); }; Alert.prototype.getStatusText = function () { - return _.result(_.find(phAlertStatusMap, {id: this.status}), + return _.result(_.find(phAlertStatusMap, { id: this.status }), 'text'); }; Alert.prototype.getGraphsURL = function (timeRange, alertRepository, @@ -184,7 +184,7 @@ treeherder.factory('PhAlerts', [ // add test info title += " " + _.uniq( _.map(alertsInSummary, function (a) { - return PhSeries.getTestName(a.series_signature, { abbreviate:true }); + return PhSeries.getTestName(a.series_signature, { abbreviate: true }); })).sort().join(' / '); // add platform info title += " (" + _.uniq( @@ -204,7 +204,7 @@ treeherder.factory('PhAlerts', [ AlertSummary.prototype.modifySelectedAlerts = function (modification) { this.allSelected = false; - return $q.all(_.filter(this.alerts, {'selected': true}).map( + return $q.all(_.filter(this.alerts, { selected: true }).map( function (selectedAlert) { selectedAlert.selected = false; return selectedAlert.modify(modification); @@ -222,7 +222,7 @@ treeherder.factory('PhAlerts', [ var promise = ThOptionCollectionModel.getMap().then( function (optionCollectionMap) { return $http.get(thServiceDomain + '/api/performance/alertsummary/' + id + '/', - {timeout : canceller.promise}).then( + { timeout: canceller.promise }).then( function (response) { return new AlertSummary(response.data, optionCollectionMap); diff --git a/ui/js/models/perf/series.js b/ui/js/models/perf/series.js index 050ecfa3d..ee2e3b52f 100644 --- a/ui/js/models/perf/series.js +++ b/ui/js/models/perf/series.js @@ -81,7 +81,7 @@ treeherder.factory('PhSeries', ['$http', 'thServiceDomain', 'ThOptionCollectionM }, getSeriesData: function (projectName, params) { return $http.get(thServiceDomain + '/api/project/' + projectName + '/performance/data/', - {params: params}).then(function (response) { + { params: params }).then(function (response) { if (response.data) { return response.data; } @@ -91,7 +91,7 @@ treeherder.factory('PhSeries', ['$http', 'thServiceDomain', 'ThOptionCollectionM getReplicateData: function (params) { params.value = 'perfherder-data.json'; return $http.get(thServiceDomain + '/api/jobdetail/' - , {params: params}).then( + , { params: params }).then( function (response) { if (response.data.results[0]) { let url = response.data.results[0].url; diff --git a/ui/js/models/repository.js b/ui/js/models/repository.js index e3f36cea2..3f3fc627c 100644 --- a/ui/js/models/repository.js +++ b/ui/js/models/repository.js @@ -36,7 +36,7 @@ treeherder.factory('ThRepositoryModel', [ if (!_.size(orderedRepoGroups)) { var groups = _.groupBy($rootScope.repos, function (r) { return r.repository_group.name; }); _.each(groups, function (reposAr, gName) { - orderedRepoGroups[thRepoGroupOrder[gName] || gName] = {name: gName, repos: reposAr}; + orderedRepoGroups[thRepoGroupOrder[gName] || gName] = { name: gName, repos: reposAr }; }); } return orderedRepoGroups; @@ -61,7 +61,7 @@ treeherder.factory('ThRepositoryModel', [ return; } _.extend(repos[name], { - treeStatus: {status: "not retrieved yet", message_of_the_day: ""}, + treeStatus: { status: "not retrieved yet", message_of_the_day: "" }, unclassifiedFailureCount: 0, groupName: repos[name].groupName }); @@ -89,7 +89,7 @@ treeherder.factory('ThRepositoryModel', [ }; var get_list = function () { - return $http.get(get_uri(), {cache: true}); + return $http.get(get_uri(), { cache: true }); }; var load = function (options) { diff --git a/ui/js/models/resultset.js b/ui/js/models/resultset.js index f31003850..b451fb472 100644 --- a/ui/js/models/resultset.js +++ b/ui/js/models/resultset.js @@ -274,8 +274,8 @@ treeherder.factory('ThResultSetModel', ['$rootScope', '$http', '$location', return; } let bbdata = { - "requested_jobs": bbnames, - "decision_task_id": decisionTaskID + requested_jobs: bbnames, + decision_task_id: decisionTaskID }; return $http.post( thUrl.getProjectUrl("/resultset/", repoName) + resultset_id + '/trigger_runnable_jobs/', diff --git a/ui/js/models/resultsets_store.js b/ui/js/models/resultsets_store.js index 196bfa6ec..00ee802e3 100644 --- a/ui/js/models/resultsets_store.js +++ b/ui/js/models/resultsets_store.js @@ -194,7 +194,7 @@ treeherder.factory('ThResultSetStore', [ // so we can pick the result_set_id from the first job var resultSetId = jobList[0].result_set_id; var resultSet = _.find(repositories[repoName].resultSets, - {id: resultSetId}); + { id: resultSetId }); if (_.isUndefined(resultSet)) { return $q.defer().resolve(); } if (_.has(resultSet, 'jobList')) { // get the new job ids @@ -258,7 +258,7 @@ treeherder.factory('ThResultSetStore', [ ); repositories[repoName] = { - name:repoName, + name: repoName, // This keeps track of the selected job. The selected job, // when rendered, will be given a class of ``selected-job``, @@ -267,20 +267,20 @@ treeherder.factory('ThResultSetStore', [ // selected job is being re-rendered, knowing which one is // selected here in the model will allow us to apply the // correct styling to it. - lastJobObjSelected:{}, + lastJobObjSelected: {}, // maps to help finding objects to update/add - rsMap:{}, - jobMap:{}, - grpMap:{}, + rsMap: {}, + jobMap: {}, + grpMap: {}, unclassifiedFailureMap: {}, // count of unclassified for the currently enabled tiers unclassifiedFailureCountForTiers: 0, // count of unclassified jobs within enabled tiers and filtered out filteredUnclassifiedFailureCount: 0, //used as the offset in paging - rsMapOldestTimestamp:null, - resultSets:[], + rsMapOldestTimestamp: null, + resultSets: [], // this is "watchable" by the controller now to update its scope. loadingStatus: { @@ -317,7 +317,7 @@ treeherder.factory('ThResultSetStore', [ var getSelectedJob = function (repoName) { return { - job:repositories[repoName].lastJobObjSelected + job: repositories[repoName].lastJobObjSelected }; }; @@ -338,7 +338,7 @@ treeherder.factory('ThResultSetStore', [ if (repoName !== "try") { decisionTaskId = ""; } - return ThRunnableJobModel.get_list(repoName, {"decision_task_id": decisionTaskId}).then(function (jobList) { + return ThRunnableJobModel.get_list(repoName, { decision_task_id: decisionTaskId }).then(function (jobList) { var id = resultSet.id; _.each(jobList, function (job) { job.result_set_id = id; @@ -696,14 +696,14 @@ treeherder.factory('ThResultSetStore', [ } platformData[platformAggregateId] = { - platformName:platformName, - revision:revision, - platformOrder:repositories[repoName].rsMap[resultsetId].rs_obj.platforms, - resultsetId:resultsetId, - resultsetAggregateId:resultsetAggregateId, - platformOption:platformOption, - jobGroups:jobGroups, - jobs:[] + platformName: platformName, + revision: revision, + platformOrder: repositories[repoName].rsMap[resultsetId].rs_obj.platforms, + resultsetId: resultsetId, + resultsetAggregateId: resultsetAggregateId, + platformOption: platformOption, + jobGroups: jobGroups, + jobs: [] }; } } @@ -934,13 +934,13 @@ treeherder.factory('ThResultSetStore', [ var getGeckoDecisionJob = function (repoName, resultsetId) { let resultSet = getResultSet(repoName, resultsetId); let platform = _.find(resultSet.platforms, { - "name": "gecko-decision", - "groups": [{"jobs": [{"state": "completed", "job_type_symbol": "D"}]}]}); + name: "gecko-decision", + groups: [{ jobs: [{ state: "completed", job_type_symbol: "D" }] }] }); if (platform) { // Gecko Decision Task has been completed. // Let's fetch the URL of full-tasks-graph.json // This extra search is important to avoid confusion with Action Tasks - return _.find(platform.groups[0].jobs, {"job_type_symbol": "D"}); + return _.find(platform.groups[0].jobs, { job_type_symbol: "D" }); } return undefined; @@ -1026,7 +1026,7 @@ treeherder.factory('ThResultSetStore', [ (data) => { thNotify.send("Error retrieving resultset data!", "danger", true); $log.error(data); - appendResultSets(repoName, {results: []}); + appendResultSets(repoName, { results: [] }); }) .then(() => { // if ``nojobs`` is on the query string, then don't load jobs. @@ -1089,7 +1089,7 @@ treeherder.factory('ThResultSetStore', [ var selectedJobEl, key; if (selectedJobId) { - key = thAggregateIds.getJobMapKey({id: selectedJobId}); + key = thAggregateIds.getJobMapKey({ id: selectedJobId }); selectedJobEl = repositories[repoName].jobMap[key]; // select the job in question @@ -1163,7 +1163,7 @@ treeherder.factory('ThResultSetStore', [ } tier = job.tier; } - return {name: name, tier: tier, symbol: symbol, mapKey: mapKey}; + return { name: name, tier: tier, symbol: symbol, mapKey: mapKey }; }; /* @@ -1173,7 +1173,7 @@ treeherder.factory('ThResultSetStore', [ */ var groupJobByPlatform = function (jobList) { var groupedJobs = { - platforms:[], + platforms: [], job_counts: getJobCount(jobList) }; diff --git a/ui/js/models/runnable_job.js b/ui/js/models/runnable_job.js index e4a93a15b..67e2efab1 100644 --- a/ui/js/models/runnable_job.js +++ b/ui/js/models/runnable_job.js @@ -13,7 +13,7 @@ treeherder.factory('ThRunnableJobModel', [ ThRunnableJobModel.get_list = function (repoName, params) { return ThJobModel.get_list( - repoName, params, {uri: ThRunnableJobModel.get_runnable_uri(repoName)}); + repoName, params, { uri: ThRunnableJobModel.get_runnable_uri(repoName) }); }; return ThRunnableJobModel; diff --git a/ui/js/providers.js b/ui/js/providers.js index 3e466149e..a57df811f 100644 --- a/ui/js/providers.js +++ b/ui/js/providers.js @@ -42,15 +42,15 @@ treeherder.provider('thResultStatus', function () { treeherder.provider('thResultStatusObject', function () { var getResultStatusObject = function () { return { - 'running':0, - 'pending':0, - 'completed':0 + running: 0, + pending: 0, + completed: 0 }; }; this.$get = function () { return { - getResultStatusObject:getResultStatusObject + getResultStatusObject: getResultStatusObject }; }; }); @@ -286,8 +286,8 @@ treeherder.provider('thAggregateIds', function () { this.$get = function () { return { - getPlatformRowId:getPlatformRowId, - getResultsetTableId:getResultsetTableId, + getPlatformRowId: getPlatformRowId, + getResultsetTableId: getResultsetTableId, getJobMapKey: getJobMapKey, getGroupMapKey: getGroupMapKey, escape: escape diff --git a/ui/js/reactrevisions.jsx b/ui/js/reactrevisions.jsx index 80145d3d7..f41272824 100644 --- a/ui/js/reactrevisions.jsx +++ b/ui/js/reactrevisions.jsx @@ -97,4 +97,4 @@ module.exports = { }; treeherder.directive('revisions', ['reactDirective', '$injector', (reactDirective, $injector) => - reactDirective(RevisionList, undefined, {}, {$injector})]); + reactDirective(RevisionList, undefined, {}, { $injector })]); diff --git a/ui/js/services/classifications.js b/ui/js/services/classifications.js index 5c1bc76fe..1520c1da8 100644 --- a/ui/js/services/classifications.js +++ b/ui/js/services/classifications.js @@ -26,7 +26,7 @@ treeherder.factory('thClassificationTypes', [ }; var load = function () { - return $http.get(thUrl.getRootUrl("/failureclassification/"), {cache: true}). + return $http.get(thUrl.getRootUrl("/failureclassification/"), { cache: true }). success(function (data) { _.forEach(data, addClassification); }); diff --git a/ui/js/services/main.js b/ui/js/services/main.js index 327dd476d..6dc627bcd 100755 --- a/ui/js/services/main.js +++ b/ui/js/services/main.js @@ -23,8 +23,7 @@ treeherder.factory('thUrl', [ return "index.html#/jobs?" + _.reduce({ repo: repo, fromchange: fromChange, tochange: toChange }, function (result, v, k) { - if (result.length) - result += '&'; + if (result.length) result += '&'; return result + k + '=' + v; }, ""); }, @@ -73,8 +72,8 @@ treeherder.factory('thCloneHtml', [ templateTxt = document.getElementById(templateId); cloneHtmlObjs[templateName] = { - interpolator:$interpolate(templateTxt.text), - text:templateTxt.text + interpolator: $interpolate(templateTxt.text), + text: templateTxt.text }; } @@ -83,7 +82,7 @@ treeherder.factory('thCloneHtml', [ }; return { - get:getClone + get: getClone }; }]); diff --git a/ui/js/services/perf/compare.js b/ui/js/services/perf/compare.js index d5972072a..764f59aab 100644 --- a/ui/js/services/perf/compare.js +++ b/ui/js/services/perf/compare.js @@ -97,8 +97,9 @@ treeherder.factory('PhCompare', [ var hasOrig = originalData && originalData.values.length; var hasNew = newData && newData.values.length; - if (!hasOrig && !hasNew) + if (!hasOrig && !hasNew) { return cmap; // No data for either side + } cmap.isEmpty = false; @@ -121,8 +122,9 @@ treeherder.factory('PhCompare', [ cmap.newRuns = []; } - if (!hasOrig || !hasNew) + if (!hasOrig || !hasNew) { return cmap; // No comparison, just display for one side. + } // keep the framework id so we can filter by that later, if necessary cmap.frameworkId = originalData.frameworkId; @@ -204,11 +206,13 @@ treeherder.factory('PhCompare', [ } $http.get(thServiceDomain + '/api/repository/').then(function (response) { - if (!_.find(response.data, {'name': originalProject})) + if (!_.find(response.data, { name: originalProject })) { errors.push("Invalid project, doesn't exist: " + originalProject); + } - if (!_.find(response.data, {'name': newProject})) + if (!_.find(response.data, { name: newProject })) { errors.push("Invalid project, doesn't exist: " + newProject); + } }); return errors; }, @@ -235,7 +239,7 @@ treeherder.factory('PhCompare', [ var values = data .filter(datum => datum.push_id === resultSetId) .map(datum => datum.value); - var seriesData = _.find(seriesList, {'signature': signature}); + var seriesData = _.find(seriesList, { signature: signature }); if (seriesData) { resultsMap[resultSetId][signature] = { platform: seriesData.platform, @@ -253,7 +257,7 @@ treeherder.factory('PhCompare', [ projectName, { signatures: _.map(seriesChunk, 'signature'), framework: _.uniq(_.map(seriesChunk, 'frameworkId')), - interval: params.interval.value} + interval: params.interval.value } ).then(function (seriesData) { _.forIn(seriesData, function (data, signature) { var series = _.find(seriesChunk, { signature: signature }); @@ -324,8 +328,9 @@ treeherder.factory('PhCompare', [ var trendMap = { isEmpty: true }; // It's possible to get an object with empty values, so check for that too. - if (!baseData.delta && !newData.delta) + if (!baseData.delta && !newData.delta) { return trendMap; // No data for either side + } trendMap.isEmpty = false; trendMap.name = baseData.name; diff --git a/ui/js/services/perf/math.js b/ui/js/services/perf/math.js index 1154c5f20..27025fdc7 100644 --- a/ui/js/services/perf/math.js +++ b/ui/js/services/perf/math.js @@ -20,8 +20,7 @@ treeherder.factory('math', [ return undefined; } - if (!avg) - avg = average(values); + if (!avg) avg = average(values); return Math.sqrt( values.map(function (v) { return Math.pow(v - avg, 2); }) diff --git a/ui/js/services/pinboard.js b/ui/js/services/pinboard.js index 5750e4666..64c768d86 100644 --- a/ui/js/services/pinboard.js +++ b/ui/js/services/pinboard.js @@ -40,7 +40,7 @@ treeherder.factory('thPinboard', [ var saveBugs = function (job) { _.forEach(relatedBugs, function (bug) { var bjm = new ThBugJobMapModel({ - bug_id : bug.id, + bug_id: bug.id, job_id: job.id, type: 'annotation' }); @@ -134,10 +134,10 @@ treeherder.factory('thPinboard', [ } _.each(pinnedJobs, _.bind(saveClassification, classification)); - $rootScope.$emit(thEvents.jobsClassified, {jobs: pinnedJobsClone}); + $rootScope.$emit(thEvents.jobsClassified, { jobs: pinnedJobsClone }); _.each(pinnedJobs, saveBugs); - $rootScope.$emit(thEvents.bugsAssociated, {jobs: pinnedJobsClone}); + $rootScope.$emit(thEvents.bugsAssociated, { jobs: pinnedJobsClone }); api.unPinAll(); }, @@ -145,13 +145,13 @@ treeherder.factory('thPinboard', [ // save the classification only on all pinned jobs saveClassificationOnly: function (classification) { _.each(pinnedJobs, _.bind(saveClassification, classification)); - $rootScope.$emit(thEvents.jobsClassified, {jobs: pinnedJobs}); + $rootScope.$emit(thEvents.jobsClassified, { jobs: pinnedJobs }); }, // save bug associations only on all pinned jobs saveBugsOnly: function () { _.each(pinnedJobs, saveBugs); - $rootScope.$emit(thEvents.bugsAssociated, {jobs: pinnedJobs}); + $rootScope.$emit(thEvents.bugsAssociated, { jobs: pinnedJobs }); }, hasPinnedJobs: function () { diff --git a/ui/js/treeherder_app.js b/ui/js/treeherder_app.js index 8a007604a..36a06ddd1 100644 --- a/ui/js/treeherder_app.js +++ b/ui/js/treeherder_app.js @@ -43,7 +43,7 @@ treeherderApp.config(['$compileProvider', '$routeProvider', '$httpProvider', when('/login', { template: '' }). - otherwise({redirectTo: '/jobs'}); + otherwise({ redirectTo: '/jobs' }); }]).run(require('./cache-templates')); module.exports = treeherderApp; diff --git a/ui/js/values.js b/ui/js/values.js index 2bef59523..be9397afa 100644 --- a/ui/js/values.js +++ b/ui/js/values.js @@ -1,11 +1,11 @@ 'use strict'; treeherder.value("thPlatformMap", { - "linux32": "Linux", + linux32: "Linux", "linux32-devedition": "Linux DevEdition", "linux32-qr": "Linux QuantumRender", "linux32-nightly": "Linux Nightly", - "linux64": "Linux x64", + linux64: "Linux x64", "linux64-asan": "Linux x64 asan", "linux64-add-on-devel": "Linux x64 addon", "linux64-devedition": "Linux x64 DevEdition", @@ -36,7 +36,7 @@ treeherder.value("thPlatformMap", { "macosx64-stylo": "OS X 10.10 Stylo", "macosx64-devedition": "OS X 10.10 DevEdition", "macosx64-nightly": "OS X 10.10 Nightly", - "windowsxp": "Windows XP", + windowsxp: "Windows XP", "windowsxp-devedition": "Windows XP DevEdition", "windows7-32": "Windows 7", "windows7-32-vm": "Windows 7 VM", @@ -102,7 +102,7 @@ treeherder.value("thPlatformMap", { "android-4-0-armv7-api15-partner1": "Android API15+ partner1", "android-api-15-gradle": "Android API15+ Gradle", "android-api-16-gradle": "Android API16+ Gradle", - "Android": "Android", + Android: "Android", "b2g-linux32": "B2G Desktop Linux", "b2g-linux64": "B2G Desktop Linux x64", @@ -113,9 +113,9 @@ treeherder.value("thPlatformMap", { "b2g-emu-kk": "B2G KK Emulator", "b2g-emu-x86-kk": "B2G KK Emulator x86", "b2g-emu-l": "B2G L Emulator", - "b2g-device-image" : "B2G Device Image", - "mulet-linux32" : "Mulet Linux", - "mulet-linux64" : "Mulet Linux x64", + "b2g-device-image": "B2G Device Image", + "mulet-linux32": "Mulet Linux", + "mulet-linux64": "Mulet Linux x64", "mulet-osx": "Mulet OS X", "mulet-win32": "Mulet Windows", @@ -127,19 +127,19 @@ treeherder.value("thPlatformMap", { "horizon-win64": "Horizon Windows x64", "gecko-decision": "Gecko Decision Task", - "lint": "Linting", + lint: "Linting", "release-mozilla-release-": "Balrog Publishing", - "other": "Other" + other: "Other" }); treeherder.value("thOptionOrder", { - "opt": 0, - "pgo": 1, - "asan": 2, - "tsan": 3, - "debug": 4, - "cc": 5, - "addon": 6 + opt: 0, + pgo: 1, + asan: 2, + tsan: 3, + debug: 4, + cc: 5, + addon: 6 }); treeherder.value("thFailureResults", ["testfailed", "busted", "exception"]); @@ -147,20 +147,20 @@ treeherder.value("thFailureResults", ["testfailed", "busted", "exception"]); treeherder.value("thTitleSuffixLimit", 70); treeherder.value("thFavicons", { - "closed": "img/tree_closed.png", - "open": "img/tree_open.png", + closed: "img/tree_closed.png", + open: "img/tree_open.png", "approval required": "img/tree_open.png", - "unavailable": "img/tree_open.png" + unavailable: "img/tree_open.png" }); treeherder.value("thRepoGroupOrder", { - "development": 1, + development: 1, "release-stabilization": 2, "project repositories": 3, "comm-repositories": 4, "qa automation tests": 5, - "try": 6, - "taskcluster": 7 + try: 6, + taskcluster: 7 }); treeherder.value("thDefaultRepo", "mozilla-inbound"); @@ -172,14 +172,14 @@ treeherder.value("phCompareDefaultOriginalRepo", "mozilla-central"); treeherder.value("phCompareDefaultNewRepo", "try"); treeherder.value("phTimeRanges", [ - { "value":86400, "text": "Last day" }, - { "value":86400*2, "text": "Last 2 days" }, - { "value":604800, "text": "Last 7 days" }, - { "value":1209600, "text": "Last 14 days" }, - { "value":2592000, "text": "Last 30 days" }, - { "value":5184000, "text": "Last 60 days" }, - { "value":7776000, "text": "Last 90 days" }, - { "value":31536000, "text": "Last year" } ]); + { value: 86400, text: "Last day" }, + { value: 86400*2, text: "Last 2 days" }, + { value: 604800, text: "Last 7 days" }, + { value: 1209600, text: "Last 14 days" }, + { value: 2592000, text: "Last 30 days" }, + { value: 5184000, text: "Last 60 days" }, + { value: 7776000, text: "Last 90 days" }, + { value: 31536000, text: "Last year" } ]); treeherder.value("phDefaultTimeRangeValue", 1209600); @@ -188,11 +188,11 @@ treeherder.value("phTimeRangeValues", { }); treeherder.value("phComparisonDate", [ - { "value":0, "text": "Today" }, - { "value":604800, "text": "1 week ago" }, - { "value":1209600, "text": "2 weeks ago" }, - { "value":2419200, "text": "4 weeks ago" }, - { "value":3628800, "text": "6 weeks ago" } + { value: 0, text: "Today" }, + { value: 604800, text: "1 week ago" }, + { value: 1209600, text: "2 weeks ago" }, + { value: 2419200, text: "4 weeks ago" }, + { value: 3628800, text: "6 weeks ago" } ]); treeherder.value("phBlockers", { @@ -202,8 +202,8 @@ treeherder.value("phBlockers", { "dromaeo_dom summary": 2.0, "glterrain summary": 5.0, "kraken summary": 2.0, - "sessionrestore": 5.0, - "sessionrestore_no_auto_restore": 5.0, + sessionrestore: 5.0, + sessionrestore_no_auto_restore: 5.0, "tart summary": 5.0, "tcanvasmark summary": 5.0, "tp5o % Processor Time": 2.0, @@ -214,11 +214,11 @@ treeherder.value("phBlockers", { "tp5o responsiveness": 2.0, "tp5o summary": 5.0, "tp5o_scroll summary": 2.0, - "tpaint": 5.0, + tpaint: 5.0, "tps summary": 5.0, - "tresize": 5.0, - "ts_paint": 2.0, - "tscrollx": 2.0, + tresize: 5.0, + ts_paint: 2.0, + tscrollx: 2.0, "tsvgr_opacity summary": 5.0, "tsvgx summary": 5.0 }); @@ -246,30 +246,30 @@ treeherder.value("phAlertStatusMap", { }); treeherder.value("phTalosDocumentationMap", { - "a11yr": "a11y", - "cart": "TART.2FCART", - "damp": "DAMP", - "dromaeo_css": "Dromaeo_Tests", - "dromaeo_dom": "Dromaeo_Tests", - "sessionrestore": "sessionrestore.2Fsessionrestore_no_auto_restore", - "sessionrestore_no_auto_restore": "sessionrestore.2Fsessionrestore_no_auto_restore", - "tart": "TART.2FCART", - "tcanvasmark": "CanvasMark", - "tp5n_main_normal_fileio": "xperf", - "tp5n_main_normal_netio": "xperf", - "tp5n_main_startup_fileio": "xperf", - "tp5n_main_startup_netio": "xperf", - "tp5n_nonmain_normal_fileio": "xperf", - "tp5n_nonmain_normal_netio": "xperf", - "tp5n_nonmain_startup_fileio": "xperf", - "tp5o": "tp5", + a11yr: "a11y", + cart: "TART.2FCART", + damp: "DAMP", + dromaeo_css: "Dromaeo_Tests", + dromaeo_dom: "Dromaeo_Tests", + sessionrestore: "sessionrestore.2Fsessionrestore_no_auto_restore", + sessionrestore_no_auto_restore: "sessionrestore.2Fsessionrestore_no_auto_restore", + tart: "TART.2FCART", + tcanvasmark: "CanvasMark", + tp5n_main_normal_fileio: "xperf", + tp5n_main_normal_netio: "xperf", + tp5n_main_startup_fileio: "xperf", + tp5n_main_startup_netio: "xperf", + tp5n_nonmain_normal_fileio: "xperf", + tp5n_nonmain_normal_netio: "xperf", + tp5n_nonmain_startup_fileio: "xperf", + tp5o: "tp5", "tp5o_% processor time": ".25_CPU", - "tp5o_main_rss": "RSS_.28Resident_Set_Size.29", + tp5o_main_rss: "RSS_.28Resident_Set_Size.29", "tp5o_modified page list bytes": "Modified_Page_List_Bytes", "tp5o_private bytes": "Private_Bytes", - "tp5o_xres": "Xres_.28X_Resource_Monitoring.29", - "tsvgr_opacity": "tsvg-opacity", - "v8_7": "V8.2C_version_7" + tp5o_xres: "Xres_.28X_Resource_Monitoring.29", + tsvgr_opacity: "tsvg-opacity", + v8_7: "V8.2C_version_7" }); treeherder.value("phTrySyntaxBuildPlatformMap", { @@ -277,7 +277,7 @@ treeherder.value("phTrySyntaxBuildPlatformMap", { "osx-10-10": "macosx64", "windows7-32": "win32", "windows8-64": "win64", - "windowsxp": "win32" + windowsxp: "win32" }); treeherder.value("phTrySyntaxTalosModifierMap", { @@ -285,7 +285,7 @@ treeherder.value("phTrySyntaxTalosModifierMap", { "osx-10-10": "10.10", "windows7-32": "Windows 7", "windows8-64": "Windows 8", - "windowsxp": "Windows XP" + windowsxp: "Windows XP" }); treeherder.value('mcTalosConfigUrl', diff --git a/ui/plugins/annotations/controller.js b/ui/plugins/annotations/controller.js index 5e30fa410..011bc8fe8 100644 --- a/ui/plugins/annotations/controller.js +++ b/ui/plugins/annotations/controller.js @@ -50,7 +50,7 @@ treeherder.controller('AnnotationsPluginCtrl', [ // classification state (in case one was added or removed). ThResultSetStore.fetchJobs($scope.repoName, [$scope.job.id]); - $rootScope.$emit(thEvents.jobsClassified, {jobs: jobs}); + $rootScope.$emit(thEvents.jobsClassified, { jobs: jobs }); }, function () { thNotify.send("Classification deletion failed", "danger", true); @@ -66,7 +66,7 @@ treeherder.controller('AnnotationsPluginCtrl', [ var jobs = {}; jobs[$scope.selectedJob.id] = $scope.selectedJob; - $rootScope.$emit(thEvents.bugsAssociated, {jobs: jobs}); + $rootScope.$emit(thEvents.bugsAssociated, { jobs: jobs }); }, function () { thNotify.send("Association to bug " + bug.bug_id + " deletion failed", "danger", true); diff --git a/ui/plugins/auto_classification/controller.js b/ui/plugins/auto_classification/controller.js index 56ef6ee37..b1f637143 100644 --- a/ui/plugins/auto_classification/controller.js +++ b/ui/plugins/auto_classification/controller.js @@ -119,7 +119,7 @@ treeherder.component('thStaticClassificationOption', { optionData: '<', selectedOption: '<', numOptions: '<', - canClassify: '<', + canClassify: '<', onExpandOptions: '&' } }); @@ -177,7 +177,7 @@ treeherder.controller('ThClassificationOptionController', [ fullLog: () => logUrl, parsedLog: () => location.origin + "/" + thUrl.getLogViewerUrl(ctrl.thJob.id), reftest: () => thReftestStatus(ctrl.thJob) ? reftestUrlRoot + logUrl + "&only_show_unexpected=1" : "", - selectedJob:() => ctrl.thJob, + selectedJob: () => ctrl.thJob, allFailures: () => [ctrl.errorLine.data.bug_suggestions.search.split(" | ")], crashSignatures: () => crashSignatures, successCallback: () => (data) => { @@ -690,7 +690,7 @@ treeherder.controller('ThErrorLineController', [ $scope.status = 'unverified'; } if (oldStatus !== $scope.status) { - ctrl.onStatusChange({status: $scope.status}); + ctrl.onStatusChange({ status: $scope.status }); } }, true); @@ -731,10 +731,10 @@ treeherder.controller('ThAutoclassifyErrorsController', ['$scope', '$element', $scope.lineStatuses = new Map(); $scope.titles = { - 'verified': "Verified Line", + verified: "Verified Line", 'unverified-ignore': "Unverified line, ignored", 'unverified-no-bug': "Unverified line missing a bug number", - 'unverified': "Unverified line", + unverified: "Unverified line", 'classification-disabled': "" }; @@ -752,7 +752,7 @@ treeherder.controller('ThAutoclassifyErrorsController', ['$scope', '$element', } elem = elem.parent(); } - ctrl.onToggleSelect({lineIds: [id], clear: !event.ctrlKey}); + ctrl.onToggleSelect({ lineIds: [id], clear: !event.ctrlKey }); }; } ]); @@ -948,9 +948,9 @@ treeherder.controller('ThAutoclassifyPanelController', [ requestPromise = $q.defer(); return $q.all({ - "matchers": ThMatcherModel.by_id(), - "error_lines": ThTextLogErrorsModel.getList(ctrl.thJob.id, - {timeout: requestPromise}) + matchers: ThMatcherModel.by_id(), + error_lines: ThTextLogErrorsModel.getList(ctrl.thJob.id, + { timeout: requestPromise }) }); } @@ -999,7 +999,7 @@ treeherder.controller('ThAutoclassifyPanelController', [ var jobs = {}; jobs[ctrl.thJob.id] = ctrl.thJob; // Emit this event to get the main UI to update - $rootScope.$emit(thEvents.autoclassifyVerified, {jobs: jobs}); + $rootScope.$emit(thEvents.autoclassifyVerified, { jobs: jobs }); } /** diff --git a/ui/plugins/controller.js b/ui/plugins/controller.js index bd5a99bae..9de3075ae 100644 --- a/ui/plugins/controller.js +++ b/ui/plugins/controller.js @@ -119,15 +119,15 @@ treeherder.controller('PluginCtrl', [ $scope.job_details = []; var jobPromise = ThJobModel.get( $scope.repoName, job.id, - {timeout: selectJobPromise}); + { timeout: selectJobPromise }); var jobDetailPromise = ThJobDetailModel.getJobDetails( - {job_guid: job.job_guid}, - {timeout: selectJobPromise}); + { job_guid: job.job_guid }, + { timeout: selectJobPromise }); var jobLogUrlPromise = ThJobLogUrlModel.get_list( job.id, - {timeout: selectJobPromise}); + { timeout: selectJobPromise }); var phSeriesPromise = PhSeries.getSeriesData( $scope.repoName, { job_id: job.id }); @@ -161,13 +161,13 @@ treeherder.controller('PluginCtrl', [ // incorporate the buildername into the job details if this is a buildbot job // (i.e. it has a buildbot request id) var buildbotRequestIdDetail = _.find($scope.job_details, - {title: 'buildbot_request_id'}); + { title: 'buildbot_request_id' }); if (buildbotRequestIdDetail) { $scope.job_details = $scope.job_details.concat({ title: "Buildername", value: $scope.job.ref_data_name }); - $scope.buildernameIndex = _.findIndex($scope.job_details, {title: "Buildername"}); + $scope.buildernameIndex = _.findIndex($scope.job_details, { title: "Buildername" }); } // the third result comes from the jobLogUrl promise @@ -212,7 +212,7 @@ treeherder.controller('PluginCtrl', [ _.forEach(seriesList, function (series) { // skip series which are subtests of another series if (series.parentSignature) - return; + { return; } var detail = { url: thServiceDomain + '/perf.html#/graphs?series=[' + [ $scope.repoName, series.signature, 1, @@ -247,7 +247,7 @@ treeherder.controller('PluginCtrl', [ duration = ""; // fields that will show in the job detail panel $scope.visibleFields = { - "Build": $scope.job.build_architecture + " " + + Build: $scope.job.build_architecture + " " + $scope.job.build_platform + " " + $scope.job.build_os || undef, "Job name": $scope.job.job_type_name || undef @@ -351,9 +351,9 @@ treeherder.controller('PluginCtrl', [ ThJobModel.retrigger($scope.repoName, job_id_list).then(function () { // XXX: Remove this after 1134929 is resolved. return ThJobDetailModel.getJobDetails({ - "title": "buildbot_request_id", - "repository": $scope.repoName, - "job_id__in": job_id_list.join(',') + title: "buildbot_request_id", + repository: $scope.repoName, + job_id__in: job_id_list.join(',') }).then(function (data) { var requestIdList = _.map(data, 'value'); requestIdList.forEach(function (requestId) { @@ -581,7 +581,7 @@ treeherder.controller('PluginCtrl', [ // load the list of existing classifications (including possibly a new one just // added). $scope.updateClassifications = function () { - ThJobClassificationModel.get_list({job_id: $scope.job.id}).then(function (response) { + ThJobClassificationModel.get_list({ job_id: $scope.job.id }).then(function (response) { $scope.classifications = response; $scope.job.note = $scope.classifications[0]; }); @@ -636,7 +636,7 @@ treeherder.controller('PluginCtrl', [ // it might in fact not have been var jobs = {}; jobs[$scope.job.id] = $scope.job; - $rootScope.$emit(thEvents.jobsClassified, {jobs: jobs}); + $rootScope.$emit(thEvents.jobsClassified, { jobs: jobs }); }); $scope.pinboard_service = thPinboard; diff --git a/ui/plugins/failure_summary/controller.js b/ui/plugins/failure_summary/controller.js index 477788255..7076ecd98 100644 --- a/ui/plugins/failure_summary/controller.js +++ b/ui/plugins/failure_summary/controller.js @@ -142,7 +142,7 @@ treeherder.controller('BugsPluginCtrl', [ return function (data) { // Auto-classify this failure now that the bug has been filed // and we have a bug number - thPinboard.addBug({id: data.success}); + thPinboard.addBug({ id: data.success }); $rootScope.$evalAsync( $rootScope.$emit( thEvents.saveClassification)); diff --git a/ui/plugins/pinboard.js b/ui/plugins/pinboard.js index 897a69cff..56ca6c5ba 100644 --- a/ui/plugins/pinboard.js +++ b/ui/plugins/pinboard.js @@ -281,7 +281,7 @@ treeherder.controller('PinboardCtrl', [ } else if (/^[0-9]*$/.test($scope.newEnteredBugNumber)) { $log.debug("new bug number to be saved: ", $scope.newEnteredBugNumber); - thPinboard.addBug({id:$scope.newEnteredBugNumber}); + thPinboard.addBug({ id: $scope.newEnteredBugNumber }); $scope.toggleEnterBugNumber(false); return true; } diff --git a/ui/plugins/similar_jobs/controller.js b/ui/plugins/similar_jobs/controller.js index 31f1608ce..8c9e7af22 100755 --- a/ui/plugins/similar_jobs/controller.js +++ b/ui/plugins/similar_jobs/controller.js @@ -90,9 +90,9 @@ treeherder.controller('SimilarJobsPluginCtrl', [ $scope.result_status_info = thResultStatusInfo; $scope.similar_jobs_filters = { - "machine_id": false, - "build_platform_id": true, - "option_collection_hash": true + machine_id: false, + build_platform_id: true, + option_collection_hash: true }; $scope.button_class = function (job) { var resultState = job.result; diff --git a/ui/plugins/tabs.js b/ui/plugins/tabs.js index aebe64a4c..b9509f213 100644 --- a/ui/plugins/tabs.js +++ b/ui/plugins/tabs.js @@ -3,45 +3,45 @@ treeherder.factory('thTabs', [ function () { var thTabs = { - "tabs": { - "jobDetails": { + tabs: { + jobDetails: { title: "Job Details", description: "additional job information", content: "plugins/job_details/main.html", enabled: true }, - "failureSummary": { + failureSummary: { title: "Failure Summary", description: "failure summary", content: "plugins/failure_summary/main.html", enabled: true }, - "autoClassification": { + autoClassification: { title: "Failure Classification", description: "intermittent classification interface", content: "plugins/auto_classification/main.html", enabled: false }, - "annotations": { + annotations: { title: "Annotations", description: "annotations", content: "plugins/annotations/main.html", enabled: true }, - "similarJobs": { + similarJobs: { title: "Similar Jobs", description: "similar jobs", content: "plugins/similar_jobs/main.html", enabled: true }, - "perfDetails": { + perfDetails: { title: "Performance", description: "performance details", content: "plugins/perf_details/main.html", enabled: false } }, - "tabOrder": [ + tabOrder: [ "jobDetails", "failureSummary", "autoClassification", @@ -49,8 +49,8 @@ treeherder.factory('thTabs', [ "similarJobs", "perfDetails" ], - "selectedTab": "jobDetails", - "showTab" : function (tab, contentId) { + selectedTab: "jobDetails", + showTab: function (tab, contentId) { thTabs.selectedTab = tab; if (!thTabs.tabs[thTabs.selectedTab].enabled) { thTabs.selectedTab = 'jobDetails';
{{$ctrl.minValue|abbreviatedNumber}}