| 'types';
export function searchIssues(query: RequestData): Promise<RawIssuesResponse> {
+ // TODO: Remove this before final merge. Needed because backend sends an error
+ if (query.facets) {
+ query.facets = query.facets.replace(/cleanCodeAttributes/, '').replace(/impacts/, '');
+ }
return getJSON('/api/issues/search', query).catch(throwGlobalError);
}
issue={
{
"actions": [],
+ "cleanCodeAttribute": "RESPECTFUL",
+ "cleanCodeAttributeCategory": "RESPONSIBLE",
"component": "main.js",
"componentEnabled": true,
"componentLongName": "main.js",
"creationDate": "2017-03-01T09:36:01+0100",
"flows": [],
"flowsWithType": [],
+ "impacts": [
+ {
+ "severity": "MEDIUM",
+ "softwareQuality": "MAINTAINABILITY",
+ },
+ ],
"key": "issue",
"line": 25,
"message": "Reduce the number of conditional operators (4) used in the expression",
],
"assignee": "luke",
"author": "luke@sonarsource.com",
+ "cleanCodeAttribute": "LAWFUL",
+ "cleanCodeAttributeCategory": "RESPONSIBLE",
"comments": [],
"component": "foo.java",
"componentEnabled": true,
"flows": [],
"flowsWithType": [],
"hash": "78417dcee7ba927b7e7c9161e29e02b8",
+ "impacts": [
+ {
+ "severity": "HIGH",
+ "softwareQuality": "MAINTAINABILITY",
+ },
+ ],
"key": "AWaqVGl3tut9VbnJvk6M",
"line": 62,
"message": "Make sure this file handling is safe here.",
"assigneeLogin": "luke",
"assigneeName": "Luke",
"author": "luke@sonarsource.com",
+ "cleanCodeAttribute": "LAWFUL",
+ "cleanCodeAttributeCategory": "RESPONSIBLE",
"comments": [],
"component": "foo.java",
"componentEnabled": true,
"flows": [],
"flowsWithType": [],
"hash": "78417dcee7ba927b7e7c9161e29e02b8",
+ "impacts": [
+ {
+ "severity": "HIGH",
+ "softwareQuality": "MAINTAINABILITY",
+ },
+ ],
"key": "AWaqVGl3tut9VbnJvk6M",
"line": 62,
"message": "Make sure this file handling is safe here.",
*/
import { BugIcon, CodeSmellIcon, SecurityHotspotIcon, VulnerabilityIcon } from 'design-system';
import { flatten, sortBy } from 'lodash';
-import { IssueType, RawIssue } from '../types/issues';
+import {
+ CleanCodeAttribute,
+ CleanCodeAttributeCategory,
+ IssueType,
+ RawIssue,
+ SoftwareImpactSeverity,
+ SoftwareQuality,
+} from '../types/issues';
import { MetricKey } from '../types/metrics';
import { Dict, Flow, FlowLocation, FlowType, Issue, TextRange } from '../types/types';
import { UserBase } from '../types/users';
...splitFlows(issue, components),
...prepareClosed(issue),
...ensureTextRange(issue),
+ cleanCodeAttributeCategory:
+ issue.cleanCodeAttributeCategory || CleanCodeAttributeCategory.Responsible,
+ cleanCodeAttribute: issue.cleanCodeAttribute || CleanCodeAttribute.Lawful,
+ impacts: issue.impacts || [
+ {
+ softwareQuality: SoftwareQuality.Maintainability,
+ severity: SoftwareImpactSeverity.High,
+ },
+ ],
} as Issue;
}
import { AppState } from '../types/appstate';
import { RuleRepository } from '../types/coding-rules';
import { EditionKey } from '../types/editions';
-import { IssueScope, IssueSeverity, IssueStatus, IssueType, RawIssue } from '../types/issues';
+import {
+ CleanCodeAttribute,
+ CleanCodeAttributeCategory,
+ IssueScope,
+ IssueSeverity,
+ IssueStatus,
+ IssueType,
+ RawIssue,
+ SoftwareImpactSeverity,
+ SoftwareQuality,
+} from '../types/issues';
import { Language } from '../types/languages';
import { Notification } from '../types/notifications';
import { DumpStatus, DumpTask } from '../types/project-dump';
type: IssueType.CodeSmell,
transitions: [],
scope: IssueScope.Main,
+ cleanCodeAttributeCategory: CleanCodeAttributeCategory.Responsible,
+ cleanCodeAttribute: CleanCodeAttribute.Respectful,
+ impacts: [
+ { softwareQuality: SoftwareQuality.Maintainability, severity: SoftwareImpactSeverity.Medium },
+ ],
...overrides,
};
textRange: { startLine: 25, endLine: 26, startOffset: 0, endOffset: 15 },
transitions: [],
type: 'BUG',
+ cleanCodeAttributeCategory: CleanCodeAttributeCategory.Responsible,
+ cleanCodeAttribute: CleanCodeAttribute.Respectful,
+ impacts: [
+ { softwareQuality: SoftwareQuality.Maintainability, severity: SoftwareImpactSeverity.Medium },
+ ],
};
const loc = mockFlowLocation;
}
// Keep this enum in the correct order (most severe to least severe).
+export enum SoftwareImpactSeverity {
+ High = 'HIGH',
+ Medium = 'MEDIUM',
+ Low = 'LOW',
+}
+
export enum IssueSeverity {
Blocker = 'BLOCKER',
Critical = 'CRITICAL',
Info = 'INFO',
}
+export enum CleanCodeAttributeCategory {
+ Consistent = 'CONSISTENT',
+ Intentional = 'INTENTIONAL',
+ Adaptable = 'ADAPTABLE',
+ Responsible = 'RESPONSIBLE',
+ Unclassified = 'UNCLASSIFIED',
+}
+
+export enum CleanCodeAttribute {
+ Clear = 'CLEAR',
+ Complete = 'COMPLETE',
+ Conventional = 'CONVENTIONAL',
+ Distinct = 'DISTINCT',
+ Efficient = 'EFFICIENT',
+ Focused = 'FOCUSED',
+ Formatted = 'FORMATTED',
+ Identifiable = 'IDENTIFIABLE',
+ Lawful = 'LAWFUL',
+ Logical = 'LOGICAL',
+ Modular = 'MODULAR',
+ Respectful = 'RESPECTFUL',
+ Tested = 'TESTED',
+ Trustworthy = 'TRUSTWORTHY',
+ Unclassified = 'UNCLASSIFIED',
+}
+
+export enum SoftwareQuality {
+ Security = 'SECURITY',
+ Reliability = 'RELIABILITY',
+ Maintainability = 'MAINTAINABILITY',
+}
+
export enum IssueScope {
Main = 'MAIN',
Test = 'TEST',
tags?: string[];
assignee?: string;
author?: string;
+ cleanCodeAttributeCategory: CleanCodeAttributeCategory;
+ cleanCodeAttribute: CleanCodeAttribute;
+ impacts: Array<{
+ softwareQuality: SoftwareQuality;
+ severity: SoftwareImpactSeverity;
+ }>;
codeVariants?: string[];
comments?: Comment[];
creationDate: string;
*/
import { RuleDescriptionSection } from '../apps/coding-rules/rule';
import { ComponentQualifier, Visibility } from './component';
-import { MessageFormatting } from './issues';
+import {
+ CleanCodeAttribute,
+ CleanCodeAttributeCategory,
+ MessageFormatting,
+ SoftwareImpactSeverity,
+ SoftwareQuality,
+} from './issues';
import { NewCodeDefinitionType } from './new-code-definition';
import { UserActive, UserBase } from './users';
assigneeName?: string;
author?: string;
branch?: string;
+ cleanCodeAttributeCategory: CleanCodeAttributeCategory;
+ cleanCodeAttribute: CleanCodeAttribute;
+ impacts: Array<{
+ softwareQuality: SoftwareQuality;
+ severity: SoftwareImpactSeverity;
+ }>;
codeVariants?: string[];
comments?: IssueComment[];
component: string;
issue.type.VULNERABILITY.plural=Vulnerabilities
issue.type.SECURITY_HOTSPOT.plural=Security Hotspots
+issue.software_quality.SECURITY=Security
+issue.software_quality.RELIABILITY=Reliability
+issue.software_quality.MAINTAINABILITY=Maintainability
+
+
+issue.clean_code_attribute_category.CONSISTENCY=Consistency
+issue.clean_code_attribute_category.INTENTIONALITY=Intentionality
+issue.clean_code_attribute_category.ADAPTABILITY=Adaptability
+issue.clean_code_attribute_category.RESPONSABILITY=Responsability
+issue.clean_code_attribute_category.UNCLASSIFIED=Unclassified
+
+issue.clean_code_attribute.CLEAR=Clear
+issue.clean_code_attribute.COMPLETE=Complete
+issue.clean_code_attribute.CONVENTIONAL=Conventional
+issue.clean_code_attribute.DISTINCT=Distinct
+issue.clean_code_attribute.EFFICIENT=Efficient
+issue.clean_code_attribute.FOCUSED=Focused
+issue.clean_code_attribute.FORMATTED=Formatted
+issue.clean_code_attribute.IDENTIFIABLE=Identifiable
+issue.clean_code_attribute.LAWFUL=Lawful
+issue.clean_code_attribute.LOGICAL=Logical
+issue.clean_code_attribute.MODULAR=Modular
+issue.clean_code_attribute.RESPECTFUL=Respectful
+issue.clean_code_attribute.TESTED=Tested
+issue.clean_code_attribute.TRUSTWORTHY=Trustworthy
+issue.clean_code_attribute.UNCLASSIFIED=Unclassified
+
issue.status.REOPENED=Reopened
issue.status.RESOLVED=Resolved
issue.status.OPEN=Open
severity.INFO=Info
severity.INFO.description=Neither a bug nor a quality flaw. Just a finding.
+# New severities
+severity.HIGH=High
+severity.HIGH.description=Must be fixed immediately.
+severity.MEDIUM=Medium
+severity.MEDIUM.description=High potential for significant to moderate impact.
+severity.LOW=Low
+severity.LOW.description=Potential for moderate to minor impact.
+
#------------------------------------------------------------------------------
#
# METRIC DOMAINS