Object {
"measures": Array [
Object {
- "leak": "0.0999999999999943",
+ "leak": "70",
"metric": Object {
"domain": "Coverage",
- "key": "coverage",
- "name": "Coverage",
- "type": "PERCENT",
+ "key": "lines_to_cover",
+ "name": "Lines to Cover",
+ "type": "INT",
},
"periods": Array [
Object {
"index": 1,
- "value": "0.0999999999999943",
+ "value": "70",
},
],
- "value": "99.3",
+ "value": "431",
},
Object {
- "leak": "70",
+ "leak": "0.0999999999999943",
"metric": Object {
"domain": "Coverage",
- "key": "lines_to_cover",
- "name": "Lines to Cover",
- "type": "INT",
+ "key": "coverage",
+ "name": "Coverage",
+ "type": "PERCENT",
},
"periods": Array [
Object {
"index": 1,
- "value": "70",
+ "value": "0.0999999999999943",
},
],
- "value": "431",
+ "value": "99.3",
},
],
"name": "Coverage",
"type": "INT",
},
},
+ "overall_category",
Object {
"metric": Object {
"key": "bugs",
{ metric: { key: 'reliability_remediation_effort', name: 'new_bugs', type: 'INT' } },
{ metric: { key: 'new_reliability_remediation_effort', name: 'bugs', type: 'INT' } },
{ metric: { key: 'new_bugs', name: 'new_bugs', type: 'INT' } },
- { metric: { key: 'bugs', name: 'bugs', type: 'INT' } }
+ { metric: { key: 'bugs', name: 'bugs', type: 'INT' } },
+ 'overall_category'
])
).toMatchSnapshot();
});
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// @flow
-export const domains = {
+export const domains /*: { [string]: { categories?: Array<string>, order: Array<string> } }*/ = {
Reliability: {
+ categories: ['new_code_category', 'overall_category'],
order: [
- 'new_reliability_rating',
+ 'new_code_category',
'new_bugs',
+ 'new_reliability_rating',
'new_reliability_remediation_effort',
- 'reliability_rating',
+ 'overall_category',
'bugs',
+ 'reliability_rating',
'reliability_remediation_effort'
]
},
Security: {
+ categories: ['new_code_category', 'overall_category'],
order: [
- 'new_security_rating',
+ 'new_code_category',
'new_vulnerabilities',
+ 'new_security_rating',
'new_security_remediation_effort',
- 'security_rating',
+ 'overall_category',
'vulnerabilities',
+ 'security_rating',
'security_remediation_effort'
]
},
Maintainability: {
+ categories: ['new_code_category', 'overall_category'],
order: [
+ 'new_code_category',
'new_code_smells',
- 'new_maintainability_rating',
'new_technical_debt',
'new_sqale_debt_ratio',
+ 'new_maintainability_rating',
+ 'overall_category',
'code_smells',
- 'sqale_rating',
'sqale_index',
'sqale_debt_ratio',
+ 'sqale_rating',
'effort_to_reach_maintainability_rating_a'
]
},
Coverage: {
+ categories: ['new_code_category', 'overall_category', 'tests_category'],
order: [
+ 'new_code_category',
'new_coverage',
- 'new_line_coverage',
- 'new_branch_coverage',
+ 'new_lines_to_cover',
'new_uncovered_lines',
+ 'new_line_coverage',
'new_uncovered_conditions',
- 'new_lines_to_cover',
+ 'new_branch_coverage',
+ 'overall_category',
'coverage',
- 'line_coverage',
- 'branch_coverage',
+ 'lines_to_cover',
'uncovered_lines',
+ 'line_coverage',
'uncovered_conditions',
- 'lines_to_cover',
+ 'branch_coverage',
+ 'tests_category',
'tests',
'test_success',
'test_errors',
},
Duplications: {
+ categories: ['new_code_category', 'overall_category'],
order: [
+ 'new_code_category',
'new_duplicated_lines_density',
- 'new_duplicated_blocks',
'new_duplicated_lines',
+ 'new_duplicated_blocks',
+ 'overall_category',
'duplicated_lines_density',
- 'duplicated_blocks',
'duplicated_lines',
+ 'duplicated_blocks',
'duplicated_files'
]
},
import FacetItem from '../../../components/facet/FacetItem';
import FacetItemsList from '../../../components/facet/FacetItemsList';
import FacetMeasureValue from './FacetMeasureValue';
-import IssueTypeIcon from '../../../components/ui/IssueTypeIcon';
-import Tooltip from '../../../components/controls/Tooltip';
-import { filterMeasures, hasBubbleChart, hasFacetStat, sortMeasures } from '../utils';
import {
+ addMeasureCategories,
+ filterMeasures,
+ hasBubbleChart,
+ hasFacetStat,
+ sortMeasures
+} from '../utils';
+import {
+ getLocalizedCategoryMetricName,
getLocalizedMetricDomain,
getLocalizedMetricName,
- translate,
- translateWithParameters
+ translate
} from '../../../helpers/l10n';
/*:: import type { MeasureEnhanced } from '../../../components/measure/types'; */
return measureSelected || overviewSelected;
};
+ renderItemsFacet = () => {
+ const { domain, selected } = this.props;
+ const items = addMeasureCategories(domain.name, filterMeasures(domain.measures));
+ const hasCategories = items.some(item => typeof item === 'string');
+ const sortedItems = sortMeasures(domain.name, items);
+ return sortedItems.map(
+ item =>
+ typeof item === 'string'
+ ? <span key={item} className="facet search-navigator-facet facet-category">
+ <span className="facet-name">
+ {translate('component_measures.facet_category', item)}
+ </span>
+ </span>
+ : <FacetItem
+ active={item.metric.key === selected}
+ disabled={false}
+ key={item.metric.key}
+ name={
+ <span className="big-spacer-left" id={`measure-${item.metric.key}-name`}>
+ {hasCategories
+ ? getLocalizedCategoryMetricName(item.metric)
+ : getLocalizedMetricName(item.metric)}
+ </span>
+ }
+ onClick={this.props.onChange}
+ stat={hasFacetStat(item.metric.key) ? <FacetMeasureValue measure={item} /> : null}
+ value={item.metric.key}
+ />
+ );
+ };
+
renderOverviewFacet = () => {
const { domain, selected } = this.props;
if (!hasBubbleChart(domain.name)) {
return null;
}
- const facetName = translateWithParameters(
- 'component_measures.domain_x_overview',
- getLocalizedMetricDomain(domain.name)
- );
return (
<FacetItem
active={domain.name === selected}
disabled={false}
key={domain.name}
name={
- <Tooltip overlay={facetName} mouseEnterDelay={0.5}>
- <span id={`measure-overview-${domain.name}-name`}>
- {facetName}
- </span>
- </Tooltip>
+ <span id={`measure-overview-${domain.name}-name`}>
+ {translate('component_measures.domain_overview')}
+ </span>
}
onClick={this.props.onChange}
stat={<BubblesIcon size={14} />}
render() {
const { domain, selected } = this.props;
- const measures = sortMeasures(domain.name, filterMeasures(domain.measures));
const helper = `component_measures.domain_facets.${domain.name}.help`;
const translatedHelper = translate(helper);
return (
name={getLocalizedMetricDomain(domain.name)}
onClick={this.handleHeaderClick}
open={this.props.open}
- values={this.hasFacetSelected(domain, measures, selected) ? 1 : 0}
+ values={this.hasFacetSelected(domain, domain.measures, selected) ? 1 : 0}
/>
{this.props.open &&
<FacetItemsList>
{this.renderOverviewFacet()}
- {measures.map(measure =>
- <FacetItem
- active={measure.metric.key === selected}
- disabled={false}
- key={measure.metric.key}
- name={
- <Tooltip overlay={getLocalizedMetricName(measure.metric)} mouseEnterDelay={0.5}>
- <span id={`measure-${measure.metric.key}-name`}>
- <IssueTypeIcon query={measure.metric.key} className="little-spacer-right" />
- {getLocalizedMetricName(measure.metric)}
- </span>
- </Tooltip>
- }
- onClick={this.props.onChange}
- stat={
- hasFacetStat(measure.metric.key) ? <FacetMeasureValue measure={measure} /> : null
- }
- value={measure.metric.key}
- />
- )}
+ {this.renderItemsFacet()}
</FacetItemsList>}
</FacetBox>
);
disabled={false}
halfWidth={false}
name={
- <Tooltip
- mouseEnterDelay={0.5}
- overlay="component_measures.domain_x_overview.Reliability"
- placement="bottom"
+ <span
+ id="measure-overview-Reliability-name"
>
- <span
- id="measure-overview-Reliability-name"
- >
- component_measures.domain_x_overview.Reliability
- </span>
- </Tooltip>
+ component_measures.domain_overview
+ </span>
}
onClick={[Function]}
stat={
}
value="Reliability"
/>
+ <span
+ className="facet search-navigator-facet facet-category"
+ >
+ <span
+ className="facet-name"
+ >
+ component_measures.facet_category.new_code_category
+ </span>
+ </span>
<FacetItem
active={false}
disabled={false}
halfWidth={false}
name={
- <Tooltip
- mouseEnterDelay={0.5}
- overlay="New Bugs"
- placement="bottom"
+ <span
+ className="big-spacer-left"
+ id="measure-new_bugs-name"
>
- <span
- id="measure-new_bugs-name"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="new_bugs"
- />
- New Bugs
- </span>
- </Tooltip>
+ New Bugs
+ </span>
}
onClick={[Function]}
stat={
}
value="new_bugs"
/>
+ <span
+ className="facet search-navigator-facet facet-category"
+ >
+ <span
+ className="facet-name"
+ >
+ component_measures.facet_category.overall_category
+ </span>
+ </span>
<FacetItem
active={false}
disabled={false}
halfWidth={false}
name={
- <Tooltip
- mouseEnterDelay={0.5}
- overlay="Bugs"
- placement="bottom"
+ <span
+ className="big-spacer-left"
+ id="measure-bugs-name"
>
- <span
- id="measure-bugs-name"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="bugs"
- />
- Bugs
- </span>
- </Tooltip>
+ Bugs
+ </span>
}
onClick={[Function]}
stat={
disabled={false}
halfWidth={false}
name={
- <Tooltip
- mouseEnterDelay={0.5}
- overlay="component_measures.domain_x_overview.Reliability"
- placement="bottom"
+ <span
+ id="measure-overview-Reliability-name"
>
- <span
- id="measure-overview-Reliability-name"
- >
- component_measures.domain_x_overview.Reliability
- </span>
- </Tooltip>
+ component_measures.domain_overview
+ </span>
}
onClick={[Function]}
stat={
}
value="Reliability"
/>
+ <span
+ className="facet search-navigator-facet facet-category"
+ >
+ <span
+ className="facet-name"
+ >
+ component_measures.facet_category.new_code_category
+ </span>
+ </span>
<FacetItem
active={false}
disabled={false}
halfWidth={false}
name={
- <Tooltip
- mouseEnterDelay={0.5}
- overlay="New Bugs"
- placement="bottom"
+ <span
+ className="big-spacer-left"
+ id="measure-new_bugs-name"
>
- <span
- id="measure-new_bugs-name"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="new_bugs"
- />
- New Bugs
- </span>
- </Tooltip>
+ New Bugs
+ </span>
}
onClick={[Function]}
stat={
}
value="new_bugs"
/>
+ <span
+ className="facet search-navigator-facet facet-category"
+ >
+ <span
+ className="facet-name"
+ >
+ component_measures.facet_category.overall_category
+ </span>
+ </span>
<FacetItem
active={true}
disabled={false}
halfWidth={false}
name={
- <Tooltip
- mouseEnterDelay={0.5}
- overlay="Bugs"
- placement="bottom"
+ <span
+ className="big-spacer-left"
+ id="measure-bugs-name"
>
- <span
- id="measure-bugs-name"
- >
- <IssueTypeIcon
- className="little-spacer-right"
- query="bugs"
- />
- Bugs
- </span>
- </Tooltip>
+ Bugs
+ </span>
}
onClick={[Function]}
stat={
Object {
"measures": Array [
Object {
- "leak": "0.0999999999999943",
+ "leak": "70",
"metric": Object {
"domain": "Coverage",
- "key": "coverage",
- "name": "Coverage",
- "type": "PERCENT",
+ "key": "lines_to_cover",
+ "name": "Lines to Cover",
+ "type": "INT",
},
"periods": Array [
Object {
"index": 1,
- "value": "0.0999999999999943",
+ "value": "70",
},
],
- "value": "99.3",
+ "value": "431",
},
Object {
- "leak": "70",
+ "leak": "0.0999999999999943",
"metric": Object {
"domain": "Coverage",
- "key": "lines_to_cover",
- "name": "Lines to Cover",
- "type": "INT",
+ "key": "coverage",
+ "name": "Coverage",
+ "type": "PERCENT",
},
"periods": Array [
Object {
"index": 1,
- "value": "70",
+ "value": "0.0999999999999943",
},
],
- "value": "431",
+ "value": "99.3",
},
],
"name": "Coverage",
export function sortMeasures(
domainName /*: string */,
- measures /*: Array<MeasureEnhanced> */
-) /*: Array<MeasureEnhanced> */ {
+ measures /*: Array<MeasureEnhanced | string> */
+) /*: Array<MeasureEnhanced | string> */ {
const config = domains[domainName] || {};
const configOrder = config.order || [];
return sortBy(measures, [
- measure => {
- const idx = configOrder.indexOf(measure.metric.key);
+ item => {
+ if (typeof item === 'string') {
+ return configOrder.indexOf(item);
+ }
+ const idx = configOrder.indexOf(item.metric.key);
return idx >= 0 ? idx : configOrder.length;
},
- measure => getLocalizedMetricName(measure.metric)
+ item => (typeof item === 'string' ? item : getLocalizedMetricName(item.metric))
]);
}
+export function addMeasureCategories(
+ domainName /*: string */,
+ measures /*: Array<MeasureEnhanced> */
+) /*: Array<any> */ {
+ const categories = domains[domainName] && domains[domainName].categories;
+ if (categories && categories.length > 0) {
+ return [...categories, ...measures];
+ }
+ return measures;
+}
+
export function enhanceComponent(
component /*: Component */,
metric /*: ?Metric */,
}
export const groupByDomains = memoize((measures /*: Array<MeasureEnhanced> */) => {
- const domains = toPairs(groupBy(measures, measure => measure.metric.domain)).map(r => {
- const [name, measures] = r;
- const sortedMeasures = sortBy(measures, measure => getLocalizedMetricName(measure.metric));
- return { name, measures: sortedMeasures };
- });
+ const domains = toPairs(groupBy(measures, measure => measure.metric.domain)).map(r => ({
+ name: r[0],
+ measures: r[1]
+ }));
return sortBy(domains, [
domain => {
return l10nLabel !== l10nKey ? l10nLabel : baseName;
}
-export function getLocalizedMetricName(metric: { key: string; name: string }) {
- const bundleKey = `metric.${metric.key}.name`;
+export function getLocalizedMetricName(
+ metric: { key: string; name: string },
+ short?: boolean
+): string {
+ const bundleKey = `metric.${metric.key}.${short ? 'short_name' : 'name'}`;
+ const fromBundle = translate(bundleKey);
+ if (fromBundle === bundleKey) {
+ return short ? getLocalizedMetricName(metric) : metric.name;
+ }
+ return fromBundle;
+}
+
+export function getLocalizedCategoryMetricName(metric: { key: string; name: string }) {
+ const bundleKey = `metric.${metric.key}.extra_short_name`;
const fromBundle = translate(bundleKey);
- return fromBundle !== bundleKey ? fromBundle : metric.name;
+ return fromBundle === bundleKey ? getLocalizedMetricName(metric, true) : fromBundle;
}
export function getLocalizedMetricDomain(domainName: string) {
}
}
+ &.facet-category {
+ opacity: 1;
+ cursor: default;
+
+ .facet-name {
+ color: @secondFontColor;
+ }
+ }
+
.facet-name {
line-height: 16px;
background-color: @barBackgroundColor;
metric.duplicated_lines_density.description=Duplicated lines balanced by statements
metric.duplicated_lines_density.name=Duplicated Lines (%)
metric.duplicated_lines_density.short_name=Duplications
+metric.duplicated_lines_density.extra_short_name=Density
metric.duplications_data.description=Duplications details
metric.duplications_data.name=Duplication Details
metric.efficiency.description=Efficiency
metric.efficiency.name=Efficiency
metric.effort_to_reach_maintainability_rating_a.description=Effort to reach maintainability rating A
metric.effort_to_reach_maintainability_rating_a.name=Effort to Reach Maintainability Rating A
+metric.effort_to_reach_maintainability_rating_a.extra_short_name=Effort to Reach A
metric.false_positive_issues.description=False positive issues
metric.false_positive_issues.name=False Positive Issues
metric.files.description=Number of files
metric.new_blocker_violations.name=New Blocker Issues
metric.new_branch_coverage.description=Condition coverage of new/changed code
metric.new_branch_coverage.name=Condition Coverage on New Code
+metric.new_branch_coverage.extra_short_name=Condition Coverage
metric.new_bugs.description=New Bugs
metric.new_bugs.name=New Bugs
metric.new_bugs.short_name=Bugs
metric.new_critical_violations.description=New Critical issues
metric.new_critical_violations.name=New Critical Issues
metric.new_duplicated_blocks.name=Duplicated Blocks on New Code
+metric.new_duplicated_blocks.extra_short_name=Duplicated Blocks
metric.new_duplicated_blocks.description=Duplicated blocks on new code
metric.new_duplicated_lines.name=Duplicated Lines on New Code
+metric.new_duplicated_lines.extra_short_name=Duplicated Lines
metric.new_duplicated_lines.description=Duplicated Lines on New Code
metric.new_duplicated_lines_density.description=Duplicated lines on new code balanced by statements
metric.new_duplicated_lines_density.name=Duplicated Lines on New Code (%)
metric.new_duplicated_lines_density.short_name=Duplications
+metric.new_duplicated_lines_density.extra_short_name=Density
metric.new_info_violations.description=New Info issues
metric.new_info_violations.name=New Info Issues
metric.new_it_branch_coverage.description=Integration tests condition coverage of new/changed code
metric.new_it_uncovered_lines.name=Uncovered Lines by IT on New Code
metric.new_lines_to_cover.description=Lines to cover on new code
metric.new_lines_to_cover.name=Lines to Cover on New Code
+metric.new_lines_to_cover.extra_short_name=Lines to Cover
metric.new_line_coverage.description=Line coverage of added/changed code
metric.new_line_coverage.name=Line Coverage on New Code
+metric.new_line_coverage.extra_short_name=Line Coverage
metric.new_maintainability_rating.description=Maintainability rating on new code
metric.new_maintainability_rating.name=Maintainability Rating on New Code
+metric.new_maintainability_rating.extra_short_name=Rating
metric.new_major_violations.description=New Major issues
metric.new_major_violations.name=New Major Issues
metric.new_minor_violations.description=New Minor issues
metric.new_overall_uncovered_lines.name=Overall Uncovered Lines on New Code
metric.new_reliability_rating.description=Reliability rating on new code
metric.new_reliability_rating.name=Reliability Rating on New Code
+metric.new_reliability_rating.extra_short_name=Rating
metric.new_reliability_remediation_effort.description=Reliability remediation effort on new code
metric.new_reliability_remediation_effort.name=Reliability Remediation Effort on New Code
+metric.new_reliability_remediation_effort.extra_short_name=Remediation Effort
metric.new_security_rating.description=Security rating on new code
metric.new_security_rating.name=Security Rating on New Code
+metric.new_security_rating.extra_short_name=Rating
metric.new_security_remediation_effort.description=Security remediation effort on new code
metric.new_security_remediation_effort.name=Security Remediation Effort on New Code
+metric.new_security_remediation_effort.extra_short_name=Remediation Effort
metric.new_sqale_debt_ratio.description=Technical Debt Ratio of new/changed code.
metric.new_sqale_debt_ratio.name=Technical Debt Ratio on New Code
metric.new_sqale_debt_ratio.short_name=Debt Ratio on new code
+metric.new_sqale_debt_ratio.extra_short_name=Debt Ratio
metric.new_technical_debt.description=Added technical debt
metric.new_technical_debt.name=Added Technical Debt
metric.new_technical_debt.short_name=Added Debt
+metric.new_technical_debt.extra_short_name=Debt
metric.new_uncovered_conditions.description=Uncovered conditions on new code
metric.new_uncovered_conditions.name=Uncovered Conditions on New Code
+metric.new_uncovered_conditions.extra_short_name=Uncovered Conditions
metric.new_uncovered_lines.description=Uncovered lines on new code
metric.new_uncovered_lines.name=Uncovered Lines on New Code
+metric.new_uncovered_lines.extra_short_name=Uncovered Lines
metric.new_violations.description=New issues
metric.new_violations.name=New Issues
metric.new_vulnerabilities.description=New Vulnerabilities
metric.reliability.name=Reliability
metric.reliability_rating.description=Reliability rating
metric.reliability_rating.name=Reliability Rating
+metric.reliability_rating.extra_short_name=Rating
metric.reliability_rating.tooltip.A=Reliability rating is A when there are no bugs.
metric.reliability_rating.tooltip.B=Reliability rating is B when there is at least one minor bug.
metric.reliability_rating.tooltip.C=Reliability rating is C when there is at least one major bug.
metric.reliability_rating.tooltip.E=Reliability rating is E when there is at least one blocker bug.
metric.reliability_remediation_effort.description=Reliability Remediation Effort
metric.reliability_remediation_effort.name=Reliability Remediation Effort
+metric.reliability_remediation_effort.extra_short_name=Remediation Effort
metric.reopened_issues.description=Reopened issues
metric.reopened_issues.name=Reopened Issues
metric.revisions_by_line.description=Revisions by line
metric.rfc_distribution.name=Class Distribution / RFC
metric.security_rating.description=Security rating
metric.security_rating.name=Security Rating
+metric.security_rating.extra_short_name=Rating
metric.security_rating.tooltip.A=Security rating is A when there are no vulnerabilities.
metric.security_rating.tooltip.B=Security rating is B when there is at least one minor vulnerability.
metric.security_rating.tooltip.C=Security rating is C when there is at least one major vulnerability.
metric.security_rating.tooltip.E=Security rating is E when there is at least one blocker vulnerability.
metric.security_remediation_effort.description=Security remediation effort
metric.security_remediation_effort.name=Security Remediation Effort
+metric.security_remediation_effort.extra_short_name=Remediation Effort
metric.skipped_tests.abbreviation=Skipped UTs
metric.skipped_tests.description=Number of skipped unit tests
metric.skipped_tests.name=Skipped Unit Tests
metric.sqale_debt_ratio.short_name=Debt Ratio
metric.sqale_index.description=Total effort (in days) to fix all the issues on the component and therefore to comply to all the requirements.
metric.sqale_index.name=Technical Debt
-metric.sqale_index.short_name=Effort
+metric.sqale_index.short_name=Debt
metric.sqale_rating.description=A-to-E rating based on the technical debt ratio
metric.sqale_rating.name=Maintainability Rating
+metric.sqale_rating.extra_short_name=Rating
metric.sqale_rating.tooltip=Maintainability rating is {0} when the technical debt ratio is greater than {1}
metric.sqale_rating.tooltip.A=Maintainability rating is A when the technical debt ratio is less than {0}
metric.statements.abbreviation=Stmts
component_measures.all_measures=All Measures
component_measures.domain_measures={0} Measures
component_measures.domain_x_overview={0} Overview
+component_measures.domain_overview=Overview
component_measures.back_to_list=Back to List
component_measures.files=files
component_measures.show_metric_history=Show history of this metric
component_measures.domain_facets.Security.help=Issues in this domain mark potential weaknesses to hackers.
component_measures.domain_facets.Complexity.help=How simple or complicated the control flow of the application is. Cyclomatic Complexity measures the minimum number of test cases requiref for full test coverage. Cognitive Complexity is a measure of how difficult the application is to Understand
+component_measures.facet_category.new_code_category=On new code
+component_measures.facet_category.overall_category=Overall
+component_measures.facet_category.tests_category=Tests
+
#------------------------------------------------------------------------------
#
# ABOUT PAGE