]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20337 Fixing formatting error
authorRevanshu Paliwal <revanshu.paliwal@sonarsource.com>
Thu, 14 Sep 2023 08:56:49 +0000 (10:56 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 19 Sep 2023 20:02:46 +0000 (20:02 +0000)
server/sonar-web/src/main/js/app/components/GlobalContainer.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/ConditionReviewAndUpdateModal.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/MetricSelect.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModal.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModalRenderer.tsx
server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx

index 47350db2cd6e514a39eb6bdf3bdf4aa7173aeade..733b53be1ed5ebed9a48bc6f605f80aa6b0691ca 100644 (file)
@@ -68,7 +68,7 @@ export default function GlobalContainer() {
             <div
               className={classNames('page-wrapper', {
                 'new-background': TEMP_PAGELIST_WITH_NEW_BACKGROUND.some((element) =>
-                  location.pathname.startsWith(element)
+                  location.pathname.startsWith(element),
                 ),
                 'white-background': TEMP_PAGELIST_WITH_NEW_BACKGROUND_WHITE.includes(
                   location.pathname,
index 9335287588106445240e4b393f9ce6154c04ff0a..c65492aa46285dea87cd35dd4b61b060fd66efd7 100644 (file)
@@ -56,12 +56,12 @@ export default function CaycReviewUpdateConditionsModal(props: Props) {
   const { weakConditions, missingConditions } = getWeakMissingAndNonCaycConditions(conditions);
   const sortedWeakConditions = sortBy(
     weakConditions,
-    (condition) => metrics[condition.metric] && metrics[condition.metric].name
+    (condition) => metrics[condition.metric] && metrics[condition.metric].name,
   );
 
   const sortedMissingConditions = sortBy(
     missingConditions,
-    (condition) => metrics[condition.metric] && metrics[condition.metric].name
+    (condition) => metrics[condition.metric] && metrics[condition.metric].name,
   );
 
   const getDocUrl = useDocUrl();
@@ -82,7 +82,7 @@ export default function CaycReviewUpdateConditionsModal(props: Props) {
               onSaveCondition(resultCondition, currentCondition);
             }
           })
-          .catch(() => undefined)
+          .catch(() => undefined),
       );
     });
 
@@ -93,7 +93,7 @@ export default function CaycReviewUpdateConditionsModal(props: Props) {
           gateName: qualityGate.name,
         })
           .then((resultCondition) => onAddCondition(resultCondition))
-          .catch(() => undefined)
+          .catch(() => undefined),
       );
     });
 
