diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-12-08 16:48:52 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-12-08 16:48:52 +0100 |
commit | 201847de4d282acafd5fb8c969f077d713d1bdf1 (patch) | |
tree | 2ee51f526ed63d2620a7b8faef8fac69b74da0fc /server/sonar-web/src/main/js/apps/overview | |
parent | 34b14e12bebafed93d21ac620e7b2b5dc3ef7d55 (diff) | |
download | sonarqube-201847de4d282acafd5fb8c969f077d713d1bdf1.tar.gz sonarqube-201847de4d282acafd5fb8c969f077d713d1bdf1.zip |
improve code quality
Diffstat (limited to 'server/sonar-web/src/main/js/apps/overview')
15 files changed, 112 insertions, 76 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/components/complexity-distribution.js b/server/sonar-web/src/main/js/apps/overview/components/complexity-distribution.js index a32a6cca4c3..7a674fa99e2 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/complexity-distribution.js +++ b/server/sonar-web/src/main/js/apps/overview/components/complexity-distribution.js @@ -15,9 +15,9 @@ export const ComplexityDistribution = React.createClass({ renderBarChart () { let data = this.props.distribution.split(';').map((point, index) => { - let tokens = point.split('='), - y = parseInt(tokens[1], 10), - value = parseInt(tokens[0], 10); + let tokens = point.split('='); + let y = parseInt(tokens[1], 10); + let value = parseInt(tokens[0], 10); return { x: index, y: y, diff --git a/server/sonar-web/src/main/js/apps/overview/components/coverage-measures-list.js b/server/sonar-web/src/main/js/apps/overview/components/coverage-measures-list.js index 96520d0ffda..61e0e8898d5 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/coverage-measures-list.js +++ b/server/sonar-web/src/main/js/apps/overview/components/coverage-measures-list.js @@ -55,7 +55,7 @@ export const CoverageMeasuresList = React.createClass({ metrics = metrics.map(metric => { return <DetailedMeasure key={metric.key} - {...this.props} + {...this.props} {...this.props} metric={metric.key} type={metric.type}/>; diff --git a/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js b/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js index ffda795363a..7020ef962bb 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js +++ b/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js @@ -73,6 +73,7 @@ export class DomainBubbleChart extends React.Component { let sizeMetricsTitle = this.getSizeMetricsTitle(); let sizeMetricsType = this.state.sizeMetrics[0].type; + /* eslint max-len: 0 */ let inner = [ component.name, `${this.state.xMetric.name}: ${formatMeasure(getMeasure(component, this.props.xMetric), this.state.xMetric.type)}`, diff --git a/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js b/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js index 7275a408e0b..25db1cddea3 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js +++ b/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js @@ -68,8 +68,8 @@ export const DomainTimeline = React.createClass({ }, handleMetricChange (selected) { - let newMetric = selected.value, - comparisonMetric = this.state.comparisonMetric; + let newMetric = selected.value; + let comparisonMetric = this.state.comparisonMetric; if (newMetric === comparisonMetric) { comparisonMetric = ''; } diff --git a/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js b/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js index d2db3d954d4..033a791ead4 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js +++ b/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js @@ -54,8 +54,8 @@ export class DomainTreemap extends React.Component { ${formatMeasure(component.measures[this.props.sizeMetric], this.state.sizeMetric.type)}` ]; if (this.state.colorMetric) { - let measure = component.measures[this.props.colorMetric], - formatted = measure != null ? formatMeasure(measure, this.state.colorMetric.type) : '—'; + let measure = component.measures[this.props.colorMetric]; + let formatted = measure != null ? formatMeasure(measure, this.state.colorMetric.type) : '—'; inner.push(`${this.state.colorMetric.name}: ${formatted}`); } inner = inner.join('<br>'); diff --git a/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js index 5edafc83856..0b751209e84 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js @@ -94,8 +94,8 @@ export const CoverageMain = React.createClass({ .domain([0, 25, 50, 75, 100]) .range(CHART_REVERSED_COLORS_RANGE_PERCENT); - let coverageMetric = this.state.coverageMetricPrefix + 'coverage', - uncoveredLinesMetric = this.state.coverageMetricPrefix + 'uncovered_lines'; + let coverageMetric = this.state.coverageMetricPrefix + 'coverage'; + let uncoveredLinesMetric = this.state.coverageMetricPrefix + 'uncovered_lines'; if (this.state.measures[coverageMetric] == null) { return this.renderEmpty(); diff --git a/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js index 7527c23c18e..4ee8ce45476 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js @@ -11,7 +11,10 @@ import { getPeriodLabel, getPeriodDate } from './../helpers/periods'; import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin'; import { filterMetrics, filterMetricsForDomains } from '../helpers/metrics'; import { CHART_COLORS_RANGE_PERCENT } from '../../../helpers/constants'; -import { AddedRemovedMeasure, AddedRemovedDebt, OnNewCodeMeasure, SeverityMeasure } from './../components/issue-measure'; +import { AddedRemovedMeasure, + AddedRemovedDebt, + OnNewCodeMeasure, + SeverityMeasure } from './../components/issue-measure'; import { IssuesTags } from './../components/issues-tags'; import Assignees from './../components/issues-assignees'; import { getFacet, extractAssignees } from '../../../api/issues'; diff --git a/server/sonar-web/src/main/js/apps/overview/gate/gate-condition.js b/server/sonar-web/src/main/js/apps/overview/gate/gate-condition.js index 6d88348ed1a..c688d959d68 100644 --- a/server/sonar-web/src/main/js/apps/overview/gate/gate-condition.js +++ b/server/sonar-web/src/main/js/apps/overview/gate/gate-condition.js @@ -18,12 +18,12 @@ const Measure = React.createClass({ export default React.createClass({ render() { - let metricName = window.t('metric', this.props.condition.metric.name, 'name'), - threshold = this.props.condition.level === 'ERROR' ? - this.props.condition.error : this.props.condition.warning, - period = this.props.condition.period ? - getPeriodLabel(this.props.component.periods, this.props.condition.period) : null, - periodDate = getPeriodDate(this.props.component.periods, this.props.condition.period); + let metricName = window.t('metric', this.props.condition.metric.name, 'name'); + let threshold = this.props.condition.level === 'ERROR' ? + this.props.condition.error : this.props.condition.warning; + let period = this.props.condition.period ? + getPeriodLabel(this.props.component.periods, this.props.condition.period) : null; + let periodDate = getPeriodDate(this.props.component.periods, this.props.condition.period); let classes = 'alert_' + this.props.condition.level.toUpperCase(); @@ -43,7 +43,11 @@ export default React.createClass({ <div className="overview-gate-condition-metric"> <div>{metricName}</div> - <div>{window.t('quality_gates.operator', this.props.condition.op, 'short')} <Measure value={threshold} type={this.props.condition.metric.type}/></div> + <div> + {window.t('quality_gates.operator', this.props.condition.op, 'short')} + {' '} + <Measure value={threshold} type={this.props.condition.metric.type}/> + </div> </div> </div> </li> diff --git a/server/sonar-web/src/main/js/apps/overview/gate/gate.js b/server/sonar-web/src/main/js/apps/overview/gate/gate.js index 05ebfda1892..3f78fe08dba 100644 --- a/server/sonar-web/src/main/js/apps/overview/gate/gate.js +++ b/server/sonar-web/src/main/js/apps/overview/gate/gate.js @@ -26,9 +26,9 @@ export default React.createClass({ return this.props.component.qualifier === 'TRK' ? <GateEmpty/> : null; } - let level = this.props.gate.level.toLowerCase(), - badgeClassName = 'badge badge-' + level, - badgeText = window.t('overview.gate', this.props.gate.level); + let level = this.props.gate.level.toLowerCase(); + let badgeClassName = 'badge badge-' + level; + let badgeText = window.t('overview.gate', this.props.gate.level); return ( <div className="overview-gate"> diff --git a/server/sonar-web/src/main/js/apps/overview/main/components.js b/server/sonar-web/src/main/js/apps/overview/main/components.js index e4207753ee2..0344e9f60c8 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/components.js +++ b/server/sonar-web/src/main/js/apps/overview/main/components.js @@ -137,8 +137,8 @@ export const Measure = React.createClass({ export const DomainMixin = { renderTimelineStartDate() { - let momentDate = moment(this.props.historyStartDate), - fromNow = momentDate.fromNow(); + let momentDate = moment(this.props.historyStartDate); + let fromNow = momentDate.fromNow(); return <span className="overview-domain-timeline-date">{window.tp('overview.started_x', fromNow)}</span>; }, 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 36168a35b5f..07aaff0c383 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 @@ -1,6 +1,13 @@ import React from 'react'; -import { Domain, DomainHeader, DomainPanel, DomainNutshell, DomainLeak, MeasuresList, Measure, DomainMixin } from './components'; +import { Domain, + DomainHeader, + DomainPanel, + DomainNutshell, + DomainLeak, + MeasuresList, + Measure, + DomainMixin } from './components'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin'; import { DonutChart } from '../../../components/charts/donut-chart'; diff --git a/server/sonar-web/src/main/js/apps/overview/main/duplications.js b/server/sonar-web/src/main/js/apps/overview/main/duplications.js index eb08696c9bc..64cafcf8932 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/duplications.js +++ b/server/sonar-web/src/main/js/apps/overview/main/duplications.js @@ -1,6 +1,13 @@ import React from 'react'; -import { Domain, DomainHeader, DomainPanel, DomainNutshell, DomainLeak, MeasuresList, Measure, DomainMixin } from './components'; +import { Domain, + DomainHeader, + DomainPanel, + DomainNutshell, + DomainLeak, + MeasuresList, + Measure, + DomainMixin } from './components'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin'; import { DonutChart } from '../../../components/charts/donut-chart'; @@ -20,8 +27,8 @@ export const GeneralDuplications = React.createClass({ if (!this.hasLeakPeriod()) { return null; } - let measure = this.props.leak['duplicated_lines_density'], - formatted = measure != null ? formatMeasureVariation(measure, 'PERCENT') : '—'; + let measure = this.props.leak['duplicated_lines_density']; + let formatted = measure != null ? formatMeasureVariation(measure, 'PERCENT') : '—'; return <DomainLeak> <MeasuresList> <Measure label={getMetricName('duplications')}> diff --git a/server/sonar-web/src/main/js/apps/overview/main/issues.js b/server/sonar-web/src/main/js/apps/overview/main/issues.js index 9993f49c720..86a145596e2 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/issues.js +++ b/server/sonar-web/src/main/js/apps/overview/main/issues.js @@ -1,7 +1,14 @@ import moment from 'moment'; import React from 'react'; -import { Domain, DomainHeader, DomainPanel, DomainNutshell, DomainLeak, MeasuresList, Measure, DomainMixin } from './components'; +import { Domain, + DomainHeader, + DomainPanel, + DomainNutshell, + DomainLeak, + MeasuresList, + Measure, + DomainMixin } from './components'; import { Rating } from './../../../components/shared/rating'; import { IssuesLink } from '../../../components/shared/issues-link'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; diff --git a/server/sonar-web/src/main/js/apps/overview/main/size.js b/server/sonar-web/src/main/js/apps/overview/main/size.js index 683d23f5270..d1138a87f13 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/size.js +++ b/server/sonar-web/src/main/js/apps/overview/main/size.js @@ -1,6 +1,13 @@ import React from 'react'; -import { Domain, DomainHeader, DomainPanel, DomainNutshell, DomainLeak, MeasuresList, Measure, DomainMixin } from './components'; +import { Domain, + DomainHeader, + DomainPanel, + DomainNutshell, + DomainLeak, + MeasuresList, + Measure, + DomainMixin } from './components'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin'; import { getMetricName } from '../helpers/metrics'; @@ -20,8 +27,8 @@ export const GeneralSize = React.createClass({ if (!this.hasLeakPeriod()) { return null; } - let measure = this.props.leak['ncloc'], - formatted = measure != null ? formatMeasureVariation(measure, 'SHORT_INT') : '—'; + let measure = this.props.leak['ncloc']; + let formatted = measure != null ? formatMeasureVariation(measure, 'SHORT_INT') : '—'; return <DomainLeak> <MeasuresList> <Measure label={getMetricName('ncloc')}>{formatted}</Measure> diff --git a/server/sonar-web/src/main/js/apps/overview/meta.js b/server/sonar-web/src/main/js/apps/overview/meta.js index 8228db26f34..80ef21d8a9e 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta.js +++ b/server/sonar-web/src/main/js/apps/overview/meta.js @@ -46,56 +46,56 @@ export default React.createClass({ render() { let profiles = (this.props.component.profiles || []).map(profile => { - return ( - <li key={profile.key}> - <span className="note spacer-right">({profile.language})</span> - <QualityProfileLink profile={profile.key}>{profile.name}</QualityProfileLink> - </li> - ); - }), - links = (this.props.component.links || []).map(link => { - let iconClassName = `spacer-right icon-color-link icon-${link.type}`; - return ( - <li key={link.type}> - <i className={iconClassName}/> - <a href={link.href} target="_blank">{link.name}</a> - </li> - ); - }); + return ( + <li key={profile.key}> + <span className="note spacer-right">({profile.language})</span> + <QualityProfileLink profile={profile.key}>{profile.name}</QualityProfileLink> + </li> + ); + }); + let links = (this.props.component.links || []).map(link => { + let iconClassName = `spacer-right icon-color-link icon-${link.type}`; + return ( + <li key={link.type}> + <i className={iconClassName}/> + <a href={link.href} target="_blank">{link.name}</a> + </li> + ); + }); let descriptionCard = this.props.component.description ? ( - <div className="overview-meta-card"> - <div className="overview-meta-description">{this.props.component.description}</div> - </div> - ) : null, + <div className="overview-meta-card"> + <div className="overview-meta-description">{this.props.component.description}</div> + </div> + ) : null; - linksCard = _.size(this.props.component.links) > 0 ? ( - <div className="overview-meta-card"> - <ul className="overview-meta-list">{links}</ul> - </div> - ) : null, + let linksCard = _.size(this.props.component.links) > 0 ? ( + <div className="overview-meta-card"> + <ul className="overview-meta-list">{links}</ul> + </div> + ) : null; - profilesCard = !this.isView() && !this.isDeveloper() && _.size(this.props.component.profiles) > 0 ? ( - <div className="overview-meta-card"> - <h4 className="overview-meta-header">{window.t('overview.quality_profiles')}</h4> - <ul className="overview-meta-list">{profiles}</ul> - </div> - ) : null, + let profilesCard = !this.isView() && !this.isDeveloper() && _.size(this.props.component.profiles) > 0 ? ( + <div className="overview-meta-card"> + <h4 className="overview-meta-header">{window.t('overview.quality_profiles')}</h4> + <ul className="overview-meta-list">{profiles}</ul> + </div> + ) : null; - gateCard = !this.isView() && !this.isDeveloper() && this.props.component.gate ? ( - <div className="overview-meta-card"> - <h4 className="overview-meta-header">{window.t('overview.quality_gate')}</h4> - <ul className="overview-meta-list"> - <li> - {this.props.component.gate.isDefault ? - <span className="note spacer-right">(Default)</span> : null} - <QualityGateLink gate={this.props.component.gate.key}> - {this.props.component.gate.name} - </QualityGateLink> - </li> - </ul> - </div> - ) : null; + let gateCard = !this.isView() && !this.isDeveloper() && this.props.component.gate ? ( + <div className="overview-meta-card"> + <h4 className="overview-meta-header">{window.t('overview.quality_gate')}</h4> + <ul className="overview-meta-list"> + <li> + {this.props.component.gate.isDefault ? + <span className="note spacer-right">(Default)</span> : null} + <QualityGateLink gate={this.props.component.gate.key}> + {this.props.component.gate.name} + </QualityGateLink> + </li> + </ul> + </div> + ) : null; return ( <div className="overview-meta"> |