diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-02-24 16:15:38 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-02-24 17:39:16 +0100 |
commit | 594e71c5ece90e920a5cd2e17450c91c7bd6867a (patch) | |
tree | b139ab4126684f6b1199a3a1037505cfb8c3d680 /server/sonar-web/src/main/js | |
parent | b9d2362b10d6d6f68b927a8c408d377634205d5f (diff) | |
download | sonarqube-594e71c5ece90e920a5cd2e17450c91c7bd6867a.tar.gz sonarqube-594e71c5ece90e920a5cd2e17450c91c7bd6867a.zip |
improve code quality
Diffstat (limited to 'server/sonar-web/src/main/js')
87 files changed, 139 insertions, 142 deletions
diff --git a/server/sonar-web/src/main/js/apps/account/tokens-view.js b/server/sonar-web/src/main/js/apps/account/tokens-view.js index 1a6f6b192d9..6ba5c9776a6 100644 --- a/server/sonar-web/src/main/js/apps/account/tokens-view.js +++ b/server/sonar-web/src/main/js/apps/account/tokens-view.js @@ -54,7 +54,7 @@ export default Marionette.ItemView.extend({ e.preventDefault(); this.errors = []; this.newToken = null; - let tokenName = this.$('.js-generate-token-form input').val(); + const tokenName = this.$('.js-generate-token-form input').val(); generateToken(this.model.id, tokenName) .then(response => { this.newToken = response; @@ -70,8 +70,8 @@ export default Marionette.ItemView.extend({ onRevokeTokenFormSubmit(e) { e.preventDefault(); - let tokenName = $(e.currentTarget).data('token'); - let token = _.findWhere(this.tokens, { name: `${tokenName}` }); + const tokenName = $(e.currentTarget).data('token'); + const token = _.findWhere(this.tokens, { name: `${tokenName}` }); if (token) { if (token.deleting) { revokeToken(this.model.id, tokenName).then(this.requestTokens.bind(this)); @@ -83,9 +83,9 @@ export default Marionette.ItemView.extend({ }, onRender () { - let copyButton = this.$('.js-copy-to-clipboard'); + const copyButton = this.$('.js-copy-to-clipboard'); if (copyButton.length) { - let clipboard = new Clipboard(copyButton.get(0)); + const clipboard = new Clipboard(copyButton.get(0)); clipboard.on('success', () => { copyButton.tooltip({ title: 'Copied!', placement: 'bottom', trigger: 'manual' }).tooltip('show'); setTimeout(() => copyButton.tooltip('hide'), 1000); diff --git a/server/sonar-web/src/main/js/apps/api-documentation/app.js b/server/sonar-web/src/main/js/apps/api-documentation/app.js index e2b8574675d..7de5702240f 100644 --- a/server/sonar-web/src/main/js/apps/api-documentation/app.js +++ b/server/sonar-web/src/main/js/apps/api-documentation/app.js @@ -30,7 +30,7 @@ import SearchView from './search-view'; const App = new Marionette.Application(); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; // State this.state = new Backbone.Model({ internal: false }); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/helpers.js b/server/sonar-web/src/main/js/apps/background-tasks/helpers.js index 73ea4e5fe8b..e53b1dda56d 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/helpers.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/helpers.js @@ -29,10 +29,10 @@ export function formatDuration(value) { return ''; } if (value >= ONE_MINUTE) { - let minutes = Math.round(value / ONE_MINUTE); + const minutes = Math.round(value / ONE_MINUTE); return format(minutes, 'min'); } else if (value >= ONE_SECOND) { - let seconds = Math.round(value / ONE_SECOND); + const seconds = Math.round(value / ONE_SECOND); return format(seconds, 's'); } else { return format(value, 'ms'); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/app.js b/server/sonar-web/src/main/js/apps/coding-rules/app.js index a5f63248c28..b6dd113f837 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/app.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/app.js @@ -35,7 +35,7 @@ import { translate } from '../../helpers/l10n'; const App = new Marionette.Application(); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; this.layout = new Layout({ el: options.el }); this.layout.render(); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js index 3e4ebc223d9..f998e58012f 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js @@ -37,7 +37,7 @@ export default ModalFormView.extend({ const profileName = profileBase != null ? profileBase.name : profile; const message = translateWithParameters('coding_rules.bulk_change.success', profileName, profileBase.language, succeeded); - this.ui.messagesContainer.append('<div class="alert alert-success">' + message + '</div>'); + this.ui.messagesContainer.append(`<div class="alert alert-success">${message}</div>`); }, showWarnMessage (profile, succeeded, failed) { @@ -45,7 +45,7 @@ export default ModalFormView.extend({ const profileName = profileBase != null ? profileBase.name : profile; const message = translateWithParameters('coding_rules.bulk_change.warning', profileName, profileBase.language, succeeded, failed); - this.ui.messagesContainer.append('<div class="alert alert-warning">' + message + '</div>'); + this.ui.messagesContainer.append(`<div class="alert alert-warning">${message}</div>`); }, onRender () { @@ -59,7 +59,7 @@ export default ModalFormView.extend({ onFormSubmit () { ModalFormView.prototype.onFormSubmit.apply(this, arguments); - const url = '/api/qualityprofiles/' + this.options.action + '_rules'; + const url = `/api/qualityprofiles/${this.options.action}_rules`; const options = _.extend({}, this.options.app.state.get('query'), { wsAction: this.options.action }); const profiles = this.$('#coding-rules-bulk-change-profile').val() || [this.options.param]; this.ui.messagesContainer.empty(); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js index 85f420c7bde..e6361001d8e 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js @@ -28,7 +28,7 @@ export default BaseFacet.extend({ BaseFacet.prototype.onRender.apply(this, arguments); const value = this.options.app.state.get('query').is_template; if (value != null) { - this.$('.js-facet').filter('[data-value="' + value + '"]').addClass('active'); + this.$('.js-facet').filter(`[data-value="${value}"]`).addClass('active'); } }, diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js index b70cd1df324..c93c4202fb9 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js @@ -151,7 +151,7 @@ export default Marionette.LayoutView.extend({ const ruleType = this.model.has('templateKey') ? 'custom' : 'manual'; confirmDialog({ title: translate('delete'), - html: translateWithParameters('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')), + html: translateWithParameters(`coding_rules.delete.${ruleType}.confirm`, this.model.get('name')), yesHandler () { const url = '/api/rules/delete'; const options = { key: that.model.id }; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js index cea722f54cc..853082f3234 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js @@ -78,7 +78,7 @@ export default ModalFormView.extend({ if (!state.id) { return state.text; } else { - return '<i class="icon-severity-' + state.id.toLowerCase() + '"></i> ' + state.text; + return `<i class="icon-severity-${state.id.toLowerCase()}"></i> ${state.text}`; } }; const severity = (this.model && this.model.get('severity')) || this.options.templateRule.get('severity'); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js index 2b76f1f1fc6..311fa010f5f 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js @@ -55,7 +55,7 @@ export default ModalForm.extend({ if (!state.id) { return state.text; } else { - return '<i class="icon-severity-' + state.id.toLowerCase() + '"></i> ' + state.text; + return `<i class="icon-severity-${state.id.toLowerCase()}"></i> ${state.text}`; } }; const severity = (this.model && this.model.get('severity')) || this.options.rule.get('severity'); diff --git a/server/sonar-web/src/main/js/apps/component-issues/app.js b/server/sonar-web/src/main/js/apps/component-issues/app.js index 15cb81d1a55..7398ccf9105 100644 --- a/server/sonar-web/src/main/js/apps/component-issues/app.js +++ b/server/sonar-web/src/main/js/apps/component-issues/app.js @@ -34,7 +34,7 @@ import FacetsView from './../issues/facets-view'; const App = new Marionette.Application(); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; this.config = options.config; this.state = new State({ diff --git a/server/sonar-web/src/main/js/apps/dashboard/app.js b/server/sonar-web/src/main/js/apps/dashboard/app.js index bedc68831ad..308ef963090 100644 --- a/server/sonar-web/src/main/js/apps/dashboard/app.js +++ b/server/sonar-web/src/main/js/apps/dashboard/app.js @@ -130,7 +130,7 @@ window.Portal.prototype = { $('#widget_title_' + widgetId).hide(); $('#widget_' + widgetId).hide(); $('#widget_props_' + widgetId).show(); - $($('#block_' + widgetId + ' a.link-action')[0]).hide(); + $($(`#block_${widgetId} a.link-action`)[0]).hide(); }, @@ -138,7 +138,7 @@ window.Portal.prototype = { $('widget_title_' + widgetId).show(); $('#widget_' + widgetId).show(); $('#widget_props_' + widgetId).hide(); - $($('#block_' + widgetId + ' a.link-action')[0]).show(); + $($(`#block_${widgetId} a.link-action`)[0]).show(); }, diff --git a/server/sonar-web/src/main/js/apps/drilldown/app.js b/server/sonar-web/src/main/js/apps/drilldown/app.js index f11445b5e50..276dd969d29 100644 --- a/server/sonar-web/src/main/js/apps/drilldown/app.js +++ b/server/sonar-web/src/main/js/apps/drilldown/app.js @@ -23,7 +23,7 @@ import SourceViewer from '../../components/source-viewer/main'; const App = new Marionette.Application(); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; App.addRegions({ viewerRegion: options.el }); $('.js-drilldown-link').on('click', function (e) { e.preventDefault(); diff --git a/server/sonar-web/src/main/js/apps/global-permissions/users-view.js b/server/sonar-web/src/main/js/apps/global-permissions/users-view.js index 9c59d065ced..10d152599c2 100644 --- a/server/sonar-web/src/main/js/apps/global-permissions/users-view.js +++ b/server/sonar-web/src/main/js/apps/global-permissions/users-view.js @@ -48,7 +48,7 @@ export default Modal.extend({ readOnly: false, focusSearch: false, format (item) { - return item.name + '<br><span class="note">' + item.login + '</span>'; + return `${item.name}<br><span class="note">${item.login}</span>`; }, queryParam: 'q', searchUrl: getSearchUrl(this.options.permission, this.options.project), diff --git a/server/sonar-web/src/main/js/apps/groups/app.js b/server/sonar-web/src/main/js/apps/groups/app.js index 06688e79802..6fea34a2a74 100644 --- a/server/sonar-web/src/main/js/apps/groups/app.js +++ b/server/sonar-web/src/main/js/apps/groups/app.js @@ -27,7 +27,7 @@ import ListFooterView from './list-footer-view'; const App = new Marionette.Application(); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; // Layout this.layout = new Layout({ el: options.el }); diff --git a/server/sonar-web/src/main/js/apps/groups/users-view.js b/server/sonar-web/src/main/js/apps/groups/users-view.js index e42827f8b1e..894b7f9a206 100644 --- a/server/sonar-web/src/main/js/apps/groups/users-view.js +++ b/server/sonar-web/src/main/js/apps/groups/users-view.js @@ -32,7 +32,7 @@ export default Modal.extend({ readOnly: false, focusSearch: false, format (item) { - return item.name + '<br><span class="note">' + item.login + '</span>'; + return `${item.name}<br><span class="note">${item.login}</span>`; }, queryParam: 'q', searchUrl: '/api/user_groups/users?ps=100&id=' + this.model.id, diff --git a/server/sonar-web/src/main/js/apps/issues/app.js b/server/sonar-web/src/main/js/apps/issues/app.js index 4d20567cbd3..5efe059d331 100644 --- a/server/sonar-web/src/main/js/apps/issues/app.js +++ b/server/sonar-web/src/main/js/apps/issues/app.js @@ -34,7 +34,7 @@ import FiltersView from './filters-view'; const App = new Marionette.Application(); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; this.state = new State(); this.list = new Issues(); diff --git a/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js b/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js index a285286ce3d..4fe7469af9d 100644 --- a/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js +++ b/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js @@ -208,7 +208,7 @@ export default SourceViewer.extend({ }, scrollToLine (line) { - const row = this.$('[data-line-number=' + line + ']'); + const row = this.$(`[data-line-number=${line}]`); const topOffset = $(window).height() / 2 - 60; const goal = row.length > 0 ? row.offset().top - topOffset : 0; return $(window).scrollTop(goal); diff --git a/server/sonar-web/src/main/js/apps/issues/controller.js b/server/sonar-web/src/main/js/apps/issues/controller.js index 6e382be4f17..07ead890dbd 100644 --- a/server/sonar-web/src/main/js/apps/issues/controller.js +++ b/server/sonar-web/src/main/js/apps/issues/controller.js @@ -199,7 +199,7 @@ export default Controller.extend({ } const route = []; _.map(filter, function (value, property) { - return route.push('' + property + '=' + encodeURIComponent(value)); + return route.push(`${property}=${encodeURIComponent(value)}`); }); return route.join(separator); }, diff --git a/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js index 76c62d7cc1a..f2fdce3cbf5 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js @@ -54,7 +54,7 @@ export default BaseFacet.extend({ props.forEach(function (prop) { const value = query[prop]; if (value != null) { - return that.$('input[name=' + prop + ']').val(value); + return that.$(`input[name=${prop}]`).val(value); } }); let values = this.model.getValues(); diff --git a/server/sonar-web/src/main/js/apps/maintenance/app.js b/server/sonar-web/src/main/js/apps/maintenance/app.js index 77f9db94568..4b58063ee52 100644 --- a/server/sonar-web/src/main/js/apps/maintenance/app.js +++ b/server/sonar-web/src/main/js/apps/maintenance/app.js @@ -25,7 +25,7 @@ import MainView from './main-view'; const App = new Marionette.Application(); App.on('start', function () { - let options = window.sonarqube; + const options = window.sonarqube; const viewOptions = _.extend(options, { model: new Backbone.Model() diff --git a/server/sonar-web/src/main/js/apps/markdown/app.js b/server/sonar-web/src/main/js/apps/markdown/app.js index 7fb723f89da..0e7a4c6e347 100644 --- a/server/sonar-web/src/main/js/apps/markdown/app.js +++ b/server/sonar-web/src/main/js/apps/markdown/app.js @@ -23,7 +23,7 @@ import MarkdownView from './markdown-help-view'; const App = new Marionette.Application(); App.on('start', function () { - let options = window.sonarqube; + const options = window.sonarqube; new MarkdownView({ el: options.el }).render(); }); diff --git a/server/sonar-web/src/main/js/apps/metrics/app.js b/server/sonar-web/src/main/js/apps/metrics/app.js index eafe6ec33e0..6a569e9fd53 100644 --- a/server/sonar-web/src/main/js/apps/metrics/app.js +++ b/server/sonar-web/src/main/js/apps/metrics/app.js @@ -27,7 +27,7 @@ import ListFooterView from './list-footer-view'; const App = new Marionette.Application(); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; // Layout this.layout = new Layout({ el: options.el }); diff --git a/server/sonar-web/src/main/js/apps/overview/helpers/periods.js b/server/sonar-web/src/main/js/apps/overview/helpers/periods.js index 4eb3ab61a6c..52a51637b85 100644 --- a/server/sonar-web/src/main/js/apps/overview/helpers/periods.js +++ b/server/sonar-web/src/main/js/apps/overview/helpers/periods.js @@ -23,7 +23,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n'; export function getPeriodLabel (periods, periodIndex) { - let period = _.findWhere(periods, { index: periodIndex }); + const period = _.findWhere(periods, { index: periodIndex }); if (!period) { return null; } @@ -35,7 +35,7 @@ export function getPeriodLabel (periods, periodIndex) { export function getPeriodDate (periods, periodIndex) { - let period = _.findWhere(periods, { index: periodIndex }); + const period = _.findWhere(periods, { index: periodIndex }); if (!period) { return null; } diff --git a/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js b/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js index e62c37d5db6..3f05ffdc8eb 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/groups-view.js @@ -23,8 +23,7 @@ import '../../components/SelectList'; import Template from './templates/permission-templates-groups.hbs'; function getSearchUrl (permission, permissionTemplate) { - return '/api/permissions/template_groups?ps=100&permission=' + permission.key + - '&templateId=' + permissionTemplate.id; + return `/api/permissions/template_groups?ps=100&permission=${permission.key}&templateId=${permissionTemplate.id}`; } export default Modal.extend({ diff --git a/server/sonar-web/src/main/js/apps/permission-templates/users-view.js b/server/sonar-web/src/main/js/apps/permission-templates/users-view.js index 318dabbb294..3e91656400a 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/users-view.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/users-view.js @@ -36,7 +36,7 @@ export default Modal.extend({ readOnly: false, focusSearch: false, format (item) { - return item.name + '<br><span class="note">' + item.login + '</span>'; + return `${item.name}<br><span class="note">${item.login}</span>`; }, queryParam: 'q', selectUrl: '/api/permissions/add_user_to_template', diff --git a/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js b/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js index e869fc85394..a75fa8a8db2 100644 --- a/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js +++ b/server/sonar-web/src/main/js/apps/project-permissions/groups-view.js @@ -23,7 +23,7 @@ import '../../components/SelectList'; import Template from './templates/project-permissions-groups.hbs'; function getSearchUrl (permission, project) { - return '/api/permissions/groups?ps=100&permission=' + permission + '&projectId=' + project; + return `/api/permissions/groups?ps=100&permission=${permission}&projectId=${project}`; } export default Modal.extend({ diff --git a/server/sonar-web/src/main/js/apps/project-permissions/users-view.js b/server/sonar-web/src/main/js/apps/project-permissions/users-view.js index 07fc18ad858..217988359b5 100644 --- a/server/sonar-web/src/main/js/apps/project-permissions/users-view.js +++ b/server/sonar-web/src/main/js/apps/project-permissions/users-view.js @@ -36,7 +36,7 @@ export default Modal.extend({ readOnly: false, focusSearch: false, format (item) { - return item.name + '<br><span class="note">' + item.login + '</span>'; + return `${item.name}<br><span class="note">${item.login}</span>`; }, queryParam: 'q', selectUrl: '/api/permissions/add_user', diff --git a/server/sonar-web/src/main/js/apps/projects/create-view.js b/server/sonar-web/src/main/js/apps/projects/create-view.js index 4bff6436515..5a3eb9d4c73 100644 --- a/server/sonar-web/src/main/js/apps/projects/create-view.js +++ b/server/sonar-web/src/main/js/apps/projects/create-view.js @@ -41,7 +41,7 @@ export default ModalForm.extend({ }, sendRequest () { - let data = { + const data = { name: this.$('#create-project-name').val(), branch: this.$('#create-project-branch').val(), key: this.$('#create-project-key').val() diff --git a/server/sonar-web/src/main/js/apps/quality-gates/app.js b/server/sonar-web/src/main/js/apps/quality-gates/app.js index 4d09615366d..4cae39632a8 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/app.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/app.js @@ -30,7 +30,7 @@ import Controller from './controller'; const App = new Marionette.Application(); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; // Layout this.layout = new Layout({ el: options.el }); this.layout.render(); diff --git a/server/sonar-web/src/main/js/apps/quality-gates/details-view.js b/server/sonar-web/src/main/js/apps/quality-gates/details-view.js index b0cc63fb0f6..ae49ae0bb9f 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/details-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/details-view.js @@ -42,7 +42,7 @@ export default Marionette.LayoutView.extend({ }, orderByName (conditions) { - let metrics = this.options.metrics; + const metrics = this.options.metrics; return _.sortBy(conditions, (condition) => { return _.findWhere(metrics, { key: condition.metric }).name; }); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/app.js b/server/sonar-web/src/main/js/apps/quality-profiles/app.js index cb120af030a..db98ec75561 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/app.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/app.js @@ -35,7 +35,7 @@ const requestExporters = $.get('/api/qualityprofiles/exporters').done(function ( App.exporters = r.exporters; }); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; // Layout this.layout = new Layout({ el: options.el }); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/create-profile-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/create-profile-view.js index 7744ae10d6c..41c049a6029 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/create-profile-view.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/create-profile-view.js @@ -67,7 +67,7 @@ export default ModalFormView.extend({ $(this).addClass('hidden'); }); importers.forEach(function (importer) { - that.$('.js-importer[data-key="' + importer.key + '"]').removeClass('hidden'); + that.$(`.js-importer[data-key="${importer.key}"]`).removeClass('hidden'); }); }, diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js index c6b4cecb7dd..da366eac71f 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js @@ -169,7 +169,7 @@ export default Marionette.LayoutView.extend({ serializeData () { const key = this.model.get('key'); - const rulesSearchUrl = '/coding_rules#qprofile=' + encodeURIComponent(key) + '|activation=true'; + const rulesSearchUrl = `/coding_rules#qprofile=${encodeURIComponent(key)}|activation=true`; return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { rulesSearchUrl, canWrite: this.options.canWrite, diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js index 7ded221819f..d1beb30c0ba 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js @@ -75,7 +75,7 @@ export default Marionette.CompositeView.extend({ filterByLanguage (language) { if (language) { this.$('[data-language]').addClass('hidden'); - this.$('[data-language="' + language + '"]').removeClass('hidden'); + this.$(`[data-language="${language}"]`).removeClass('hidden'); } else { this.$('[data-language]').removeClass('hidden'); } diff --git a/server/sonar-web/src/main/js/apps/source-viewer/app.js b/server/sonar-web/src/main/js/apps/source-viewer/app.js index 1be6f211f36..9e11bcdaca7 100644 --- a/server/sonar-web/src/main/js/apps/source-viewer/app.js +++ b/server/sonar-web/src/main/js/apps/source-viewer/app.js @@ -22,7 +22,7 @@ import SourceViewer from '../../components/source-viewer/main'; const App = new Marionette.Application(); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; this.addRegions({ mainRegion: options.el }); diff --git a/server/sonar-web/src/main/js/apps/update-center/app.js b/server/sonar-web/src/main/js/apps/update-center/app.js index 63c125c2740..1e00828f263 100644 --- a/server/sonar-web/src/main/js/apps/update-center/app.js +++ b/server/sonar-web/src/main/js/apps/update-center/app.js @@ -30,7 +30,7 @@ import Plugins from './plugins'; const App = new Marionette.Application(); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; // State this.state = new Backbone.Model({ diff --git a/server/sonar-web/src/main/js/apps/users/app.js b/server/sonar-web/src/main/js/apps/users/app.js index c2890dabf8d..f8d25051478 100644 --- a/server/sonar-web/src/main/js/apps/users/app.js +++ b/server/sonar-web/src/main/js/apps/users/app.js @@ -27,7 +27,7 @@ import ListFooterView from './list-footer-view'; const App = new Marionette.Application(); const init = function () { - let options = window.sonarqube; + const options = window.sonarqube; // Layout this.layout = new Layout({ el: options.el }); diff --git a/server/sonar-web/src/main/js/apps/users/groups-view.js b/server/sonar-web/src/main/js/apps/users/groups-view.js index d8af44fb4f7..b66ec089153 100644 --- a/server/sonar-web/src/main/js/apps/users/groups-view.js +++ b/server/sonar-web/src/main/js/apps/users/groups-view.js @@ -32,7 +32,7 @@ export default Modal.extend({ readOnly: false, focusSearch: false, format (item) { - return item.name + '<br><span class="note">' + item.description + '</span>'; + return `${item.name}<br><span class="note">${item.description}</span>`; }, queryParam: 'q', searchUrl: '/api/users/groups?ps=100&login=' + this.model.id, diff --git a/server/sonar-web/src/main/js/apps/users/tokens-view.js b/server/sonar-web/src/main/js/apps/users/tokens-view.js index a88d92a7f29..883a2b8687e 100644 --- a/server/sonar-web/src/main/js/apps/users/tokens-view.js +++ b/server/sonar-web/src/main/js/apps/users/tokens-view.js @@ -55,7 +55,7 @@ export default Modal.extend({ e.preventDefault(); this.errors = []; this.newToken = null; - let tokenName = this.$('.js-generate-token-form input').val(); + const tokenName = this.$('.js-generate-token-form input').val(); generateToken(this.model.id, tokenName) .then(response => { this.newToken = response; @@ -71,8 +71,8 @@ export default Modal.extend({ onRevokeTokenFormSubmit(e) { e.preventDefault(); - let tokenName = $(e.currentTarget).data('token'); - let token = _.findWhere(this.tokens, { name: `${tokenName}` }); + const tokenName = $(e.currentTarget).data('token'); + const token = _.findWhere(this.tokens, { name: `${tokenName}` }); if (token) { if (token.deleting) { revokeToken(this.model.id, tokenName).then(this.requestTokens.bind(this)); @@ -85,9 +85,9 @@ export default Modal.extend({ onRender () { Modal.prototype.onRender.apply(this, arguments); - let copyButton = this.$('.js-copy-to-clipboard'); + const copyButton = this.$('.js-copy-to-clipboard'); if (copyButton.length) { - let clipboard = new Clipboard(copyButton.get(0)); + const clipboard = new Clipboard(copyButton.get(0)); clipboard.on('success', () => { copyButton.tooltip({ title: 'Copied!', placement: 'bottom', trigger: 'manual' }).tooltip('show'); setTimeout(() => copyButton.tooltip('hide'), 1000); diff --git a/server/sonar-web/src/main/js/components/SelectList/index.js b/server/sonar-web/src/main/js/components/SelectList/index.js index b60aeb879c0..283735516bc 100644 --- a/server/sonar-web/src/main/js/components/SelectList/index.js +++ b/server/sonar-web/src/main/js/components/SelectList/index.js @@ -269,7 +269,7 @@ const SelectListView = Backbone.View.extend({ }, renderEmpty () { - this.$list.append('<li class="empty-message">' + this.settings.labels.noResults + '</li>'); + this.$list.append(`<li class="empty-message">${this.settings.labels.noResults}</li>`); }, confirmFilter (model) { @@ -293,7 +293,7 @@ const SelectListView = Backbone.View.extend({ this.$('.select-list-search-control input').val(''); this.$('.select-list-control-button').removeClass('active') - .filter('[name=' + filter + ']').addClass('active'); + .filter(`[name=${filter}]`).addClass('active'); this.showFetchSpinner(); diff --git a/server/sonar-web/src/main/js/components/common/modal-form.js b/server/sonar-web/src/main/js/components/common/modal-form.js index b2c697f29dd..1ee62b5f720 100644 --- a/server/sonar-web/src/main/js/components/common/modal-form.js +++ b/server/sonar-web/src/main/js/components/common/modal-form.js @@ -58,13 +58,13 @@ export default ModalView.extend({ const container = this.ui.messagesContainer.empty(); if (_.isArray(errors)) { errors.forEach(function (error) { - const html = '<div class="alert alert-danger">' + error.msg + '</div>'; + const html = `<div class="alert alert-danger">${error.msg}</div>`; container.append(html); }); } if (_.isArray(warnings)) { warnings.forEach(function (warn) { - const html = '<div class="alert alert-warning">' + warn.msg + '</div>'; + const html = `<div class="alert alert-warning">${warn.msg}</div>`; container.append(html); }); } diff --git a/server/sonar-web/src/main/js/components/common/modals.js b/server/sonar-web/src/main/js/components/common/modals.js index 264b547bb12..9b9c6259144 100644 --- a/server/sonar-web/src/main/js/components/common/modals.js +++ b/server/sonar-web/src/main/js/components/common/modals.js @@ -73,7 +73,7 @@ export default Marionette.ItemView.extend({ renderOverlay () { const overlay = $('.' + this.overlayClassName); if (overlay.length === 0) { - $('<div class="' + this.overlayClassName + '"></div>').appendTo($('body')); + $(`<div class="${this.overlayClassName}"></div>`).appendTo($('body')); } }, diff --git a/server/sonar-web/src/main/js/components/issue/models/issue.js b/server/sonar-web/src/main/js/components/issue/models/issue.js index 354ca31d93d..84337c0c50d 100644 --- a/server/sonar-web/src/main/js/components/issue/models/issue.js +++ b/server/sonar-web/src/main/js/components/issue/models/issue.js @@ -145,7 +145,7 @@ export default Backbone.Model.extend({ * @returns {Object} */ reset (attrs, options) { - for (let key in this.attributes) { + for (const key in this.attributes) { if (this.attributes.hasOwnProperty(key) && !(key in attrs)) { attrs[key] = void 0; } diff --git a/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js b/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js index 3ffb071be22..19daabb80f4 100644 --- a/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js @@ -31,7 +31,7 @@ export default ActionOptionsView.extend({ }, selectInitialOption () { - this.makeActive(this.getOptions().filter('[data-value="' + this.getActionPlan() + '"]')); + this.makeActive(this.getOptions().filter(`[data-value="${this.getActionPlan()}"]`)); }, selectOption (e) { diff --git a/server/sonar-web/src/main/js/components/issue/views/set-severity-form-view.js b/server/sonar-web/src/main/js/components/issue/views/set-severity-form-view.js index 33f3b77de50..eaa0ccf4085 100644 --- a/server/sonar-web/src/main/js/components/issue/views/set-severity-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/set-severity-form-view.js @@ -30,7 +30,7 @@ export default ActionOptionsView.extend({ }, selectInitialOption () { - return this.makeActive(this.getOptions().filter('[data-value="' + this.getTransition() + '"]')); + return this.makeActive(this.getOptions().filter(`[data-value="${this.getTransition()}"]`)); }, selectOption (e) { diff --git a/server/sonar-web/src/main/js/components/mixins/resize-mixin.js b/server/sonar-web/src/main/js/components/mixins/resize-mixin.js index 0956957f9f1..ff0ce1f2204 100644 --- a/server/sonar-web/src/main/js/components/mixins/resize-mixin.js +++ b/server/sonar-web/src/main/js/components/mixins/resize-mixin.js @@ -34,9 +34,9 @@ export const ResizeMixin = { }, handleResize () { - let boundingClientRect = ReactDOM.findDOMNode(this).parentNode.getBoundingClientRect(); - let newWidth = this.props.width || boundingClientRect.width; - let newHeight = this.props.height || boundingClientRect.height; + const boundingClientRect = ReactDOM.findDOMNode(this).parentNode.getBoundingClientRect(); + const newWidth = this.props.width || boundingClientRect.width; + const newHeight = this.props.height || boundingClientRect.height; this.setState({ width: newWidth, height: newHeight }); }, diff --git a/server/sonar-web/src/main/js/components/navigator/controller.js b/server/sonar-web/src/main/js/components/navigator/controller.js index ca5c72798ed..7eb88e37704 100644 --- a/server/sonar-web/src/main/js/components/navigator/controller.js +++ b/server/sonar-web/src/main/js/components/navigator/controller.js @@ -118,7 +118,7 @@ export default Marionette.Controller.extend({ const filter = this.options.app.state.get('query'); const route = []; _.map(filter, function (value, property) { - route.push('' + property + '=' + encodeURIComponent(value)); + route.push(`${property}=${encodeURIComponent(value)}`); }); return route.join(separator); }, diff --git a/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js b/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js index ce9e3deec08..f496ba66143 100644 --- a/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js +++ b/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js @@ -46,7 +46,7 @@ export default Marionette.ItemView.extend({ const value = this.options.app.state.get('query')[property]; if (typeof value === 'string') { value.split(',').forEach(function (s) { - const facet = that.$('.js-facet').filter('[data-value="' + s + '"]'); + const facet = that.$('.js-facet').filter(`[data-value="${s}"]`); if (facet.length > 0) { facet.addClass('active'); } diff --git a/server/sonar-web/src/main/js/components/router/router.js b/server/sonar-web/src/main/js/components/router/router.js index aea35f51f33..8e38ba9812a 100644 --- a/server/sonar-web/src/main/js/components/router/router.js +++ b/server/sonar-web/src/main/js/components/router/router.js @@ -30,7 +30,7 @@ export const RouterMixin = { }, getRoute() { - let path = window.location.pathname; + const path = window.location.pathname; if (path.indexOf(this.props.urlRoot) === 0) { return path.substr(this.props.urlRoot.length); } else { @@ -48,12 +48,12 @@ export const RouterMixin = { }, handleRouteChange() { - let route = this.getRoute(); + const route = this.getRoute(); this.setState({ route }); }, navigate (route) { - let url = this.props.urlRoot + route + window.location.search + window.location.hash; + const url = this.props.urlRoot + route + window.location.search + window.location.hash; window.history.pushState({ route }, document.title, url); this.setState({ route }); } diff --git a/server/sonar-web/src/main/js/components/source-viewer/main.js b/server/sonar-web/src/main/js/components/source-viewer/main.js index c013b8e3c53..9516aa17e46 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/main.js +++ b/server/sonar-web/src/main/js/components/source-viewer/main.js @@ -532,7 +532,7 @@ export default Marionette.LayoutView.extend({ }, highlightLine (line) { - const row = this.$('.source-line[data-line-number=' + line + ']'); + const row = this.$(`.source-line[data-line-number=${line}]`); this.removeHighlighting(); this.highlightedLine = line; row.addClass(HIGHLIGHTED_ROW_CLASS); @@ -563,7 +563,7 @@ export default Marionette.LayoutView.extend({ }, scrollToLine (line) { - const row = this.$('.source-line[data-line-number=' + line + ']'); + const row = this.$(`.source-line[data-line-number=${line}]`); if (row.length > 0) { const p = $(window); const pTopOffset = p.offset() != null ? p.offset().top : 0; @@ -575,7 +575,7 @@ export default Marionette.LayoutView.extend({ }, scrollToFirstLine (line) { - const row = this.$('.source-line[data-line-number=' + line + ']'); + const row = this.$(`.source-line[data-line-number=${line}]`); if (row.length > 0) { const p = $(window); const pTopOffset = p.offset() != null ? p.offset().top : 0; @@ -586,7 +586,7 @@ export default Marionette.LayoutView.extend({ }, scrollToLastLine (line) { - const row = this.$('.source-line[data-line-number=' + line + ']'); + const row = this.$(`.source-line[data-line-number=${line}]`); if (row.length > 0) { let p = $(window); if (p.is(document)) { @@ -764,7 +764,7 @@ export default Marionette.LayoutView.extend({ showIssueLocation (location, index) { if (location && location.textRange) { const line = location.textRange.startLine; - const row = this.$('.source-line-code[data-line-number="' + line + '"]'); + const row = this.$(`.source-line-code[data-line-number="${line}"]`); if (index > 0 && _.size(location.msg)) { // render location marker only for @@ -785,7 +785,7 @@ export default Marionette.LayoutView.extend({ highlightIssueLocationInCode (location) { for (let line = location.textRange.startLine; line <= location.textRange.endLine; line++) { - const row = this.$('.source-line-code[data-line-number="' + line + '"]'); + const row = this.$(`.source-line-code[data-line-number="${line}"]`); // get location for the current line const from = line === location.textRange.startLine ? location.textRange.startOffset : 0; diff --git a/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js b/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js index bfcbe8d3126..9e65406e940 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js +++ b/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js @@ -51,7 +51,7 @@ export default ModalView.extend({ initPieChart () { const trans = function (left, top) { - return 'translate(' + left + ', ' + top + ')'; + return `translate(${left}, ${top})`; }; const defaults = { @@ -221,7 +221,7 @@ export default ModalView.extend({ that.testSorting = 'status'; that.testAsc = true; that.sortTests(function (test) { - return '' + that.testsOrder.indexOf(test.status) + '_______' + test.name; + return `${that.testsOrder.indexOf(test.status)}_______${test.name}`; }); }); }, @@ -261,7 +261,7 @@ export default ModalView.extend({ this.testAsc = !this.testAsc; } this.sortTests(function (test) { - return '' + that.testsOrder.indexOf(test.status) + '_______' + test.name; + return `${that.testsOrder.indexOf(test.status)}_______${test.name}`; }); this.testSorting = 'status'; this.render(); diff --git a/server/sonar-web/src/main/js/components/widgets/barchart.js b/server/sonar-web/src/main/js/components/widgets/barchart.js index 0a71514502b..3c53eeb04be 100644 --- a/server/sonar-web/src/main/js/components/widgets/barchart.js +++ b/server/sonar-web/src/main/js/components/widgets/barchart.js @@ -23,7 +23,7 @@ import moment from 'moment'; import d3 from 'd3'; function trans (left, top) { - return 'translate(' + left + ', ' + top + ')'; + return `translate(${left}, ${top})`; } const defaults = function () { diff --git a/server/sonar-web/src/main/js/helpers/csv.js b/server/sonar-web/src/main/js/helpers/csv.js index d64e00f7c94..57d372a6d2b 100644 --- a/server/sonar-web/src/main/js/helpers/csv.js +++ b/server/sonar-web/src/main/js/helpers/csv.js @@ -19,5 +19,5 @@ */ export function csvEscape (value) { const escaped = value.replace(/"/g, '\\"'); - return '"' + escaped + '"'; + return `"${escaped}"`; } diff --git a/server/sonar-web/src/main/js/helpers/handlebars/all.js b/server/sonar-web/src/main/js/helpers/handlebars/all.js index 5318772ef49..2019577fe2e 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/all.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/all.js @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -module.exports = function () { - const args = Array.prototype.slice.call(arguments, 0, -1); - const options = arguments[arguments.length - 1]; - const all = args.reduce(function (prev, current) { +module.exports = function (...args) { + const options = args[args.length - 1]; + const list = args.slice(0, -1); + const all = list.reduce(function (prev, current) { return prev && current; }, true); return all ? options.fn(this) : options.inverse(this); diff --git a/server/sonar-web/src/main/js/helpers/handlebars/any.js b/server/sonar-web/src/main/js/helpers/handlebars/any.js index 1d81a679d85..a82aacd80c2 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/any.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/any.js @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -module.exports = function () { - const args = Array.prototype.slice.call(arguments, 0, -1); - const options = arguments[arguments.length - 1]; - const any = args.reduce(function (prev, current) { +module.exports = function (...args) { + const options = args[args.length - 1]; + const list = args.slice(0, -1); + const any = list.reduce(function (prev, current) { return prev || current; }, false); return any ? options.fn(this) : options.inverse(this); diff --git a/server/sonar-web/src/main/js/helpers/handlebars/avatarHelper.js b/server/sonar-web/src/main/js/helpers/handlebars/avatarHelper.js index d6a00952ddf..1e913674f90 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/avatarHelper.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/avatarHelper.js @@ -27,6 +27,6 @@ module.exports = function (email, size) { .replace('{EMAIL_MD5}', emailHash) .replace('{SIZE}', size * 2); return new Handlebars.default.SafeString( - '<img class="rounded" src="' + url + '" width="' + size + '" height="' + size + '" alt="' + email + '">' + `<img class="rounded" src="${url}" width="${size}" height="${size}" alt="${email}">` ); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/dashboardL10n.js b/server/sonar-web/src/main/js/helpers/handlebars/dashboardL10n.js index bfee7ad7e88..57eac44c50c 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/dashboardL10n.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/dashboardL10n.js @@ -20,7 +20,7 @@ import { translate } from '../../helpers/l10n'; module.exports = function (dashboardName) { - const l10nKey = 'dashboard.' + dashboardName + '.name'; + const l10nKey = `dashboard.${dashboardName}.name`; const l10nLabel = translate(l10nKey); if (l10nLabel !== l10nKey) { return l10nLabel; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/default.js b/server/sonar-web/src/main/js/helpers/handlebars/default.js index 9e16c7e76ae..deabad32ed6 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/default.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/default.js @@ -17,9 +17,9 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -module.exports = function () { - const args = Array.prototype.slice.call(arguments, 0, -1); - return args.reduce(function (prev, current) { +module.exports = function (...args) { + const list = args.slice(0, -1); + return list.reduce(function (prev, current) { return prev != null ? prev : current; }, null); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/ifNotEmpty.js b/server/sonar-web/src/main/js/helpers/handlebars/ifNotEmpty.js index a6c314a607e..d0bd9d4e067 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/ifNotEmpty.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/ifNotEmpty.js @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -module.exports = function () { - const args = Array.prototype.slice.call(arguments, 0, -1); - const options = arguments[arguments.length - 1]; - const notEmpty = args.reduce(function (prev, current) { +module.exports = function (...args) { + const options = args[args.length - 1]; + const list = args.slice(0, -1); + const notEmpty = list.reduce(function (prev, current) { return prev || (current && current.length > 0); }, false); return notEmpty ? options.fn(this) : options.inverse(this); diff --git a/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js b/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js index 242f90f53f8..d52892d3512 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/isActiveLink.js @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -module.exports = function () { - const args = Array.prototype.slice.call(arguments, 0, -1); - const options = arguments[arguments.length - 1]; - const prefix = args.join(''); +module.exports = function (...args) { + const options = args[args.length - 1]; + const list = args.slice(0, -1); + const prefix = list.join(''); const path = window.location.pathname; const match = path.indexOf(prefix) === 0; return match ? options.fn(this) : options.inverse(this); diff --git a/server/sonar-web/src/main/js/helpers/handlebars/issueFilterItemLink.js b/server/sonar-web/src/main/js/helpers/handlebars/issueFilterItemLink.js index a1825b04421..5039f525a95 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/issueFilterItemLink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/issueFilterItemLink.js @@ -23,7 +23,7 @@ function getQuery (query, separator) { separator = separator || '|'; const route = []; _.forEach(query, function (value, property) { - route.push('' + property + '=' + encodeURIComponent(value)); + route.push(`${property}=${encodeURIComponent(value)}`); }); return route.join(separator); } diff --git a/server/sonar-web/src/main/js/helpers/handlebars/issueFilterTotalLink.js b/server/sonar-web/src/main/js/helpers/handlebars/issueFilterTotalLink.js index b900a9407e9..5b02cca139f 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/issueFilterTotalLink.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/issueFilterTotalLink.js @@ -23,7 +23,7 @@ function getQuery (query, separator) { separator = separator || '|'; const route = []; _.forEach(query, function (value, property) { - route.push('' + property + '=' + encodeURIComponent(value)); + route.push(`${property}=${encodeURIComponent(value)}`); }); return route.join(separator); } diff --git a/server/sonar-web/src/main/js/helpers/handlebars/joinEach.js b/server/sonar-web/src/main/js/helpers/handlebars/joinEach.js index 4bc816b288c..204366e6b88 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/joinEach.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/joinEach.js @@ -21,7 +21,8 @@ module.exports = function (array, separator, options) { let ret = ''; if (array && array.length > 0) { - for (let i = 0, n = array.length; i < n; i++) { + const n = array.length; + for (let i = 0; i < n; i++) { ret += options.fn(array[i]); if (i < n - 1) { ret += separator; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/link.js b/server/sonar-web/src/main/js/helpers/handlebars/link.js index faabd509205..c0db825918d 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/link.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/link.js @@ -17,6 +17,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -module.exports = function () { - return Array.prototype.slice.call(arguments, 0, -1).join(''); +module.exports = function (...args) { + return args.slice(0, -1).join(''); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/log.js b/server/sonar-web/src/main/js/helpers/handlebars/log.js index 1e07f8f0c7f..c1190223b11 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/log.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/log.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -module.exports = function () { +module.exports = function (...args) { /* eslint no-console: 0 */ - const args = Array.prototype.slice.call(arguments, 0, -1); - console.log.apply(console, args); + console.log.apply(console, args.slice(0, -1)); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/qualifierIcon.js b/server/sonar-web/src/main/js/helpers/handlebars/qualifierIcon.js index 313e6d2edeb..0c6f6dd5037 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/qualifierIcon.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/qualifierIcon.js @@ -21,6 +21,6 @@ import Handlebars from 'handlebars/runtime'; module.exports = function (qualifier) { return new Handlebars.default.SafeString( - qualifier ? '<i class="icon-qualifier-' + qualifier.toLowerCase() + '"></i>' : '' + qualifier ? `<i class="icon-qualifier-${qualifier.toLowerCase()}"></i>` : '' ); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/severityChangelog.js b/server/sonar-web/src/main/js/helpers/handlebars/severityChangelog.js index effea6826ea..1c2a5a10c25 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/severityChangelog.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/severityChangelog.js @@ -21,7 +21,7 @@ import Handlebars from 'handlebars/runtime'; import { translate, translateWithParameters } from '../../helpers/l10n'; module.exports = function (severity) { - const label = '<i class="icon-severity-' + severity.toLowerCase() + '"></i> ' + translate('severity', severity); + const label = `<i class="icon-severity-${severity.toLowerCase()}"></i> ${translate('severity', severity)}`; const message = translateWithParameters('quality_profiles.severity_set_to_x', label); return new Handlebars.default.SafeString(message); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/severityHelper.js b/server/sonar-web/src/main/js/helpers/handlebars/severityHelper.js index dd10398f07c..9d375f3f745 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/severityHelper.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/severityHelper.js @@ -22,6 +22,6 @@ import { translate } from '../../helpers/l10n'; module.exports = function (severity) { return new Handlebars.default.SafeString( - '<i class="icon-severity-' + severity.toLowerCase() + '"></i> ' + translate('severity', severity) + `<i class="icon-severity-${severity.toLowerCase()}"></i> ${translate('severity', severity)}` ); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/severityIcon.js b/server/sonar-web/src/main/js/helpers/handlebars/severityIcon.js index aaf797610be..c0ca43d0b38 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/severityIcon.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/severityIcon.js @@ -21,6 +21,6 @@ import Handlebars from 'handlebars/runtime'; module.exports = function (severity) { return new Handlebars.default.SafeString( - '<i class="icon-severity-' + severity.toLowerCase() + '"></i>' + `<i class="icon-severity-${severity.toLowerCase()}"></i>` ); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/show.js b/server/sonar-web/src/main/js/helpers/handlebars/show.js index c889de770e6..7606767eb31 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/show.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/show.js @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -module.exports = function () { - const args = Array.prototype.slice.call(arguments); +module.exports = function (...args) { let ret = null; args.forEach(function (arg) { if (typeof arg === 'string' && ret == null) { diff --git a/server/sonar-web/src/main/js/helpers/handlebars/statusHelper.js b/server/sonar-web/src/main/js/helpers/handlebars/statusHelper.js index 93f45817637..26b77c74f4d 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/statusHelper.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/statusHelper.js @@ -21,7 +21,7 @@ import Handlebars from 'handlebars/runtime'; import { translate } from '../../helpers/l10n'; module.exports = function (status, resolution) { - let s = '<i class="icon-status-' + status.toLowerCase() + '"></i> ' + translate('issue.status', status); + let s = `<i class="icon-status-${status.toLowerCase()}"></i> ${translate('issue.status', status)}`; if (resolution != null) { s = s + ' (' + translate('issue.resolution', resolution) + ')'; } diff --git a/server/sonar-web/src/main/js/helpers/handlebars/statusIcon.js b/server/sonar-web/src/main/js/helpers/handlebars/statusIcon.js index 0ced8b08a90..c53cc552c09 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/statusIcon.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/statusIcon.js @@ -21,6 +21,6 @@ import Handlebars from 'handlebars/runtime'; module.exports = function (status) { return new Handlebars.default.SafeString( - '<i class="icon-status-' + status.toLowerCase() + '"></i>' + `<i class="icon-status-${status.toLowerCase()}"></i>` ); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/sum.js b/server/sonar-web/src/main/js/helpers/handlebars/sum.js index be7b330a915..5a059782067 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/sum.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/sum.js @@ -17,9 +17,9 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -module.exports = function () { - const args = Array.prototype.slice.call(arguments, 0, -1); - return args.reduce(function (p, c) { +module.exports = function (...args) { + const list = args.slice(0, -1); + return list.reduce(function (p, c) { return p + +c; }, 0); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/testStatusIcon.js b/server/sonar-web/src/main/js/helpers/handlebars/testStatusIcon.js index 008340bdaa6..be0f7cc6400 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/testStatusIcon.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/testStatusIcon.js @@ -21,6 +21,6 @@ import Handlebars from 'handlebars/runtime'; module.exports = function (status) { return new Handlebars.default.SafeString( - '<i class="icon-test-status-' + status.toLowerCase() + '"></i>' + `<i class="icon-test-status-${status.toLowerCase()}"></i>` ); }; diff --git a/server/sonar-web/src/main/js/helpers/handlebars/testStatusIconClass.js b/server/sonar-web/src/main/js/helpers/handlebars/testStatusIconClass.js index 92329b1d8ba..5202d6d58e6 100644 --- a/server/sonar-web/src/main/js/helpers/handlebars/testStatusIconClass.js +++ b/server/sonar-web/src/main/js/helpers/handlebars/testStatusIconClass.js @@ -20,7 +20,6 @@ import Handlebars from 'handlebars/runtime'; module.exports = function (status) { - return new Handlebars.default.SafeString('' + - 'icon-test-status-' + status.toLowerCase() + return new Handlebars.default.SafeString(`icon-test-status-${status.toLowerCase()}` ); }; diff --git a/server/sonar-web/src/main/js/helpers/l10n.js b/server/sonar-web/src/main/js/helpers/l10n.js index f8eaa296131..2ce515e7085 100644 --- a/server/sonar-web/src/main/js/helpers/l10n.js +++ b/server/sonar-web/src/main/js/helpers/l10n.js @@ -93,7 +93,7 @@ export function installGlobal () { } export function getLocalizedDashboardName (baseName) { - const l10nKey = 'dashboard.' + baseName + '.name'; + const l10nKey = `dashboard.${baseName}.name`; const l10nLabel = translate(l10nKey); return l10nLabel !== l10nKey ? l10nLabel : baseName; } diff --git a/server/sonar-web/src/main/js/helpers/measures.js b/server/sonar-web/src/main/js/helpers/measures.js index 518abbdd008..360380ec65f 100644 --- a/server/sonar-web/src/main/js/helpers/measures.js +++ b/server/sonar-web/src/main/js/helpers/measures.js @@ -28,7 +28,7 @@ import { translate, translateWithParameters } from './l10n'; * @param {string} type */ export function formatMeasure (value, type) { - let formatter = getFormatter(type); + const formatter = getFormatter(type); return useFormatter(value, formatter); } @@ -39,7 +39,7 @@ export function formatMeasure (value, type) { * @param {string} type */ export function formatMeasureVariation (value, type) { - let formatter = getVariationFormatter(type); + const formatter = getVariationFormatter(type); return useFormatter(value, formatter); } @@ -60,8 +60,8 @@ export function localizeMetric (metricKey) { * @returns {Array} */ export function groupByDomain (metrics) { - let groupedMetrics = _.groupBy(metrics, 'domain'); - let domains = _.map(groupedMetrics, (metricList, domain) => { + const groupedMetrics = _.groupBy(metrics, 'domain'); + const domains = _.map(groupedMetrics, (metricList, domain) => { return { domain, metrics: _.sortBy(metricList, 'name') @@ -140,7 +140,7 @@ function shortIntFormatter (value) { } function shortIntVariationFormatter (value) { - let formatted = shortIntFormatter(Math.abs(value)); + const formatted = shortIntFormatter(Math.abs(value)); return value < 0 ? `-${formatted}` : `+${formatted}`; } @@ -178,10 +178,10 @@ function millisecondsFormatter (value) { const ONE_SECOND = 1000; const ONE_MINUTE = 60 * ONE_SECOND; if (value >= ONE_MINUTE) { - let minutes = Math.round(value / ONE_MINUTE); + const minutes = Math.round(value / ONE_MINUTE); return `${minutes}min`; } else if (value >= ONE_SECOND) { - let seconds = Math.round(value / ONE_SECOND); + const seconds = Math.round(value / ONE_SECOND); return `${seconds}s`; } else { return `${value}ms`; @@ -189,8 +189,8 @@ function millisecondsFormatter (value) { } function millisecondsVariationFormatter (value) { - let absValue = Math.abs(value); - let formattedValue = millisecondsFormatter(absValue); + const absValue = Math.abs(value); + const formattedValue = millisecondsFormatter(absValue); return value < 0 ? `-${formattedValue}` : `+${formattedValue}`; } diff --git a/server/sonar-web/src/main/js/helpers/request.js b/server/sonar-web/src/main/js/helpers/request.js index 99988db287d..c5c1bb2fdbc 100644 --- a/server/sonar-web/src/main/js/helpers/request.js +++ b/server/sonar-web/src/main/js/helpers/request.js @@ -64,7 +64,7 @@ class Request { submit () { let url = this.url; - let options = _.defaults(this.options, OPTIONS); + const options = _.defaults(this.options, OPTIONS); options.headers = _.defaults(this.headers, HEADERS); if (this.data) { if (options.method === 'GET') { diff --git a/server/sonar-web/src/main/js/helpers/urls.js b/server/sonar-web/src/main/js/helpers/urls.js index dc693e74952..96f26039701 100644 --- a/server/sonar-web/src/main/js/helpers/urls.js +++ b/server/sonar-web/src/main/js/helpers/urls.js @@ -34,7 +34,7 @@ export function getComponentUrl (componentKey) { * @returns {string} */ export function getComponentIssuesUrl (componentKey, query) { - let serializedQuery = Object.keys(query).map(criterion => { + const serializedQuery = Object.keys(query).map(criterion => { return `${encodeURIComponent(criterion)}=${encodeURIComponent(query[criterion])}`; }).join('|'); return '/component_issues?id=' + encodeURIComponent(componentKey) + '#' + serializedQuery; diff --git a/server/sonar-web/src/main/js/main/app.js b/server/sonar-web/src/main/js/main/app.js index f00a6ecacbb..24592caac8f 100644 --- a/server/sonar-web/src/main/js/main/app.js +++ b/server/sonar-web/src/main/js/main/app.js @@ -51,7 +51,7 @@ function startNavigation () { } function prepareAppOptions (navResponse) { - let appOptions = { el: '#content' }; + const appOptions = { el: '#content' }; if (navResponse) { appOptions.rootQualifiers = navResponse.global.qualifiers; if (navResponse.component) { diff --git a/server/sonar-web/src/main/js/main/nav/component/recent-history.js b/server/sonar-web/src/main/js/main/nav/component/RecentHistory.js index 12fa283cf93..12fa283cf93 100644 --- a/server/sonar-web/src/main/js/main/nav/component/recent-history.js +++ b/server/sonar-web/src/main/js/main/nav/component/RecentHistory.js diff --git a/server/sonar-web/src/main/js/main/nav/component/component-nav.js b/server/sonar-web/src/main/js/main/nav/component/component-nav.js index 97ea07a520d..95bcc443b3e 100644 --- a/server/sonar-web/src/main/js/main/nav/component/component-nav.js +++ b/server/sonar-web/src/main/js/main/nav/component/component-nav.js @@ -27,7 +27,7 @@ import ComponentNavFavorite from './component-nav-favorite'; import ComponentNavBreadcrumbs from './component-nav-breadcrumbs'; import ComponentNavMeta from './component-nav-meta'; import ComponentNavMenu from './component-nav-menu'; -import RecentHistory from './recent-history'; +import RecentHistory from './RecentHistory'; export default React.createClass({ componentDidMount() { diff --git a/server/sonar-web/src/main/js/main/nav/dashboard-name-mixin.js b/server/sonar-web/src/main/js/main/nav/dashboard-name-mixin.js index 09861d46f14..8ec177c23cb 100644 --- a/server/sonar-web/src/main/js/main/nav/dashboard-name-mixin.js +++ b/server/sonar-web/src/main/js/main/nav/dashboard-name-mixin.js @@ -21,7 +21,7 @@ import { translate } from '../../helpers/l10n'; export default { getLocalizedDashboardName(baseName) { - const l10nKey = 'dashboard.' + baseName + '.name'; + const l10nKey = `dashboard.${baseName}.name`; const l10nLabel = translate(l10nKey); if (l10nLabel !== l10nKey) { return l10nLabel; diff --git a/server/sonar-web/src/main/js/main/nav/global/global-nav-user.js b/server/sonar-web/src/main/js/main/nav/global/global-nav-user.js index 0d10bbbe045..e9acafd4700 100644 --- a/server/sonar-web/src/main/js/main/nav/global/global-nav-user.js +++ b/server/sonar-web/src/main/js/main/nav/global/global-nav-user.js @@ -19,7 +19,7 @@ */ import React from 'react'; import Avatar from '../../../components/shared/avatar'; -import RecentHistory from '../component/recent-history'; +import RecentHistory from '../component/RecentHistory'; import { translate } from '../../../helpers/l10n'; export default React.createClass({ diff --git a/server/sonar-web/src/main/js/main/nav/global/search-view.js b/server/sonar-web/src/main/js/main/nav/global/search-view.js index 0af5fef914b..14751ee3ad7 100644 --- a/server/sonar-web/src/main/js/main/nav/global/search-view.js +++ b/server/sonar-web/src/main/js/main/nav/global/search-view.js @@ -25,7 +25,7 @@ import SelectableCollectionView from '../../../components/common/selectable-coll import SearchItemTemplate from '../templates/nav-search-item.hbs'; import EmptySearchTemplate from '../templates/nav-search-empty.hbs'; import SearchTemplate from '../templates/nav-search.hbs'; -import RecentHistory from '../component/recent-history'; +import RecentHistory from '../component/RecentHistory'; import { translate } from '../../../helpers/l10n'; import { collapsedDirFromPath, fileFromPath } from '../../../helpers/path'; diff --git a/server/sonar-web/src/main/js/widgets/issue-filter/widget.js b/server/sonar-web/src/main/js/widgets/issue-filter/widget.js index 3382342b988..1e371ed4122 100644 --- a/server/sonar-web/src/main/js/widgets/issue-filter/widget.js +++ b/server/sonar-web/src/main/js/widgets/issue-filter/widget.js @@ -212,7 +212,7 @@ function getQuery (query, separator) { separator = separator || '|'; const route = []; _.forEach(query, function (value, property) { - route.push('' + property + '=' + encodeURIComponent(value)); + route.push(`${property}=${encodeURIComponent(value)}`); }); return route.join(separator); } diff --git a/server/sonar-web/src/main/js/widgets/old/base.js b/server/sonar-web/src/main/js/widgets/old/base.js index caae96c917c..5e3001e44e7 100644 --- a/server/sonar-web/src/main/js/widgets/old/base.js +++ b/server/sonar-web/src/main/js/widgets/old/base.js @@ -87,7 +87,7 @@ import _ from 'underscore'; }; BaseWidget.prototype.trans = function (left, top) { - return 'translate(' + left + ',' + top + ')'; + return `translate(${left},${top})`; }; BaseWidget.prototype.render = function (container) { |