@@ -123,7 +123,7 @@ export default function CaycReviewUpdateConditionsModal(props: Props) {
           <Title as="h4" className="sw-mb-2 sw-mt-4 sw-body-sm-highlight">
             {translateWithParameters(
               'quality_gates.cayc.review_update_modal.add_condition.header',
-              sortedMissingConditions.length
+              sortedMissingConditions.length,
             )}
           </Title>
           <ConditionsTable
@@ -140,7 +140,7 @@ export default function CaycReviewUpdateConditionsModal(props: Props) {
           <Title as="h4" className="sw-mb-2 sw-mt-4 sw-body-sm-highlight">
             {translateWithParameters(
               'quality_gates.cayc.review_update_modal.modify_condition.header',
-              sortedWeakConditions.length
+              sortedWeakConditions.length,
             )}
           </Title>
           <ConditionsTable
@@ -163,7 +163,7 @@ export default function CaycReviewUpdateConditionsModal(props: Props) {
       isLarge
       headerTitle={translateWithParameters(
         'quality_gates.cayc.review_update_modal.header',
-        qualityGate.name
+        qualityGate.name,
       )}
       onClose={onClose}
       body={body}
index 69e0f2237e626e527eb1e91b7261b8958fc7cdb8..544c817564e772c018c786b09cedbb7f418a0fa9 100644 (file)
@@ -85,14 +85,14 @@ export function Conditions({
   updatedConditionId,
 }: Props) {
   const [editing, setEditing] = React.useState<boolean>(
-    qualityGate.caycStatus === CaycStatus.NonCompliant
+    qualityGate.caycStatus === CaycStatus.NonCompliant,
   );
   const canEdit = Boolean(qualityGate.actions?.manageConditions);
   const { conditions = [] } = qualityGate;
   const existingConditions = conditions.filter((condition) => metrics[condition.metric]);
   const { overallCodeConditions, newCodeConditions } = groupAndSortByPriorityConditions(
     existingConditions,
-    metrics
+    metrics,
   );
 
   const duplicates: ConditionType[] = [];
@@ -123,10 +123,10 @@ export function Conditions({
           (metric) =>
             !metric.hidden &&
             !FORBIDDEN_METRIC_TYPES.includes(metric.type) &&
-            !FORBIDDEN_METRICS.includes(metric.key)
+            !FORBIDDEN_METRICS.includes(metric.key),
         ),
         conditions,
-        (metric, condition) => metric.key === condition.metric
+        (metric, condition) => metric.key === condition.metric,
       );
       return (
         <ConditionModal
@@ -138,7 +138,7 @@ export function Conditions({
         />
       );
     },
-    [metrics, qualityGate, onAddCondition]
+    [metrics, qualityGate, onAddCondition],
   );
 
   const renderCaycModal = React.useCallback(
@@ -161,7 +161,7 @@ export function Conditions({
         />
       );
     },
-    [qualityGate, metrics, updatedConditionId, onAddCondition, onRemoveCondition, onSaveCondition]
+    [qualityGate, metrics, updatedConditionId, onAddCondition, onRemoveCondition, onSaveCondition],
   );
 
   return (
index 271bbef4a75af1a7d7ae89486cdad92070a1200e..b6ef0834e6ca4923946d137e802782756ce0cb8d 100644 (file)
@@ -55,7 +55,7 @@ export function MetricSelect({ metric, metricsArray, metrics, onMetricChange }:
       label: getLocalizedMetricNameNoDiffMetric(m, metrics),
       domain: m.domain,
     })),
-    'domain'
+    'domain',
   );
 
   // Use "disabled" property to emulate optgroups.
@@ -76,7 +76,7 @@ export function MetricSelect({ metric, metricsArray, metrics, onMetricChange }:
     (query: string, resolve: (options: Options<LabelValueSelectOption<string>>) => void) => {
       resolve(options.filter((opt) => opt.label.toLowerCase().includes(query.toLowerCase())));
     },
-    [options]
+    [options],
   );
 
   return (
index f4e36d6a02ba84eab96bdec2f014dc6490917979..49767caa32c1166a11e35608ce7be22e779a7421 100644 (file)
@@ -53,7 +53,7 @@ export default class QualityGatePermissionsAddModal extends React.Component<Prop
 
   handleSearch = (
     q: string,
-    resolve: (options: Options<LabelValueSelectOption<UserBase | Group>>) => void
+    resolve: (options: Options<LabelValueSelectOption<UserBase | Group>>) => void,
   ) => {
     const { qualityGate } = this.props;
 
@@ -68,7 +68,7 @@ export default class QualityGatePermissionsAddModal extends React.Component<Prop
         [...usersResponse.users, ...groupsResponse.groups].map((o) => ({
           value: o,
           label: isUser(o) ? `${o.name} ${o.login}` : o.name,
-        }))
+        })),
       )
       .then(resolve)
       .catch(() => resolve([]));
