From: stanislavh Date: Thu, 17 Aug 2023 08:21:42 +0000 (+0200) Subject: SONAR-20023 Remove rule deprecated and removed badges from list/details X-Git-Tag: 10.2.0.77647~170 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0f6ff74ea84029cad16f78f7ad98293933e1cc1e;p=sonarqube.git SONAR-20023 Remove rule deprecated and removed badges from list/details --- diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx index 54fdfeb64a4..fce07fd1743 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueHeader-it.tsx @@ -22,8 +22,7 @@ import * as React from 'react'; import { WorkspaceContext } from '../../../components/workspace/context'; import { mockIssue, mockRuleDetails } from '../../../helpers/testMocks'; import { renderComponent } from '../../../helpers/testReactTestingUtils'; -import { byLabelText, byRole, byText } from '../../../helpers/testSelector'; -import { RuleStatus } from '../../../types/rules'; +import { byRole, byText } from '../../../helpers/testSelector'; import { Dict } from '../../../types/types'; import IssueHeader from '../components/IssueHeader'; @@ -38,11 +37,10 @@ it('renders correctly', async () => { codeVariants: ['first', 'second'], effort: '5min', quickFixAvailable: true, - ruleStatus: RuleStatus.Deprecated, externalRuleEngine: 'eslint', }, }, - { eslint: 'yes' } + { eslint: 'eslint' } ); // Title @@ -88,11 +86,8 @@ it('renders correctly', async () => { // SonarLint badge expect(byText('issue.quick_fix_available_with_sonarlint_no_link').get()).toBeInTheDocument(); - // Rule status - Deprecated - expect(byLabelText(`issue.resolution.badge.${RuleStatus.Deprecated}`).get()).toBeInTheDocument(); - // Rule external engine - expect(byText(/issue.resolution.badge/).get()).toBeInTheDocument(); + expect(byText('eslint').get()).toBeInTheDocument(); }); it('renders correctly when some data is not provided', () => { @@ -112,13 +107,8 @@ it('renders correctly when some data is not provided', () => { byText('issue.quick_fix_available_with_sonarlint_no_link').query() ).not.toBeInTheDocument(); - // Rule status deprecated - expect( - byLabelText(`issue.resolution.badge.${RuleStatus.Deprecated}`).query() - ).not.toBeInTheDocument(); - // Rule external engine - expect(byText(/issue.resolution.badge/).query()).not.toBeInTheDocument(); + expect(byText('eslint').query()).not.toBeInTheDocument(); }); function renderIssueHeader( diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-it.tsx index 08cd336d489..9ea10f02b66 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-it.tsx @@ -657,12 +657,6 @@ describe('issues item', () => { await expect( screen.getByText('issue.quick_fix_available_with_sonarlint_no_link') ).toHaveATooltipWithContent('issue.quick_fix_available_with_sonarlint'); - - expect( - screen.getByRole('status', { - name: 'issue.resolution.badge.DEPRECATED', - }) - ).toBeInTheDocument(); }); }); diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx index 95aeb66c064..a0b4fd5adba 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx @@ -31,7 +31,6 @@ import * as React from 'react'; import { setIssueAssignee } from '../../../api/issues'; import { updateIssue } from '../../../components/issue/actions'; import IssueActionsBar from '../../../components/issue/components/IssueActionsBar'; -import { RuleBadge } from '../../../components/issue/components/IssueBadges'; import { CleanCodeAttributePill } from '../../../components/shared/CleanCodeAttributePill'; import SoftwareImpactPill from '../../../components/shared/SoftwareImpactPill'; import { WorkspaceContext } from '../../../components/workspace/context'; @@ -43,7 +42,6 @@ import { getKeyboardShortcutEnabled } from '../../../helpers/preferences'; import { getComponentIssuesUrl, getPathUrlAsString, getRuleUrl } from '../../../helpers/urls'; import { BranchLike } from '../../../types/branch-like'; import { IssueActions, IssueType } from '../../../types/issues'; -import { RuleStatus } from '../../../types/rules'; import { Issue, RuleDetails } from '../../../types/types'; import IssueHeaderMeta from './IssueHeaderMeta'; @@ -148,10 +146,6 @@ export default class IssueHeader extends React.PureComponent { return null; }} - {(issue.ruleStatus === RuleStatus.Deprecated || - issue.ruleStatus === RuleStatus.Removed) && ( - - )} ); }; diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx b/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx index b99f1ced825..f6d0752ed53 100644 --- a/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx +++ b/server/sonar-web/src/main/js/components/issue/__tests__/Issue-it.tsx @@ -36,7 +36,6 @@ import { IssueTransition, IssueType, } from '../../../types/issues'; -import { RuleStatus } from '../../../types/rules'; import Issue from '../Issue'; jest.mock('../../../helpers/preferences', () => ({ @@ -66,15 +65,6 @@ describe('rendering', () => { expect(onClick).toHaveBeenCalledWith(issue.key); }); - it.each([RuleStatus.Deprecated, RuleStatus.Removed])( - 'should render correctly for a %s rule', - (ruleStatus) => { - const { ui } = getPageObject(); - renderIssue({ issue: mockIssue(false, { ruleStatus }) }); - expect(ui.ruleStatusBadge(ruleStatus).get()).toBeInTheDocument(); - } - ); - it('should render correctly for external rule engines', () => { renderIssue({ issue: mockIssue(true, { externalRuleEngine: 'ESLINT' }) }); expect(screen.getByRole('status', { name: 'ESLINT' })).toBeInTheDocument(); @@ -194,7 +184,6 @@ function getPageObject() { const selectors = { // Issue - ruleStatusBadge: (status: RuleStatus) => byText(`issue.resolution.badge.${status}`), locationsBadge: (count: number) => byText(count), lineInfo: (line: number) => byText(`L${line}`), effort: (effort: string) => byText(`issue.x_effort.${effort}`), diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueBadges.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueBadges.tsx index e62255154bc..f2ece1a9124 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueBadges.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueBadges.tsx @@ -17,63 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import classNames from 'classnames'; -import { Badge } from 'design-system'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { RuleStatus } from '../../../types/rules'; -import DocumentationTooltip from '../../common/DocumentationTooltip'; +import { translate } from '../../../helpers/l10n'; import Link from '../../common/Link'; import Tooltip from '../../controls/Tooltip'; import SonarLintIcon from '../../icons/SonarLintIcon'; export interface IssueBadgesProps { quickFixAvailable?: boolean; - ruleStatus?: RuleStatus; } export default function IssueBadges(props: IssueBadgesProps) { - const { quickFixAvailable, ruleStatus } = props; + const { quickFixAvailable } = props; return (
- - -
); } -export function RuleBadge({ - ruleStatus, - className, -}: { - ruleStatus?: RuleStatus; - className?: string; -}) { - if (ruleStatus === RuleStatus.Deprecated || ruleStatus === RuleStatus.Removed) { - return ( - - - {translate('issue.resolution.badge', ruleStatus)} - - - ); - } - - return null; -} - export function SonarLintBadge({ quickFixAvailable }: { quickFixAvailable?: boolean }) { if (quickFixAvailable) { return ( diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueMetaBar.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueMetaBar.tsx index 14c5223eaa5..d25f0d6cf5d 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueMetaBar.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueMetaBar.tsx @@ -23,7 +23,6 @@ import { Badge, CommentIcon, SeparatorCircleIcon, themeColor } from 'design-syst import * as React from 'react'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { isDefined } from '../../../helpers/types'; -import { RuleStatus } from '../../../types/rules'; import { Issue } from '../../../types/types'; import Tooltip from '../../controls/Tooltip'; import DateFromNow from '../../intl/DateFromNow'; @@ -52,10 +51,7 @@ export default function IssueMetaBar(props: Props) { return (
  • - +
  • {ruleEngine && ( diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index f930730bd56..d7a47cb9578 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -1064,8 +1064,6 @@ issue.resolution.WONTFIX=Won't Fix issue.resolution.WONTFIX.description=Issues that are accepted in this context. They and their effort will be ignored. issue.resolution.REMOVED=Removed issue.resolution.REMOVED.description=Either the rule or the resource was changed (removed, relocated, parameters changed, etc.) so that analysis no longer finds these issues. -issue.resolution.badge.REMOVED=Rule removed -issue.resolution.badge.DEPRECATED=Rule deprecated issue.unresolved.description=Unresolved issues have not been addressed in any way. issue.action.permalink=Get permalink