Skip to content

Commit

Permalink
Feature/pm/sonar 10554 display issues from external engine (SonarSour…
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-mugnier-sonarsource authored and SonarTech committed Apr 26, 2018
1 parent 9c04ec3 commit 4c9a714
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 22 deletions.
4 changes: 2 additions & 2 deletions server/sonar-web/src/main/js/app/styles/components/badges.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ a.badge {
}

.badge-tiny-height {
height: var(--tinyControlHeight);
line-height: calc(var(--tinyControlHeight) - 1px);
height: var(--tinyControlHeight) !important;
line-height: calc(var(--tinyControlHeight) - 1px) !important;
}

.badge-muted {
Expand Down
4 changes: 4 additions & 0 deletions server/sonar-web/src/main/js/app/styles/components/issues.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
overflow: hidden;
}

.issue-message .button-link {
height: 16px;
}

.issue-rule {
vertical-align: top;
margin-top: 2px;
Expand Down
8 changes: 4 additions & 4 deletions server/sonar-web/src/main/js/app/styles/init/misc.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
.vertical-top {
vertical-align: top;
vertical-align: top !important;
}

.vertical-bottom {
vertical-align: bottom;
vertical-align: bottom !important;
}

.vertical-middle {
vertical-align: middle;
vertical-align: middle !important;
}

.vertical-text-top {
vertical-align: text-top;
vertical-align: text-top !important;
}

.nowrap {
Expand Down
2 changes: 2 additions & 0 deletions server/sonar-web/src/main/js/app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ export interface Issue {
componentUuid: string;
creationDate: string;
effort?: string;
fromExternalRule?: boolean;
key: string;
flows: FlowLocation[][];
line?: number;
Expand Down Expand Up @@ -400,6 +401,7 @@ export interface RuleDetails extends Rule {
htmlDesc?: string;
htmlNote?: string;
internalKey?: string;
isExternal?: boolean;
mdDesc?: string;
mdNote?: string;
remFnBaseEffort?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { updateRule } from '../../../api/rules';
import { RuleDetails } from '../../../app/types';
import MarkdownTips from '../../../components/common/MarkdownTips';
import { Button, ResetButtonLink } from '../../../components/ui/buttons';
import { translate } from '../../../helpers/l10n';
import { translate, translateWithParameters } from '../../../helpers/l10n';

interface Props {
canWrite: boolean | undefined;
Expand Down Expand Up @@ -192,10 +192,16 @@ export default class RuleDetailsDescription extends React.PureComponent<Props, S

return (
<div className="js-rule-description">
<div
className="coding-rules-detail-description rule-desc markdown"
dangerouslySetInnerHTML={{ __html: ruleDetails.htmlDesc || '' }}
/>
{ruleDetails.isExternal ? (
<div className="coding-rules-detail-description rule-desc markdown">
{translateWithParameters('issue.external_issue_description', ruleDetails.name)}
</div>
) : (
<div
className="coding-rules-detail-description rule-desc markdown"
dangerouslySetInnerHTML={{ __html: ruleDetails.htmlDesc || '' }}
/>
)}

{!ruleDetails.templateKey && (
<div className="coding-rules-detail-description coding-rules-detail-description-extra">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,13 @@ export default class RuleDetailsMeta extends React.PureComponent<Props, State> {
<header className="page-header">
<div className="pull-right">
<span className="note text-middle">{ruleDetails.key}</span>
<Link
className="coding-rules-detail-permalink link-no-underline spacer-left text-middle"
to={getRuleUrl(ruleDetails.key, this.props.organization)}>
<LinkIcon />
</Link>
{!ruleDetails.isExternal && (
<Link
className="coding-rules-detail-permalink link-no-underline spacer-left text-middle"
to={getRuleUrl(ruleDetails.key, this.props.organization)}>
<LinkIcon />
</Link>
)}
{!this.props.hideSimilarRulesFilter && (
<SimilarRulesFilter onFilterChange={this.props.onFilterChange} rule={ruleDetails} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
// @flow
import React from 'react';
import PropTypes from 'prop-types';
import { translate } from '../../../helpers/l10n';
import Tooltip from '../../controls/Tooltip';
import { translate, translateWithParameters } from '../../../helpers/l10n';

export default class IssueMessage extends React.PureComponent {
/*:: props: {
engine?: string;
message: string,
rule: string,
organization: string
organization: string,
rule: string
};
*/

Expand All @@ -52,6 +54,14 @@ export default class IssueMessage extends React.PureComponent {
aria-label={translate('issue.rule_details')}
onClick={this.handleClick}
/>
{this.props.engine && (
<Tooltip
overlay={translateWithParameters('issue.from_external_rule_engine', this.props.engine)}>
<div className="outline-badge badge-tiny-height spacer-left vertical-text-top">
{this.props.engine}
</div>
</Tooltip>
)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ export default function IssueTitleBar(props /*: Props */) {

return (
<div className="issue-row">
<IssueMessage message={issue.message} rule={issue.rule} organization={issue.organization} />
<IssueMessage
engine={issue.externalRuleEngine}
message={issue.message}
organization={issue.organization}
rule={issue.rule}
/>

<div className="issue-row-meta">
<ul className="list-inline issue-meta-list">
Expand All @@ -84,8 +89,8 @@ export default function IssueTitleBar(props /*: Props */) {
creationDate={issue.creationDate}
isOpen={props.currentPopup === 'changelog'}
issue={issue}
togglePopup={props.togglePopup}
onFail={props.onFail}
togglePopup={props.togglePopup}
/>
</li>
{issue.textRange != null && (
Expand Down Expand Up @@ -120,9 +125,9 @@ export default function IssueTitleBar(props /*: Props */) {
<SimilarIssuesFilter
isOpen={props.currentPopup === 'similarIssues'}
issue={issue}
togglePopup={props.togglePopup}
onFail={props.onFail}
onFilter={props.onFilter}
togglePopup={props.togglePopup}
/>
</li>
)}
Expand Down
1 change: 1 addition & 0 deletions server/sonar-web/src/main/js/components/issue/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export type Issue = {
componentUuid: string,
creationDate: string,
effort?: string,
externalRuleEngine?: string,
key: string,
flows: Array<Array<FlowLocation>>,
line?: number,
Expand Down
2 changes: 2 additions & 0 deletions sonar-core/src/main/resources/org/sonar/l10n/core.properties
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,8 @@ issue.effort=Effort:
issue.x_effort={0} effort
issue.filter_similar_issues=Filter Similar Issues
issue.this_issue_involves_x_code_locations=This issue involves {0} code location(s)
issue.from_external_rule_engine=Issue detected by an external rule engine: {0}
issue.external_issue_description=This is external rule {0}. No details are available.
issues.return_to_list=Return to List
issues.bulk_change=All Issues ({0})
issues.bulk_change_selected=Selected Issues ({0})
Expand Down

0 comments on commit 4c9a714

Please sign in to comment.