index 37d49034fa9d43a070f538ff16759f449166ce76..9dcfd8eb17aedaf992e1d0e0ab20b3b51ec8abcd 100644 (file)
@@ -37,7 +37,7 @@ export interface QualityGatePermissionsAddModalRendererProps {
   onClose: () => void;
   handleSearch: (
     q: string,
-    resolve: (options: Options<LabelValueSelectOption<UserBase | UserGroup>>) => void
+    resolve: (options: Options<LabelValueSelectOption<UserBase | UserGroup>>) => void,
   ) => void;
   onSelection: (selection: SingleValue<LabelValueSelectOption<UserBase | UserGroup>>) => void;
   selection?: UserBase | UserGroup;
@@ -139,7 +139,7 @@ function OptionRenderer({
 function Option<
   Option extends LabelValueSelectOption<UserBase | UserGroup>,
   IsMulti extends boolean = false,
-  Group extends GroupBase<Option> = GroupBase<Option>
+  Group extends GroupBase<Option> = GroupBase<Option>,
 >(props: OptionProps<Option, IsMulti, Group>) {
   const {
     data: { value },
index de602a125b0adc5802101e363ad90a03e597a184..8522ed7a4887e83c87d9786312a87c654d1ec1a8 100644 (file)
@@ -42,7 +42,7 @@ it('should open the default quality gates', async () => {
     await screen.findByRole('button', {
       current: 'page',
       name: `${defaultQualityGate.name} default`,
-    })
+    }),
   ).toBeInTheDocument();
 });
 
@@ -52,13 +52,13 @@ it('should list all quality gates', async () => {
   expect(
     await screen.findByRole('button', {
       name: `${handler.getDefaultQualityGate().name} default`,
-    })
+    }),
   ).toBeInTheDocument();
 
   expect(
     screen.getByRole('button', {
       name: `${handler.getBuiltInQualityGate().name} quality_gates.built_in`,
-    })
+    }),
   ).toBeInTheDocument();
 });
 
@@ -228,7 +228,7 @@ it('should be able to add a condition', async () => {
   await user.click(dialog.getByRole('button', { name: 'quality_gates.add_condition' }));
 
   expect(
-    await overallConditions.findByRole('cell', { name: 'Maintainability Rating' })
+    await overallConditions.findByRole('cell', { name: 'Maintainability Rating' }),
   ).toBeInTheDocument();
   expect(await overallConditions.findByRole('cell', { name: 'B' })).toBeInTheDocument();
 });
