diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2018-06-12 11:39:04 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2018-07-04 09:31:03 +0200 |
commit | d42307dd484ab82daecddb4e98b2085ba711b34f (patch) | |
tree | cd1abe3614d350e3e1d66feaf6c2b47cad9571f3 /server/sonar-web/src | |
parent | 1de495806592ec053c70322de93f797019a448d3 (diff) | |
download | sonarqube-d42307dd484ab82daecddb4e98b2085ba711b34f.tar.gz sonarqube-d42307dd484ab82daecddb4e98b2085ba711b34f.zip |
SONAR-10867 Add security hotspot new issue type
Diffstat (limited to 'server/sonar-web/src')
8 files changed, 66 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx index 8094cf54b33..ff2accac97f 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx @@ -33,7 +33,7 @@ export default class TypeFacet extends React.PureComponent<BasicProps> { renderTextName = (type: string) => translate('issue.type', type); render() { - const options = ['BUG', 'VULNERABILITY', 'CODE_SMELL']; + const options = ['BUG', 'VULNERABILITY', 'CODE_SMELL', 'SECURITY_HOTSPOT']; return ( <Facet diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.tsx index 889115e7111..a6a189b7ddb 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.tsx @@ -95,7 +95,7 @@ export default class TypeFacet extends React.PureComponent<Props> { }; render() { - const types = ['BUG', 'VULNERABILITY', 'CODE_SMELL']; + const types = ['BUG', 'VULNERABILITY', 'CODE_SMELL', 'SECURITY_HOTSPOT']; const values = this.props.types.map(type => translate('issue.type', type)); return ( diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx index a3a73a80a9f..261f5998c75 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx @@ -30,7 +30,7 @@ import { getRulesUrl } from '../../../helpers/urls'; import { translate } from '../../../helpers/l10n'; import { Profile } from '../types'; -const TYPES = ['BUG', 'VULNERABILITY', 'CODE_SMELL']; +const TYPES = ['BUG', 'VULNERABILITY', 'CODE_SMELL', 'SECURITY_HOTSPOT']; interface Props { organization: string | null; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRules-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRules-test.tsx index fcabce9784a..2a313ccb6d8 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRules-test.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRules-test.tsx @@ -43,14 +43,15 @@ const PROFILE = { const EDITABLE_PROFILE = { ...PROFILE, actions: { edit: true } }; const apiResponseAll = { - total: 243, + total: 253, facets: [ { property: 'types', values: [ { val: 'CODE_SMELL', count: 168 }, { val: 'BUG', count: 68 }, - { val: 'VULNERABILITY', count: 7 } + { val: 'VULNERABILITY', count: 7 }, + { val: 'SECURITY_HOTSPOT', count: 10 } ] } ] @@ -64,7 +65,8 @@ const apiResponseActive = { values: [ { val: 'BUG', count: 68 }, { val: 'CODE_SMELL', count: 0 }, - { val: 'VULNERABILITY', count: 0 } + { val: 'VULNERABILITY', count: 0 }, + { val: 'SECURITY_HOTSPOT', count: 0 } ] } ] diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap index 2fd0450b1bd..ea82cabc5dc 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileRules-test.tsx.snap @@ -30,7 +30,7 @@ exports[`should render the quality profiles rules with sonarway comparison 1`] = count={68} organization="foo" qprofile="foo" - total={243} + total={253} /> <ProfileRulesRowOfType count={68} @@ -56,6 +56,14 @@ exports[`should render the quality profiles rules with sonarway comparison 1`] = total={168} type="CODE_SMELL" /> + <ProfileRulesRowOfType + count={0} + key="SECURITY_HOTSPOT" + organization="foo" + qprofile="foo" + total={10} + type="SECURITY_HOTSPOT" + /> </tbody> </table> </div> diff --git a/server/sonar-web/src/main/js/components/icons-components/SecurityHotspotIcon.tsx b/server/sonar-web/src/main/js/components/icons-components/SecurityHotspotIcon.tsx new file mode 100644 index 00000000000..334d10852db --- /dev/null +++ b/server/sonar-web/src/main/js/components/icons-components/SecurityHotspotIcon.tsx @@ -0,0 +1,43 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; +import Icon, { IconProps } from './Icon'; + +export default function SecurityHotspotIcon({ className, fill = 'currentColor', size }: IconProps) { + return ( + <Icon className={className} size={size}> + <g style={{ fill }}> + <path + d="M10.238 2.416c-0.432-0.895-1.259-1.504-2.202-1.504-1.386 0-2.521 1.318-2.521 2.927v5.481" + fill="none" + stroke={fill} + strokeLinecap="round" + strokeWidth="1.1429" + /> + <path d="M8.537 10.372v1.199h-1.099v-1.199c-0.638-0.228-1.099-0.832-1.099-1.546 0-0.909 0.739-1.649 1.648-1.649s1.649 0.74 1.649 1.649c0 0.715-0.461 1.32-1.099 1.546zM10.734 4.979h-5.494c-1.21 0-2.199 0.989-2.199 2.197v4.395c0 1.21 0.989 2.199 2.199 2.199h5.494c1.209 0 2.197-0.989 2.197-2.199v-4.395c0-1.209-0.989-2.197-2.197-2.197z" /> + <path d="M4.030 6.352h6.923v6.923h-6.923z" /> + <path + d="M7.504 10.283c0-0.423 0.048-0.757 0.144-1.002s0.251-0.457 0.465-0.637c0.215-0.18 0.377-0.344 0.489-0.493s0.167-0.313 0.167-0.493c0-0.438-0.189-0.656-0.565-0.656-0.174 0-0.314 0.064-0.421 0.191s-0.164 0.3-0.17 0.518h-1.469c0.006-0.58 0.189-1.031 0.548-1.354s0.864-0.485 1.513-0.485c0.646 0 1.147 0.149 1.501 0.447s0.532 0.723 0.532 1.274c0 0.241-0.048 0.459-0.144 0.656s-0.249 0.398-0.46 0.604l-0.5 0.465c-0.142 0.136-0.241 0.276-0.296 0.42s-0.086 0.325-0.091 0.545h-1.243zM7.326 11.604c0-0.215 0.078-0.39 0.233-0.528s0.349-0.207 0.58-0.207c0.232 0 0.425 0.068 0.58 0.207s0.233 0.313 0.233 0.528-0.078 0.39-0.233 0.528c-0.155 0.138-0.349 0.207-0.58 0.207s-0.425-0.068-0.58-0.207c-0.155-0.138-0.233-0.313-0.233-0.528z" + fill="#fff" + /> + </g> + </Icon> + ); +} diff --git a/server/sonar-web/src/main/js/components/ui/IssueTypeIcon.tsx b/server/sonar-web/src/main/js/components/ui/IssueTypeIcon.tsx index 5cf34fe37e3..05252164305 100644 --- a/server/sonar-web/src/main/js/components/ui/IssueTypeIcon.tsx +++ b/server/sonar-web/src/main/js/components/ui/IssueTypeIcon.tsx @@ -21,6 +21,7 @@ import * as React from 'react'; import BugIcon from '../icons-components/BugIcon'; import VulnerabilityIcon from '../icons-components/VulnerabilityIcon'; import CodeSmellIcon from '../icons-components/CodeSmellIcon'; +import SecurityHotspotIcon from '../icons-components/SecurityHotspotIcon'; interface Props { className?: string; @@ -47,6 +48,10 @@ export default function IssueTypeIcon({ className, query, size }: Props) { case 'new_code_smells': icon = <CodeSmellIcon size={size} />; break; + case 'security_hotspot': + case 'security_hotspots': + icon = <SecurityHotspotIcon size={size} />; + break; } if (!icon) { diff --git a/server/sonar-web/src/main/js/helpers/constants.ts b/server/sonar-web/src/main/js/helpers/constants.ts index 7c6a893ca7f..0857573b85f 100644 --- a/server/sonar-web/src/main/js/helpers/constants.ts +++ b/server/sonar-web/src/main/js/helpers/constants.ts @@ -21,7 +21,7 @@ import * as theme from '../app/theme'; export const SEVERITIES = ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO']; export const STATUSES = ['OPEN', 'REOPENED', 'CONFIRMED', 'RESOLVED', 'CLOSED']; -export const TYPES = ['BUG', 'VULNERABILITY', 'CODE_SMELL']; +export const TYPES = ['BUG', 'VULNERABILITY', 'CODE_SMELL', 'SECURITY_HOTSPOT']; export const RULE_STATUSES = ['READY', 'BETA', 'DEPRECATED']; export const CHART_COLORS_RANGE_PERCENT = [ |