From 5da7c8f3f1ffc2975e1fdeef86d414230fe490d0 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 1 Nov 2016 14:13:39 +0100 Subject: [PATCH] SONAR-8326 Drop all code related to IT/overall coverage on web side (#1348) --- .../src/main/js/apps/code/components/App.js | 6 +- .../main/js/apps/code/components/Component.js | 4 +- .../js/apps/code/components/Components.js | 6 +- .../sonar-web/src/main/js/apps/code/utils.js | 10 +-- .../config/complementary.js | 24 ------- .../apps/component-measures/config/domains.js | 33 --------- .../home/HomeMeasuresList.js | 22 +----- .../apps/overview/components/OverviewApp.js | 8 --- .../main/js/apps/overview/main/Coverage.js | 70 ++++++------------- .../main/js/components/source-viewer/main.js | 41 +++-------- .../source-viewer/measures-overlay.js | 6 -- .../source-viewer/popups/coverage-popup.js | 11 +-- .../js/components/source-viewer/source.js | 11 +-- .../_source-viewer-measures-coverage.hbs | 30 ++------ .../source-viewer-coverage-popup.hbs | 4 +- .../templates/source-viewer-measures.hbs | 4 +- .../source-viewer/templates/source-viewer.hbs | 15 +--- .../sonar-web/src/main/js/helpers/measures.js | 19 ----- .../resources/org/sonar/l10n/core.properties | 15 ++-- 19 files changed, 61 insertions(+), 278 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/code/components/App.js b/server/sonar-web/src/main/js/apps/code/components/App.js index 86563c2875f..7dc6b7158b3 100644 --- a/server/sonar-web/src/main/js/apps/code/components/App.js +++ b/server/sonar-web/src/main/js/apps/code/components/App.js @@ -27,7 +27,6 @@ import Search from './Search'; import ListFooter from '../../../components/controls/ListFooter'; import { retrieveComponentChildren, retrieveComponent, loadMoreChildren, parseError } from '../utils'; import { addComponent, addComponentBreadcrumbs } from '../bucket'; -import { selectCoverageMetric } from '../../../helpers/measures'; import '../code.css'; @@ -70,8 +69,6 @@ export default class App extends React.Component { const isView = component.qualifier === 'VW' || component.qualifier === 'SVW'; retrieveComponentChildren(component.key, isView).then(r => { addComponent(r.baseComponent); - const prefix = selectCoverageMetric(r.baseComponent.measures); - this.coverageMetric = `${prefix}coverage`; this.handleUpdate(); }).catch(e => { if (this.mounted) { @@ -192,8 +189,7 @@ export default class App extends React.Component { + components={components}/> )} diff --git a/server/sonar-web/src/main/js/apps/code/components/Component.js b/server/sonar-web/src/main/js/apps/code/components/Component.js index 11b975c81c2..14386f2b2f5 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Component.js +++ b/server/sonar-web/src/main/js/apps/code/components/Component.js @@ -66,7 +66,7 @@ export default class Component extends React.Component { } render () { - const { component, rootComponent, selected, previous, coverageMetric, canBrowse } = this.props; + const { component, rootComponent, selected, previous, canBrowse } = this.props; const isView = ['VW', 'SVW'].includes(rootComponent.qualifier); let componentAction = null; @@ -93,7 +93,7 @@ export default class Component extends React.Component { { metric: 'bugs', type: 'SHORT_INT' }, { metric: 'vulnerabilities', type: 'SHORT_INT' }, { metric: 'code_smells', type: 'SHORT_INT' }, - { metric: coverageMetric, type: 'PERCENT' }, + { metric: 'coverage', type: 'PERCENT' }, { metric: 'duplicated_lines_density', type: 'PERCENT' } ]; diff --git a/server/sonar-web/src/main/js/apps/code/components/Components.js b/server/sonar-web/src/main/js/apps/code/components/Components.js index dc5a3da84e8..902ccccd345 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Components.js +++ b/server/sonar-web/src/main/js/apps/code/components/Components.js @@ -23,7 +23,7 @@ import Component from './Component'; import ComponentsEmpty from './ComponentsEmpty'; import ComponentsHeader from './ComponentsHeader'; -const Components = ({ rootComponent, baseComponent, components, selected, coverageMetric }) => ( +const Components = ({ rootComponent, baseComponent, components, selected }) => ( {baseComponent && ( @@ -31,8 +31,7 @@ const Components = ({ rootComponent, baseComponent, components, selected, covera + component={baseComponent}/> @@ -47,7 +46,6 @@ const Components = ({ rootComponent, baseComponent, components, selected, covera component={component} selected={component === selected} previous={index > 0 ? list[index - 1] : null} - coverageMetric={coverageMetric} canBrowse={true}/> )) ) : ( diff --git a/server/sonar-web/src/main/js/apps/code/utils.js b/server/sonar-web/src/main/js/apps/code/utils.js index 80788455d4f..72c1f58425d 100644 --- a/server/sonar-web/src/main/js/apps/code/utils.js +++ b/server/sonar-web/src/main/js/apps/code/utils.js @@ -35,17 +35,11 @@ const METRICS = [ 'code_smells', 'bugs', 'vulnerabilities', + 'coverage', 'duplicated_lines_density', 'alert_status' ]; -const METRICS_WITH_COVERAGE = [ - ...METRICS, - 'coverage', - 'it_coverage', - 'overall_coverage' -]; - const VIEW_METRICS = [ 'releasability_rating', 'alert_status', @@ -117,7 +111,7 @@ function storeChildrenBreadcrumbs (parentComponentKey, children) { } function getMetrics (isView) { - return isView ? VIEW_METRICS : METRICS_WITH_COVERAGE; + return isView ? VIEW_METRICS : METRICS; } /** diff --git a/server/sonar-web/src/main/js/apps/component-measures/config/complementary.js b/server/sonar-web/src/main/js/apps/component-measures/config/complementary.js index b33de901b5f..67628c7e96e 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/config/complementary.js +++ b/server/sonar-web/src/main/js/apps/component-measures/config/complementary.js @@ -18,18 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ export default { - 'overall_coverage': ['overall_uncovered_lines', 'overall_uncovered_conditions'], - 'overall_line_coverage': ['overall_uncovered_lines'], - 'overall_branch_coverage': ['overall_uncovered_conditions'], - 'overall_uncovered_lines': ['overall_line_coverage'], - 'overall_uncovered_conditions': ['overall_branch_coverage'], - - 'new_overall_coverage': ['new_overall_uncovered_lines', 'new_overall_uncovered_conditions'], - 'new_overall_line_coverage': ['new_overall_uncovered_lines'], - 'new_overall_branch_coverage': ['new_overall_uncovered_conditions'], - 'new_overall_uncovered_lines': ['new_overall_line_coverage'], - 'new_overall_uncovered_conditions': ['new_overall_branch_coverage'], - 'coverage': ['uncovered_lines', 'uncovered_conditions'], 'line_coverage': ['uncovered_lines'], 'branch_coverage': ['uncovered_conditions'], @@ -42,18 +30,6 @@ export default { 'new_uncovered_lines': ['new_line_coverage'], 'new_uncovered_conditions': ['new_branch_coverage'], - 'it_coverage': ['it_uncovered_lines', 'it_uncovered_conditions'], - 'it_line_coverage': ['it_uncovered_lines'], - 'it_branch_coverage': ['it_uncovered_conditions'], - 'it_uncovered_lines': ['it_line_coverage'], - 'it_uncovered_conditions': ['it_branch_coverage'], - - 'new_it_coverage': ['new_it_uncovered_lines', 'new_it_uncovered_conditions'], - 'new_it_line_coverage': ['new_it_uncovered_lines'], - 'new_it_branch_coverage': ['new_it_uncovered_conditions'], - 'new_it_uncovered_lines': ['new_it_line_coverage'], - 'new_it_uncovered_conditions': ['new_it_branch_coverage'], - 'duplicated_lines_density': ['duplicated_lines'], 'new_duplicated_lines_density': ['new_duplicated_lines'], 'duplicated_lines': ['duplicated_lines_density'], diff --git a/server/sonar-web/src/main/js/apps/component-measures/config/domains.js b/server/sonar-web/src/main/js/apps/component-measures/config/domains.js index 2c810ad9989..80a231995ec 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/config/domains.js +++ b/server/sonar-web/src/main/js/apps/component-measures/config/domains.js @@ -68,27 +68,11 @@ export const domains = { 'Coverage': { main: [ - 'overall_coverage', 'coverage', - 'it_coverage', - 'new_overall_coverage', 'new_coverage', - 'new_it_coverage', 'tests' ], order: [ - 'overall_coverage', - 'new_overall_coverage', - 'overall_line_coverage', - 'new_overall_line_coverage', - 'overall_branch_coverage', - 'new_overall_branch_coverage', - 'overall_uncovered_lines', - 'new_overall_uncovered_lines', - 'overall_uncovered_conditions', - 'new_overall_uncovered_conditions', - 'new_overall_lines_to_cover', - 'coverage', 'new_coverage', 'line_coverage', @@ -101,18 +85,6 @@ export const domains = { 'new_uncovered_conditions', 'new_lines_to_cover', - 'it_coverage', - 'new_it_coverage', - 'it_line_coverage', - 'new_it_line_coverage', - 'it_branch_coverage', - 'new_it_branch_coverage', - 'it_uncovered_lines', - 'new_it_uncovered_lines', - 'it_uncovered_conditions', - 'new_it_uncovered_conditions', - 'new_it_lines_to_cover', - 'lines_to_cover', 'tests', @@ -122,11 +94,6 @@ export const domains = { 'skipped_tests', 'test_success_density', 'test_execution_time' - ], - spaces: [ - 'coverage', - 'it_coverage', - 'tests' ] }, diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js b/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js index 921a24f9f03..ce240293f58 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js @@ -33,26 +33,6 @@ function sortMeasures (measures, order) { ]; } -function filterCoverageMeasures (measures) { - const hasOverallCoverage = !!measures.find(measure => measure.metric.key === 'overall_coverage'); - const hasUTCoverage = !!measures.find(measure => measure.metric.key === 'coverage'); - const hasITCoverage = !!measures.find(measure => measure.metric.key === 'it_coverage'); - - // display overall coverage only if all types of coverage exist - const shouldShowOverallCoverage = hasOverallCoverage && hasUTCoverage && hasITCoverage; - - // skip if we should display overall coverage - if (shouldShowOverallCoverage) { - return measures; - } - - // otherwise, hide all overall coverage measures - return measures.filter(measure => { - return measure.metric.key.indexOf('overall_') !== 0 && - measure.metric.key.indexOf('new_overall_') !== 0; - }); -} - function filterIssuesMeasures (measures) { const BANNED_MEASURES = [ 'blocker_violations', @@ -73,7 +53,7 @@ const HomeMeasuresList = ({ domain, component }) => { const { measures, name } = domain; const config = domains[name] || {}; - const filteredMeasures = filterCoverageMeasures(filterIssuesMeasures(measures)); + const filteredMeasures = filterIssuesMeasures(measures); const configMain = config.main || []; const [mainMeasures, otherMeasures] = partition(filteredMeasures, measure => configMain.includes(measure.metric.key)); diff --git a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js index 2c65059b388..a2791781168 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js +++ b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js @@ -57,15 +57,9 @@ const METRICS = [ 'new_technical_debt', // coverage - 'overall_coverage', - 'new_overall_coverage', 'coverage', 'new_coverage', - 'it_coverage', - 'new_it_coverage', 'new_lines_to_cover', - 'new_it_lines_to_cover', - 'new_overall_lines_to_cover', 'tests', // duplications @@ -83,8 +77,6 @@ const HISTORY_METRICS_LIST = [ 'sqale_index', 'duplicated_lines_density', 'ncloc', - 'overall_coverage', - 'it_coverage', 'coverage' ]; diff --git a/server/sonar-web/src/main/js/apps/overview/main/Coverage.js b/server/sonar-web/src/main/js/apps/overview/main/Coverage.js index 1a6aaaee7d5..bfa8c94a754 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/Coverage.js +++ b/server/sonar-web/src/main/js/apps/overview/main/Coverage.js @@ -26,41 +26,20 @@ import { formatMeasure, getPeriodValue } from '../../../helpers/measures'; import { translate } from '../../../helpers/l10n'; class Coverage extends React.Component { - getCoverageMetricPrefix () { + getCoverage () { const { measures } = this.props; - const hasOverallCoverage = !!measures - .find(measure => measure.metric.key === 'overall_coverage'); - const hasUTCoverage = !!measures - .find(measure => measure.metric.key === 'coverage'); - const hasITCoverage = !!measures - .find(measure => measure.metric.key === 'it_coverage'); - - if (hasOverallCoverage && hasUTCoverage && hasITCoverage) { - return 'overall_'; - } else if (hasITCoverage) { - return 'it_'; - } else { - return ''; - } - } - - getCoverage (prefix) { - const { measures } = this.props; - const { value } = measures - .find(measure => measure.metric.key === `${prefix}coverage`); + const { value } = measures.find(measure => measure.metric.key === 'coverage'); return Number(value); } - getNewCoverageMeasure (prefix) { + getNewCoverageMeasure () { const { measures } = this.props; - return measures - .find(measure => measure.metric.key === `new_${prefix}coverage`); + return measures.find(measure => measure.metric.key === 'new_coverage'); } - getNewLinesToCover (prefix) { + getNewLinesToCover () { const { measures } = this.props; - return measures - .find(measure => measure.metric.key === `new_${prefix}lines_to_cover`); + return measures.find(measure => measure.metric.key === 'new_lines_to_cover'); } renderHeader () { @@ -69,9 +48,8 @@ class Coverage extends React.Component { translate('metric.coverage.name')); } - renderTimeline (coverageMetricPrefix, range) { - const metricKey = `${coverageMetricPrefix}coverage`; - return this.props.renderTimeline(metricKey, range); + renderTimeline (range) { + return this.props.renderTimeline('coverage', range); } renderTests () { @@ -86,10 +64,10 @@ class Coverage extends React.Component { return this.props.renderDonut(data); } - renderCoverage (coverageMetricPrefix) { + renderCoverage () { const { component } = this.props; - const metric = `${coverageMetricPrefix}coverage`; - const coverage = this.getCoverage(coverageMetricPrefix); + const metric = 'coverage'; + const coverage = this.getCoverage(); return (
@@ -112,10 +90,10 @@ class Coverage extends React.Component { ); } - renderNewCoverage (coverageMetricPrefix) { + renderNewCoverage () { const { component, leakPeriod } = this.props; - const newCoverageMeasure = this.getNewCoverageMeasure(coverageMetricPrefix); - const newLinesToCover = this.getNewLinesToCover(coverageMetricPrefix); + const newCoverageMeasure = this.getNewCoverageMeasure(); + const newLinesToCover = this.getNewLinesToCover(); const newCoverageValue = newCoverageMeasure ? getPeriodValue(newCoverageMeasure, leakPeriod.index) : null; @@ -168,20 +146,20 @@ class Coverage extends React.Component { ); } - renderNutshell (coverageMetricPrefix) { + renderNutshell () { return (
- {this.renderCoverage(coverageMetricPrefix)} + {this.renderCoverage()} {this.renderTests()}
- {this.renderTimeline(coverageMetricPrefix, 'before')} + {this.renderTimeline('before')}
); } - renderLeak (coverageMetricPrefix) { + renderLeak () { const { leakPeriod } = this.props; if (leakPeriod == null) { @@ -191,19 +169,17 @@ class Coverage extends React.Component { return (
- {this.renderNewCoverage(coverageMetricPrefix)} + {this.renderNewCoverage()}
- {this.renderTimeline(coverageMetricPrefix, 'after')} + {this.renderTimeline('after')}
); } render () { const { measures } = this.props; - const coverageMetricPrefix = this.getCoverageMetricPrefix(); - const coverageMeasure = - measures.find(measure => measure.metric.key === `${coverageMetricPrefix}coverage`); + const coverageMeasure = measures.find(measure => measure.metric.key === 'coverage'); if (coverageMeasure == null) { return null; @@ -214,8 +190,8 @@ class Coverage extends React.Component { {this.renderHeader()}
- {this.renderNutshell(coverageMetricPrefix)} - {this.renderLeak(coverageMetricPrefix)} + {this.renderNutshell()} + {this.renderLeak()}
); 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 ca259f91d35..f1bdef0ea56 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 @@ -184,29 +184,15 @@ export default Marionette.LayoutView.extend({ return { from: 1, to: this.LINES_AROUND }; }, - getUTCoverageStatus (row) { + getCoverageStatus (row) { let status = null; - if (row.utLineHits > 0) { + if (row.lineHits > 0) { status = 'partially-covered'; } - if (row.utLineHits > 0 && row.utConditions === row.utCoveredConditions) { + if (row.lineHits > 0 && row.conditions === row.coveredConditions) { status = 'covered'; } - if (row.utLineHits === 0 || row.utCoveredConditions === 0) { - status = 'uncovered'; - } - return status; - }, - - getItCoverageStatus (row) { - let status = null; - if (row.itLineHits > 0) { - status = 'partially-covered'; - } - if (row.itLineHits > 0 && row.itConditions === row.itCoveredConditions) { - status = 'covered'; - } - if (row.itLineHits === 0 || row.itCoveredConditions === 0) { + if (row.lineHits === 0 || row.coveredConditions === 0) { status = 'uncovered'; } return status; @@ -230,16 +216,14 @@ export default Marionette.LayoutView.extend({ } source = source.map(function (row) { return _.extend(row, { - utCoverageStatus: that.getUTCoverageStatus(row), - itCoverageStatus: that.getItCoverageStatus(row) + coverageStatus: that.getCoverageStatus(row), }); }); const firstLine = _.first(source).line; const linesRequested = data.to - data.from + 1; that.model.set({ source, - hasUTCoverage: that.model.hasUTCoverage(source), - hasITCoverage: that.model.hasITCoverage(source), + hasCoverage: that.model.hasCoverage(source), hasSourceBefore: firstLine > 1, hasSourceAfter: data.sources.length === linesRequested }); @@ -445,7 +429,6 @@ export default Marionette.LayoutView.extend({ const popup = new CoveragePopupView({ row, collection: new Backbone.Collection(data.tests), - tests: $(e.currentTarget).data('tests'), triggerEl: $(e.currentTarget) }); popup.render(); @@ -634,14 +617,12 @@ export default Marionette.LayoutView.extend({ } source = source.map(function (row) { return _.extend(row, { - utCoverageStatus: that.getUTCoverageStatus(row), - itCoverageStatus: that.getItCoverageStatus(row) + coverageStatus: that.getCoverageStatus(row) }); }); that.model.set({ source, - hasUTCoverage: that.model.hasUTCoverage(source), - hasITCoverage: that.model.hasITCoverage(source), + hasCoverage: that.model.hasCoverage(source), hasSourceBefore: (data.sources.length === that.LINES_AROUND) && (_.first(source).line > 0) }); that.addIssuesPerLineMeta(that.issues); @@ -680,14 +661,12 @@ export default Marionette.LayoutView.extend({ } source = source.map(function (row) { return _.extend(row, { - utCoverageStatus: that.getUTCoverageStatus(row), - itCoverageStatus: that.getItCoverageStatus(row) + coverageStatus: that.getCoverageStatus(row) }); }); that.model.set({ source, - hasUTCoverage: that.model.hasUTCoverage(source), - hasITCoverage: that.model.hasITCoverage(source), + hasCoverage: that.model.hasCoverage(source), hasSourceAfter: data.sources.length === that.LINES_AROUND }); that.addIssuesPerLineMeta(that.issues); 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 1442ac49793..aaf665a5271 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 @@ -131,12 +131,6 @@ export default ModalView.extend({ if (measures.conditions_to_cover && measures.uncovered_conditions) { measures.covered_conditions = measures.conditions_to_cover - measures.uncovered_conditions; } - if (measures.it_lines_to_cover && measures.it_uncovered_lines) { - measures.it_covered_lines = measures.it_lines_to_cover - measures.it_uncovered_lines; - } - if (measures.it_conditions_to_cover && measures.it_uncovered_conditions) { - measures.it_covered_conditions = measures.it_conditions_to_cover - measures.it_uncovered_conditions; - } return measures; }, diff --git a/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js b/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js index 891ebca66e6..4f1918625eb 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js +++ b/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js @@ -54,16 +54,7 @@ export default Popup.extend({ tests: testSet }; }); - _.extend(row, { - lineHits: row[this.options.tests + 'LineHits'], - conditions: row[this.options.tests + 'Conditions'], - coveredConditions: row[this.options.tests + 'CoveredConditions'] - }); - return { - testFiles, - row, - tests: this.options.tests - }; + return { testFiles, row }; } }); diff --git a/server/sonar-web/src/main/js/components/source-viewer/source.js b/server/sonar-web/src/main/js/components/source-viewer/source.js index 189c093f779..8a085468bb4 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/source.js +++ b/server/sonar-web/src/main/js/components/source-viewer/source.js @@ -29,7 +29,6 @@ export default Backbone.Model.extend({ hasSource: false, hasCoverage: false, - hasITCoverage: false, hasDuplications: false, hasSCM: false, @@ -94,15 +93,9 @@ export default Backbone.Model.extend({ this.set({ hasDuplications }); }, - hasUTCoverage (source) { + hasCoverage (source) { return _.some(source, function (line) { - return line.utCoverageStatus != null; - }); - }, - - hasITCoverage (source) { - return _.some(source, function (line) { - return line.itCoverageStatus != null; + return line.coverageStatus != null; }); } }); diff --git a/server/sonar-web/src/main/js/components/source-viewer/templates/measures/_source-viewer-measures-coverage.hbs b/server/sonar-web/src/main/js/components/source-viewer/templates/measures/_source-viewer-measures-coverage.hbs index 026a3de5310..7258237382a 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/templates/measures/_source-viewer-measures-coverage.hbs +++ b/server/sonar-web/src/main/js/components/source-viewer/templates/measures/_source-viewer-measures-coverage.hbs @@ -1,15 +1,15 @@ -{{#any measures.coverage measures.it_coverage}} +{{#if measures.coverage}}
- {{default measures.overall_coverage measures.coverage measures.it_coverage}} + {{measures.coverage}} {{t 'metric.coverage.name'}}
@@ -18,7 +18,7 @@
- Covered by Unit Tests + Covered by Tests
Lines @@ -33,24 +33,4 @@
{{/any}} - - {{#any measures.it_covered_lines measures.it_lines_to_cover measures.it_covered_conditions measures.it_conditions_to_cover}} -
-
-
- Covered by Integration Tests -
-
- Lines - {{measures.it_uncovered_lines}}/{{measures.it_lines_to_cover}} -
- {{#if measures.it_conditions_to_cover}} -
- Conditions - {{default measures.it_uncovered_conditions 0}}/{{measures.it_conditions_to_cover}} -
- {{/if}} -
-
- {{/any}} -{{/any}} +{{/if}} diff --git a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-coverage-popup.hbs b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-coverage-popup.hbs index 9906d547398..a0e7b62896e 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-coverage-popup.hbs +++ b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-coverage-popup.hbs @@ -1,12 +1,12 @@
{{#if row.lineHits}} - {{t 'source_viewer' tests 'covered'}} + {{t 'source_viewer.covered'}} {{#if row.conditions}} ({{default row.coveredConditions 0}} of {{row.conditions}} {{t 'source_viewer.conditions'}}) {{/if}} {{else}} - {{t 'source_viewer' tests 'not_covered'}} + {{t 'source_viewer.not_covered'}} {{#if row.conditions}} ({{row.conditions}} {{t 'source_viewer.conditions'}}) {{/if}} diff --git a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-measures.hbs b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-measures.hbs index a9dff3243e6..272abb83209 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-measures.hbs +++ b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-measures.hbs @@ -31,13 +31,13 @@ {{> 'measures/_source-viewer-measures-issues'}}
- {{#any measures.coverage measures.it_coverage}} + {{#if measures.coverage}}
{{> 'measures/_source-viewer-measures-coverage'}}
- {{/any}} + {{/if}}
{{> 'measures/_source-viewer-measures-duplications'}} diff --git a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer.hbs b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer.hbs index 15b73888633..ede6aeddde8 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer.hbs +++ b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer.hbs @@ -27,18 +27,9 @@ {{/ifSCMChanged2}} - {{#if ../hasUTCoverage}} -
- {{/if}} - - {{#if ../hasITCoverage}} - {{/if}} diff --git a/server/sonar-web/src/main/js/helpers/measures.js b/server/sonar-web/src/main/js/helpers/measures.js index 8473c9e49ed..14cbd630c3a 100644 --- a/server/sonar-web/src/main/js/helpers/measures.js +++ b/server/sonar-web/src/main/js/helpers/measures.js @@ -113,25 +113,6 @@ export function isDiffMetric (metricKey) { return metricKey.indexOf('new_') === 0; } -/** - * Check all types of coverage and return most suitable one - * @param {Array} measures - * @returns {string} - */ -export function selectCoverageMetric (measures) { - const hasOverallCoverage = !!measures.find(measure => measure.metric === 'overall_coverage'); - const hasUTCoverage = !!measures.find(measure => measure.metric === 'coverage'); - const hasITCoverage = !!measures.find(measure => measure.metric === 'it_coverage'); - - if (hasOverallCoverage && hasUTCoverage && hasITCoverage) { - return 'overall_'; - } else if (hasITCoverage) { - return 'it_'; - } else { - return ''; - } -} - /* * Helpers */ diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 1a5e2becb1a..5dde6db0920 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -2908,20 +2908,15 @@ component_viewer.workspace.tooltip=Keeps track of history of navigation component_viewer.workspace.show_workspace=Show workspace component_viewer.workspace.hide_workspace=Hide workspace -source_viewer.ut.covered=Covered by tests -source_viewer.ut.not_covered=Not covered by tests -source_viewer.it.covered=Covered by integration tests -source_viewer.it.not_covered=Not covered by integration tests +source_viewer.covered=Covered by tests +source_viewer.not_covered=Not covered by tests source_viewer.conditions=conditions source_viewer.tooltip.duplicated_line=This line is duplicated. Click to see duplicated blocks. source_viewer.tooltip.duplicated_block=Duplicated block. Click for details. -source_viewer.tooltip.ut.covered=Fully covered by tests. Click for details. -source_viewer.tooltip.ut.partially-covered=Partially covered by tests. Click for details. -source_viewer.tooltip.ut.uncovered=Not covered by tests. -source_viewer.tooltip.it.covered=Fully covered by integration tests. Click for details. -source_viewer.tooltip.it.partially-covered=Partially covered by integration tests. Click for details. -source_viewer.tooltip.it.uncovered=Not covered by integration tests. +source_viewer.tooltip.covered=Fully covered by tests. Click for details. +source_viewer.tooltip.partially-covered=Partially covered by tests. Click for details. +source_viewer.tooltip.uncovered=Not covered by tests. source_viewer.tooltip.new_code=New {0}. source_viewer.load_more_code=Load More Code -- 2.39.5
 
-
-
+ {{#if ../hasCoverage}} +