@@ -241,7 +241,7 @@ it('should be able to edit a condition', async () => {
   const newConditions = within(await screen.findByTestId('quality-gates__conditions-new'));
 
   await user.click(
-    newConditions.getByLabelText('quality_gates.condition.edit.Coverage on New Code')
+    newConditions.getByLabelText('quality_gates.condition.edit.Coverage on New Code'),
   );
   const dialog = within(screen.getByRole('dialog'));
   await user.click(dialog.getByRole('textbox', { name: 'quality_gates.conditions.value' }));
@@ -258,12 +258,12 @@ it('should be able to handle duplicate or deprecated condition', async () => {
 
   await user.click(
     // make it a regexp to ignore badges:
-    await screen.findByRole('button', { name: new RegExp(handler.getCorruptedQualityGateName()) })
+    await screen.findByRole('button', { name: new RegExp(handler.getCorruptedQualityGateName()) }),
   );
 
   expect(await screen.findByText('quality_gates.duplicated_conditions')).toBeInTheDocument();
   expect(
-    await screen.findByRole('cell', { name: 'Complexity / Function deprecated' })
+    await screen.findByRole('cell', { name: 'Complexity / Function deprecated' }),
   ).toBeInTheDocument();
 });
 
@@ -276,7 +276,7 @@ it('should be able to handle delete condition', async () => {
   const newConditions = within(await screen.findByTestId('quality-gates__conditions-new'));
 
   await user.click(
-    newConditions.getByLabelText('quality_gates.condition.delete.Coverage on New Code')
+    newConditions.getByLabelText('quality_gates.condition.delete.Coverage on New Code'),
   );
 
   const dialog = within(screen.getByRole('dialog'));
@@ -291,10 +291,10 @@ it('should explain condition on branch', async () => {
   renderQualityGateApp({ featureList: [Feature.BranchSupport] });
 
   expect(
-    await screen.findByText('quality_gates.conditions.new_code.description')
+    await screen.findByText('quality_gates.conditions.new_code.description'),
   ).toBeInTheDocument();
   expect(
-    await screen.findByText('quality_gates.conditions.overall_code.description')
+    await screen.findByText('quality_gates.conditions.overall_code.description'),
   ).toBeInTheDocument();
 });
 
@@ -310,29 +310,29 @@ it('should show warning banner when CAYC condition is not properly set and shoul
   expect(screen.getByText('quality_gates.cayc_missing.banner.title')).toBeInTheDocument();
   expect(screen.getByText('quality_gates.cayc_missing.banner.description')).toBeInTheDocument();
   expect(
-    screen.getByRole('button', { name: 'quality_gates.cayc_condition.review_update' })
+    screen.getByRole('button', { name: 'quality_gates.cayc_condition.review_update' }),
   ).toBeInTheDocument();
 
   await user.click(
-    screen.getByRole('button', { name: 'quality_gates.cayc_condition.review_update' })
+    screen.getByRole('button', { name: 'quality_gates.cayc_condition.review_update' }),
   );
   expect(
     screen.getByRole('dialog', {
       name: 'quality_gates.cayc.review_update_modal.header.SonarSource way - CFamily',
-    })
+    }),
   ).toBeInTheDocument();
   expect(
-    screen.getByText('quality_gates.cayc.review_update_modal.description1')
+    screen.getByText('quality_gates.cayc.review_update_modal.description1'),
   ).toBeInTheDocument();
   expect(
-    screen.getByText('quality_gates.cayc.review_update_modal.description2')
+    screen.getByText('quality_gates.cayc.review_update_modal.description2'),
   ).toBeInTheDocument();
   expect(
-    screen.getByRole('button', { name: 'quality_gates.cayc.review_update_modal.confirm_text' })
+    screen.getByRole('button', { name: 'quality_gates.cayc.review_update_modal.confirm_text' }),
   ).toBeInTheDocument();
 
   await user.click(
-    screen.getByRole('button', { name: 'quality_gates.cayc.review_update_modal.confirm_text' })
+    screen.getByRole('button', { name: 'quality_gates.cayc.review_update_modal.confirm_text' }),
   );
 
   const conditionsWrapper = within(await screen.findByTestId('quality-gates__conditions-new'));
@@ -344,7 +344,7 @@ it('should show warning banner when CAYC condition is not properly set and shoul
   expect(conditionsWrapper.getByText('Duplicated Lines (%)')).toBeInTheDocument();
 
   const overallConditionsWrapper = within(
-    await screen.findByTestId('quality-gates__conditions-overall')
+    await screen.findByTestId('quality-gates__conditions-overall'),
   );
   expect(overallConditionsWrapper.getByText('Complexity / Function')).toBeInTheDocument();
 });
@@ -385,13 +385,13 @@ it('should show success banner when quality gate is CAYC compliant', async () =>
 
   expect(screen.getByText('quality_gates.cayc.banner.title')).toBeInTheDocument();
   expect(
-    screen.getByText('quality_gates.cayc.banner.description1', { exact: false })
+    screen.getByText('quality_gates.cayc.banner.description1', { exact: false }),
   ).toBeInTheDocument();
   expect(
-    screen.queryByText('quality_gates.cayc_condition.missing_warning.title')
+    screen.queryByText('quality_gates.cayc_condition.missing_warning.title'),
   ).not.toBeInTheDocument();
   expect(
-    screen.queryByRole('button', { name: 'quality_gates.cayc_condition.review_update' })
+    screen.queryByRole('button', { name: 'quality_gates.cayc_condition.review_update' }),
   ).not.toBeInTheDocument();
 
   const conditionsWrapper = within(await screen.findByTestId('quality-gates__conditions-new'));
@@ -415,24 +415,24 @@ it('should unlock editing option for CAYC conditions', async () => {
   expect(
     screen.queryByRole('button', {
       name: 'quality_gates.condition.edit.Security Rating on New Code',
-    })
+    }),
   ).not.toBeInTheDocument();
   expect(
     screen.queryByRole('button', {
       name: 'quality_gates.condition.delete.Security Rating on New Code',
-    })
+    }),
   ).not.toBeInTheDocument();
 
   await user.click(screen.getByText('quality_gates.cayc.unlock_edit'));
   expect(
     screen.getByRole('button', {
       name: 'quality_gates.condition.edit.Security Rating on New Code',
-    })
+    }),
   ).toBeInTheDocument();
   expect(
     screen.getByRole('button', {
       name: 'quality_gates.condition.delete.Security Rating on New Code',
-    })
+    }),
   ).toBeInTheDocument();
 });
 
@@ -533,7 +533,7 @@ describe('The Permissions section', () => {
     expect(
       await screen.findByRole('button', {
         name: `${handler.getDefaultQualityGate().name} default`,
-      })
+      }),
     ).toBeInTheDocument();
 
     expect(screen.queryByText('quality_gates.permissions')).not.toBeInTheDocument();