aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Perrin <philippe.perrin@sonarsource.com>2022-11-02 11:08:39 +0100
committersonartech <sonartech@sonarsource.com>2022-11-02 20:03:01 +0000
commit2ab6fc273ecbf405f7c126fab11ddc0b9bf516da (patch)
treea6e005b4f57fb488d3e551b7df52399e69b0674c
parent60e4b88e4567c1af3051b6cdc4c8858f8b0fca21 (diff)
downloadsonarqube-2ab6fc273ecbf405f7c126fab11ddc0b9bf516da.tar.gz
sonarqube-2ab6fc273ecbf405f7c126fab11ddc0b9bf516da.zip
SONAR-13368 Bump to prettier@2.7.1
-rw-r--r--server/sonar-web/.prettierrc4
-rw-r--r--server/sonar-web/package.json7
-rw-r--r--server/sonar-web/src/main/js/api/alm-integrations.ts24
-rw-r--r--server/sonar-web/src/main/js/api/alm-settings.ts2
-rw-r--r--server/sonar-web/src/main/js/api/application.ts4
-rw-r--r--server/sonar-web/src/main/js/api/auth.ts5
-rw-r--r--server/sonar-web/src/main/js/api/branches.ts9
-rw-r--r--server/sonar-web/src/main/js/api/ce.ts4
-rw-r--r--server/sonar-web/src/main/js/api/components.ts18
-rw-r--r--server/sonar-web/src/main/js/api/issues.ts20
-rw-r--r--server/sonar-web/src/main/js/api/languages.ts2
-rw-r--r--server/sonar-web/src/main/js/api/measures.ts14
-rw-r--r--server/sonar-web/src/main/js/api/metrics.ts2
-rw-r--r--server/sonar-web/src/main/js/api/mocks/AuthenticationServiceMock.ts10
-rw-r--r--server/sonar-web/src/main/js/api/mocks/BranchesServiceMock.ts2
-rw-r--r--server/sonar-web/src/main/js/api/mocks/CodeServiceMocks.ts30
-rw-r--r--server/sonar-web/src/main/js/api/mocks/CodingRulesMock.ts108
-rw-r--r--server/sonar-web/src/main/js/api/mocks/ComputeEngineServiceMock.ts28
-rw-r--r--server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts196
-rw-r--r--server/sonar-web/src/main/js/api/mocks/NotificationsMock.ts10
-rw-r--r--server/sonar-web/src/main/js/api/mocks/PermissionTemplateServiceMock.ts10
-rw-r--r--server/sonar-web/src/main/js/api/mocks/QualityGatesServiceMock.ts88
-rw-r--r--server/sonar-web/src/main/js/api/mocks/SecurityHotspotServiceMock.ts30
-rw-r--r--server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts10
-rw-r--r--server/sonar-web/src/main/js/api/mocks/SourceViewerServiceMock.ts72
-rw-r--r--server/sonar-web/src/main/js/api/mocks/UserTokensMock.ts16
-rw-r--r--server/sonar-web/src/main/js/api/permissions.ts6
-rw-r--r--server/sonar-web/src/main/js/api/plugins.ts14
-rw-r--r--server/sonar-web/src/main/js/api/projectActivity.ts12
-rw-r--r--server/sonar-web/src/main/js/api/projectLinks.ts7
-rw-r--r--server/sonar-web/src/main/js/api/quality-gates.ts6
-rw-r--r--server/sonar-web/src/main/js/api/quality-profiles.ts23
-rw-r--r--server/sonar-web/src/main/js/api/rules.ts10
-rw-r--r--server/sonar-web/src/main/js/api/security-hotspots.ts14
-rw-r--r--server/sonar-web/src/main/js/api/settings.ts12
-rw-r--r--server/sonar-web/src/main/js/api/static.ts2
-rw-r--r--server/sonar-web/src/main/js/api/time-machine.ts6
-rw-r--r--server/sonar-web/src/main/js/api/user-tokens.ts2
-rw-r--r--server/sonar-web/src/main/js/api/user_groups.ts2
-rw-r--r--server/sonar-web/src/main/js/api/users.ts2
-rw-r--r--server/sonar-web/src/main/js/api/web-api.ts2
-rw-r--r--server/sonar-web/src/main/js/app/components/AdminContainer.tsx11
-rw-r--r--server/sonar-web/src/main/js/app/components/AdminContext.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/App.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/ComponentContainer.tsx39
-rw-r--r--server/sonar-web/src/main/js/app/components/GlobalFooter.tsx9
-rw-r--r--server/sonar-web/src/main/js/app/components/GlobalFooterBranding.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/GlobalMessage.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/GlobalMessagesContainer.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx33
-rw-r--r--server/sonar-web/src/main/js/app/components/MigrationContainer.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/NonAdminPagesContainer.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/PageTracker.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/PluginRiskConsent.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/RecentHistory.ts4
-rw-r--r--server/sonar-web/src/main/js/app/components/SonarLintConnection.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/StartupModal.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/SystemAnnouncement.tsx9
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/AdminContainer-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/App-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx73
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/KeyboardShortcutsModal-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/Landing-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/MigrationContainer-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/PageTracker-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/PluginRiskConsent-test.tsx11
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/RecentHistory-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/ResetPassword-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/SonarLintConnection-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx15
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/SystemAnnouncement-test.tsx26
-rw-r--r--server/sonar-web/src/main/js/app/components/app-state/AppStateContext.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/app-state/AppStateContextProvider.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/app-state/__tests__/AppStateContextProvider-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/app-state/__tests__/withAppStateContext-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/app-state/withAppStateContext.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/available-features/__tests__/withAvailableFeatures-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/branch-status/BranchStatusContext.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/branch-status/BranchStatusContextProvider.tsx17
-rw-r--r--server/sonar-web/src/main/js/app/components/branch-status/__tests__/BranchStatusContextProvider-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/componentContext/ComponentContext.ts2
-rw-r--r--server/sonar-web/src/main/js/app/components/componentContext/withComponentContext.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/current-user/CurrentUserContextProvider.tsx15
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/CreateApplicationForm.tsx15
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/Extension.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/__tests__/CreateApplicationForm-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/__tests__/Extension-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/__tests__/GlobalPageExtension-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectAdminPageExtension-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectPageExtension-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/extensions/exposeLibraries.ts22
-rw-r--r--server/sonar-web/src/main/js/app/components/indexation/IndexationNotification.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationHelper.ts2
-rw-r--r--server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationRenderer.tsx18
-rw-r--r--server/sonar-web/src/main/js/app/components/indexation/PageUnavailableDueToIndexation.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx38
-rw-r--r--server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationHelper-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationRenderer-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/indexation/__tests__/PageUnavailableDueToIndexation-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/languages/LanguagesContextProvider.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/languages/__tests__/LanguagesContextProvider-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/languages/__tests__/withLanguagesContext-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/languages/withLanguagesContext.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/metrics/MetricsContextProvider.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/metrics/__tests__/MetricsContextProvider-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/metrics/__tests__/withMetricsContext-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/metrics/withMetricsContext.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx17
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavWarnings.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/HeaderMeta.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx98
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx56
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavProjectBindingErrorNotif-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/HeaderMeta-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/Menu-test.tsx28
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/BranchLikeNavigation.tsx15
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx26
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLikeMergeInformation.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx29
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItem.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItemList.tsx42
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/BranchLikeNavigation-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLike-test.tsx34
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLikeMergeInformation-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItemList-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/DrawerLink.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/InfoDrawer.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/InfoDrawerPage.tsx8
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformation.tsx14
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformationPages.ts2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformationRenderer.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformation-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformationRenderer-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/BadgeParams.tsx31
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/ProjectBadges.tsx19
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/BadgeParams-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/ProjectBadges-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/utils-test.ts4
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/utils.ts2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaLink.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaLinks.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityProfiles.tsx15
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaSize.tsx7
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaTags.tsx13
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaTagsSelector.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaLink-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaQualityProfiles-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaSize-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTags-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTagsSelector-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/ProjectNotifications.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/__tests__/ProjectNotifications-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/projectInformation/projectRegulatoryReport/RegulatoryReport.tsx25
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx27
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavBranding-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavMenu-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/PendingPluginsActionNotif.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx33
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/SystemRestartNotif.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/app/components/promotion-notification/PromotionNotification.tsx3
-rw-r--r--server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/app/components/search/Search.tsx39
-rw-r--r--server/sonar-web/src/main/js/app/components/search/SearchResult.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/search/SearchResults.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/search/SearchShowMore.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/search/__tests__/Search-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/app/components/search/__tests__/SearchResult-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/search/__tests__/SearchResults-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/app/components/search/__tests__/SearchShowMore-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/search/utils.ts4
-rw-r--r--server/sonar-web/src/main/js/app/components/update-notification/UpdateNotification.tsx19
-rw-r--r--server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx38
-rw-r--r--server/sonar-web/src/main/js/app/index.ts6
-rw-r--r--server/sonar-web/src/main/js/app/theme.js14
-rw-r--r--server/sonar-web/src/main/js/app/utils/NavigateWithParams.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/utils/__tests__/handleRequiredAuthorization-test.ts6
-rw-r--r--server/sonar-web/src/main/js/app/utils/exportModulesAsGlobals.ts2
-rw-r--r--server/sonar-web/src/main/js/app/utils/isValidUri.ts2
-rw-r--r--server/sonar-web/src/main/js/app/utils/startReactApp.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx120
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/ProjectModal.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/account/profile/Preferences.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/account/profile/Profile.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/account/projects/Projects.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/audit-logs/utils.ts4
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/NoWorkersSupportPopup.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Search.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/StatPendingCount.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/BackgroundTasksApp-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/StatPendingCount-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/StatPendingTime-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskStatus-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Workers-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/WorkersForm-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/constants.ts8
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/utils.ts6
-rw-r--r--server/sonar-web/src/main/js/apps/change-admin-password/ChangeAdminPasswordApp.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/change-admin-password/ChangeAdminPasswordAppRenderer.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/change-admin-password/__tests__/ChangeAdminPasswordApp-it.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts2
-rw-r--r--server/sonar-web/src/main/js/apps/code/__tests__/buckets-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/code/__tests__/utils-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/code/bucket.ts4
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Component.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Components.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Search.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/__tests__/CodeApp-test.tsx58
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentMeasure-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentName-test.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/__tests__/Search-test.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/code/utils.ts40
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts82
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/ActivationButton.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx63
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/BulkChange.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx31
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/Facet.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/LanguageFacet.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/ProfileFacet.tsx27
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RepositoryFacet.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsDescription.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx29
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsTagsPopup.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleInheritanceIcon.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/SimilarRulesFilter.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/TagFacet.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/TemplateFacet.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/ActivationFormModal-test.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/App-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/BulkChange-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/CustomRuleFormModal-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/LanguageFacet-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RepositoryFacet-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetails-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsIssues-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsMeta-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsTagsPopup-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx34
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/TagFacet-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/query.ts8
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/routes.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule.ts2
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/__tests__/utils-test.ts48
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/App.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx47
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverviewContainer.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/__tests__/App-test.tsx38
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumb-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumbs-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/__tests__/LeakPeriodLegend-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureContent-test.tsx36
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureHeader-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureOverview-test.tsx28
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/config/bubbles.ts14
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/config/complementary.ts2
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/config/domains.ts38
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx29
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx31
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/BubbleChart-test.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx56
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentList-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/FilesView-test.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/routes.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/DomainFacet-test.tsx26
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/FacetMeasureValue-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/Sidebar-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/utils.ts54
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/AzurePersonalAccessTokenForm.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/AzureProjectAccordion.tsx27
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/AzureProjectCreate.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/AzureProjectsList.tsx19
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/BitbucketCloudProjectCreate.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/BitbucketCloudProjectCreateRender.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/BitbucketCloudSearchForm.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/BitbucketImportRepositoryForm.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/BitbucketProjectAccordion.tsx26
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/BitbucketProjectCreate.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/BitbucketProjectCreateRenderer.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/BitbucketRepositories.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/BitbucketSearchResults.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/CreateProjectModeSelection.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx28
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreate.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/GitlabProjectCreate.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/GitlabProjectCreateRenderer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/GitlabProjectSelectionForm.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/ManualProjectCreate.tsx34
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/PersonalAccessTokenForm.tsx50
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/AzurePersonalAccessTokenForm-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectAccordion-test.tsx57
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectCreate-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectCreateRenderer-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectsList-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudProjectCreate-test.tsx26
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudProjectCreateRender-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudSearchForm-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketImportRepositoryForm-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectAccordion-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectCreate-test.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectCreateRenderer-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketRepositories-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketSearchResults-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectModeSelection-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx41
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/GitHubProjectCreate-test.tsx32
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/GitHubProjectCreateRenderer-test.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectCreate-test.tsx32
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectCreateRenderer-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectSelectionForm-test.tsx21
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/ManualProjectCreate-test.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/PersonalAccessTokenForm-test.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/types.ts2
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/App.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/EditMembers.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx26
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/Form.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/List.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/ListItem.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/__tests__/App-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/__tests__/EditMembersModal-test.tsx29
-rw-r--r--server/sonar-web/src/main/js/apps/groups/components/__tests__/List-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx48
-rw-r--r--server/sonar-web/src/main/js/apps/issues/__tests__/actions-test.ts16
-rw-r--r--server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/actions.ts12
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/AssigneeSelect.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx67
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/IssueHeader.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx126
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/IssuesList.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/AssigneeSelect-test.tsx26
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/BulkChangeModal-test.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/ComponentBreadcrumbs-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesApp-test.tsx77
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesSourceViewer-test.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationBadge.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssueLocations-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx47
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx21
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx34
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/ComponentSourceSnippetGroupViewer-test.tsx103
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/CrossComponentSourceViewer-test.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/SnippetViewer-test.tsx34
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/utils-test.ts85
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/utils.ts28
-rw-r--r--server/sonar-web/src/main/js/apps/issues/routes.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/AssigneeFacet.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/DirectoryFacet.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/LanguageFacet.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/PeriodFilter.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/ResolutionFacet.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/ScopeFacet.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/StandardFacet.tsx64
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/TypeFacet.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AssigneeFacet-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/CreationDateFacet-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/DirectoryFacet-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/PeriodFilter-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ProjectFacet-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/RuleFacet-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ScopeFacet-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StandardFacet-test.tsx57
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StatusFacet-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/TypeFacet-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/utils.ts20
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/components/App.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx36
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/App.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/MarketplaceAppContainer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/PluginsList.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/Search.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/__tests__/App-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/__tests__/EditionBoxes-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceAppContainer-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/__tests__/PluginUpdates-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/__tests__/PluginsList-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLog.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogButton.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginLicense.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginOrganization.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginRiskConsentBox.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateButton.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdates.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginUrls.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginActions-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginAvailable-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginChangeLog-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginDescription-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginOrganization-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginUrls-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/utils.ts8
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/ApplicationLeakPeriodInfo.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx87
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/DebtValue.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/DrilldownMeasureValue.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/Event.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx27
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanel.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/NoCodeWarning.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanelSection.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/Analysis-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/ApplicationLeakPeriodInfo-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx90
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/DebtValue-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/Event-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelIssueMeasureRow-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/NoCodeWarning-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanel-test.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/SecurityHotspotsReviewed-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/App.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/IssueRating.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/MeasurementLabel.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/QualityGateConditions.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/SonarLintPromotion.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueLabel-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueRating-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/MeasurementLabel-test.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateCondition-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/SonarLintPromition-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx27
-rw-r--r--server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/AfterMergeEstimate-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-test.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/overview/utils.ts18
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/App.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/Defaults.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/Form.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/Header.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/List.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/ListHeader.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/Template.tsx19
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/ActionsCell-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/App-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Defaults-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/ListItem-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/NameCell-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Template-test.tsx30
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/utils.ts14
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/__tests__/utils-test.ts6
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/global/components/AllHoldersList.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx42
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/AllHoldersList-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/App-test.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/AllHoldersList.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/App.tsx48
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/App-test.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/ApplyTemplate-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionCell.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionHeader.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/SearchForm.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/GroupHolder-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/HoldersList-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/PermissionCell-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/UserHolder-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/utils.ts20
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/__tests__/actions-test.ts22
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.ts54
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/actions.ts20
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/Events.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.tsx27
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx52
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityDateInput.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/Event-test.tsx28
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/Events-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysesList-test.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysis-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-it.tsx31
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-test.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppRenderer-test.tsx30
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityGraphs-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddEventForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveAnalysisForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/forms/__tests__/AddEventForm-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/utils.ts17
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/App.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/AppHeader.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingAnalysis.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingDays.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingPreviousVersion.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingReferenceBranch.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisList.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisListRenderer.tsx37
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/BranchBaselineSettingModal.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/BranchList.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/ProjectBaselineSelector.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/App-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingAnalysis-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingDays-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingPreviousVersion-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingReferenceBranch-test.tsx34
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchAnalysisList-test.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchAnalysisListRenderer-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchBaselineSettingModal-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchList-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchListRow-test.tsx26
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/ProjectBaselineSelector-test.tsx33
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/utils-test.ts26
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/utils.ts4
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTable.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTabs.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/BranchPurgeSetting.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformation.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTable-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTabs-test.tsx52
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchPurgeSetting-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformation-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformationRenderer-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/ProjectBranchesApp-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectDeletion/__tests__/Form-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Export-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Import-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectKey/UpdateForm.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projectKey/__tests__/Key-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectKey/__tests__/UpdateForm-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/projectLinks/App.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/projectLinks/CreationModal.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectLinks/Table.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectLinks/__tests__/App-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projectLinks/__tests__/Table-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateApp.tsx31
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx31
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-test.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateAppRenderer-test.tsx26
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesApp.tsx46
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesApp-test.tsx46
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesAppRenderer-test.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/components/AddLanguageModal.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/components/SetQualityProfileModal.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/AddLanguageModal-test.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/LanguageProfileSelectOption-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/SetQualityProfileModal-test.tsx33
-rw-r--r--server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts26
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ApplicationCreation.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/EmptyFavoriteSearch.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/FavoriteFilter.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/PageHeader.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/PageSidebar.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenuItem.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.tsx21
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/ApplicationCreation-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/EmptyInstance-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/FavoriteFilter-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/PageHeader-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/PageSidebar-test.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCreationMenu-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectsList-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectsSortingSelect-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardLanguages.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasure.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCard-test.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCardLanguages-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCardMeasures-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx21
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/SecurityReviewFilter.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/__tests__/Filter-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/__tests__/LanguagesFilter-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/__tests__/NewLinesFilter-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/__tests__/SearchableFilterFooter-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/__tests__/SizeFilter-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/query.ts24
-rw-r--r--server/sonar-web/src/main/js/apps/projects/utils.ts38
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/ChangeDefaultVisibilityForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/DeleteModal.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/ProjectRowActions.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/RestoreAccessModal.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/BulkApplyTemplateModal-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ChangeDefaultVisibilityForm-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/DeleteModal-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Header-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-it.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-test.tsx21
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRow-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRowActions-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Search-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/__tests__/utils-test.ts2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/App.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/ConditionOperator.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx41
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/CopyQualityGateForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/CreateQualityGateForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/DeleteQualityGateForm.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/Details.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/MetricSelect.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/Projects.tsx32
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissions.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModal.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModalRenderer.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsRenderer.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/RenameQualityGateForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/ThresholdInput.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/App-it.tsx26
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/utils.ts6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogSearch-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonForm-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResultActivation-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx51
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx37
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileLink.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileModalForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/QualityProfilesApp.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/ProfileActions-test.tsx60
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/ProfileContainer-test.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/QualityProfilesApp-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritanceBox.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissions.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsGroup.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsUser.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ChangeParentForm-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ChangeProjectsForm-test.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileDetails-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileInheritance-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileInheritanceBox-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissions-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsForm-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsFormSelect-test.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsGroup-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsUser-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileProjects-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileRules-test.tsx30
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx29
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListHeader.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/CreateProfileForm-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/EvolutionDeprecated-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/PageHeader-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/ProfilesList-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/ProfilesListHeader-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/types.ts2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/utils.ts18
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx58
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-test.tsx89
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/__tests__/utils-test.ts92
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx19
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotCategory.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotCommentPopup.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotHeader.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotListItem.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeButton.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeOverlay.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotPrimaryLocationBox.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistory.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistoryAndComments.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSimpleList.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainer.tsx30
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainerRenderer.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetHeader.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerTabs.tsx31
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/FilterBar-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotCategory-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotCommentPopup-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotHeader-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotList-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeButton-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeOverlay-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotPrimaryLocationBox-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotReviewHistory-test.tsx64
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotReviewHistoryAndComments-test.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSimpleList-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx58
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainerRenderer-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetHeader-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewer-test.tsx47
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerRenderer-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerTabs-test.tsx42
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/StatusUpdateSuccessModal-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/Assignee.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelection.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelectionRenderer.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/Assignee-test.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeRenderer-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeSelection-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeSelectionRenderer-test.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.tsx11
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelection.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelectionRenderer.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/Status-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/utils.ts74
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/LoginForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/__tests__/Login-it.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/__tests__/Logout-it.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/sessions/components/__tests__/Unauthorized-it.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/__tests__/utils-test.ts48
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/AdditionalCategories.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/Definition.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/DefinitionActions.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/DefinitionRenderer.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/EmailForm.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/Languages.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/NewCodePeriod.tsx28
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/SettingsApp.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/SettingsAppRenderer.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/SettingsSearch.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/SettingsSearchRenderer.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.tsx21
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/AdditionalCategories-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/AllCategoriesList-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/CategoryDefinitionsList-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/Definition-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionActions-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionRenderer-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/EmailForm-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/NewCodePeriod-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsApp-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsAppRenderer-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsSearch-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsSearchRenderer-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/__tests__/SubCategoryDefinitionsList-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionBox.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionForm.tsx34
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormRenderer.tsx18
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx30
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTab.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx21
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketCloudForm.tsx7
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketForm.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketServerForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/CreationTooltip.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/DeleteModal.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubForm.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionBox-test.tsx30
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionForm-test.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionFormField-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionFormRenderer-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-test.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTab-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTabRenderer-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/BitbucketForm-test.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/CreationTooltip-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/GithubForm-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx28
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/authentication/SamlAuthentication.tsx83
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/authentication/SamlFormField.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/authentication/SamlSecuredField.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/Input.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/InputForFormattedText.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSecured.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForFormattedText-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForSingleSelectList-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx34
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx42
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/AlmSpecificForm-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx63
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBindingRenderer-test.tsx42
-rw-r--r--server/sonar-web/src/main/js/apps/settings/constants.ts2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/settings/encryption/__tests__/EncryptionApp-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/utils.ts34
-rw-r--r--server/sonar-web/src/main/js/apps/system/__tests__/utils-test.ts20
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/App.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/ChangeLogLevelForm.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/ClusterSysInfos.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/PageActions.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/PageHeader.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/StandaloneSysInfos.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/__tests__/App-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/__tests__/ClusterSysInfos-test.tsx22
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/__tests__/PageActions-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/__tests__/PageHeader-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/info-items/HealthCard.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/info-items/HealthCauseItem.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/HealthCard-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/SysInfoItem-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/system/utils.ts22
-rw-r--r--server/sonar-web/src/main/js/apps/users/UsersApp.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/users/UsersList.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/users/__tests__/UsersList-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/DeactivateForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/GroupsForm.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/TokensForm.tsx49
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/TokensFormItem.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserActions.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserForm.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx9
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/__tests__/DeactivateForm-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/__tests__/GroupsForm-test.tsx35
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/__tests__/PasswordForm-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/__tests__/TokensFormItem-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/__tests__/UserActions-test.tsx23
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/__tests__/UserForm-test.tsx25
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/__tests__/UserGroups-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/__tests__/UserListItem-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/__tests__/UserListItemIdentity-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/users/utils.ts4
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/Action.tsx30
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/Params.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/__tests__/Action-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/__tests__/ActionChangelog-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/__tests__/Domain-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/__tests__/Menu-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/__tests__/Params-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/__tests__/ResponseExample-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/__tests__/Search-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/components/__tests__/WebApiApp-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/web-api/utils.ts6
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/App.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/CreateWebhookForm.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/DeliveryAccordion.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/WebhookActions.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/__tests__/DeliveriesForm-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/__tests__/DeliveryAccordion-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/__tests__/LatestDeliveryForm-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/__tests__/PageActions-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookActions-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookItem-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookItemLatestDelivery-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhooksList-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx64
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx25
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewerContext.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx18
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx62
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx32
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeader-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx15
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx20
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/LineOptionsPopup.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx60
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayMeasure.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/Line-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx30
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/duplications-test.ts6
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/highlight-test.ts8
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/indexing-test.ts8
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/issueLocations-test.ts10
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/loadIssues-test.ts18
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/duplications.ts4
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts8
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/indexing.ts20
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/issueLocations.ts6
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/lines.ts2
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/helpers/loadIssues.ts8
-rw-r--r--server/sonar-web/src/main/js/components/a11y/A11yContext.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/a11y/A11yProvider.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/a11y/A11ySkipLinks.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/AddGraphMetric.tsx31
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/DataTableModal.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/DefinitionChangeEventInner.tsx16
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/GraphHistory.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/GraphsHeader.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/GraphsLegendCustom.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/GraphsLegendNewCode.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/GraphsTooltips.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentCoverage.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentDuplication.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentEvents.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentIssues.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/RichQualityGateEventInner.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/ActivityGraph-it.tsx36
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/DataTableModal-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/DefinitionChangeEventInner-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendCustom-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendItem-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendStatic-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltips-test.tsx30
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContent-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentCoverage-test.tsx16
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentDuplication-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentEvents-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentIssues-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/RichQualityGateEventInner-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/__tests__/utils-test.ts48
-rw-r--r--server/sonar-web/src/main/js/components/activity-graph/utils.ts44
-rw-r--r--server/sonar-web/src/main/js/components/charts/AdvancedTimeline.tsx62
-rw-r--r--server/sonar-web/src/main/js/components/charts/BarChart.tsx14
-rw-r--r--server/sonar-web/src/main/js/components/charts/BubbleChart.tsx38
-rw-r--r--server/sonar-web/src/main/js/components/charts/ColorGradientLegend.tsx13
-rw-r--r--server/sonar-web/src/main/js/components/charts/ColorRatingsLegend.tsx13
-rw-r--r--server/sonar-web/src/main/js/components/charts/DonutChart.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/charts/Histogram.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/charts/LineChart.tsx22
-rw-r--r--server/sonar-web/src/main/js/components/charts/TreeMap.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/charts/TreeMapRect.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/charts/ZoomTimeLine.tsx102
-rw-r--r--server/sonar-web/src/main/js/components/charts/__tests__/AdvancedTimeline-test.tsx56
-rw-r--r--server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/charts/__tests__/BubbleChart-test.tsx31
-rw-r--r--server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/charts/__tests__/Histogram-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/charts/__tests__/TreeMap-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/charts/__tests__/ZoomTimeLine-test.tsx40
-rw-r--r--server/sonar-web/src/main/js/components/common/ActivityLink.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/common/AnalysisWarningsModal.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/common/CodeSnippet.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/common/DocLink.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/common/DocumentationTooltip.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/common/Link.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/common/LocationIndex.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/common/MeasuresLink.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/common/MultiSelect.tsx28
-rw-r--r--server/sonar-web/src/main/js/components/common/MultiSelectOption.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/common/ProjectKeyInput.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/common/ResetPasswordForm.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/common/RestartButton.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/common/ScreenPositionHelper.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/common/SelectList.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/common/SelectListItem.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/common/StatusIndicator.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/AnalysisWarningsModal-test.tsx15
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/BranchStatus-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/DocumentationTooltip-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/FormattingTips-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/FormattingTipsWithLink-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/MultiSelect-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/VisibilitySelector-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/controls/ActionsDropdown.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/controls/BackButton.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/controls/BoxedGroupAccordion.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/controls/BoxedTabs.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/controls/ButtonToggle.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/controls/Checkbox.tsx22
-rw-r--r--server/sonar-web/src/main/js/components/controls/ClickEventBoundary.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/ComponentReportActions.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/ComponentReportActionsRenderer.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/controls/ConfirmButton.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/controls/ConfirmModal.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/controls/DateInput.tsx24
-rw-r--r--server/sonar-web/src/main/js/components/controls/DateRangeInput.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/Dropdown.tsx15
-rw-r--r--server/sonar-web/src/main/js/components/controls/Favorite.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/controls/HelpTooltip.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/controls/IdentityProviderLink.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/controls/ListFooter.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/controls/Modal.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/ModalButton.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/Radio.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/controls/RadioCard.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/controls/ReloadButton.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/controls/SearchBox.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/controls/Select.tsx44
-rw-r--r--server/sonar-web/src/main/js/components/controls/SelectList.tsx18
-rw-r--r--server/sonar-web/src/main/js/components/controls/SelectListListContainer.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/controls/SelectListListElement.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/controls/SimpleModal.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/Toggle.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/controls/Toggler.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/Tooltip.tsx19
-rw-r--r--server/sonar-web/src/main/js/components/controls/ValidationForm.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/controls/ValidationInput.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/controls/ValidationModal.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/BoxedGroupAccordion-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/ButtonToggle-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/Checkbox-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActions-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActionsRenderer-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/ConfirmButton-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/ConfirmModal-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/Favorite-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/HomePageSelect-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/IdentityProviderLink-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/ListFooter-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/ModalValidationField-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/RadioCard-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/Select-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/SelectList-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/SelectListListElement-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/Toggler-test.tsx15
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/Tooltip-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/ValidationInput-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/controls/__tests__/clipboard-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/controls/clipboard.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopupHelper.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsContext.ts2
-rw-r--r--server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsProvider.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/EmbedDocsPopup-test.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/facet/FacetBox.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/facet/FacetHeader.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/facet/FacetItem.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx39
-rw-r--r--server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationGuard-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/components/hoc/withCLanguageFeature.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/hoc/withIndexationContext.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/hoc/withIndexationGuard.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/hoc/withKeyboardNavigation.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/hoc/withNotifications.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/hoc/withRouter.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/hoc/withScrollTo.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/icons/DropdownIcon.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/icons/FavoriteIcon.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/icons/HomeIcon.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/icons/Icon.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/icons/StatusIcon.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/icons/TestStatusIcon.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/intl/DateFormatter.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/intl/DateFromNow.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/intl/DateTimeFormatter.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/intl/TimeFormatter.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/intl/__tests__/DateFormatter-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/intl/__tests__/DateFromNow-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/intl/__tests__/DateTimeFormatter-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/intl/__tests__/TimeFormatter-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/intl/__tests__/__snapshots__/dateUtils-test.ts4
-rw-r--r--server/sonar-web/src/main/js/components/intl/dateUtils.ts4
-rw-r--r--server/sonar-web/src/main/js/components/issue/Issue.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/issue/IssueMessageBox.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/issue/IssueView.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/issue/__tests__/IssueView-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/issue/__tests__/actions-test.ts4
-rw-r--r--server/sonar-web/src/main/js/components/issue/__tests__/issue-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/issue/actions.ts4
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueMessage.tsx15
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueMessageTags.tsx15
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/IssueType.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/IssueAssign-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/IssueChangelog-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/IssueChangelogDiff-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTransition-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/CommentForm.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/CommentList.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/CommentTile.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SetIssueTagsPopup.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SetTransitionPopup.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/__tests__/ChangelogPopup-test.tsx34
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/__tests__/SimilarIssuesPopup-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/locations/CrossFileLocationNavigator.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/locations/FlowsList.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/locations/LocationsList.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/locations/SingleFileLocationNavigator.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/measure/Measure.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/measure/RatingTooltipContent.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/measure/utils.ts4
-rw-r--r--server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/rules/RuleDescription.tsx29
-rw-r--r--server/sonar-web/src/main/js/components/rules/RuleTabViewer.tsx49
-rw-r--r--server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tags/TagsList.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/tags/__tests__/TagsSelector-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/TutorialSelection.tsx21
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx24
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/__tests__/utils-test.ts4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/azure-pipelines/AzurePipelinesTutorial.tsx13
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/azure-pipelines/BranchAnalysisStepContent.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ExtensionInstallationStepContent.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/azure-pipelines/JavaToolInstallation.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ServiceEndpointStepContent.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/AzurePipelinesTutorial-it.tsx20
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/AlertClassicEditor.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/ClangGCC.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PrepareAnalysisCommand.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PublishSteps.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/AnalysisCommand.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/BitbucketPipelinesTutorial.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/PreambuleYaml.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/RepositoryVariables.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx37
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/AllSet.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/CompilationInfo.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/EditTokenModal.tsx28
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/ProjectTokenScopeInfo.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/RenderOptions.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/SentenceWithFilename.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/SentenceWithHighlights.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/Step.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/TokenStepGenerator.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/YamlFileStep.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/__tests__/EditTokenModal-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/__tests__/GithubCFamilyExampleRepositories-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/github-action/AnalysisCommand.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/github-action/SecretStep.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/AnalysisCommand-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx35
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/SecretStep-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/github-action/commands/CFamily.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/github-action/commands/Gradle.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/gitlabci/EnvironmentVariablesStep.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/gitlabci/GitLabCITutorial.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/gitlabci/ProjectKeyStep.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/gitlabci/YmlFileStep.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/EnvironmentVariablesStep-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/ProjectKeyStep-test.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/YmlFileStep-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommand.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommand-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsTutorial.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/MultiBranchPipelineStep.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/PreRequisitesStep.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/SelectAlmStep.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStep.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepBitbucket.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGitLab.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGithub.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx35
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsfileStep-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/MultiBranchPipelineStep-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/SelectAlmStep-test.tsx28
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStep-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStepBitbucket-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStepGithub-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/CFamilly.tsx13
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetCore.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CFamilly-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CreateJenkinsfileBulletPoint-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/OtherTutorial.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx38
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/__tests__/TokenStep-test.tsx20
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/DotNet.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetCore.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadBuildWrapper.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/AnalysisCommand-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadBuildWrapper-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadScanner-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecBuildWrapper-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecScanner-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/test-utils.ts6
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/types.ts6
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/utils.ts2
-rw-r--r--server/sonar-web/src/main/js/components/ui/Alert.tsx15
-rw-r--r--server/sonar-web/src/main/js/components/ui/AutoEllipsis.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/ui/Avatar.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/ui/CoverageRating.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/ui/DismissableAlert.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/ui/DuplicationsRating.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/ui/GenericAvatar.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/ui/Level.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/ui/MandatoryFieldMarker.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/ui/NavBar.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/ui/PageShortcutsTooltip.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/ui/Rating.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/ui/SizeRating.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx18
-rw-r--r--server/sonar-web/src/main/js/components/ui/__tests__/Avatar-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx19
-rw-r--r--server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldsExplanation-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/ui/__tests__/popups-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/ui/popups.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/ui/update-center/MetaData.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/ui/update-center/MetaDataVersion.tsx11
-rw-r--r--server/sonar-web/src/main/js/components/ui/update-center/MetaDataVersions.tsx13
-rw-r--r--server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaData-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersion-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersions-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/ui/update-center/mocks/update-center-metadata.ts8
-rw-r--r--server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx19
-rw-r--r--server/sonar-web/src/main/js/components/upgrade/SystemUpgradeIntermediate.tsx9
-rw-r--r--server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx13
-rw-r--r--server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeForm-test.tsx18
-rw-r--r--server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeIntermediate-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeItem-test.tsx14
-rw-r--r--server/sonar-web/src/main/js/components/upgrade/__tests__/utils-test.ts12
-rw-r--r--server/sonar-web/src/main/js/components/upgrade/utils.ts10
-rw-r--r--server/sonar-web/src/main/js/components/workspace/Workspace.tsx47
-rw-r--r--server/sonar-web/src/main/js/components/workspace/WorkspaceComponentViewer.tsx12
-rw-r--r--server/sonar-web/src/main/js/components/workspace/WorkspaceHeader.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/workspace/WorkspaceNav.tsx8
-rw-r--r--server/sonar-web/src/main/js/components/workspace/WorkspaceRuleDetails.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/workspace/WorkspaceRuleViewer.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx32
-rw-r--r--server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceComponentViewer-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceHeader-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceNav-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceRuleDetails-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceRuleViewer-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/workspace/context.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts8
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/error-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/extensions-test.ts11
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/extensionsHandler-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/handleRequiredAuthentication-test.ts6
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts54
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts12
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts10
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts16
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/pages-test.ts6
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/path-test.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/periods-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts14
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/query-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/ratings-test.ts14
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/request-test.ts6
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/scrolling-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts56
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts8
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts30
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts92
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/users-test.ts16
-rw-r--r--server/sonar-web/src/main/js/helpers/branch-like.ts28
-rw-r--r--server/sonar-web/src/main/js/helpers/browser.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/code-difference.ts11
-rw-r--r--server/sonar-web/src/main/js/helpers/component.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/constants.ts16
-rw-r--r--server/sonar-web/src/main/js/helpers/cookies.ts20
-rw-r--r--server/sonar-web/src/main/js/helpers/editions.ts12
-rw-r--r--server/sonar-web/src/main/js/helpers/extensions.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/globalMessages.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/issues.ts50
-rw-r--r--server/sonar-web/src/main/js/helpers/keycodes.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/l10n.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/l10nBundle.ts12
-rw-r--r--server/sonar-web/src/main/js/helpers/measures.ts18
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/alm-integrations.ts16
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts32
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/application.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/branch-like.ts8
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/component-report.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/component.ts14
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/dom.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/editions.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/issues.ts8
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/metrics.ts270
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/permissions.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/plugins.ts14
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/project-activity.ts22
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/projects.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts34
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/quality-profiles.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/react-select.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts68
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/settings.ts14
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/sources.ts8
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/tasks.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/token.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/users.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/webhook.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/path.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/projectLinks.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/qualityGates.ts10
-rw-r--r--server/sonar-web/src/main/js/helpers/query.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/request.ts28
-rw-r--r--server/sonar-web/src/main/js/helpers/sanitize.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/scrolling.ts10
-rw-r--r--server/sonar-web/src/main/js/helpers/security-standard.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/sonarlint.ts12
-rw-r--r--server/sonar-web/src/main/js/helpers/stringify-queryparams.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/strings.ts180
-rw-r--r--server/sonar-web/src/main/js/helpers/testMocks.ts192
-rw-r--r--server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx14
-rw-r--r--server/sonar-web/src/main/js/helpers/testUtils.ts20
-rw-r--r--server/sonar-web/src/main/js/helpers/tokens.ts12
-rw-r--r--server/sonar-web/src/main/js/helpers/urls.ts44
-rw-r--r--server/sonar-web/src/main/js/types/__tests__/alm-settings-test.ts2
-rw-r--r--server/sonar-web/src/main/js/types/__tests__/component-test.ts2
-rw-r--r--server/sonar-web/src/main/js/types/alm-settings.ts6
-rw-r--r--server/sonar-web/src/main/js/types/component.ts10
-rw-r--r--server/sonar-web/src/main/js/types/editions.ts2
-rw-r--r--server/sonar-web/src/main/js/types/extension.ts2
-rw-r--r--server/sonar-web/src/main/js/types/features.ts2
-rw-r--r--server/sonar-web/src/main/js/types/globalMessages.ts2
-rw-r--r--server/sonar-web/src/main/js/types/indexation.ts2
-rw-r--r--server/sonar-web/src/main/js/types/issues.ts4
-rw-r--r--server/sonar-web/src/main/js/types/metrics.ts4
-rw-r--r--server/sonar-web/src/main/js/types/permissions.ts2
-rw-r--r--server/sonar-web/src/main/js/types/plugins.ts4
-rw-r--r--server/sonar-web/src/main/js/types/project-activity.ts2
-rw-r--r--server/sonar-web/src/main/js/types/rules.ts2
-rw-r--r--server/sonar-web/src/main/js/types/security-hotspots.ts12
-rw-r--r--server/sonar-web/src/main/js/types/security.ts2
-rw-r--r--server/sonar-web/src/main/js/types/settings.ts6
-rw-r--r--server/sonar-web/src/main/js/types/system.ts2
-rw-r--r--server/sonar-web/src/main/js/types/tasks.ts4
-rw-r--r--server/sonar-web/src/main/js/types/token.ts4
-rw-r--r--server/sonar-web/src/main/js/types/types.ts2
-rw-r--r--server/sonar-web/src/main/js/types/users.ts2
-rw-r--r--server/sonar-web/yarn.lock12
1564 files changed, 9521 insertions, 9642 deletions
diff --git a/server/sonar-web/.prettierrc b/server/sonar-web/.prettierrc
new file mode 100644
index 00000000000..5ac85e271d5
--- /dev/null
+++ b/server/sonar-web/.prettierrc
@@ -0,0 +1,4 @@
+{
+ "printWidth": 100,
+ "singleQuote": true
+}
diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json
index b7eaf64fc63..ec9de3a203e 100644
--- a/server/sonar-web/package.json
+++ b/server/sonar-web/package.json
@@ -93,7 +93,7 @@
"path-browserify": "1.0.1",
"postcss-calc": "7.0.2",
"postcss-custom-properties": "9.1.1",
- "prettier": "1.19.1",
+ "prettier": "2.7.1",
"react-select-event": "5.5.1",
"testing-library-selector": "0.2.1",
"typescript": "4.8.4",
@@ -133,10 +133,5 @@
"last 3 Edge versions",
"IE 11"
],
- "prettier": {
- "jsxBracketSameLine": true,
- "printWidth": 100,
- "singleQuote": true
- },
"packageManager": "yarn@3.2.4"
}
diff --git a/server/sonar-web/src/main/js/api/alm-integrations.ts b/server/sonar-web/src/main/js/api/alm-integrations.ts
index 1cd48a9e80a..2a023a6b103 100644
--- a/server/sonar-web/src/main/js/api/alm-integrations.ts
+++ b/server/sonar-web/src/main/js/api/alm-integrations.ts
@@ -27,7 +27,7 @@ import {
BitbucketRepository,
GithubOrganization,
GithubRepository,
- GitlabProject
+ GitlabProject,
} from '../types/alm-integration';
import { Paging } from '../types/types';
import { ProjectBase } from './components';
@@ -88,7 +88,7 @@ export function importAzureRepository(
return postJSON('/api/alm_integrations/import_azure_project', {
almSetting,
projectName,
- repositoryName
+ repositoryName,
}).catch(throwGlobalError);
}
@@ -107,7 +107,7 @@ export function getBitbucketServerRepositories(
}> {
return getJSON('/api/alm_integrations/search_bitbucketserver_repos', {
almSetting,
- projectName
+ projectName,
});
}
@@ -119,7 +119,7 @@ export function importBitbucketServerProject(
return postJSON('/api/alm_integrations/import_bitbucketserver_project', {
almSetting,
projectKey,
- repositorySlug
+ repositorySlug,
}).catch(throwGlobalError);
}
@@ -132,7 +132,7 @@ export function searchForBitbucketServerRepositories(
}> {
return getJSON('/api/alm_integrations/search_bitbucketserver_repos', {
almSetting,
- repositoryName
+ repositoryName,
});
}
@@ -149,7 +149,7 @@ export function searchForBitbucketCloudRepositories(
almSetting,
repositoryName,
p: page,
- ps: pageSize
+ ps: pageSize,
});
}
@@ -163,7 +163,7 @@ export function importBitbucketCloudRepository(
): Promise<{ project: ProjectBase }> {
return postJSON('/api/alm_integrations/import_bitbucketcloud_repo', {
almSetting,
- repositorySlug
+ repositorySlug,
}).catch(throwGlobalError);
}
@@ -175,7 +175,7 @@ export function importGithubRepository(
return postJSON('/api/alm_integrations/import_github_project', {
almSetting,
organization,
- repositoryKey
+ repositoryKey,
}).catch(throwGlobalError);
}
@@ -185,7 +185,7 @@ export function getGithubOrganizations(
): Promise<{ organizations: GithubOrganization[] }> {
return getJSON('/api/alm_integrations/list_github_organizations', {
almSetting,
- token
+ token,
}).catch((response?: Response) => {
if (response && response.status !== 400) {
throwGlobalError(response);
@@ -206,7 +206,7 @@ export function getGithubRepositories(data: {
organization,
p: page,
ps: pageSize,
- q: query || undefined
+ q: query || undefined,
}).catch(throwGlobalError);
}
@@ -221,7 +221,7 @@ export function getGitlabProjects(data: {
almSetting,
projectName: query || undefined,
p: page,
- ps: pageSize
+ ps: pageSize,
})
.then(({ repositories, paging }) => ({ projects: repositories, projectsPaging: paging }))
.catch(throwGlobalError);
@@ -234,6 +234,6 @@ export function importGitlabProject(data: {
const { almSetting, gitlabProjectId } = data;
return postJSON('/api/alm_integrations/import_gitlab_project', {
almSetting,
- gitlabProjectId
+ gitlabProjectId,
}).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/alm-settings.ts b/server/sonar-web/src/main/js/api/alm-settings.ts
index d4d4e3f4c38..13030310a52 100644
--- a/server/sonar-web/src/main/js/api/alm-settings.ts
+++ b/server/sonar-web/src/main/js/api/alm-settings.ts
@@ -33,7 +33,7 @@ import {
GitlabBindingDefinition,
GitlabProjectAlmBindingParams,
ProjectAlmBindingConfigurationErrors,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../types/alm-settings';
export function getAlmDefinitions(): Promise<AlmSettingsBindingDefinitions> {
diff --git a/server/sonar-web/src/main/js/api/application.ts b/server/sonar-web/src/main/js/api/application.ts
index 99bd71ef4a9..92fca30b9e4 100644
--- a/server/sonar-web/src/main/js/api/application.ts
+++ b/server/sonar-web/src/main/js/api/application.ts
@@ -27,14 +27,14 @@ export function getApplicationLeak(
branch?: string
): Promise<ApplicationPeriod[]> {
return getJSON('/api/applications/show_leak', { application, branch }).then(
- r => r.leaks,
+ (r) => r.leaks,
throwGlobalError
);
}
export function getApplicationDetails(application: string, branch?: string): Promise<Application> {
return getJSON('/api/applications/show', { application, branch }).then(
- r => r.application,
+ (r) => r.application,
throwGlobalError
);
}
diff --git a/server/sonar-web/src/main/js/api/auth.ts b/server/sonar-web/src/main/js/api/auth.ts
index 958dc9f4175..bf383f338b3 100644
--- a/server/sonar-web/src/main/js/api/auth.ts
+++ b/server/sonar-web/src/main/js/api/auth.ts
@@ -28,10 +28,7 @@ export function logIn(login: string, password: string): Promise<Response> {
}
export function logOut(): Promise<Response> {
- return request('/api/authentication/logout')
- .setMethod('POST')
- .submit()
- .then(basicCheckStatus);
+ return request('/api/authentication/logout').setMethod('POST').submit().then(basicCheckStatus);
}
function basicCheckStatus(response: Response): Promise<Response> {
diff --git a/server/sonar-web/src/main/js/api/branches.ts b/server/sonar-web/src/main/js/api/branches.ts
index baf8f9d9d72..9f3fdf03e77 100644
--- a/server/sonar-web/src/main/js/api/branches.ts
+++ b/server/sonar-web/src/main/js/api/branches.ts
@@ -22,12 +22,15 @@ import { getJSON, post } from '../helpers/request';
import { Branch, PullRequest } from '../types/branch-like';
export function getBranches(project: string): Promise<Branch[]> {
- return getJSON('/api/project_branches/list', { project }).then(r => r.branches, throwGlobalError);
+ return getJSON('/api/project_branches/list', { project }).then(
+ (r) => r.branches,
+ throwGlobalError
+ );
}
export function getPullRequests(project: string): Promise<PullRequest[]> {
return getJSON('/api/project_pull_requests/list', { project }).then(
- r => r.pullRequests,
+ (r) => r.pullRequests,
throwGlobalError
);
}
@@ -48,6 +51,6 @@ export function excludeBranchFromPurge(projectKey: string, branchName: string, e
return post('/api/project_branches/set_automatic_deletion_protection', {
project: projectKey,
branch: branchName,
- value: excluded
+ value: excluded,
}).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/ce.ts b/server/sonar-web/src/main/js/api/ce.ts
index 1d6ad5b3395..517dad4b140 100644
--- a/server/sonar-web/src/main/js/api/ce.ts
+++ b/server/sonar-web/src/main/js/api/ce.ts
@@ -52,7 +52,7 @@ export function getStatus(
}
export function getTask(id: string, additionalFields?: string[]): Promise<Task> {
- return getJSON('/api/ce/task', { id, additionalFields }).then(r => r.task);
+ return getJSON('/api/ce/task', { id, additionalFields }).then((r) => r.task);
}
export function cancelTask(id: string): Promise<any> {
@@ -71,7 +71,7 @@ export function getTasksForComponent(component: string): Promise<{ queue: Task[]
}
export function getTypes(): Promise<string[]> {
- return getJSON('/api/ce/task_types').then(r => r.taskTypes);
+ return getJSON('/api/ce/task_types').then((r) => r.taskTypes);
}
export function getWorkers(): Promise<{ canSetWorkerCount: boolean; value: number }> {
diff --git a/server/sonar-web/src/main/js/api/components.ts b/server/sonar-web/src/main/js/api/components.ts
index d05d132b1f7..5ed1fc90d08 100644
--- a/server/sonar-web/src/main/js/api/components.ts
+++ b/server/sonar-web/src/main/js/api/components.ts
@@ -31,7 +31,7 @@ import {
Paging,
SourceLine,
SourceViewerFile,
- Visibility
+ Visibility,
} from '../types/types';
export interface BaseSearchProjectsParameters {
@@ -60,9 +60,7 @@ export interface SearchProjectsParameters extends BaseSearchProjectsParameters {
ps?: number;
}
-export function getComponents(
- parameters: SearchProjectsParameters
-): Promise<{
+export function getComponents(parameters: SearchProjectsParameters): Promise<{
components: Project[];
paging: Paging;
}> {
@@ -184,11 +182,11 @@ export function getComponentShow(data: { component: string } & BranchParameters)
}
export function getParents(component: string): Promise<any> {
- return getComponentShow({ component }).then(r => r.ancestors);
+ return getComponentShow({ component }).then((r) => r.ancestors);
}
export function getBreadcrumbs(data: { component: string } & BranchParameters): Promise<any> {
- return getComponentShow(data).then(r => {
+ return getComponentShow(data).then((r) => {
const reversedAncestors = [...r.ancestors].reverse();
return [...reversedAncestors, r.component];
});
@@ -219,9 +217,7 @@ export interface Facet {
values: Array<{ val: string; count: number }>;
}
-export function searchProjects(
- data: RequestData
-): Promise<{
+export function searchProjects(data: RequestData): Promise<{
components: Component[];
facets: Facet[];
paging: Paging;
@@ -286,7 +282,7 @@ export function getComponentForSourceViewer(
export function getSources(
data: { key: string; from?: number; to?: number } & BranchParameters
): Promise<SourceLine[]> {
- return getJSON('/api/sources/lines', data).then(r => r.sources);
+ return getJSON('/api/sources/lines', data).then((r) => r.sources);
}
export function getDuplications(
@@ -298,7 +294,7 @@ export function getDuplications(
export function getTests(
data: { sourceFileKey: string; sourceFileLineNumber: number | string } & BranchParameters
): Promise<any> {
- return getJSON('/api/tests/list', data).then(r => r.tests);
+ return getJSON('/api/tests/list', data).then((r) => r.tests);
}
interface ProjectResponse {
diff --git a/server/sonar-web/src/main/js/api/issues.ts b/server/sonar-web/src/main/js/api/issues.ts
index 6518a532e41..b0c845ca982 100644
--- a/server/sonar-web/src/main/js/api/issues.ts
+++ b/server/sonar-web/src/main/js/api/issues.ts
@@ -26,7 +26,7 @@ import {
parseJSON,
post,
postJSON,
- RequestData
+ RequestData,
} from '../helpers/request';
import { IssueResponse, RawIssuesResponse } from '../types/issues';
import { Dict, FacetValue, IssueChangelog, SnippetsByComponent, SourceLine } from '../types/types';
@@ -66,9 +66,9 @@ export function getFacets(
...query,
facets: facets.join(),
ps: 1,
- additionalFields: '_all'
+ additionalFields: '_all',
};
- return searchIssues(data).then(r => {
+ return searchIssues(data).then((r) => {
return { facets: r.facets, response: r };
});
}
@@ -77,7 +77,7 @@ export function getFacet(
query: RequestData,
facet: FacetName
): Promise<{ facet: { count: number; val: string }[]; response: RawIssuesResponse }> {
- return getFacets(query, [facet]).then(r => {
+ return getFacets(query, [facet]).then((r) => {
return { facet: r.facets[0].values, response: r.response };
});
}
@@ -90,7 +90,7 @@ export function searchIssueTags(data: {
q?: string;
}): Promise<string[]> {
return getJSON('/api/issues/tags', data)
- .then(r => r.tags)
+ .then((r) => r.tags)
.catch(throwGlobalError);
}
@@ -99,7 +99,7 @@ export function getIssueChangelog(issue: string): Promise<{ changelog: IssueChan
}
export function getIssueFilters() {
- return getJSON('/api/issue_filters/search').then(r => r.issueFilters);
+ return getJSON('/api/issue_filters/search').then((r) => r.issueFilters);
}
export function addIssueComment(data: { issue: string; text: string }): Promise<IssueResponse> {
@@ -149,19 +149,19 @@ export function searchIssueAuthors(data: {
ps?: number;
q?: string;
}): Promise<string[]> {
- return getJSON('/api/issues/authors', data).then(r => r.authors, throwGlobalError);
+ return getJSON('/api/issues/authors', data).then((r) => r.authors, throwGlobalError);
}
export function getIssueFlowSnippets(issueKey: string): Promise<Dict<SnippetsByComponent>> {
return get('/api/sources/issue_snippets', { issueKey })
- .then(r => {
+ .then((r) => {
if (r.status === HttpStatus.NoContent) {
return {} as any;
}
return parseJSON(r);
})
- .then(result => {
- Object.keys(result).forEach(k => {
+ .then((result) => {
+ Object.keys(result).forEach((k) => {
if (result[k].sources) {
result[k].sources = result[k].sources.reduce(
(lineMap: Dict<SourceLine>, line: SourceLine) => {
diff --git a/server/sonar-web/src/main/js/api/languages.ts b/server/sonar-web/src/main/js/api/languages.ts
index 45d891d9486..99e20716db7 100644
--- a/server/sonar-web/src/main/js/api/languages.ts
+++ b/server/sonar-web/src/main/js/api/languages.ts
@@ -22,5 +22,5 @@ import { getJSON } from '../helpers/request';
import { Language } from '../types/languages';
export function getLanguages(): Promise<Language[]> {
- return getJSON('/api/languages/list').then(r => r.languages, throwGlobalError);
+ return getJSON('/api/languages/list').then((r) => r.languages, throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/measures.ts b/server/sonar-web/src/main/js/api/measures.ts
index de681a61a49..5895e5eafbc 100644
--- a/server/sonar-web/src/main/js/api/measures.ts
+++ b/server/sonar-web/src/main/js/api/measures.ts
@@ -23,7 +23,7 @@ import { BranchParameters } from '../types/branch-like';
import {
MeasuresAndMetaWithMetrics,
MeasuresAndMetaWithPeriod,
- MeasuresForProjects
+ MeasuresForProjects,
} from '../types/measures';
import { Measure } from '../types/types';
@@ -32,7 +32,7 @@ const COMPONENT_URL = '/api/measures/component';
export function getMeasures(
data: { component: string; metricKeys: string } & BranchParameters
): Promise<Measure[]> {
- return getJSON(COMPONENT_URL, data).then(r => r.component.measures, throwGlobalError);
+ return getJSON(COMPONENT_URL, data).then((r) => r.component.measures, throwGlobalError);
}
export function getMeasuresWithMetrics(
@@ -44,7 +44,7 @@ export function getMeasuresWithMetrics(
additionalFields: 'metrics',
component,
metricKeys: metrics.join(','),
- ...branchParameters
+ ...branchParameters,
}).catch(throwGlobalError);
}
@@ -57,7 +57,7 @@ export function getMeasuresWithPeriod(
additionalFields: 'period',
component,
metricKeys: metrics.join(','),
- ...branchParameters
+ ...branchParameters,
}).catch(throwGlobalError);
}
@@ -70,7 +70,7 @@ export function getMeasuresWithPeriodAndMetrics(
additionalFields: 'period,metrics',
component,
metricKeys: metrics.join(','),
- ...branchParameters
+ ...branchParameters,
}).catch(throwGlobalError);
}
@@ -80,6 +80,6 @@ export function getMeasuresForProjects(
): Promise<MeasuresForProjects[]> {
return getJSON('/api/measures/search', {
projectKeys: projectKeys.join(),
- metricKeys: metricKeys.join()
- }).then(r => r.measures);
+ metricKeys: metricKeys.join(),
+ }).then((r) => r.measures);
}
diff --git a/server/sonar-web/src/main/js/api/metrics.ts b/server/sonar-web/src/main/js/api/metrics.ts
index c3d684d774a..498cd1d0371 100644
--- a/server/sonar-web/src/main/js/api/metrics.ts
+++ b/server/sonar-web/src/main/js/api/metrics.ts
@@ -47,7 +47,7 @@ export function getAllMetrics(data?: {
data: { p?: number; ps?: number } = { ps: 500 },
prev?: MetricsResponse
): Promise<Metric[]> {
- return getMetrics(data).then(r => {
+ return getMetrics(data).then((r) => {
const result = prev ? prev.metrics.concat(r.metrics) : r.metrics;
if (r.p * r.ps >= r.total) {
return result;
diff --git a/server/sonar-web/src/main/js/api/mocks/AuthenticationServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/AuthenticationServiceMock.ts
index c5a5287e6c2..bae674d25c7 100644
--- a/server/sonar-web/src/main/js/api/mocks/AuthenticationServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/AuthenticationServiceMock.ts
@@ -29,7 +29,7 @@ export default class AuthenticationServiceMock {
mockSettingValue({ key: 'test1', value: '' }),
mockSettingValue({ key: 'test2', value: 'test2' }),
mockSettingValue({ key: 'sonar.auth.saml.certificate.secured' }),
- mockSettingValue({ key: 'sonar.auth.saml.enabled', value: 'false' })
+ mockSettingValue({ key: 'sonar.auth.saml.enabled', value: 'false' }),
];
constructor() {
@@ -41,7 +41,7 @@ export default class AuthenticationServiceMock {
getValuesHandler = (data: { keys: string; component?: string } & BranchParameters) => {
if (data.keys) {
- return Promise.resolve(this.settingValues.filter(set => data.keys.includes(set.key)));
+ return Promise.resolve(this.settingValues.filter((set) => data.keys.includes(set.key)));
}
return Promise.resolve(this.settingValues);
};
@@ -50,12 +50,12 @@ export default class AuthenticationServiceMock {
if (value === 'error') {
const res = new Response('', {
status: 400,
- statusText: 'fail'
+ statusText: 'fail',
});
return Promise.reject(res);
}
- const updatedSettingValue = this.settingValues.find(set => set.key === definition.key);
+ const updatedSettingValue = this.settingValues.find((set) => set.key === definition.key);
if (updatedSettingValue) {
updatedSettingValue.value = value;
}
@@ -64,7 +64,7 @@ export default class AuthenticationServiceMock {
resetValueHandler = (data: { keys: string; component?: string } & BranchParameters) => {
if (data.keys) {
- this.settingValues.forEach(set => {
+ this.settingValues.forEach((set) => {
if (data.keys.includes(set.key)) {
set.value = '';
}
diff --git a/server/sonar-web/src/main/js/api/mocks/BranchesServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/BranchesServiceMock.ts
index d833cb22e70..6d9e4b4936f 100644
--- a/server/sonar-web/src/main/js/api/mocks/BranchesServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/BranchesServiceMock.ts
@@ -27,7 +27,7 @@ export default class BranchesServiceMock {
defaultBranchLikes: BranchLike[] = [
mockBranch({ isMain: true, name: 'master' }),
mockBranch({ excludedFromPurge: false, name: 'delete-branch' }),
- mockBranch({ name: 'normal-branch' })
+ mockBranch({ name: 'normal-branch' }),
];
constructor() {
diff --git a/server/sonar-web/src/main/js/api/mocks/CodeServiceMocks.ts b/server/sonar-web/src/main/js/api/mocks/CodeServiceMocks.ts
index 7a4271cc6a0..2c9a8021110 100644
--- a/server/sonar-web/src/main/js/api/mocks/CodeServiceMocks.ts
+++ b/server/sonar-web/src/main/js/api/mocks/CodeServiceMocks.ts
@@ -35,7 +35,7 @@ function isLeaf(node: ComponentTree) {
}
function listChildComponent(node: ComponentTree): ComponentMeasure[] {
- return map(node.child, n => n.component);
+ return map(node.child, (n) => n.component);
}
function listAllComponent(node: ComponentTree): ComponentMeasure[] {
@@ -65,28 +65,28 @@ export default class CodeServiceMock {
key: 'foo:folerA',
name: 'folderA',
path: 'folderA',
- qualifier: ComponentQualifier.Directory
+ qualifier: ComponentQualifier.Directory,
}),
child: [
{
component: mockComponentMeasure(true, {
key: 'foo:folderA/out.tsx',
name: 'out.tsx',
- path: 'folderA/out.tsx'
+ path: 'folderA/out.tsx',
}),
- child: []
- }
- ]
+ child: [],
+ },
+ ],
},
{
component: mockComponentMeasure(true, {
key: 'foo:index.tsx',
name: 'index.tsx',
- path: 'index.tsx'
+ path: 'index.tsx',
}),
- child: []
- }
- ]
+ child: [],
+ },
+ ],
};
(getComponentTree as jest.Mock).mockImplementation(this.handleGetComponentTree);
(getChildren as jest.Mock).mockImplementation(this.handleGetChildren);
@@ -97,7 +97,7 @@ export default class CodeServiceMock {
if (from.component.key === key) {
return from;
}
- return from.child.find(node => this.findBaseComponent(key, node));
+ return from.child.find((node) => this.findBaseComponent(key, node));
}
handleGetChildren = (
@@ -124,7 +124,7 @@ export default class CodeServiceMock {
let components: ComponentMeasure[] = [];
if (base === undefined) {
return Promise.reject({
- errors: [{ msg: `No component has been found for id ${component}` }]
+ errors: [{ msg: `No component has been found for id ${component}` }],
});
}
if (strategy === 'all' || strategy === '') {
@@ -142,8 +142,8 @@ export default class CodeServiceMock {
paging: {
pageIndex: 1,
pageSize: 100,
- total: components.length
- }
+ total: components.length,
+ },
});
};
@@ -154,7 +154,7 @@ export default class CodeServiceMock {
facets: [],
issues: [],
languages: [],
- paging: { total: 0, pageIndex: 1, pageSize: 100 }
+ paging: { total: 0, pageIndex: 1, pageSize: 100 },
});
};
diff --git a/server/sonar-web/src/main/js/api/mocks/CodingRulesMock.ts b/server/sonar-web/src/main/js/api/mocks/CodingRulesMock.ts
index 8756329b36d..fd98ea3216e 100644
--- a/server/sonar-web/src/main/js/api/mocks/CodingRulesMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/CodingRulesMock.ts
@@ -23,7 +23,7 @@ import {
mockCurrentUser,
mockQualityProfile,
mockRuleDetails,
- mockRuleRepository
+ mockRuleRepository,
} from '../../helpers/testMocks';
import { RuleRepository } from '../../types/coding-rules';
import { RawIssuesResponse } from '../../types/issues';
@@ -37,7 +37,7 @@ import {
Profile,
searchQualityProfiles,
SearchQualityProfilesParameters,
- SearchQualityProfilesResponse
+ SearchQualityProfilesResponse,
} from '../quality-profiles';
import { getRuleDetails, getRulesApp, searchRules, updateRule } from '../rules';
import { dismissNotice, getCurrentUser } from '../users';
@@ -48,7 +48,7 @@ interface FacetFilter {
const FACET_RULE_MAP: { [key: string]: keyof Rule } = {
languages: 'lang',
- types: 'type'
+ types: 'type',
};
export default class CodingRulesMock {
defaultRules: RuleDetails[] = [];
@@ -62,12 +62,12 @@ export default class CodingRulesMock {
constructor() {
this.repositories = [
mockRuleRepository({ key: 'repo1' }),
- mockRuleRepository({ key: 'repo2' })
+ mockRuleRepository({ key: 'repo2' }),
];
this.qualityProfile = [
mockQualityProfile({ key: 'p1', name: 'QP Foo', language: 'java', languageName: 'Java' }),
mockQualityProfile({ key: 'p2', name: 'QP Bar', language: 'js' }),
- mockQualityProfile({ key: 'p3', name: 'QP FooBar', language: 'java', languageName: 'Java' })
+ mockQualityProfile({ key: 'p3', name: 'QP FooBar', language: 'java', languageName: 'Java' }),
];
const resourceContent = 'Some link <a href="http://example.com">Awsome Reading</a>';
@@ -80,7 +80,7 @@ export default class CodingRulesMock {
type: 'BUG',
lang: 'java',
langName: 'Java',
- name: 'Awsome java rule'
+ name: 'Awsome java rule',
}),
mockRuleDetails({
key: 'rule2',
@@ -93,10 +93,10 @@ export default class CodingRulesMock {
{ key: RuleDescriptionSections.ASSESS_THE_PROBLEM, content: 'Assess' },
{
key: RuleDescriptionSections.RESOURCES,
- content: resourceContent
- }
+ content: resourceContent,
+ },
],
- langName: 'JavaScript'
+ langName: 'JavaScript',
}),
mockRuleDetails({ key: 'rule3', name: 'Unknown rule', lang: 'js', langName: 'JavaScript' }),
mockRuleDetails({
@@ -104,7 +104,7 @@ export default class CodingRulesMock {
type: 'BUG',
lang: 'c',
langName: 'C',
- name: 'Awsome C rule'
+ name: 'Awsome C rule',
}),
mockRuleDetails({
key: 'rule5',
@@ -117,9 +117,9 @@ export default class CodingRulesMock {
{ key: RuleDescriptionSections.HOW_TO_FIX, content: rootCauseContent },
{
key: RuleDescriptionSections.RESOURCES,
- content: resourceContent
- }
- ]
+ content: resourceContent,
+ },
+ ],
}),
mockRuleDetails({
key: 'rule6',
@@ -128,7 +128,7 @@ export default class CodingRulesMock {
langName: 'Python',
name: 'Bad Python rule',
isExternal: true,
- descriptionSections: undefined
+ descriptionSections: undefined,
}),
mockRuleDetails({
key: 'rule7',
@@ -139,23 +139,23 @@ export default class CodingRulesMock {
descriptionSections: [
{
key: RuleDescriptionSections.INTRODUCTION,
- content: 'Introduction to this rule with context'
+ content: 'Introduction to this rule with context',
},
{
key: RuleDescriptionSections.HOW_TO_FIX,
content: 'This is how to fix for spring',
- context: { key: 'spring', displayName: 'Spring' }
+ context: { key: 'spring', displayName: 'Spring' },
},
{
key: RuleDescriptionSections.HOW_TO_FIX,
content: 'This is how to fix for spring boot',
- context: { key: 'spring_boot', displayName: 'Spring boot' }
+ context: { key: 'spring_boot', displayName: 'Spring boot' },
},
{
key: RuleDescriptionSections.RESOURCES,
- content: resourceContent
- }
- ]
+ content: resourceContent,
+ },
+ ],
}),
mockRuleDetails({
key: 'rule8',
@@ -168,11 +168,11 @@ export default class CodingRulesMock {
{ key: RuleDescriptionSections.HOW_TO_FIX, content: rootCauseContent },
{
key: RuleDescriptionSections.RESOURCES,
- content: resourceContent
- }
+ content: resourceContent,
+ },
],
- educationPrinciples: ['defense_in_depth', 'never_trust_user_input']
- })
+ educationPrinciples: ['defense_in_depth', 'never_trust_user_input'],
+ }),
];
(updateRule as jest.Mock).mockImplementation(this.handleUpdateRule);
@@ -189,7 +189,7 @@ export default class CodingRulesMock {
}
getRuleWithoutDetails() {
- return this.rules.map(r =>
+ return this.rules.map((r) =>
pick(r, [
'isTemplate',
'key',
@@ -201,7 +201,7 @@ export default class CodingRulesMock {
'status',
'sysTags',
'tags',
- 'type'
+ 'type',
])
);
}
@@ -209,7 +209,7 @@ export default class CodingRulesMock {
filterFacet({ languages }: FacetFilter) {
let filteredRules = this.getRuleWithoutDetails();
if (languages) {
- filteredRules = filteredRules.filter(r => r.lang && languages.includes(r.lang));
+ filteredRules = filteredRules.filter((r) => r.lang && languages.includes(r.lang));
}
return filteredRules;
}
@@ -234,11 +234,11 @@ export default class CodingRulesMock {
}
allRulesName() {
- return this.rules.map(r => r.name);
+ return this.rules.map((r) => r.name);
}
allQualityProfile(language: string) {
- return this.qualityProfile.filter(qp => qp.language === language);
+ return this.qualityProfile.filter((qp) => qp.language === language);
}
handleGetGacet = (): Promise<{
@@ -253,8 +253,8 @@ export default class CodingRulesMock {
facets: [],
issues: [],
languages: [],
- paging: { total: 0, pageIndex: 1, pageSize: 1 }
- }
+ paging: { total: 0, pageIndex: 1, pageSize: 1 },
+ },
});
};
@@ -262,23 +262,23 @@ export default class CodingRulesMock {
actives?: boolean;
key: string;
}): Promise<{ actives?: RuleActivation[]; rule: RuleDetails }> => {
- const rule = this.rules.find(r => r.key === parameters.key);
+ const rule = this.rules.find((r) => r.key === parameters.key);
if (!rule) {
return Promise.reject({
- errors: [{ msg: `No rule has been found for id ${parameters.key}` }]
+ errors: [{ msg: `No rule has been found for id ${parameters.key}` }],
});
}
return this.reply({ actives: parameters.actives ? [] : undefined, rule });
};
handleUpdateRule = (data: RulesUpdateRequest): Promise<RuleDetails> => {
- const rule = this.rules.find(r => r.key === data.key);
+ const rule = this.rules.find((r) => r.key === data.key);
if (rule === undefined) {
return Promise.reject({
- errors: [{ msg: `No rule has been found for id ${data.key}` }]
+ errors: [{ msg: `No rule has been found for id ${data.key}` }],
});
}
- const template = this.rules.find(r => r.key === rule.templateKey);
+ const template = this.rules.find((r) => r.key === rule.templateKey);
// Lets not convert the md to html in test.
rule.mdDesc = data.markdown_description !== undefined ? data.markdown_description : rule.mdDesc;
@@ -289,14 +289,14 @@ export default class CodingRulesMock {
rule.name = data.name !== undefined ? data.name : rule.name;
if (template && data.params) {
rule.params = [];
- data.params.split(';').forEach(param => {
+ data.params.split(';').forEach((param) => {
const parts = param.split('=');
- const paramsDef = template.params?.find(p => p.key === parts[0]);
+ const paramsDef = template.params?.find((p) => p.key === parts[0]);
rule.params?.push({
key: parts[0],
type: paramsDef?.type || 'STRING',
defaultValue: trim(parts[1], '" '),
- htmlDesc: paramsDef?.htmlDesc
+ htmlDesc: paramsDef?.htmlDesc,
});
});
}
@@ -316,17 +316,19 @@ export default class CodingRulesMock {
handleSearchRules = ({ facets, languages, p, ps, rule_key }: SearchRulesQuery) => {
const countFacet = (facets || '').split(',').map((facet: keyof Rule) => {
- const facetCount = countBy(this.rules.map(r => r[FACET_RULE_MAP[facet] || facet] as string));
+ const facetCount = countBy(
+ this.rules.map((r) => r[FACET_RULE_MAP[facet] || facet] as string)
+ );
return {
property: facet,
- values: Object.keys(facetCount).map(val => ({ val, count: facetCount[val] }))
+ values: Object.keys(facetCount).map((val) => ({ val, count: facetCount[val] })),
};
});
const currentPs = ps || 10;
const currentP = p || 1;
let filteredRules: Rule[] = [];
if (rule_key) {
- filteredRules = this.getRuleWithoutDetails().filter(r => r.key === rule_key);
+ filteredRules = this.getRuleWithoutDetails().filter((r) => r.key === rule_key);
} else {
filteredRules = this.filterFacet({ languages });
}
@@ -336,7 +338,7 @@ export default class CodingRulesMock {
p: currentP,
ps: currentPs,
rules: responseRules,
- facets: countFacet
+ facets: countFacet,
});
};
@@ -345,31 +347,31 @@ export default class CodingRulesMock {
return this.reply({
succeeded: this.rules.length - 1,
failed: 1,
- errors: [{ msg: 'c rule c:S6069 cannot be activated on cpp profile SonarSource' }]
+ errors: [{ msg: 'c rule c:S6069 cannot be activated on cpp profile SonarSource' }],
});
}
return this.reply({
succeeded: this.rules.length,
failed: 0,
- errors: []
+ errors: [],
});
};
handleBulkDeactivateRules = () => {
return this.reply({
succeeded: this.rules.length,
- failed: 0
+ failed: 0,
});
};
- handleSearchQualityProfiles = ({ language }: SearchQualityProfilesParameters = {}): Promise<
- SearchQualityProfilesResponse
- > => {
+ handleSearchQualityProfiles = ({
+ language,
+ }: SearchQualityProfilesParameters = {}): Promise<SearchQualityProfilesResponse> => {
let profiles: Profile[] = this.isAdmin
- ? this.qualityProfile.map(p => ({ ...p, actions: { edit: true } }))
+ ? this.qualityProfile.map((p) => ({ ...p, actions: { edit: true } }))
: this.qualityProfile;
if (language) {
- profiles = profiles.filter(p => p.language === language);
+ profiles = profiles.filter((p) => p.language === language);
}
return this.reply({ profiles });
};
@@ -382,8 +384,8 @@ export default class CodingRulesMock {
return this.reply(
mockCurrentUser({
dismissedNotices: {
- educationPrinciples: this.dismissedNoticesEP
- }
+ educationPrinciples: this.dismissedNoticesEP,
+ },
})
);
};
diff --git a/server/sonar-web/src/main/js/api/mocks/ComputeEngineServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/ComputeEngineServiceMock.ts
index e718aaa7bdc..f6557aee6c1 100644
--- a/server/sonar-web/src/main/js/api/mocks/ComputeEngineServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/ComputeEngineServiceMock.ts
@@ -29,7 +29,7 @@ import {
getStatus,
getTypes,
getWorkers,
- setWorkerCount
+ setWorkerCount,
} from '../ce';
const RANDOM_RADIX = 36;
@@ -45,13 +45,13 @@ const TASK_TYPES = [
TaskTypes.AppRefresh,
TaskTypes.ProjectImport,
TaskTypes.ViewRefresh,
- TaskTypes.ReportSubmit
+ TaskTypes.ReportSubmit,
];
const DEFAULT_TASKS: Task[] = [mockTask()];
const DEFAULT_WORKERS = {
canSetWorkerCount: true,
- value: 2
+ value: 2,
};
const CANCELABLE_TASK_STATUSES = [TaskStatuses.Pending];
@@ -73,7 +73,7 @@ export default class ComputeEngineServiceMock {
}
handleCancelAllTasks = () => {
- this.tasks.forEach(t => {
+ this.tasks.forEach((t) => {
if (CANCELABLE_TASK_STATUSES.includes(t.status)) {
t.status = TaskStatuses.Canceled;
}
@@ -83,7 +83,7 @@ export default class ComputeEngineServiceMock {
};
handleCancelTask = (id: string) => {
- const task = this.tasks.find(t => t.id === id);
+ const task = this.tasks.find((t) => t.id === id);
if (task && CANCELABLE_TASK_STATUSES.includes(task.status)) {
task.status = TaskStatuses.Canceled;
@@ -96,7 +96,7 @@ export default class ComputeEngineServiceMock {
handleGetActivity = (data: ActivityRequestParameters) => {
let results = cloneDeep(this.tasks);
- results = results.filter(task => {
+ results = results.filter((task) => {
return !(
(data.component && task.componentKey !== data.component) ||
(data.status && !data.status.split(',').includes(task.status)) ||
@@ -117,8 +117,8 @@ export default class ComputeEngineServiceMock {
/*
* This is more complex in real life, but it's a good enough approximation to suit tests
*/
- results = Object.values(groupBy(results, t => t.componentKey)).map(
- tasks => sortBy(tasks, t => t.executedAt).pop()!
+ results = Object.values(groupBy(results, (t) => t.componentKey)).map(
+ (tasks) => sortBy(tasks, (t) => t.executedAt).pop()!
);
}
@@ -130,15 +130,15 @@ export default class ComputeEngineServiceMock {
paging: {
pageIndex: page,
pageSize: PAGE_SIZE,
- total: results.length
- }
+ total: results.length,
+ },
});
};
handleGetStatus = (component?: string) => {
return Promise.resolve(
this.tasks
- .filter(task => !component || task.componentKey === component)
+ .filter((task) => !component || task.componentKey === component)
.reduce(
(stats, task) => {
switch (task.status) {
@@ -187,14 +187,12 @@ export default class ComputeEngineServiceMock {
};
addTask = (overrides: Partial<Task> = {}) => {
- const id = Math.random()
- .toString(RANDOM_RADIX)
- .slice(RANDOM_PREFIX);
+ const id = Math.random().toString(RANDOM_RADIX).slice(RANDOM_PREFIX);
this.tasks.push(
mockTask({
id,
- ...overrides
+ ...overrides,
})
);
};
diff --git a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts
index 243c522293a..2d7b4b48f3f 100644
--- a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts
@@ -22,7 +22,7 @@ import { RuleDescriptionSections } from '../../apps/coding-rules/rule';
import {
mockSnippetsByComponent,
mockSourceLine,
- mockSourceViewerFile
+ mockSourceViewerFile,
} from '../../helpers/mocks/sources';
import { RequestData } from '../../helpers/request';
import { getStandards } from '../../helpers/security-standard';
@@ -31,7 +31,7 @@ import {
mockLoggedInUser,
mockPaging,
mockRawIssue,
- mockRuleDetails
+ mockRuleDetails,
} from '../../helpers/testMocks';
import { BranchParameters } from '../../types/branch-like';
import {
@@ -39,7 +39,7 @@ import {
RawFacet,
RawIssue,
RawIssuesResponse,
- ReferencedComponent
+ ReferencedComponent,
} from '../../types/issues';
import { Standards } from '../../types/security';
import {
@@ -48,7 +48,7 @@ import {
RuleActivation,
RuleDetails,
SnippetsByComponent,
- SourceViewerFile
+ SourceViewerFile,
} from '../../types/types';
import { NoticeType } from '../../types/users';
import { getComponentForSourceViewer, getSources } from '../components';
@@ -64,7 +64,7 @@ import {
setIssueSeverity,
setIssueTags,
setIssueTransition,
- setIssueType
+ setIssueType,
} from '../issues';
import { getRuleDetails } from '../rules';
import { dismissNotice, getCurrentUser, searchUsers } from '../users';
@@ -74,7 +74,7 @@ function mockReferenceComponent(override?: Partial<ReferencedComponent>) {
key: 'component1',
name: 'Component1',
uuid: 'id1',
- ...override
+ ...override,
};
}
@@ -93,7 +93,7 @@ export default class IssuesServiceMock {
// Comment should have their own store as we can test better CRUD operation
this.sourceViewerFiles = [
mockSourceViewerFile('file.foo', 'project'),
- mockSourceViewerFile('file.bar', 'project')
+ mockSourceViewerFile('file.bar', 'project'),
];
this.list = [
{
@@ -106,7 +106,7 @@ export default class IssuesServiceMock {
startLine: 10,
endLine: 10,
startOffset: 0,
- endOffset: 2
+ endOffset: 2,
},
flows: [
{
@@ -120,8 +120,8 @@ export default class IssuesServiceMock {
startLine: 20,
endLine: 20,
startOffset: 0,
- endOffset: 1
- }
+ endOffset: 1,
+ },
},
{
component: 'project:file.foo',
@@ -130,10 +130,10 @@ export default class IssuesServiceMock {
startLine: 21,
endLine: 21,
startOffset: 0,
- endOffset: 1
- }
- }
- ]
+ endOffset: 1,
+ },
+ },
+ ],
},
{
type: FlowType.EXECUTION,
@@ -145,8 +145,8 @@ export default class IssuesServiceMock {
startLine: 20,
endLine: 20,
startOffset: 0,
- endOffset: 1
- }
+ endOffset: 1,
+ },
},
{
component: 'project:file.bar',
@@ -155,8 +155,8 @@ export default class IssuesServiceMock {
startLine: 22,
endLine: 22,
startOffset: 0,
- endOffset: 1
- }
+ endOffset: 1,
+ },
},
{
component: 'project:file.bar',
@@ -165,28 +165,28 @@ export default class IssuesServiceMock {
startLine: 5,
endLine: 5,
startOffset: 0,
- endOffset: 1
- }
- }
- ]
- }
- ]
+ endOffset: 1,
+ },
+ },
+ ],
+ },
+ ],
}),
snippets: keyBy(
[
mockSnippetsByComponent(
'file.foo',
'project',
- times(40, i => i + 1)
+ times(40, (i) => i + 1)
),
mockSnippetsByComponent(
'file.bar',
'project',
- times(40, i => i + 1)
- )
+ times(40, (i) => i + 1)
+ ),
],
'component.key'
- )
+ ),
},
{
issue: mockRawIssue(false, {
@@ -195,9 +195,9 @@ export default class IssuesServiceMock {
message: 'Issue on file',
rule: 'simpleRuleId',
textRange: undefined,
- line: undefined
+ line: undefined,
}),
- snippets: {}
+ snippets: {},
},
{
issue: mockRawIssue(false, {
@@ -209,7 +209,7 @@ export default class IssuesServiceMock {
startLine: 10,
endLine: 10,
startOffset: 0,
- endOffset: 2
+ endOffset: 2,
},
flows: [
{
@@ -221,10 +221,10 @@ export default class IssuesServiceMock {
startLine: 1,
endLine: 1,
startOffset: 0,
- endOffset: 1
- }
- }
- ]
+ endOffset: 1,
+ },
+ },
+ ],
},
{
locations: [
@@ -235,28 +235,28 @@ export default class IssuesServiceMock {
startLine: 20,
endLine: 20,
startOffset: 0,
- endOffset: 1
- }
- }
- ]
- }
- ]
+ endOffset: 1,
+ },
+ },
+ ],
+ },
+ ],
}),
snippets: keyBy(
[
mockSnippetsByComponent(
'file.foo',
'project',
- times(40, i => i + 1)
+ times(40, (i) => i + 1)
),
mockSnippetsByComponent(
'file.bar',
'project',
- times(40, i => i + 1)
- )
+ times(40, (i) => i + 1)
+ ),
],
'component.key'
- )
+ ),
},
{
issue: mockRawIssue(false, {
@@ -270,20 +270,20 @@ export default class IssuesServiceMock {
startLine: 25,
endLine: 25,
startOffset: 0,
- endOffset: 1
+ endOffset: 1,
},
- ruleDescriptionContextKey: 'spring'
+ ruleDescriptionContextKey: 'spring',
}),
snippets: keyBy(
[
mockSnippetsByComponent(
'file.bar',
'project',
- times(40, i => i + 20)
- )
+ times(40, (i) => i + 20)
+ ),
],
'component.key'
- )
+ ),
},
{
issue: mockRawIssue(false, {
@@ -295,19 +295,19 @@ export default class IssuesServiceMock {
startLine: 28,
endLine: 28,
startOffset: 0,
- endOffset: 1
- }
+ endOffset: 1,
+ },
}),
snippets: keyBy(
[
mockSnippetsByComponent(
'file.bar',
'project',
- times(40, i => i + 20)
- )
+ times(40, (i) => i + 20)
+ ),
],
'component.key'
- )
+ ),
},
{
issue: mockRawIssue(false, {
@@ -321,23 +321,23 @@ export default class IssuesServiceMock {
startLine: 25,
endLine: 25,
startOffset: 0,
- endOffset: 1
+ endOffset: 1,
},
ruleDescriptionContextKey: 'spring',
ruleStatus: 'DEPRECATED',
- quickFixAvailable: true
+ quickFixAvailable: true,
}),
snippets: keyBy(
[
mockSnippetsByComponent(
'file.bar',
'project',
- times(40, i => i + 20)
- )
+ times(40, (i) => i + 20)
+ ),
],
'component.key'
- )
- }
+ ),
+ },
];
(searchIssues as jest.Mock).mockImplementation(this.handleSearchIssues);
(getRuleDetails as jest.Mock).mockImplementation(this.handleGetRuleDetails);
@@ -372,7 +372,7 @@ export default class IssuesServiceMock {
owasp2021FacetList(): RawFacet {
return {
property: 'owaspTop10-2021',
- values: [{ val: 'a1', count: 0 }]
+ values: [{ val: 'a1', count: 0 }],
};
}
@@ -383,22 +383,22 @@ export default class IssuesServiceMock {
handleBulkChangeIssues = (issueKeys: string[], query: RequestData) => {
//For now we only check for issue type change.
this.list
- .filter(i => issueKeys.includes(i.issue.key))
- .forEach(data => {
+ .filter((i) => issueKeys.includes(i.issue.key))
+ .forEach((data) => {
data.issue.type = query.set_type;
});
return this.reply({});
};
handleGetSources = (data: { key: string; from?: number; to?: number } & BranchParameters) => {
- return this.reply(range(data.from || 1, data.to || 10).map(line => mockSourceLine({ line })));
+ return this.reply(range(data.from || 1, data.to || 10).map((line) => mockSourceLine({ line })));
};
handleGetComponentForSourceViewer = (data: { component: string } & BranchParameters) => {
- const file = this.sourceViewerFiles.find(f => f.key === data.component);
+ const file = this.sourceViewerFiles.find((f) => f.key === data.component);
if (file === undefined) {
return Promise.reject({
- errors: [{ msg: `No source file has been found for id ${data.component}` }]
+ errors: [{ msg: `No source file has been found for id ${data.component}` }],
});
}
@@ -406,7 +406,7 @@ export default class IssuesServiceMock {
};
handleGetIssueFlowSnippets = (issueKey: string): Promise<Dict<SnippetsByComponent>> => {
- const issue = this.list.find(i => i.issue.key === issueKey);
+ const issue = this.list.find((i) => i.issue.key === issueKey);
if (issue === undefined) {
return Promise.reject({ errors: [{ msg: `No issue has been found for id ${issueKey}` }] });
}
@@ -433,28 +433,28 @@ export default class IssuesServiceMock {
key: RuleDescriptionSections.HOW_TO_FIX,
context: {
key: 'spring',
- displayName: 'Spring'
- }
+ displayName: 'Spring',
+ },
},
{
content: '<p> Context 2 content<p>',
key: RuleDescriptionSections.HOW_TO_FIX,
context: {
key: 'context_2',
- displayName: 'Context 2'
- }
+ displayName: 'Context 2',
+ },
},
{
content: '<p> Context 3 content<p>',
key: RuleDescriptionSections.HOW_TO_FIX,
context: {
key: 'context_3',
- displayName: 'Context 3'
- }
+ displayName: 'Context 3',
+ },
},
- { key: RuleDescriptionSections.RESOURCES, content: '<h1>Link</h1>' }
- ]
- })
+ { key: RuleDescriptionSections.RESOURCES, content: '<h1>Link</h1>' },
+ ],
+ }),
});
}
return this.reply({
@@ -465,10 +465,10 @@ export default class IssuesServiceMock {
descriptionSections: [
{
key: RuleDescriptionSections.DEFAULT,
- content: '<h1>Default</h1> Default description'
- }
- ]
- })
+ content: '<h1>Default</h1> Default description',
+ },
+ ],
+ }),
});
};
@@ -479,16 +479,16 @@ export default class IssuesServiceMock {
}
return {
property: name,
- values: []
+ values: [],
};
});
return this.reply({
components: [mockReferenceComponent()],
effortTotal: 199629,
facets,
- issues: this.list.map(line => line.issue),
+ issues: this.list.map((line) => line.issue),
languages: [],
- paging: mockPaging()
+ paging: mockPaging(),
});
};
@@ -522,25 +522,25 @@ export default class IssuesServiceMock {
unconfirm: 'REOPENED',
resolve: 'RESOLVED',
wontfix: 'RESOLVED',
- falsepositive: 'RESOLVED'
+ falsepositive: 'RESOLVED',
};
const transitionMap: Dict<string[]> = {
REOPENED: ['confirm', 'resolve', 'falsepositive', 'wontfix'],
OPEN: ['confirm', 'resolve', 'falsepositive', 'wontfix'],
CONFIRMED: ['resolve', 'unconfirm', 'falsepositive', 'wontfix'],
- RESOLVED: ['reopen']
+ RESOLVED: ['reopen'],
};
const resolutionMap: Dict<string> = {
wontfix: 'WONTFIX',
- falsepositive: 'FALSE-POSITIVE'
+ falsepositive: 'FALSE-POSITIVE',
};
return this.getActionsResponse(
{
status: statusMap[data.transition],
transitions: transitionMap[statusMap[data.transition]],
- resolution: resolutionMap[data.transition]
+ resolution: resolutionMap[data.transition],
},
data.issue
);
@@ -562,9 +562,9 @@ export default class IssuesServiceMock {
key: '1234',
login: 'admin',
markdown: data.text,
- updatable: true
- }
- ]
+ updatable: true,
+ },
+ ],
},
data.issue
);
@@ -581,9 +581,9 @@ export default class IssuesServiceMock {
key: '1234',
login: 'admin',
markdown: data.text,
- updatable: true
- }
- ]
+ updatable: true,
+ },
+ ],
},
'issue2'
);
@@ -593,7 +593,7 @@ export default class IssuesServiceMock {
// For comment its little more complex to get comment Id
return this.getActionsResponse(
{
- comments: []
+ comments: [],
},
'issue2'
);
@@ -608,15 +608,15 @@ export default class IssuesServiceMock {
};
getActionsResponse = (overrides: Partial<RawIssue>, issueKey: string) => {
- const issueDataSelected = this.list.find(l => l.issue.key === issueKey)!;
+ const issueDataSelected = this.list.find((l) => l.issue.key === issueKey)!;
issueDataSelected.issue = {
...issueDataSelected?.issue,
- ...overrides
+ ...overrides,
};
return this.reply({
- issue: issueDataSelected.issue
+ issue: issueDataSelected.issue,
});
};
diff --git a/server/sonar-web/src/main/js/api/mocks/NotificationsMock.ts b/server/sonar-web/src/main/js/api/mocks/NotificationsMock.ts
index b539ea0ed08..7e50a368fef 100644
--- a/server/sonar-web/src/main/js/api/mocks/NotificationsMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/NotificationsMock.ts
@@ -22,7 +22,7 @@ import { cloneDeep } from 'lodash';
import {
AddRemoveNotificationParameters,
Notification,
- NotificationsResponse
+ NotificationsResponse,
} from '../../types/notifications';
import { addNotification, getNotifications, removeNotification } from '../notifications';
@@ -35,11 +35,11 @@ const perProjectTypes = [
'NewAlerts',
'NewFalsePositiveIssue',
'NewIssues',
- 'SQ-MyNewIssues'
+ 'SQ-MyNewIssues',
];
const defaultNotifications: Notification[] = [
- { channel: 'EmailNotificationChannel', type: 'ChangesOnMyIssue' }
+ { channel: 'EmailNotificationChannel', type: 'ChangesOnMyIssue' },
];
export default class NotificationsMock {
@@ -58,7 +58,7 @@ export default class NotificationsMock {
channels: [...channels],
globalTypes: [...globalTypes],
notifications: cloneDeep(this.notifications),
- perProjectTypes: [...perProjectTypes]
+ perProjectTypes: [...perProjectTypes],
});
};
@@ -70,7 +70,7 @@ export default class NotificationsMock {
handleRemoveNotification = (params: AddRemoveNotificationParameters) => {
const index = this.notifications.findIndex(
- n => n.project === params.project && n.type === params.type && n.channel === params.channel
+ (n) => n.project === params.project && n.type === params.type && n.channel === params.channel
);
if (index < 0) {
diff --git a/server/sonar-web/src/main/js/api/mocks/PermissionTemplateServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/PermissionTemplateServiceMock.ts
index 96bea6d9599..93e13d7126d 100644
--- a/server/sonar-web/src/main/js/api/mocks/PermissionTemplateServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/PermissionTemplateServiceMock.ts
@@ -30,9 +30,15 @@ const defaultPermissionTemplates: PermissionTemplate[] = [
name: 'Permission Template 1',
createdAt: '',
defaultFor: [],
- permissions: []
+ permissions: [],
+ },
+ {
+ id: 'template2',
+ name: 'Permission Template 2',
+ createdAt: '',
+ defaultFor: [],
+ permissions: [],
},
- { id: 'template2', name: 'Permission Template 2', createdAt: '', defaultFor: [], permissions: [] }
];
export default class PermissionTemplateServiceMock {
diff --git a/server/sonar-web/src/main/js/api/mocks/QualityGatesServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/QualityGatesServiceMock.ts
index e087d046dc1..530f6980ccf 100644
--- a/server/sonar-web/src/main/js/api/mocks/QualityGatesServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/QualityGatesServiceMock.ts
@@ -40,7 +40,7 @@ import {
searchProjects,
searchUsers,
setQualityGateAsDefault,
- updateCondition
+ updateCondition,
} from '../quality-gates';
export class QualityGatesServiceMock {
@@ -62,7 +62,7 @@ export class QualityGatesServiceMock {
id: 'AXJMbIUGPAOIsUIE3eNT',
metric: 'new_maintainability_rating',
op: 'GT',
- error: '1'
+ error: '1',
},
{ id: 'AXJMbIUGPAOIsUIE3eNU', metric: 'new_reliability_rating', op: 'GT', error: '1' },
{ id: 'AXJMbIUGPAOIsUIE3eNV', metric: 'new_security_rating', op: 'GT', error: '1' },
@@ -70,17 +70,17 @@ export class QualityGatesServiceMock {
id: 'AXJMbIUHPAOIsUIE3eNc',
metric: 'new_duplicated_lines_density',
op: 'GT',
- error: '3'
+ error: '3',
},
{
id: 'AXJMbIUHPAOIsUIE3eOi',
metric: 'new_security_hotspots_reviewed',
op: 'LT',
- error: '100'
- }
+ error: '100',
+ },
],
isDefault: true,
- isBuiltIn: false
+ isBuiltIn: false,
}),
mockQualityGate({
id: 'AXGYZrDqC-YjVCvvbRDY',
@@ -88,10 +88,10 @@ export class QualityGatesServiceMock {
conditions: [
{ id: 'AXJMbIUHPAOIsUIE3eOu', metric: 'new_coverage', op: 'LT', error: '0' },
{ id: 'AXJMbIUHPAOIsUIE3eOubis', metric: 'new_coverage', op: 'LT', error: '1' },
- { id: 'deprecated', metric: 'function_complexity', op: 'LT', error: '1' }
+ { id: 'deprecated', metric: 'function_complexity', op: 'LT', error: '1' },
],
isDefault: false,
- isBuiltIn: false
+ isBuiltIn: false,
}),
mockQualityGate({
id: 'AWBWEMe4qGAMGEYPjJlr',
@@ -103,25 +103,25 @@ export class QualityGatesServiceMock {
id: 'AXJMbIUHPAOIsUIE3eOE',
metric: 'new_maintainability_rating',
op: 'GT',
- error: '1'
+ error: '1',
},
{ id: 'AXJMbIUHPAOIsUIE3eOF', metric: 'new_coverage', op: 'LT', error: '80' },
{
id: 'AXJMbIUHPAOIsUIE3eOG',
metric: 'new_duplicated_lines_density',
op: 'GT',
- error: '3'
+ error: '3',
},
{
id: 'AXJMbIUHPAOIsUIE3eOk',
metric: 'new_security_hotspots_reviewed',
op: 'LT',
- error: '100'
- }
+ error: '100',
+ },
],
isDefault: false,
- isBuiltIn: true
- })
+ isBuiltIn: true,
+ }),
];
this.list = cloneDeep(this.readOnlyList);
@@ -130,7 +130,7 @@ export class QualityGatesServiceMock {
{ key: 'test1', name: 'test1', selected: false },
{ key: 'test2', name: 'test2', selected: false },
{ key: 'test3', name: 'test3', selected: true },
- { key: 'test4', name: 'test4', selected: true }
+ { key: 'test4', name: 'test4', selected: true },
];
(fetchQualityGate as jest.Mock).mockImplementation(this.showHandler);
@@ -164,11 +164,11 @@ export class QualityGatesServiceMock {
}
getDefaultQualityGate() {
- return this.list.find(q => q.isDefault) || mockQualityGate({ isDefault: true });
+ return this.list.find((q) => q.isDefault) || mockQualityGate({ isDefault: true });
}
getBuiltInQualityGate() {
- return this.list.find(q => q.isBuiltIn) || mockQualityGate({ isBuiltIn: true });
+ return this.list.find((q) => q.isBuiltIn) || mockQualityGate({ isBuiltIn: true });
}
setIsAdmin(isAdmin: boolean) {
@@ -183,26 +183,26 @@ export class QualityGatesServiceMock {
associateProjects: this.isAdmin,
delete: q.isBuiltIn ? false : this.isAdmin,
manageConditions: this.isAdmin,
- delegate: this.isAdmin
+ delegate: this.isAdmin,
};
}
listHandler = () => {
return this.reply({
qualitygates: this.list
- .map(q => omit(q, 'conditions'))
- .map(q => ({
+ .map((q) => omit(q, 'conditions'))
+ .map((q) => ({
...q,
- actions: this.computeActions(q)
+ actions: this.computeActions(q),
})),
default: this.getDefaultQualityGate().id,
- actions: { create: this.isAdmin }
+ actions: { create: this.isAdmin },
});
};
showHandler = ({ id }: { id: string }) => {
const qualityGate = omit(
- this.list.find(q => q.id === id),
+ this.list.find((q) => q.id === id),
'isDefault'
);
return this.reply({ ...qualityGate, actions: this.computeActions(qualityGate) });
@@ -216,22 +216,22 @@ export class QualityGatesServiceMock {
name,
conditions: [],
isDefault: false,
- isBuiltIn: false
+ isBuiltIn: false,
})
);
return this.reply({
id: newId,
- name
+ name,
});
};
destroyHandler = ({ id }: { id: string }) => {
- this.list = this.list.filter(q => q.id !== id);
+ this.list = this.list.filter((q) => q.id !== id);
return Promise.resolve();
};
copyHandler = ({ id, name }: { id: string; name: string }) => {
- const newQG = cloneDeep(this.list.find(q => q.id === id));
+ const newQG = cloneDeep(this.list.find((q) => q.id === id));
if (newQG === undefined) {
return Promise.reject({ errors: [{ msg: `No quality gate has been found for id ${id}` }] });
}
@@ -245,27 +245,27 @@ export class QualityGatesServiceMock {
return this.reply({
id: newQG.id,
- name
+ name,
});
};
renameHandler = ({ id, name }: { id: string; name: string }) => {
- const renameQG = this.list.find(q => q.id === id);
+ const renameQG = this.list.find((q) => q.id === id);
if (renameQG === undefined) {
return Promise.reject({ errors: [{ msg: `No quality gate has been found for id ${id}` }] });
}
renameQG.name = name;
return this.reply({
id: renameQG.id,
- name
+ name,
});
};
setDefaultHandler = ({ id }: { id: string }) => {
- this.list.forEach(q => {
+ this.list.forEach((q) => {
q.isDefault = false;
});
- const selectedQG = this.list.find(q => q.id === id);
+ const selectedQG = this.list.find((q) => q.id === id);
if (selectedQG === undefined) {
return Promise.reject({ errors: [{ msg: `No quality gate has been found for id ${id}` }] });
}
@@ -279,10 +279,10 @@ export class QualityGatesServiceMock {
} & Omit<Condition, 'id'>
) => {
const { metric, gateId, op, error } = data;
- const qg = this.list.find(q => q.id === gateId);
+ const qg = this.list.find((q) => q.id === gateId);
if (qg === undefined) {
return Promise.reject({
- errors: [{ msg: `No quality gate has been found for id ${gateId}` }]
+ errors: [{ msg: `No quality gate has been found for id ${gateId}` }],
});
}
@@ -295,7 +295,7 @@ export class QualityGatesServiceMock {
};
updateConditionHandler = ({ id, metric, op, error }: Condition) => {
- const condition = flatten(this.list.map(q => q.conditions || [])).find(q => q.id === id);
+ const condition = flatten(this.list.map((q) => q.conditions || [])).find((q) => q.id === id);
if (condition === undefined) {
return Promise.reject({ errors: [{ msg: `No condition has been found for id ${id}` }] });
}
@@ -308,33 +308,33 @@ export class QualityGatesServiceMock {
};
deleteConditionHandler = ({ id }: { id: string }) => {
- this.list.forEach(q => {
- remove(q.conditions || [], c => c.id === id);
+ this.list.forEach((q) => {
+ remove(q.conditions || [], (c) => c.id === id);
});
return Promise.resolve();
};
searchProjectsHandler = ({
selected,
- query
+ query,
}: {
selected: string;
query: string | undefined;
}) => {
let filteredProjects = this.projects;
if (selected === 'selected') {
- filteredProjects = this.projects.filter(p => p.selected);
+ filteredProjects = this.projects.filter((p) => p.selected);
} else if (selected === 'deselected') {
- filteredProjects = this.projects.filter(p => !p.selected);
+ filteredProjects = this.projects.filter((p) => !p.selected);
}
if (query !== '' && query !== undefined) {
- filteredProjects = filteredProjects.filter(p => p.name.includes(query));
+ filteredProjects = filteredProjects.filter((p) => p.name.includes(query));
}
const response = {
paging: { pageIndex: 1, pageSize: 3, total: 55 },
- results: filteredProjects
+ results: filteredProjects,
};
return this.reply(response);
};
@@ -356,7 +356,7 @@ export class QualityGatesServiceMock {
};
selectHandler = ({ projectKey }: { projectKey: string }) => {
- const changedProject = this.projects.find(p => p.key === projectKey);
+ const changedProject = this.projects.find((p) => p.key === projectKey);
if (changedProject) {
changedProject.selected = true;
}
@@ -364,7 +364,7 @@ export class QualityGatesServiceMock {
};
deSelectHandler = ({ projectKey }: { projectKey: string }) => {
- const changedProject = this.projects.find(p => p.key === projectKey);
+ const changedProject = this.projects.find((p) => p.key === projectKey);
if (changedProject) {
changedProject.selected = false;
}
diff --git a/server/sonar-web/src/main/js/api/mocks/SecurityHotspotServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/SecurityHotspotServiceMock.ts
index 0cc19002c46..3a28a222ae7 100644
--- a/server/sonar-web/src/main/js/api/mocks/SecurityHotspotServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/SecurityHotspotServiceMock.ts
@@ -39,7 +39,7 @@ export default class SecurityHotspotServiceMock {
this.rawHotspotKey = Object.keys(mockRawHotspot());
this.hotspots = [
mockHotspot({ key: '1', status: HotspotStatus.TO_REVIEW }),
- mockHotspot({ key: '2', status: HotspotStatus.TO_REVIEW })
+ mockHotspot({ key: '2', status: HotspotStatus.TO_REVIEW }),
];
(getMeasures as jest.Mock).mockImplementation(this.handleGetMeasures);
@@ -49,10 +49,10 @@ export default class SecurityHotspotServiceMock {
);
(getRuleDetails as jest.Mock).mockResolvedValue({ rule: mockRuleDetails() });
(getSources as jest.Mock).mockResolvedValue(
- times(NUMBER_OF_LINES, n =>
+ times(NUMBER_OF_LINES, (n) =>
mockSourceLine({
line: n,
- code: ' <span class="sym-35 sym">symbole</span>'
+ code: ' <span class="sym-35 sym">symbole</span>',
})
)
);
@@ -60,7 +60,7 @@ export default class SecurityHotspotServiceMock {
handleGetSources = (data: { key: string; from?: number; to?: number } & BranchParameters) => {
return this.reply(
- range(data.from || 1, data.to || MAX_END_RANGE).map(line => mockSourceLine({ line }))
+ range(data.from || 1, data.to || MAX_END_RANGE).map((line) => mockSourceLine({ line }))
);
};
@@ -77,31 +77,31 @@ export default class SecurityHotspotServiceMock {
) => {
return this.reply({
paging: { pageIndex: 1, pageSize: data.ps, total: this.hotspots.length },
- hotspots: this.hotspots.map(hotspot => pick(hotspot, this.rawHotspotKey)),
+ hotspots: this.hotspots.map((hotspot) => pick(hotspot, this.rawHotspotKey)),
components: [
{
key: 'guillaume-peoch-sonarsource_benflix_AYGpXq2bd8qy4i0eO9ed:index.php',
qualifier: 'FIL',
name: 'index.php',
longName: 'index.php',
- path: 'index.php'
+ path: 'index.php',
},
{
key: 'guillaume-peoch-sonarsource_benflix_AYGpXq2bd8qy4i0eO9ed',
qualifier: 'TRK',
name: 'benflix',
- longName: 'benflix'
- }
- ]
+ longName: 'benflix',
+ },
+ ],
});
};
handleGetSecurityHotspotDetails = (securityHotspotKey: string) => {
- const hotspot = this.hotspots.find(h => h.key === securityHotspotKey);
+ const hotspot = this.hotspots.find((h) => h.key === securityHotspotKey);
if (hotspot === undefined) {
return Promise.reject({
- errors: [{ msg: `No security hotspot for key ${securityHotspotKey}` }]
+ errors: [{ msg: `No security hotspot for key ${securityHotspotKey}` }],
});
}
@@ -115,9 +115,9 @@ export default class SecurityHotspotServiceMock {
key: 'guillaume-peoch-sonarsource_benflix_AYGpXq2bd8qy4i0eO9ed',
name: 'benflix',
qualifier: 'TRK',
- measures: [{ metric: 'security_hotspots_reviewed', value: '0.0', bestValue: false }]
- }
- }
+ measures: [{ metric: 'security_hotspots_reviewed', value: '0.0', bestValue: false }],
+ },
+ },
]);
};
@@ -129,7 +129,7 @@ export default class SecurityHotspotServiceMock {
this.rawHotspotKey = Object.keys(mockRawHotspot());
this.hotspots = [
mockHotspot({ key: '1', status: HotspotStatus.TO_REVIEW }),
- mockHotspot({ key: '2', status: HotspotStatus.TO_REVIEW })
+ mockHotspot({ key: '2', status: HotspotStatus.TO_REVIEW }),
];
};
}
diff --git a/server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts
index 7d22006a564..89727adaa72 100644
--- a/server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts
@@ -28,8 +28,8 @@ export default class SettingsServiceMock {
defaultValues: SettingValue[] = [
{
key: SettingsKey.AuditHouseKeeping,
- value: HousekeepingPolicy.Weekly
- }
+ value: HousekeepingPolicy.Weekly,
+ },
];
constructor() {
@@ -40,12 +40,12 @@ export default class SettingsServiceMock {
}
handleGetValue = (data: { key: string; component?: string } & BranchParameters) => {
- const setting = this.settingValues.find(s => s.key === data.key);
+ const setting = this.settingValues.find((s) => s.key === data.key);
return this.reply(setting);
};
handleGetValues = (data: { keys: string[]; component?: string } & BranchParameters) => {
- const settings = this.settingValues.filter(s => data.keys.includes(s.key));
+ const settings = this.settingValues.filter((s) => data.keys.includes(s.key));
return this.reply(settings);
};
@@ -59,7 +59,7 @@ export default class SettingsServiceMock {
};
set = (key: SettingsKey, value: string) => {
- const setting = this.settingValues.find(s => s.key === key);
+ const setting = this.settingValues.find((s) => s.key === key);
if (setting) {
setting.value = value;
} else {
diff --git a/server/sonar-web/src/main/js/api/mocks/SourceViewerServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/SourceViewerServiceMock.ts
index 7205b908eb1..90ff8c7098d 100644
--- a/server/sonar-web/src/main/js/api/mocks/SourceViewerServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/SourceViewerServiceMock.ts
@@ -24,7 +24,7 @@ import {
getComponentData,
getComponentForSourceViewer,
getDuplications,
- getSources
+ getSources,
} from '../../api/components';
import { mockSourceLine } from '../../helpers/mocks/sources';
import { HttpStatus } from '../../helpers/request';
@@ -43,7 +43,7 @@ function mockSourceFileView(name: string, project = 'project') {
analysisDate: '2019-08-08T12:15:12+0200',
leakPeriodDate: '2018-08-07T11:22:22+0200',
version: '1.2-SNAPSHOT',
- needIssueSync: false
+ needIssueSync: false,
},
sourceFileView: {
key: `${project}:${name}`,
@@ -56,8 +56,8 @@ function mockSourceFileView(name: string, project = 'project') {
projectName: 'Test project',
fav: false,
canMarkAsFavorite: true,
- measures: { lines: '0', issues: '0' }
- }
+ measures: { lines: '0', issues: '0' },
+ },
};
}
@@ -72,44 +72,44 @@ const ANCESTORS = [
visibility: 'public',
leakPeriodDate: '2018-08-07T11:22:22+0200',
version: '1.2-SNAPSHOT',
- needIssueSync: false
- }
+ needIssueSync: false,
+ },
];
const FILES: Dict<any> = {
'project:test3.js': {
...mockSourceFileView('test3.js'),
sources: [],
- ancestors: ANCESTORS
+ ancestors: ANCESTORS,
},
'project:test2.js': {
...mockSourceFileView('test2.js'),
- sources: times(200, n =>
+ sources: times(200, (n) =>
mockSourceLine({
line: n,
- code: `\u003cspan class\u003d"cd"\u003eLine ${n}\u003c/span\u003e`
+ code: `\u003cspan class\u003d"cd"\u003eLine ${n}\u003c/span\u003e`,
})
),
- ancestors: ANCESTORS
+ ancestors: ANCESTORS,
},
'foo:index.tsx': {
...mockSourceFileView('index.tsx', 'foo'),
- sources: times(200, n =>
+ sources: times(200, (n) =>
mockSourceLine({
line: n,
- code: 'function Test() {}'
+ code: 'function Test() {}',
})
),
- ancestors: ANCESTORS
+ ancestors: ANCESTORS,
},
'project:testSymb.tsx': {
...mockSourceFileView('testSymb.tsx'),
- sources: times(20, n =>
+ sources: times(20, (n) =>
mockSourceLine({
line: n,
- code: ' <span class="sym-35 sym">symbole</span>'
+ code: ' <span class="sym-35 sym">symbole</span>',
})
),
- ancestors: ANCESTORS
+ ancestors: ANCESTORS,
},
'project:test.js': {
...mockSourceFileView('test.js'),
@@ -123,7 +123,7 @@ const FILES: Dict<any> = {
duplicated: false,
isNew: false,
lineHits: 1,
- coveredConditions: 1
+ coveredConditions: 1,
},
{
line: 2,
@@ -134,7 +134,7 @@ const FILES: Dict<any> = {
duplicated: false,
isNew: false,
lineHits: 0,
- conditions: 1
+ conditions: 1,
},
{
line: 3,
@@ -144,19 +144,18 @@ const FILES: Dict<any> = {
scmDate: '2022-01-28T21:03:07+0100',
duplicated: false,
isNew: false,
- lineHits: 1
+ lineHits: 1,
},
{
line: 4,
- code:
- '\u003cspan class\u003d"cd"\u003e * mailto:info AT sonarsource DOT com\u003c/span\u003e',
+ code: '\u003cspan class\u003d"cd"\u003e * mailto:info AT sonarsource DOT com\u003c/span\u003e',
scmRevision: 'f09ee6b610528aa37b7b51be395c93524cebae8f',
scmAuthor: 'stas.vilchik@sonarsource.com',
duplicated: false,
isNew: false,
lineHits: 1,
conditions: 1,
- coveredConditions: 1
+ coveredConditions: 1,
},
{
line: 5,
@@ -166,7 +165,7 @@ const FILES: Dict<any> = {
isNew: false,
lineHits: 2,
conditions: 2,
- coveredConditions: 1
+ coveredConditions: 1,
},
{
line: 6,
@@ -174,33 +173,32 @@ const FILES: Dict<any> = {
scmRevision: 'f04ee6b610528aa37b7b51be395c93524cebae8f',
duplicated: false,
isNew: false,
- lineHits: 0
+ lineHits: 0,
},
{
line: 7,
code: '\u003cspan class\u003d"cd"\u003e * 7\u003c/span\u003e',
scmRevision: 'f04ee6b610528aa37b7b51be395c93524cebae8f',
duplicated: true,
- isNew: true
+ isNew: true,
},
{
- code:
- '\u003cspan class\u003d"cd"\u003e * This program is free software; you can redistribute it and/or\u003c/span\u003e',
+ code: '\u003cspan class\u003d"cd"\u003e * This program is free software; you can redistribute it and/or\u003c/span\u003e',
scmRevision: 'f09ee6b610528aa37b7b51be395c93524cebae8f',
scmAuthor: 'stas.vilchik@sonarsource.com',
scmDate: '2018-07-10T20:21:20+0200',
duplicated: false,
- isNew: false
- }
+ isNew: false,
+ },
],
ancestors: ANCESTORS,
duplications: [
{
blocks: [
{ from: 7, size: 1, _ref: '1' },
- { from: 1, size: 1, _ref: '2' }
- ]
- }
+ { from: 1, size: 1, _ref: '2' },
+ ],
+ },
],
files: {
'1': {
@@ -209,7 +207,7 @@ const FILES: Dict<any> = {
uuid: 'AX8NSmj8EGYw5-dyy63J',
project: 'project',
projectUuid: 'AX7juKJqVeQLJMPyb_b-',
- projectName: 'project'
+ projectName: 'project',
},
'2': {
key: 'project:test2.js',
@@ -217,10 +215,10 @@ const FILES: Dict<any> = {
uuid: 'BX8NSmj8EGYw5-dyy63J',
project: 'project',
projectUuid: 'AX7juKJqVeQLJMPyb_b-',
- projectName: 'project'
- }
- }
- }
+ projectName: 'project',
+ },
+ },
+ },
};
export class SourceViewerServiceMock {
diff --git a/server/sonar-web/src/main/js/api/mocks/UserTokensMock.ts b/server/sonar-web/src/main/js/api/mocks/UserTokensMock.ts
index cd21d0fc443..2fef8eb17f0 100644
--- a/server/sonar-web/src/main/js/api/mocks/UserTokensMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/UserTokensMock.ts
@@ -30,12 +30,12 @@ const defaultTokens = [
mockUserToken({
name: 'local-scanner',
createdAt: '2022-03-07T09:02:59+0000',
- lastConnectionDate: '2022-04-07T09:51:48+0000'
+ lastConnectionDate: '2022-04-07T09:51:48+0000',
}),
mockUserToken({
name: 'test',
- createdAt: '2020-01-23T19:25:19+0000'
- })
+ createdAt: '2020-01-23T19:25:19+0000',
+ }),
];
export default class UserTokensMock {
@@ -59,7 +59,7 @@ export default class UserTokensMock {
login,
type,
projectKey,
- expirationDate
+ expirationDate,
}: {
name: string;
login?: string;
@@ -78,11 +78,9 @@ export default class UserTokensMock {
type,
projectKey,
isExpired: false,
- token: Math.random()
- .toString(RANDOM_RADIX)
- .slice(RANDOM_PREFIX),
+ token: Math.random().toString(RANDOM_RADIX).slice(RANDOM_PREFIX),
createdAt: '2022-04-04T04:04:04+0000',
- expirationDate
+ expirationDate,
};
this.tokens.push(token);
@@ -91,7 +89,7 @@ export default class UserTokensMock {
};
handleRevokeToken = ({ name }: { name: string; login?: string }) => {
- const index = this.tokens.findIndex(t => t.name === name);
+ const index = this.tokens.findIndex((t) => t.name === name);
if (index < 0) {
return Promise.resolve();
diff --git a/server/sonar-web/src/main/js/api/permissions.ts b/server/sonar-web/src/main/js/api/permissions.ts
index 295ccc7f274..15e7e99fe6e 100644
--- a/server/sonar-web/src/main/js/api/permissions.ts
+++ b/server/sonar-web/src/main/js/api/permissions.ts
@@ -24,7 +24,7 @@ import {
PermissionGroup,
PermissionTemplate,
PermissionUser,
- Visibility
+ Visibility,
} from '../types/types';
import { BaseSearchProjectsParameters } from './components';
@@ -197,7 +197,7 @@ export function getPermissionTemplateUsers(
if (permission) {
data.permission = permission;
}
- return getJSON('/api/permissions/template_users', data).then(r => r.users);
+ return getJSON('/api/permissions/template_users', data).then((r) => r.users);
}
export function getPermissionTemplateGroups(
@@ -212,7 +212,7 @@ export function getPermissionTemplateGroups(
if (permission) {
data.permission = permission;
}
- return getJSON('/api/permissions/template_groups', data).then(r => r.groups);
+ return getJSON('/api/permissions/template_groups', data).then((r) => r.groups);
}
export function changeProjectVisibility(
diff --git a/server/sonar-web/src/main/js/api/plugins.ts b/server/sonar-web/src/main/js/api/plugins.ts
index 64510fd49e9..871a2a8d89b 100644
--- a/server/sonar-web/src/main/js/api/plugins.ts
+++ b/server/sonar-web/src/main/js/api/plugins.ts
@@ -26,7 +26,7 @@ import {
InstalledPlugin,
PendingPluginResult,
PluginType,
- Update
+ Update,
} from '../types/plugins';
export function getAvailablePlugins(): Promise<{
@@ -45,8 +45,8 @@ function getLastUpdates(updates: undefined | Update[]): Update[] {
return [];
}
const lastUpdate = ['COMPATIBLE', 'REQUIRES_SYSTEM_UPGRADE', 'DEPS_REQUIRE_SYSTEM_UPGRADE'].map(
- status => {
- const index = findLastIndex(updates, update => update.status === status);
+ (status) => {
+ const index = findLastIndex(updates, (update) => update.status === status);
return index > -1 ? updates[index] : undefined;
}
);
@@ -87,9 +87,9 @@ export function getInstalledPluginsWithUpdates(): Promise<InstalledPlugin[]> {
return {
...updatePlugin,
...plugin,
- updates: getLastUpdates(updatePlugin.updates).map(update =>
+ updates: getLastUpdates(updatePlugin.updates).map((update) =>
addChangelog(update, updatePlugin.updates)
- )
+ ),
};
}
return plugin;
@@ -102,7 +102,7 @@ export function getPluginUpdates(): Promise<InstalledPlugin[]> {
return Promise.all([getUpdatesPluginApi(), getInstalledPluginApi()])
.then(([updates, installed]) =>
updates.plugins.map((updatePlugin: InstalledPlugin) => {
- const updates = getLastUpdates(updatePlugin.updates).map(update =>
+ const updates = getLastUpdates(updatePlugin.updates).map((update) =>
addChangelog(update, updatePlugin.updates)
);
const plugin = installed.plugins.find((p: InstalledPlugin) => p.key === updatePlugin.key);
@@ -110,7 +110,7 @@ export function getPluginUpdates(): Promise<InstalledPlugin[]> {
return {
...plugin,
...updatePlugin,
- updates
+ updates,
};
}
return { ...updatePlugin, updates };
diff --git a/server/sonar-web/src/main/js/api/projectActivity.ts b/server/sonar-web/src/main/js/api/projectActivity.ts
index 06e8e582e43..6e19b1cb475 100644
--- a/server/sonar-web/src/main/js/api/projectActivity.ts
+++ b/server/sonar-web/src/main/js/api/projectActivity.ts
@@ -26,7 +26,7 @@ import { Paging } from '../types/types';
export enum ProjectActivityStatuses {
STATUS_PROCESSED = 'P',
STATUS_UNPROCESSED = 'U',
- STATUS_LIVE_MEASURE_COMPUTE = 'L'
+ STATUS_LIVE_MEASURE_COMPUTE = 'L',
}
export function getProjectActivity(
@@ -63,7 +63,10 @@ export function createEvent(
if (description) {
data.description = description;
}
- return postJSON('/api/project_analyses/create_event', data).then(r => r.event, throwGlobalError);
+ return postJSON('/api/project_analyses/create_event', data).then(
+ (r) => r.event,
+ throwGlobalError
+ );
}
export function deleteEvent(event: string): Promise<void | Response> {
@@ -82,7 +85,10 @@ export function changeEvent(
if (description) {
data.description = description;
}
- return postJSON('/api/project_analyses/update_event', data).then(r => r.event, throwGlobalError);
+ return postJSON('/api/project_analyses/update_event', data).then(
+ (r) => r.event,
+ throwGlobalError
+ );
}
export function deleteAnalysis(analysis: string): Promise<void | Response> {
diff --git a/server/sonar-web/src/main/js/api/projectLinks.ts b/server/sonar-web/src/main/js/api/projectLinks.ts
index 6af46e1adc5..478720227a8 100644
--- a/server/sonar-web/src/main/js/api/projectLinks.ts
+++ b/server/sonar-web/src/main/js/api/projectLinks.ts
@@ -22,7 +22,10 @@ import { getJSON, post, postJSON } from '../helpers/request';
import { ProjectLink } from '../types/types';
export function getProjectLinks(projectKey: string): Promise<ProjectLink[]> {
- return getJSON('/api/project_links/search', { projectKey }).then(r => r.links, throwGlobalError);
+ return getJSON('/api/project_links/search', { projectKey }).then(
+ (r) => r.links,
+ throwGlobalError
+ );
}
export function deleteLink(linkId: string) {
@@ -34,5 +37,5 @@ export function createLink(data: {
projectKey: string;
url: string;
}): Promise<ProjectLink> {
- return postJSON('/api/project_links/create', data).then(r => r.link, throwGlobalError);
+ return postJSON('/api/project_links/create', data).then((r) => r.link, throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/quality-gates.ts b/server/sonar-web/src/main/js/api/quality-gates.ts
index dbc478b3b60..798a899be81 100644
--- a/server/sonar-web/src/main/js/api/quality-gates.ts
+++ b/server/sonar-web/src/main/js/api/quality-gates.ts
@@ -26,7 +26,7 @@ import {
Group,
QualityGateApplicationStatus,
QualityGateProjectStatus,
- SearchPermissionsParameters
+ SearchPermissionsParameters,
} from '../types/quality-gates';
import { Condition, Paging, QualityGate } from '../types/types';
import { UserBase } from '../types/users';
@@ -83,7 +83,7 @@ export function getGateForProject(data: { project: string }): Promise<QualityGat
({ qualityGate }) =>
qualityGate && {
...qualityGate,
- isDefault: qualityGate.default
+ isDefault: qualityGate.default,
},
throwGlobalError
);
@@ -130,7 +130,7 @@ export function getQualityGateProjectStatus(
} & BranchParameters
): Promise<QualityGateProjectStatus> {
return getJSON('/api/qualitygates/project_status', data)
- .then(r => r.projectStatus)
+ .then((r) => r.projectStatus)
.catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/quality-profiles.ts b/server/sonar-web/src/main/js/api/quality-profiles.ts
index 283f0c52d2a..ad42d46bd71 100644
--- a/server/sonar-web/src/main/js/api/quality-profiles.ts
+++ b/server/sonar-web/src/main/js/api/quality-profiles.ts
@@ -75,7 +75,7 @@ export function searchQualityProfiles(
export function getQualityProfile({
compareToSonarWay,
- profile: { key }
+ profile: { key },
}: {
compareToSonarWay?: boolean;
profile: Profile;
@@ -103,24 +103,21 @@ export function getProfileProjects(
return getJSON('/api/qualityprofiles/projects', data).catch(throwGlobalError);
}
-export function getProfileInheritance({
- language,
- name: qualityProfile
-}: Profile): Promise<{
+export function getProfileInheritance({ language, name: qualityProfile }: Profile): Promise<{
ancestors: ProfileInheritanceDetails[];
children: ProfileInheritanceDetails[];
profile: ProfileInheritanceDetails;
}> {
return getJSON('/api/qualityprofiles/inheritance', {
language,
- qualityProfile
+ qualityProfile,
}).catch(throwGlobalError);
}
export function setDefaultProfile({ language, name: qualityProfile }: Profile) {
return post('/api/qualityprofiles/set_default', {
language,
- qualityProfile
+ qualityProfile,
});
}
@@ -143,7 +140,7 @@ export function changeProfileParent(
return post('/api/qualityprofiles/change_parent', {
language,
qualityProfile,
- parentQualityProfile: parentProfile ? parentProfile.name : undefined
+ parentQualityProfile: parentProfile ? parentProfile.name : undefined,
}).catch(throwGlobalError);
}
@@ -167,11 +164,11 @@ export function getQualityProfileExporterUrl(
export function getImporters(): Promise<
Array<{ key: string; languages: Array<string>; name: string }>
> {
- return getJSON('/api/qualityprofiles/importers').then(r => r.importers, throwGlobalError);
+ return getJSON('/api/qualityprofiles/importers').then((r) => r.importers, throwGlobalError);
}
export function getExporters(): Promise<any> {
- return getJSON('/api/qualityprofiles/exporters').then(r => r.exporters);
+ return getJSON('/api/qualityprofiles/exporters').then((r) => r.exporters);
}
export function getProfileChangelog(
@@ -190,7 +187,7 @@ export function getProfileChangelog(
to,
language,
qualityProfile,
- p: page
+ p: page,
});
}
@@ -215,7 +212,7 @@ export function associateProject({ language, name: qualityProfile }: Profile, pr
return post('/api/qualityprofiles/add_project', {
language,
qualityProfile,
- project
+ project,
}).catch(throwGlobalError);
}
@@ -223,7 +220,7 @@ export function dissociateProject({ language, name: qualityProfile }: Profile, p
return post('/api/qualityprofiles/remove_project', {
language,
qualityProfile,
- project
+ project,
}).catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/rules.ts b/server/sonar-web/src/main/js/api/rules.ts
index 583e684c200..3fa049665cc 100644
--- a/server/sonar-web/src/main/js/api/rules.ts
+++ b/server/sonar-web/src/main/js/api/rules.ts
@@ -32,7 +32,7 @@ export function searchRules(data: SearchRulesQuery): Promise<SearchRulesResponse
}
export function takeFacet(response: SearchRulesResponse, property: string) {
- const facet = response.facets?.find(f => f.property === property);
+ const facet = response.facets?.find((f) => f.property === property);
return facet ? facet.values : [];
}
@@ -53,7 +53,7 @@ export function getRuleDetails(parameters: {
}
export function getRuleTags(parameters: { ps?: number; q: string }): Promise<string[]> {
- return getJSON('/api/rules/tags', parameters).then(r => r.tags, throwGlobalError);
+ return getJSON('/api/rules/tags', parameters).then((r) => r.tags, throwGlobalError);
}
export function createRule(data: {
@@ -68,8 +68,8 @@ export function createRule(data: {
type?: string;
}): Promise<RuleDetails> {
return postJSON('/api/rules/create', data).then(
- r => r.rule,
- response => {
+ (r) => r.rule,
+ (response) => {
// do not show global error if the status code is 409
// this case should be handled inside a component
if (response && response.status === 409) {
@@ -86,5 +86,5 @@ export function deleteRule(parameters: { key: string }) {
}
export function updateRule(data: RulesUpdateRequest): Promise<RuleDetails> {
- return postJSON('/api/rules/update', data).then(r => r.rule, throwGlobalError);
+ return postJSON('/api/rules/update', data).then((r) => r.rule, throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/api/security-hotspots.ts b/server/sonar-web/src/main/js/api/security-hotspots.ts
index 7ad46bda59a..7c44c93edbd 100644
--- a/server/sonar-web/src/main/js/api/security-hotspots.ts
+++ b/server/sonar-web/src/main/js/api/security-hotspots.ts
@@ -27,7 +27,7 @@ import {
HotspotResolution,
HotspotSearchResponse,
HotspotSetStatusRequest,
- HotspotStatus
+ HotspotStatus,
} from '../types/security-hotspots';
import { UserBase } from '../types/users';
@@ -100,17 +100,17 @@ export function getSecurityHotspotDetails(securityHotspotKey: string): Promise<H
if (users) {
if (hotspot.assignee) {
- hotspot.assigneeUser = users.find(u => u.login === hotspot.assignee) || {
+ hotspot.assigneeUser = users.find((u) => u.login === hotspot.assignee) || {
active: true,
- login: hotspot.assignee
+ login: hotspot.assignee,
};
}
- hotspot.authorUser = users.find(u => u.login === hotspot.author) || {
+ hotspot.authorUser = users.find((u) => u.login === hotspot.author) || {
active: true,
- login: hotspot.author
+ login: hotspot.author,
};
- hotspot.comment.forEach(c => {
- c.user = users.find(u => u.login === c.login) || { active: true, login: c.login };
+ hotspot.comment.forEach((c) => {
+ c.user = users.find((u) => u.login === c.login) || { active: true, login: c.login };
});
}
diff --git a/server/sonar-web/src/main/js/api/settings.ts b/server/sonar-web/src/main/js/api/settings.ts
index 5780a8814b8..0baadccc407 100644
--- a/server/sonar-web/src/main/js/api/settings.ts
+++ b/server/sonar-web/src/main/js/api/settings.ts
@@ -26,12 +26,12 @@ import {
ExtendedSettingDefinition,
SettingDefinition,
SettingValue,
- SettingValueResponse
+ SettingValueResponse,
} from '../types/settings';
export function getDefinitions(component?: string): Promise<ExtendedSettingDefinition[]> {
return getJSON('/api/settings/list_definitions', { component }).then(
- r => r.definitions,
+ (r) => r.definitions,
throwGlobalError
);
}
@@ -47,10 +47,10 @@ export function getValues(
): Promise<SettingValue[]> {
return getJSON('/api/settings/values', {
keys: data.keys.join(','),
- component: data.component
+ component: data.component,
}).then((r: SettingValueResponse) => [
...r.settings,
- ...r.setSecuredSettings.map(key => ({ key }))
+ ...r.setSecuredSettings.map((key) => ({ key })),
]);
}
@@ -59,7 +59,7 @@ export function getAllValues(
): Promise<SettingValue[]> {
return getJSON('/api/settings/values', data).then((r: SettingValueResponse) => [
...r.settings,
- ...r.setSecuredSettings.map(key => ({ key }))
+ ...r.setSecuredSettings.map((key) => ({ key })),
]);
}
@@ -75,7 +75,7 @@ export function setSettingValue(
data.values = value;
} else if (definition.type === 'PROPERTY_SET') {
data.fieldValues = value
- .map((fields: any) => omitBy(fields, value => value == null))
+ .map((fields: any) => omitBy(fields, (value) => value == null))
.map(JSON.stringify);
} else {
data.value = value;
diff --git a/server/sonar-web/src/main/js/api/static.ts b/server/sonar-web/src/main/js/api/static.ts
index 2968e680439..85121065b44 100644
--- a/server/sonar-web/src/main/js/api/static.ts
+++ b/server/sonar-web/src/main/js/api/static.ts
@@ -23,5 +23,5 @@ export function getPluginStaticFileContent(pluginKey: string, staticFilePath: st
return request(`/static/${pluginKey}/${staticFilePath}`)
.submit()
.then(checkStatus)
- .then(response => response.text());
+ .then((response) => response.text());
}
diff --git a/server/sonar-web/src/main/js/api/time-machine.ts b/server/sonar-web/src/main/js/api/time-machine.ts
index 0f9f592cd71..cd59a20b76e 100644
--- a/server/sonar-web/src/main/js/api/time-machine.ts
+++ b/server/sonar-web/src/main/js/api/time-machine.ts
@@ -53,14 +53,14 @@ export function getAllTimeMachineData(
} & BranchParameters,
prev?: TimeMachineResponse
): Promise<TimeMachineResponse> {
- return getTimeMachineData({ ...data, ps: 1000 }).then(r => {
+ return getTimeMachineData({ ...data, ps: 1000 }).then((r) => {
const result = prev
? {
measures: prev.measures.map((measure, idx) => ({
...measure,
- history: measure.history.concat(r.measures[idx].history)
+ history: measure.history.concat(r.measures[idx].history),
})),
- paging: r.paging
+ paging: r.paging,
}
: r;
diff --git a/server/sonar-web/src/main/js/api/user-tokens.ts b/server/sonar-web/src/main/js/api/user-tokens.ts
index c016d4452a3..1cdd58a824e 100644
--- a/server/sonar-web/src/main/js/api/user-tokens.ts
+++ b/server/sonar-web/src/main/js/api/user-tokens.ts
@@ -23,7 +23,7 @@ import { NewUserToken, UserToken } from '../types/token';
/** List tokens for given user login */
export function getTokens(login: string): Promise<UserToken[]> {
- return getJSON('/api/user_tokens/search', { login }).then(r => r.userTokens, throwGlobalError);
+ return getJSON('/api/user_tokens/search', { login }).then((r) => r.userTokens, throwGlobalError);
}
export function generateToken(data: {
diff --git a/server/sonar-web/src/main/js/api/user_groups.ts b/server/sonar-web/src/main/js/api/user_groups.ts
index 5949d53c70d..217ab99f2a1 100644
--- a/server/sonar-web/src/main/js/api/user_groups.ts
+++ b/server/sonar-web/src/main/js/api/user_groups.ts
@@ -50,7 +50,7 @@ export function removeUserFromGroup(data: { id?: string; name?: string; login?:
}
export function createGroup(data: { description?: string; name: string }): Promise<Group> {
- return postJSON('/api/user_groups/create', data).then(r => r.group, throwGlobalError);
+ return postJSON('/api/user_groups/create', data).then((r) => r.group, throwGlobalError);
}
export function updateGroup(data: { description?: string; id: number; name?: string }) {
diff --git a/server/sonar-web/src/main/js/api/users.ts b/server/sonar-web/src/main/js/api/users.ts
index 423c3b67b80..7353412753e 100644
--- a/server/sonar-web/src/main/js/api/users.ts
+++ b/server/sonar-web/src/main/js/api/users.ts
@@ -88,7 +88,7 @@ export function updateUser(data: {
}): Promise<User> {
return postJSON('/api/users/update', {
...data,
- scmAccount: data.scmAccount.length > 0 ? data.scmAccount : ''
+ scmAccount: data.scmAccount.length > 0 ? data.scmAccount : '',
});
}
diff --git a/server/sonar-web/src/main/js/api/web-api.ts b/server/sonar-web/src/main/js/api/web-api.ts
index 31b3770d7ac..b95422dd012 100644
--- a/server/sonar-web/src/main/js/api/web-api.ts
+++ b/server/sonar-web/src/main/js/api/web-api.ts
@@ -32,7 +32,7 @@ interface RawDomain {
export function fetchWebApi(showInternal = true): Promise<RawDomain[]> {
return getJSON('/api/webservices/list', { include_internals: showInternal })
- .then(r => r.webServices)
+ .then((r) => r.webServices)
.catch(throwGlobalError);
}
diff --git a/server/sonar-web/src/main/js/app/components/AdminContainer.tsx b/server/sonar-web/src/main/js/app/components/AdminContainer.tsx
index 0b5bcc72ab9..edd745f472f 100644
--- a/server/sonar-web/src/main/js/app/components/AdminContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/AdminContainer.tsx
@@ -48,7 +48,7 @@ export class AdminContainer extends React.PureComponent<AdminContainerProps, Sta
state: State = {
pendingPlugins: defaultPendingPlugins,
systemStatus: defaultSystemStatus,
- adminPages: []
+ adminPages: [],
};
componentDidMount() {
@@ -68,14 +68,14 @@ export class AdminContainer extends React.PureComponent<AdminContainerProps, Sta
fetchNavigationSettings = () => {
getSettingsNavigation().then(
- r => this.setState({ adminPages: r.extensions }),
+ (r) => this.setState({ adminPages: r.extensions }),
() => {}
);
};
fetchPendingPlugins = () => {
getPendingPlugins().then(
- pendingPlugins => {
+ (pendingPlugins) => {
if (this.mounted) {
this.setState({ pendingPlugins });
}
@@ -138,8 +138,9 @@ export class AdminContainer extends React.PureComponent<AdminContainerProps, Sta
fetchSystemStatus: this.fetchSystemStatus,
fetchPendingPlugins: this.fetchPendingPlugins,
pendingPlugins,
- systemStatus
- }}>
+ systemStatus,
+ }}
+ >
<Outlet context={adminPagesContext} />
</AdminContext.Provider>
</div>
diff --git a/server/sonar-web/src/main/js/app/components/AdminContext.tsx b/server/sonar-web/src/main/js/app/components/AdminContext.tsx
index 15628a0bd91..2e00bc92316 100644
--- a/server/sonar-web/src/main/js/app/components/AdminContext.tsx
+++ b/server/sonar-web/src/main/js/app/components/AdminContext.tsx
@@ -35,6 +35,6 @@ const AdminContext = React.createContext<AdminContextInterface>({
fetchSystemStatus: () => {},
fetchPendingPlugins: () => {},
pendingPlugins: defaultPendingPlugins,
- systemStatus: defaultSystemStatus
+ systemStatus: defaultSystemStatus,
});
export default AdminContext;
diff --git a/server/sonar-web/src/main/js/app/components/App.tsx b/server/sonar-web/src/main/js/app/components/App.tsx
index 297252eba06..b21724633e3 100644
--- a/server/sonar-web/src/main/js/app/components/App.tsx
+++ b/server/sonar-web/src/main/js/app/components/App.tsx
@@ -68,7 +68,7 @@ export class App extends React.PureComponent<Props> {
renderPreconnectLink = () => {
const {
- appState: { settings }
+ appState: { settings },
} = this.props;
const enableGravatar = settings[GlobalSettingKeys.EnableGravatar] === 'true';
diff --git a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
index f4dfc260e65..181517004f8 100644
--- a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
@@ -30,13 +30,13 @@ import {
getBranchLikeQuery,
isBranch,
isMainBranch,
- isPullRequest
+ isPullRequest,
} from '../../helpers/branch-like';
import { HttpStatus } from '../../helpers/request';
import { getPortfolioUrl } from '../../helpers/urls';
import {
ProjectAlmBindingConfigurationErrors,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../../types/alm-settings';
import { BranchLike } from '../../types/branch-like';
import { ComponentQualifier, isPortfolioLike } from '../../types/component';
@@ -45,7 +45,7 @@ import { Task, TaskStatuses, TaskTypes, TaskWarning } from '../../types/tasks';
import { Component, Status } from '../../types/types';
import handleRequiredAuthorization from '../utils/handleRequiredAuthorization';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from './available-features/withAvailableFeatures';
import withBranchStatusActions from './branch-status/withBranchStatusActions';
import ComponentContainerNotFound from './ComponentContainerNotFound';
@@ -107,7 +107,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
try {
const [nav, { component }] = await Promise.all([
getComponentNavigation({ component: key, branch, pullRequest }),
- getComponentData({ component: key, branch, pullRequest })
+ getComponentData({ component: key, branch, pullRequest }),
]);
componentWithQualifier = this.addQualifier({ ...nav, ...component });
} catch (e) {
@@ -146,7 +146,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
branchLikes,
component: componentWithQualifier,
projectBinding,
- loading: false
+ loading: false,
});
this.fetchStatus(componentWithQualifier.key);
@@ -174,7 +174,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
!hasFeature(Feature.BranchSupport) ||
breadcrumb.qualifier === ComponentQualifier.Application
? Promise.resolve([])
- : getPullRequests(key)
+ : getPullRequests(key),
]);
branchLikes = [...branches, ...pullRequests];
@@ -214,11 +214,11 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
);
}
- const isPending = pendingTasks.some(task => task.status === TaskStatuses.Pending);
+ const isPending = pendingTasks.some((task) => task.status === TaskStatuses.Pending);
return {
currentTask: newCurrentTask,
isPending,
- tasksInProgress: newTasksInProgress
+ tasksInProgress: newTasksInProgress,
};
},
() => {
@@ -237,7 +237,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
if (component.qualifier === ComponentQualifier.Project) {
getAnalysisStatus({
component: component.key,
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
}).then(
({ component }) => {
this.setState({ warnings: component.warnings });
@@ -264,14 +264,14 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
addQualifier = (component: Component) => ({
...component,
- qualifier: component.breadcrumbs[component.breadcrumbs.length - 1].qualifier
+ qualifier: component.breadcrumbs[component.breadcrumbs.length - 1].qualifier,
});
getCurrentBranchLike = (branchLikes: BranchLike[]) => {
const { query } = this.props.location;
return query.pullRequest
- ? branchLikes.find(b => isPullRequest(b) && b.key === query.pullRequest)
- : branchLikes.find(b => isBranch(b) && (query.branch ? b.name === query.branch : b.isMain));
+ ? branchLikes.find((b) => isPullRequest(b) && b.key === query.pullRequest)
+ : branchLikes.find((b) => isBranch(b) && (query.branch ? b.name === query.branch : b.isMain));
};
getCurrentTask = (current: Task, branchLike?: BranchLike) => {
@@ -286,12 +286,12 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
getPendingTasksForBranchLike = (pendingTasks: Task[], branchLike?: BranchLike) => {
return pendingTasks.filter(
- task => this.isReportRelatedTask(task) && this.isSameBranch(task, branchLike)
+ (task) => this.isReportRelatedTask(task) && this.isSameBranch(task, branchLike)
);
};
getInProgressTasks = (pendingTasks: Task[]) => {
- return pendingTasks.filter(task => task.status === TaskStatuses.InProgress);
+ return pendingTasks.filter((task) => task.status === TaskStatuses.InProgress);
};
isReportRelatedTask = (task: Task) => {
@@ -360,7 +360,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
};
registerBranchStatuses = (branchLikes: BranchLike[], component: Component) => {
- branchLikes.forEach(branchLike => {
+ branchLikes.forEach((branchLike) => {
if (branchLike.status) {
this.props.updateBranchStatus(
branchLike,
@@ -373,7 +373,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
handleComponentChange = (changes: Partial<Component>) => {
if (this.mounted) {
- this.setState(state => {
+ this.setState((state) => {
if (state.component) {
const newComponent: Component = { ...state.component, ...changes };
return { component: newComponent };
@@ -422,7 +422,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
projectBinding,
projectBindingErrors,
tasksInProgress,
- warnings
+ warnings,
} = this.state;
const isInProgress = tasksInProgress && tasksInProgress.length > 0;
@@ -461,8 +461,9 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
isPending,
onBranchesChange: this.handleBranchesChange,
onComponentChange: this.handleComponentChange,
- projectBinding
- }}>
+ projectBinding,
+ }}
+ >
<Outlet />
</ComponentContext.Provider>
)}
diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx b/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx
index 3ed1bec60b8..2646c620010 100644
--- a/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx
+++ b/server/sonar-web/src/main/js/app/components/GlobalFooter.tsx
@@ -62,7 +62,8 @@ export function GlobalFooter({ hideLoggedInInfo, appState }: GlobalFooterProps)
<a
href="https://www.gnu.org/licenses/lgpl-3.0.txt"
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate('footer.license')}
</a>
</li>
@@ -70,7 +71,8 @@ export function GlobalFooter({ hideLoggedInInfo, appState }: GlobalFooterProps)
<a
href="https://community.sonarsource.com/c/help/sq"
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate('footer.community')}
</a>
</li>
@@ -81,7 +83,8 @@ export function GlobalFooter({ hideLoggedInInfo, appState }: GlobalFooterProps)
<a
href="https://redirect.sonarsource.com/doc/plugin-library.html"
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate('footer.plugins')}
</a>
</li>
diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooterBranding.tsx b/server/sonar-web/src/main/js/app/components/GlobalFooterBranding.tsx
index 1c9145b2231..60e0f5815ba 100644
--- a/server/sonar-web/src/main/js/app/components/GlobalFooterBranding.tsx
+++ b/server/sonar-web/src/main/js/app/components/GlobalFooterBranding.tsx
@@ -37,7 +37,8 @@ export default function GlobalFooterBranding() {
href="https://www.sonarqube.org/?referrer=sonarqube"
rel="noopener noreferrer"
target="_blank"
- title="SonarQube™">
+ title="SonarQube™"
+ >
SonarQube™
</a>{' '}
but is <strong>not</strong> an official version provided by{' '}
@@ -45,7 +46,8 @@ export default function GlobalFooterBranding() {
href="https://www.sonarsource.com"
rel="noopener noreferrer"
target="_blank"
- title="SonarSource SA">
+ title="SonarSource SA"
+ >
SonarSource SA
</a>
.
diff --git a/server/sonar-web/src/main/js/app/components/GlobalMessage.tsx b/server/sonar-web/src/main/js/app/components/GlobalMessage.tsx
index 9a0a64e1a2d..b7e21d4b416 100644
--- a/server/sonar-web/src/main/js/app/components/GlobalMessage.tsx
+++ b/server/sonar-web/src/main/js/app/components/GlobalMessage.tsx
@@ -36,7 +36,8 @@ export default function GlobalMessage(props: GlobalMessageProps) {
<MessageBox
data-test={`global-message__${message.level}`}
level={message.level}
- role={message.level === 'SUCCESS' ? 'status' : 'alert'}>
+ role={message.level === 'SUCCESS' ? 'status' : 'alert'}
+ >
{cutLongWords(message.text)}
<CloseButton
className="button-small"
diff --git a/server/sonar-web/src/main/js/app/components/GlobalMessagesContainer.tsx b/server/sonar-web/src/main/js/app/components/GlobalMessagesContainer.tsx
index 0618a6befa0..b4f5e0b0a45 100644
--- a/server/sonar-web/src/main/js/app/components/GlobalMessagesContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/GlobalMessagesContainer.tsx
@@ -38,7 +38,7 @@ export default class GlobalMessagesContainer extends React.Component<{}, State>
super(props);
this.state = {
- messages: []
+ messages: [],
};
}
@@ -65,7 +65,7 @@ export default class GlobalMessagesContainer extends React.Component<{}, State>
closeMessage = (messageId: string) => {
if (this.mounted) {
this.setState(({ messages }) => {
- return { messages: messages.filter(m => m.id !== messageId) };
+ return { messages: messages.filter((m) => m.id !== messageId) };
});
}
};
@@ -79,7 +79,7 @@ export default class GlobalMessagesContainer extends React.Component<{}, State>
return (
<MessagesContainer>
- {messages.map(message => (
+ {messages.map((message) => (
<GlobalMessage
closeGlobalMessage={this.closeMessage}
key={message.id}
diff --git a/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx b/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx
index 15c6672a055..a7693d6e4d3 100644
--- a/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx
+++ b/server/sonar-web/src/main/js/app/components/KeyboardShortcutsModal.tsx
@@ -40,8 +40,8 @@ const CATEGORIES: { left: Shortcuts; right: Shortcuts } = {
category: 'global',
shortcuts: [
{ keys: ['s'], action: 'search' },
- { keys: ['?'], action: 'open_shortcuts' }
- ]
+ { keys: ['?'], action: 'open_shortcuts' },
+ ],
},
{
category: 'issues_page',
@@ -57,9 +57,9 @@ const CATEGORIES: { left: Shortcuts; right: Shortcuts } = {
{ keys: ['i'], action: 'severity' },
{ keys: ['c'], action: 'comment' },
{ keys: ['ctrl', '+', 'enter'], action: 'submit_comment' },
- { keys: ['t'], action: 'tags' }
- ]
- }
+ { keys: ['t'], action: 'tags' },
+ ],
+ },
],
right: [
{
@@ -67,26 +67,26 @@ const CATEGORIES: { left: Shortcuts; right: Shortcuts } = {
shortcuts: [
{ keys: ['↑', '↓'], action: 'select_files' },
{ keys: ['→'], action: 'open_file' },
- { keys: ['←'], action: 'back' }
- ]
+ { keys: ['←'], action: 'back' },
+ ],
},
{
category: 'measures_page',
shortcuts: [
{ keys: ['↑', '↓'], action: 'select_files' },
{ keys: ['→'], action: 'open_file' },
- { keys: ['←'], action: 'back' }
- ]
+ { keys: ['←'], action: 'back' },
+ ],
},
{
category: 'rules_page',
shortcuts: [
{ keys: ['↑', '↓'], action: 'navigate' },
{ keys: ['→'], action: 'rule_details' },
- { keys: ['←'], action: 'back' }
- ]
- }
- ]
+ { keys: ['←'], action: 'back' },
+ ],
+ },
+ ],
};
function renderShortcuts(list: Shortcuts) {
@@ -106,7 +106,7 @@ function renderShortcuts(list: Shortcuts) {
{shortcuts.map(({ action, keys }) => (
<tr key={action}>
<td>
- {keys.map(k =>
+ {keys.map((k) =>
k === '+' ? (
<span key={k} className="little-spacer-right">
{k}
@@ -143,7 +143,7 @@ export default function KeyboardShortcutsModal() {
}
if (event.key === KeyboardKeys.KeyQuestionMark) {
- setDisplay(d => !d);
+ setDisplay((d) => !d);
}
};
@@ -169,7 +169,8 @@ export default function KeyboardShortcutsModal() {
onClick={() => {
setDisplay(false);
return true;
- }}>
+ }}
+ >
{translate('keyboard_shortcuts.disable_link')}
</Link>
</div>
diff --git a/server/sonar-web/src/main/js/app/components/MigrationContainer.tsx b/server/sonar-web/src/main/js/app/components/MigrationContainer.tsx
index d846dd577bc..49b0619a886 100644
--- a/server/sonar-web/src/main/js/app/components/MigrationContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/MigrationContainer.tsx
@@ -27,8 +27,8 @@ export function MigrationContainer() {
const to = {
pathname: '/maintenance',
search: new URLSearchParams({
- return_to: returnTo
- }).toString()
+ return_to: returnTo,
+ }).toString(),
};
return <Navigate to={to} />;
diff --git a/server/sonar-web/src/main/js/app/components/NonAdminPagesContainer.tsx b/server/sonar-web/src/main/js/app/components/NonAdminPagesContainer.tsx
index 0b1a924ab5f..72a3de1c3e5 100644
--- a/server/sonar-web/src/main/js/app/components/NonAdminPagesContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/NonAdminPagesContainer.tsx
@@ -38,7 +38,8 @@ export default function NonAdminPagesContainer() {
<Alert
className="it__alert-no-access-all-child-project max-width-60 huge-spacer-top"
display="block"
- variant="error">
+ variant="error"
+ >
<p>{translate('application.cannot_access_all_child_projects1')}</p>
<br />
<p>{translate('application.cannot_access_all_child_projects2')}</p>
diff --git a/server/sonar-web/src/main/js/app/components/PageTracker.tsx b/server/sonar-web/src/main/js/app/components/PageTracker.tsx
index 7ae1adbf0a9..5a4103840f6 100644
--- a/server/sonar-web/src/main/js/app/components/PageTracker.tsx
+++ b/server/sonar-web/src/main/js/app/components/PageTracker.tsx
@@ -65,7 +65,8 @@ export class PageTracker extends React.Component<Props, State> {
<Helmet
defaultTitle={getInstance()}
defer={false}
- onChangeClientState={appState.webAnalyticsJsPath ? this.trackPage : undefined}>
+ onChangeClientState={appState.webAnalyticsJsPath ? this.trackPage : undefined}
+ >
{this.props.children}
</Helmet>
);
diff --git a/server/sonar-web/src/main/js/app/components/PluginRiskConsent.tsx b/server/sonar-web/src/main/js/app/components/PluginRiskConsent.tsx
index 1de2edd1a28..1bef4d1b85e 100644
--- a/server/sonar-web/src/main/js/app/components/PluginRiskConsent.tsx
+++ b/server/sonar-web/src/main/js/app/components/PluginRiskConsent.tsx
@@ -55,7 +55,7 @@ export function PluginRiskConsent(props: PluginRiskConsentProps) {
try {
await setSimpleSettingValue({
key: SettingsKey.PluginRiskConsent,
- value: RiskConsent.Accepted
+ value: RiskConsent.Accepted,
});
// force a refresh for the backend
diff --git a/server/sonar-web/src/main/js/app/components/RecentHistory.ts b/server/sonar-web/src/main/js/app/components/RecentHistory.ts
index 80d3b244ca9..99ede7be7ad 100644
--- a/server/sonar-web/src/main/js/app/components/RecentHistory.ts
+++ b/server/sonar-web/src/main/js/app/components/RecentHistory.ts
@@ -54,7 +54,7 @@ export default class RecentHistory {
static add(componentKey: string, componentName: string, icon: string) {
const sonarHistory = RecentHistory.get();
const newEntry = { key: componentKey, name: componentName, icon };
- let newHistory = sonarHistory.filter(entry => entry.key !== newEntry.key);
+ let newHistory = sonarHistory.filter((entry) => entry.key !== newEntry.key);
newHistory.unshift(newEntry);
newHistory = newHistory.slice(0, HISTORY_LIMIT);
RecentHistory.set(newHistory);
@@ -62,7 +62,7 @@ export default class RecentHistory {
static remove(componentKey: string) {
const history = RecentHistory.get();
- const newHistory = history.filter(entry => entry.key !== componentKey);
+ const newHistory = history.filter((entry) => entry.key !== componentKey);
RecentHistory.set(newHistory);
}
}
diff --git a/server/sonar-web/src/main/js/app/components/SonarLintConnection.tsx b/server/sonar-web/src/main/js/app/components/SonarLintConnection.tsx
index 1a997e66bc7..bc0e19f2d97 100644
--- a/server/sonar-web/src/main/js/app/components/SonarLintConnection.tsx
+++ b/server/sonar-web/src/main/js/app/components/SonarLintConnection.tsx
@@ -31,7 +31,7 @@ import { portIsValid, sendUserToken } from '../../helpers/sonarlint';
import {
computeTokenExpirationDate,
getAvailableExpirationOptions,
- getNextTokenName
+ getNextTokenName,
} from '../../helpers/tokens';
import { NewUserToken, TokenExpiration } from '../../types/token';
import { LoggedInUser } from '../../types/users';
@@ -41,7 +41,7 @@ enum Status {
request,
tokenError,
tokenCreated,
- tokenSent
+ tokenSent,
}
interface Props {
@@ -152,7 +152,7 @@ export function SonarLintConnection({ currentUser }: Props) {
<Link to="/account/security">
{translate('sonarlint-connection.token-error.description2.link')}
</Link>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/app/components/StartupModal.tsx b/server/sonar-web/src/main/js/app/components/StartupModal.tsx
index f52d1cbce65..6276e8f020c 100644
--- a/server/sonar-web/src/main/js/app/components/StartupModal.tsx
+++ b/server/sonar-web/src/main/js/app/components/StartupModal.tsx
@@ -69,7 +69,7 @@ export class StartupModal extends React.PureComponent<Props & StateProps, State>
if (!lastPrompt || differenceInDays(new Date(), parseDate(lastPrompt)) >= 1) {
showLicense()
- .then(license => {
+ .then((license) => {
if (!license || !license.isValidEdition) {
save(LICENSE_PROMPT, toShortNotSoISOString(new Date()), currentUser.login);
this.setState({ open: true });
diff --git a/server/sonar-web/src/main/js/app/components/SystemAnnouncement.tsx b/server/sonar-web/src/main/js/app/components/SystemAnnouncement.tsx
index b889cd478dc..aaf0389f4b7 100644
--- a/server/sonar-web/src/main/js/app/components/SystemAnnouncement.tsx
+++ b/server/sonar-web/src/main/js/app/components/SystemAnnouncement.tsx
@@ -25,7 +25,7 @@ import { Alert } from '../../components/ui/Alert';
import { Feature } from '../../types/features';
import { GlobalSettingKeys, SettingValue } from '../../types/settings';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from './available-features/withAvailableFeatures';
import './SystemAnnouncement.css';
@@ -54,7 +54,7 @@ export class SystemAnnouncement extends React.PureComponent<WithAvailableFeature
getSettings = async () => {
const values: SettingValue[] = await getValues({
- keys: [GlobalSettingKeys.DisplayAnnouncementMessage, GlobalSettingKeys.AnnouncementMessage]
+ keys: [GlobalSettingKeys.DisplayAnnouncementMessage, GlobalSettingKeys.AnnouncementMessage],
});
const settings = keyBy(values, 'key');
@@ -63,7 +63,7 @@ export class SystemAnnouncement extends React.PureComponent<WithAvailableFeature
message:
(settings[GlobalSettingKeys.AnnouncementMessage] &&
settings[GlobalSettingKeys.AnnouncementMessage].value) ||
- ''
+ '',
});
};
@@ -86,7 +86,8 @@ export class SystemAnnouncement extends React.PureComponent<WithAvailableFeature
className="system-announcement-banner"
title={message}
display="banner"
- variant="warning">
+ variant="warning"
+ >
{message}
</Alert>
</div>
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/AdminContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/AdminContainer-test.tsx
index fc5b9bcd6ab..d6a1c4b275a 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/AdminContainer-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/AdminContainer-test.tsx
@@ -24,11 +24,11 @@ import { AdminContainer, AdminContainerProps } from '../AdminContainer';
jest.mock('../../../api/plugins', () => ({
getSettingsNavigation: jest.fn().mockResolvedValue({}),
- getPendingPlugins: jest.fn().mockResolvedValue({})
+ getPendingPlugins: jest.fn().mockResolvedValue({}),
}));
jest.mock('../../../api/system', () => ({
- getSystemStatus: jest.fn().mockResolvedValue({})
+ getSystemStatus: jest.fn().mockResolvedValue({}),
}));
it('should render correctly', () => {
@@ -40,9 +40,10 @@ function shallowRender(props: Partial<AdminContainerProps> = {}) {
return shallow(
<AdminContainer
appState={mockAppState({
- canAdmin: true
+ canAdmin: true,
})}
- {...props}>
+ {...props}
+ >
<div />
</AdminContainer>
);
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/App-test.tsx
index 842155e2977..3550ef1f068 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/App-test.tsx
@@ -29,9 +29,9 @@ it('should render correctly', () => {
appState: mockAppState({
settings: {
'sonar.lf.enableGravatar': 'true',
- 'sonar.lf.gravatarServerUrl': 'http://example.com'
- }
- })
+ 'sonar.lf.gravatarServerUrl': 'http://example.com',
+ },
+ }),
})
).toMatchSnapshot('with gravatar');
});
@@ -47,8 +47,8 @@ function shallowRender(props: Partial<App['props']> = {}) {
appState={mockAppState({
settings: {
'sonar.lf.enableGravatar': 'false',
- 'sonar.lf.gravatarServerUrl': ''
- }
+ 'sonar.lf.gravatarServerUrl': '',
+ },
})}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
index 8f637b05dc4..4603bd576af 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
@@ -51,35 +51,35 @@ jest.mock('../../../api/branches', () => {
.fn()
.mockResolvedValue([
mockPullRequest({ key: 'pr-89', status: { qualityGateStatus: 'ERROR' } }),
- mockPullRequest({ key: 'pr-90', title: 'PR Feature 2' })
- ])
+ mockPullRequest({ key: 'pr-90', title: 'PR Feature 2' }),
+ ]),
};
});
jest.mock('../../../api/ce', () => ({
getAnalysisStatus: jest.fn().mockResolvedValue({ component: { warnings: [] } }),
- getTasksForComponent: jest.fn().mockResolvedValue({ queue: [] })
+ getTasksForComponent: jest.fn().mockResolvedValue({ queue: [] }),
}));
jest.mock('../../../api/components', () => ({
- getComponentData: jest.fn().mockResolvedValue({ component: { analysisDate: '2018-07-30' } })
+ getComponentData: jest.fn().mockResolvedValue({ component: { analysisDate: '2018-07-30' } }),
}));
jest.mock('../../../api/navigation', () => ({
getComponentNavigation: jest.fn().mockResolvedValue({
breadcrumbs: [{ key: 'portfolioKey', name: 'portfolio', qualifier: 'VW' }],
- key: 'portfolioKey'
- })
+ key: 'portfolioKey',
+ }),
}));
jest.mock('../../../api/alm-settings', () => ({
getProjectAlmBinding: jest.fn().mockResolvedValue(undefined),
- validateProjectAlmBinding: jest.fn().mockResolvedValue(undefined)
+ validateProjectAlmBinding: jest.fn().mockResolvedValue(undefined),
}));
jest.mock('../../utils/handleRequiredAuthorization', () => ({
__esModule: true,
- default: jest.fn()
+ default: jest.fn(),
}));
const Inner = () => <div />;
@@ -99,7 +99,7 @@ it('changes component', () => {
wrapper.setState({
branchLikes: [mockMainBranch()],
component: { qualifier: 'TRK', visibility: 'public' } as Component,
- loading: false
+ loading: false,
});
wrapper.instance().handleComponentChange({ visibility: 'private' });
@@ -108,7 +108,7 @@ it('changes component', () => {
it('loads the project binding, if any', async () => {
const component = mockComponent({
- breadcrumbs: [{ key: 'foo', name: 'foo', qualifier: ComponentQualifier.Project }]
+ breadcrumbs: [{ key: 'foo', name: 'foo', qualifier: ComponentQualifier.Project }],
});
(getComponentNavigation as jest.Mock).mockResolvedValueOnce({});
(getComponentData as jest.Mock<any>)
@@ -116,7 +116,7 @@ it('loads the project binding, if any', async () => {
.mockResolvedValueOnce({ component });
(getProjectAlmBinding as jest.Mock).mockResolvedValueOnce(undefined).mockResolvedValueOnce({
alm: AlmKeys.GitHub,
- key: 'foo'
+ key: 'foo',
});
const wrapper = shallowRender();
@@ -137,7 +137,7 @@ it("doesn't load branches portfolio", async () => {
expect(getComponentData).toHaveBeenCalledWith({ component: 'portfolioKey', branch: undefined });
expect(getComponentNavigation).toHaveBeenCalledWith({
component: 'portfolioKey',
- branch: undefined
+ branch: undefined,
});
});
@@ -146,14 +146,14 @@ it('updates branches on change', async () => {
const wrapper = shallowRender({
hasFeature: () => true,
location: mockLocation({ query: { id: 'portfolioKey' } }),
- updateBranchStatus
+ updateBranchStatus,
});
wrapper.setState({
branchLikes: [mockMainBranch()],
component: mockComponent({
- breadcrumbs: [{ key: 'projectKey', name: 'project', qualifier: 'TRK' }]
+ breadcrumbs: [{ key: 'projectKey', name: 'project', qualifier: 'TRK' }],
}),
- loading: false
+ loading: false,
});
wrapper.instance().handleBranchesChange();
expect(getBranches).toHaveBeenCalledWith('projectKey');
@@ -164,7 +164,7 @@ it('updates branches on change', async () => {
it('fetches status', async () => {
(getComponentData as jest.Mock<any>).mockResolvedValueOnce({
- component: {}
+ component: {},
});
const wrapper = shallowRender();
@@ -200,17 +200,17 @@ it('filters correctly the pending tasks for a main branch', () => {
expect(component.getCurrentTask(currentTask, pullRequest)).toMatchObject(currentTask);
expect(component.getPendingTasksForBranchLike(pendingTasks, mainBranch)).toMatchObject([{}]);
expect(component.getPendingTasksForBranchLike(pendingTasks, pullRequest)).toMatchObject([
- currentTask
+ currentTask,
]);
});
it('reload component after task progress finished', async () => {
(getTasksForComponent as jest.Mock<any>)
.mockResolvedValueOnce({
- queue: [{ id: 'foo', status: TaskStatuses.InProgress, type: TaskTypes.ViewRefresh }]
+ queue: [{ id: 'foo', status: TaskStatuses.InProgress, type: TaskTypes.ViewRefresh }],
})
.mockResolvedValueOnce({
- queue: []
+ queue: [],
});
const wrapper = shallowRender();
@@ -245,13 +245,13 @@ it('reload component after task progress finished', async () => {
it('reloads component after task progress finished, and moves straight to current', async () => {
(getComponentData as jest.Mock<any>).mockResolvedValueOnce({
- component: { key: 'bar' }
+ component: { key: 'bar' },
});
(getTasksForComponent as jest.Mock<any>)
.mockResolvedValueOnce({ queue: [] })
.mockResolvedValueOnce({
queue: [],
- current: { id: 'foo', status: TaskStatuses.Success, type: TaskTypes.AppRefresh }
+ current: { id: 'foo', status: TaskStatuses.Success, type: TaskTypes.AppRefresh },
});
const wrapper = shallowRender();
@@ -279,11 +279,11 @@ it('reloads component after task progress finished, and moves straight to curren
it('only fully loads a non-empty component once', async () => {
(getComponentData as jest.Mock<any>).mockResolvedValueOnce({
- component: { key: 'bar', analysisDate: '2019-01-01' }
+ component: { key: 'bar', analysisDate: '2019-01-01' },
});
(getTasksForComponent as jest.Mock<any>).mockResolvedValueOnce({
queue: [],
- current: { id: 'foo', status: TaskStatuses.Success, type: TaskTypes.Report }
+ current: { id: 'foo', status: TaskStatuses.Success, type: TaskTypes.Report },
});
const wrapper = shallowRender();
@@ -294,15 +294,15 @@ it('only fully loads a non-empty component once', async () => {
it('only fully reloads a non-empty component if there was previously some task in progress', async () => {
(getComponentData as jest.Mock<any>).mockResolvedValueOnce({
- component: { key: 'bar', analysisDate: '2019-01-01' }
+ component: { key: 'bar', analysisDate: '2019-01-01' },
});
(getTasksForComponent as jest.Mock<any>)
.mockResolvedValueOnce({
- queue: [{ id: 'foo', status: TaskStatuses.InProgress, type: TaskTypes.AppRefresh }]
+ queue: [{ id: 'foo', status: TaskStatuses.InProgress, type: TaskTypes.AppRefresh }],
})
.mockResolvedValueOnce({
queue: [],
- current: { id: 'foo', status: TaskStatuses.Success, type: TaskTypes.AppRefresh }
+ current: { id: 'foo', status: TaskStatuses.Success, type: TaskTypes.AppRefresh },
});
const wrapper = shallowRender();
@@ -347,14 +347,14 @@ it('should redirect if the user has no access', async () => {
it('should redirect if the component is a portfolio', async () => {
const componentKey = 'comp-key';
(getComponentData as jest.Mock<any>).mockResolvedValueOnce({
- component: { key: componentKey, breadcrumbs: [{ qualifier: ComponentQualifier.Portfolio }] }
+ component: { key: componentKey, breadcrumbs: [{ qualifier: ComponentQualifier.Portfolio }] },
});
const replace = jest.fn();
const wrapper = shallowRender({
location: mockLocation({ pathname: '/dashboard' }),
- router: mockRouter({ replace })
+ router: mockRouter({ replace }),
});
await waitAndUpdate(wrapper);
expect(replace).toHaveBeenCalledWith({ pathname: '/portfolio', search: `?id=${componentKey}` });
@@ -362,7 +362,7 @@ it('should redirect if the component is a portfolio', async () => {
it('should display display the unavailable page if the component needs issue sync', async () => {
(getComponentData as jest.Mock).mockResolvedValueOnce({
- component: { key: 'test', qualifier: ComponentQualifier.Project, needIssueSync: true }
+ component: { key: 'test', qualifier: ComponentQualifier.Project, needIssueSync: true },
});
const wrapper = shallowRender();
@@ -375,8 +375,8 @@ it('should display display the unavailable page if the component needs issue syn
it('should correctly reload last task warnings if anything got dismissed', async () => {
(getComponentData as jest.Mock<any>).mockResolvedValueOnce({
component: mockComponent({
- breadcrumbs: [{ key: 'foo', name: 'Foo', qualifier: ComponentQualifier.Project }]
- })
+ breadcrumbs: [{ key: 'foo', name: 'Foo', qualifier: ComponentQualifier.Project }],
+ }),
});
(getComponentNavigation as jest.Mock).mockResolvedValueOnce({});
@@ -390,14 +390,14 @@ it('should correctly reload last task warnings if anything got dismissed', async
describe('should correctly validate the project binding depending on the context', () => {
const COMPONENT = mockComponent({
- breadcrumbs: [{ key: 'foo', name: 'Foo', qualifier: ComponentQualifier.Project }]
+ breadcrumbs: [{ key: 'foo', name: 'Foo', qualifier: ComponentQualifier.Project }],
});
const PROJECT_BINDING_ERRORS = mockProjectAlmBindingConfigurationErrors();
it.each([
["has an analysis; won't perform any check", { ...COMPONENT, analysisDate: '2020-01' }],
['has a project binding; check is OK', COMPONENT, undefined, 1],
- ['has a project binding; check is not OK', COMPONENT, PROJECT_BINDING_ERRORS, 1]
+ ['has a project binding; check is not OK', COMPONENT, PROJECT_BINDING_ERRORS, 1],
])('%s', async (_, component, projectBindingErrors = undefined, n = 0) => {
(getComponentNavigation as jest.Mock).mockResolvedValueOnce({});
(getComponentData as jest.Mock<any>).mockResolvedValueOnce({ component });
@@ -417,12 +417,12 @@ describe('should correctly validate the project binding depending on the context
it.each([
[ComponentQualifier.Application],
[ComponentQualifier.Portfolio],
- [ComponentQualifier.SubPortfolio]
+ [ComponentQualifier.SubPortfolio],
])(
'should not care about PR decoration settings for %s',
async (componentQualifier: ComponentQualifier) => {
const component = mockComponent({
- breadcrumbs: [{ key: 'foo', name: 'Foo', qualifier: componentQualifier }]
+ breadcrumbs: [{ key: 'foo', name: 'Foo', qualifier: componentQualifier }],
});
(getComponentNavigation as jest.Mock).mockResolvedValueOnce({});
(getComponentData as jest.Mock<any>).mockResolvedValueOnce({ component });
@@ -442,7 +442,8 @@ function shallowRender(props: Partial<ComponentContainer['props']> = {}) {
location={mockLocation({ query: { id: 'foo' } })}
updateBranchStatus={jest.fn()}
router={mockRouter()}
- {...props}>
+ {...props}
+ >
<Inner />
</ComponentContainer>
);
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx
index afacff7897a..e1b0da75c07 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/GlobalFooter-test.tsx
@@ -31,7 +31,7 @@ it('should not render the only logged in information', () => {
expect(
getWrapper({
hideLoggedInInfo: true,
- appState: mockAppState({ version: '6.4-SNAPSHOT' })
+ appState: mockAppState({ version: '6.4-SNAPSHOT' }),
})
).toMatchSnapshot();
});
@@ -39,7 +39,7 @@ it('should not render the only logged in information', () => {
it('should show the db warning message', () => {
expect(
getWrapper({
- appState: mockAppState({ productionDatabase: false, edition: EditionKey.community })
+ appState: mockAppState({ productionDatabase: false, edition: EditionKey.community }),
}).find('Alert')
).toMatchSnapshot();
});
@@ -47,7 +47,7 @@ it('should show the db warning message', () => {
it('should display the sq version', () => {
expect(
getWrapper({
- appState: mockAppState({ edition: EditionKey.enterprise, version: '6.4-SNAPSHOT' })
+ appState: mockAppState({ edition: EditionKey.enterprise, version: '6.4-SNAPSHOT' }),
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/KeyboardShortcutsModal-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/KeyboardShortcutsModal-test.tsx
index edeee98bd8f..1dcb5bc0961 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/KeyboardShortcutsModal-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/KeyboardShortcutsModal-test.tsx
@@ -27,12 +27,12 @@ jest.mock('react', () => {
let close: () => void;
return {
...jest.requireActual('react'),
- useEffect: jest.fn().mockImplementation(f => {
+ useEffect: jest.fn().mockImplementation((f) => {
close = f();
}),
clean: () => {
close();
- }
+ },
};
});
@@ -66,13 +66,13 @@ it('should ignore other keydownes', () => {
expect(wrapper.type()).toBeNull();
});
-it.each([['input'], ['select'], ['textarea']])('should ignore events on a %s', type => {
+it.each([['input'], ['select'], ['textarea']])('should ignore events on a %s', (type) => {
const wrapper = shallowRender();
const fakeEvent = new KeyboardEvent('keydown', { key: '!' });
Object.defineProperty(fakeEvent, 'target', {
- value: document.createElement(type)
+ value: document.createElement(type),
});
document.dispatchEvent(fakeEvent);
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/Landing-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/Landing-test.tsx
index 13f854d9bfa..97a188f7a83 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/Landing-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/Landing-test.tsx
@@ -29,8 +29,8 @@ it.each([
[mockLoggedInUser(), '/projects'],
[
mockLoggedInUser({ homepage: { type: 'ISSUES' } }),
- expect.objectContaining({ pathname: '/issues' })
- ]
+ expect.objectContaining({ pathname: '/issues' }),
+ ],
])('should render correctly', (currentUser: CurrentUser, expected: string) => {
const wrapper = shallowRender({ currentUser });
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/MigrationContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/MigrationContainer-test.tsx
index b32306cc8c6..15d0f3e6767 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/MigrationContainer-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/MigrationContainer-test.tsx
@@ -24,7 +24,7 @@ import { getSystemStatus } from '../../../helpers/system';
import MigrationContainer from '../MigrationContainer';
jest.mock('../../../helpers/system', () => ({
- getSystemStatus: jest.fn()
+ getSystemStatus: jest.fn(),
}));
const originalLocation = window.location;
@@ -33,18 +33,18 @@ beforeAll(() => {
const location = {
pathname: '/projects',
search: '?query=toto',
- hash: '#hash'
+ hash: '#hash',
};
Object.defineProperty(window, 'location', {
writable: true,
- value: location
+ value: location,
});
});
afterAll(() => {
Object.defineProperty(window, 'location', {
writable: true,
- value: originalLocation
+ value: originalLocation,
});
});
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/PageTracker-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/PageTracker-test.tsx
index e94c228a5e0..12c88b53429 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/PageTracker-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/PageTracker-test.tsx
@@ -25,11 +25,11 @@ import { mockAppState, mockLocation } from '../../../helpers/testMocks';
import { PageTracker } from '../PageTracker';
jest.mock('../../../helpers/extensions', () => ({
- installScript: jest.fn().mockResolvedValue({})
+ installScript: jest.fn().mockResolvedValue({}),
}));
jest.mock('../../../helpers/extensionsHandler', () => ({
- getWebAnalyticsPageHandlerFromCache: jest.fn().mockReturnValue(undefined)
+ getWebAnalyticsPageHandlerFromCache: jest.fn().mockReturnValue(undefined),
}));
beforeAll(() => {
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/PluginRiskConsent-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/PluginRiskConsent-test.tsx
index 49decfbdbbb..5f222b0cf09 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/PluginRiskConsent-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/PluginRiskConsent-test.tsx
@@ -25,13 +25,13 @@ import { mockLoggedInUser, mockRouter } from '../../../helpers/testMocks';
import { PluginRiskConsent, PluginRiskConsentProps } from '../PluginRiskConsent';
jest.mock('../../../api/settings', () => ({
- setSimpleSettingValue: jest.fn().mockResolvedValue({})
+ setSimpleSettingValue: jest.fn().mockResolvedValue({}),
}));
jest.mock('react', () => {
return {
...jest.requireActual('react'),
- useEffect: jest.fn().mockImplementation(f => f())
+ useEffect: jest.fn().mockImplementation((f) => f()),
};
});
@@ -47,7 +47,7 @@ it('should redirect non-admin users', () => {
const replace = jest.fn();
const wrapper = shallowRender({
currentUser: mockLoggedInUser(),
- router: mockRouter({ replace })
+ router: mockRouter({ replace }),
});
expect(wrapper.type()).toBeNull();
expect(replace).toHaveBeenCalled();
@@ -56,10 +56,7 @@ it('should redirect non-admin users', () => {
it('should handle acknowledgement and redirect', async () => {
const wrapper = shallowRender();
- wrapper
- .find(Button)
- .first()
- .simulate('click');
+ wrapper.find(Button).first().simulate('click');
await new Promise(setImmediate);
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/RecentHistory-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/RecentHistory-test.tsx
index 6afd157eab0..a7952ec55c0 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/RecentHistory-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/RecentHistory-test.tsx
@@ -23,7 +23,7 @@ import RecentHistory, { History } from '../RecentHistory';
jest.mock('../../../helpers/storage', () => ({
get: jest.fn(),
remove: jest.fn(),
- save: jest.fn()
+ save: jest.fn(),
}));
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/ResetPassword-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/ResetPassword-test.tsx
index fd6b3996442..208ffb0e3b7 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/ResetPassword-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/ResetPassword-test.tsx
@@ -24,7 +24,7 @@ import { mockLoggedInUser } from '../../../helpers/testMocks';
import { ResetPassword, ResetPasswordProps } from '../ResetPassword';
jest.mock('../../../helpers/system', () => ({
- getBaseUrl: jest.fn().mockReturnValue('/context')
+ getBaseUrl: jest.fn().mockReturnValue('/context'),
}));
const originalLocation = window.location;
@@ -32,18 +32,18 @@ const originalLocation = window.location;
beforeAll(() => {
const location = {
...window.location,
- href: null
+ href: null,
};
Object.defineProperty(window, 'location', {
writable: true,
- value: location
+ value: location,
});
});
afterAll(() => {
Object.defineProperty(window, 'location', {
writable: true,
- value: originalLocation
+ value: originalLocation,
});
});
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/SonarLintConnection-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/SonarLintConnection-test.tsx
index 4c1daef425d..98da2e15c5d 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/SonarLintConnection-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/SonarLintConnection-test.tsx
@@ -32,7 +32,7 @@ jest.mock('../../../api/user-tokens');
jest.mock('../../../helpers/handleRequiredAuthentication', () => ({
__esModule: true,
- default: jest.fn()
+ default: jest.fn(),
}));
jest.mock('../../../helpers/sonarlint', () => {
@@ -61,9 +61,9 @@ jest.mock('../../../api/settings', () => {
getAllValues: jest.fn().mockResolvedValue([
{
key: SettingsKey.TokenMaxAllowedLifetime,
- value: 'No expiration'
- }
- ])
+ value: 'No expiration',
+ },
+ ]),
};
});
@@ -141,7 +141,7 @@ function renderSonarLintConnection(overrides: { currentUser?: CurrentUser; port?
const { currentUser, port } = {
currentUser: mockLoggedInUser(),
port: '64120',
- ...overrides
+ ...overrides,
};
const searchParams = new URLSearchParams();
@@ -152,6 +152,6 @@ function renderSonarLintConnection(overrides: { currentUser?: CurrentUser; port?
renderApp('sonarlint/auth', <SonarLintConnection />, {
currentUser,
- navigateTo: `sonarlint/auth?${searchParams.toString()}`
+ navigateTo: `sonarlint/auth?${searchParams.toString()}`,
});
}
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx
index 79daabad3ac..4073e35ffec 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx
@@ -31,21 +31,21 @@ import { LoggedInUser } from '../../../types/users';
import { StartupModal } from '../StartupModal';
jest.mock('../../../api/editions', () => ({
- showLicense: jest.fn().mockResolvedValue(undefined)
+ showLicense: jest.fn().mockResolvedValue(undefined),
}));
jest.mock('../../../helpers/storage', () => ({
get: jest.fn(),
- save: jest.fn()
+ save: jest.fn(),
}));
jest.mock('../../../helpers/l10n', () => ({
- hasMessage: jest.fn().mockReturnValue(true)
+ hasMessage: jest.fn().mockReturnValue(true),
}));
jest.mock('../../../helpers/dates', () => ({
parseDate: jest.fn().mockReturnValue('parsed-date'),
- toShortNotSoISOString: jest.fn().mockReturnValue('short-not-iso-date')
+ toShortNotSoISOString: jest.fn().mockReturnValue('short-not-iso-date'),
}));
jest.mock('date-fns', () => ({ differenceInDays: jest.fn().mockReturnValue(1) }));
@@ -56,7 +56,7 @@ const LOGGED_IN_USER: LoggedInUser = {
login: 'luke',
name: 'Skywalker',
scmAccounts: [],
- dismissedNotices: {}
+ dismissedNotices: {},
};
beforeEach(() => {
@@ -90,7 +90,7 @@ it('should render only the children', async () => {
getWrapper({
appState: mockAppState({ canAdmin: false }),
currentUser: { ...LOGGED_IN_USER },
- location: mockLocation({ pathname: '/create-organization' })
+ location: mockLocation({ pathname: '/create-organization' }),
})
);
});
@@ -124,7 +124,8 @@ function getWrapper(props: Partial<StartupModal['props']> = {}) {
currentUser={LOGGED_IN_USER}
location={mockLocation({ pathname: 'foo/bar' })}
router={mockRouter()}
- {...props}>
+ {...props}
+ >
<div />
</StartupModal>
);
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/SystemAnnouncement-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/SystemAnnouncement-test.tsx
index 3dda2518c26..b7ee8387d89 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/SystemAnnouncement-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/SystemAnnouncement-test.tsx
@@ -26,7 +26,7 @@ import { AvailableFeaturesContext } from '../available-features/AvailableFeature
import SystemAnnouncement from '../SystemAnnouncement';
jest.mock('../../../api/settings', () => ({
- getValues: jest.fn()
+ getValues: jest.fn(),
}));
jest.mock('lodash', () => {
@@ -41,41 +41,41 @@ it('should display system announcement', async () => {
{
key: 'sonar.announcement.displayMessage',
value: 'false',
- inherited: true
- }
+ inherited: true,
+ },
])
.mockResolvedValueOnce([
{
key: 'sonar.announcement.displayMessage',
value: 'false',
- inherited: true
- }
+ inherited: true,
+ },
])
.mockResolvedValueOnce([
{
key: 'sonar.announcement.displayMessage',
- value: 'true'
- }
+ value: 'true',
+ },
])
.mockResolvedValueOnce([
{
key: 'sonar.announcement.displayMessage',
- value: 'true'
+ value: 'true',
},
{
key: 'sonar.announcement.message',
- value: ''
- }
+ value: '',
+ },
])
.mockResolvedValueOnce([
{
key: 'sonar.announcement.displayMessage',
- value: 'true'
+ value: 'true',
},
{
key: 'sonar.announcement.message',
- value: 'Foo'
- }
+ value: 'Foo',
+ },
]);
renderSystemAnnouncement();
diff --git a/server/sonar-web/src/main/js/app/components/app-state/AppStateContext.tsx b/server/sonar-web/src/main/js/app/components/app-state/AppStateContext.tsx
index d327bfb3aa1..de1d2bf3416 100644
--- a/server/sonar-web/src/main/js/app/components/app-state/AppStateContext.tsx
+++ b/server/sonar-web/src/main/js/app/components/app-state/AppStateContext.tsx
@@ -28,6 +28,6 @@ export const DEFAULT_APP_STATE = {
productionDatabase: true,
qualifiers: [],
settings: {},
- version: ''
+ version: '',
};
export const AppStateContext = React.createContext<AppState>(DEFAULT_APP_STATE);
diff --git a/server/sonar-web/src/main/js/app/components/app-state/AppStateContextProvider.tsx b/server/sonar-web/src/main/js/app/components/app-state/AppStateContextProvider.tsx
index 43c937b651f..686341e0dd5 100644
--- a/server/sonar-web/src/main/js/app/components/app-state/AppStateContextProvider.tsx
+++ b/server/sonar-web/src/main/js/app/components/app-state/AppStateContextProvider.tsx
@@ -29,7 +29,7 @@ export interface AppStateContextProviderProps {
export default function AppStateContextProvider({
appState,
- children
+ children,
}: React.PropsWithChildren<AppStateContextProviderProps>) {
return <AppStateContext.Provider value={appState}>{children}</AppStateContext.Provider>;
}
diff --git a/server/sonar-web/src/main/js/app/components/app-state/__tests__/AppStateContextProvider-test.tsx b/server/sonar-web/src/main/js/app/components/app-state/__tests__/AppStateContextProvider-test.tsx
index 57e3f0a1e0a..d9430d10537 100644
--- a/server/sonar-web/src/main/js/app/components/app-state/__tests__/AppStateContextProvider-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/app-state/__tests__/AppStateContextProvider-test.tsx
@@ -26,7 +26,7 @@ import AppStateContextProvider, { AppStateContextProviderProps } from '../AppSta
it('should set value correctly', async () => {
const appState = mockAppState({ settings: { 'sonar.lf.logoUrl': 'whatevs/' } });
const wrapper = render({
- appState
+ appState,
});
await waitAndUpdate(wrapper);
diff --git a/server/sonar-web/src/main/js/app/components/app-state/__tests__/withAppStateContext-test.tsx b/server/sonar-web/src/main/js/app/components/app-state/__tests__/withAppStateContext-test.tsx
index 78e009131c2..788502e4c8f 100644
--- a/server/sonar-web/src/main/js/app/components/app-state/__tests__/withAppStateContext-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/app-state/__tests__/withAppStateContext-test.tsx
@@ -30,8 +30,8 @@ jest.mock('../AppStateContext', () => {
AppStateContext: {
Consumer: ({ children }: { children: (props: {}) => React.ReactNode }) => {
return children(appState);
- }
- }
+ },
+ },
};
});
diff --git a/server/sonar-web/src/main/js/app/components/app-state/withAppStateContext.tsx b/server/sonar-web/src/main/js/app/components/app-state/withAppStateContext.tsx
index fa432377d1e..e03a54c9556 100644
--- a/server/sonar-web/src/main/js/app/components/app-state/withAppStateContext.tsx
+++ b/server/sonar-web/src/main/js/app/components/app-state/withAppStateContext.tsx
@@ -38,7 +38,7 @@ export default function withAppStateContext<P>(
render() {
return (
<AppStateContext.Consumer>
- {appState => <WrappedComponent appState={appState} {...(this.props as P)} />}
+ {(appState) => <WrappedComponent appState={appState} {...(this.props as P)} />}
</AppStateContext.Consumer>
);
}
diff --git a/server/sonar-web/src/main/js/app/components/available-features/__tests__/withAvailableFeatures-test.tsx b/server/sonar-web/src/main/js/app/components/available-features/__tests__/withAvailableFeatures-test.tsx
index 071e941d1f5..473842ca1f6 100644
--- a/server/sonar-web/src/main/js/app/components/available-features/__tests__/withAvailableFeatures-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/available-features/__tests__/withAvailableFeatures-test.tsx
@@ -27,8 +27,8 @@ jest.mock('../AvailableFeaturesContext', () => {
AvailableFeaturesContext: {
Consumer: ({ children }: { children: (props: {}) => React.ReactNode }) => {
return children([Feature.MonoRepositoryPullRequestDecoration]);
- }
- }
+ },
+ },
};
});
@@ -44,9 +44,6 @@ it('should provide a way to check if a feature is available', () => {
const wrapper = shallow(<UnderTest />);
expect(wrapper.dive().type()).toBe(Wrapped);
expect(
- wrapper
- .dive<Wrapped>()
- .props()
- .hasFeature(Feature.MonoRepositoryPullRequestDecoration)
+ wrapper.dive<Wrapped>().props().hasFeature(Feature.MonoRepositoryPullRequestDecoration)
).toBe(true);
});
diff --git a/server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx b/server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx
index ea133252b76..757175424bf 100644
--- a/server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx
+++ b/server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx
@@ -38,9 +38,9 @@ export default function withAvailableFeatures<P>(
render() {
return (
<AvailableFeaturesContext.Consumer>
- {availableFeatures => (
+ {(availableFeatures) => (
<WrappedComponent
- hasFeature={feature => availableFeatures.includes(feature)}
+ hasFeature={(feature) => availableFeatures.includes(feature)}
{...(this.props as P)}
/>
)}
diff --git a/server/sonar-web/src/main/js/app/components/branch-status/BranchStatusContext.tsx b/server/sonar-web/src/main/js/app/components/branch-status/BranchStatusContext.tsx
index 64220f8c13b..0d2a693a3e1 100644
--- a/server/sonar-web/src/main/js/app/components/branch-status/BranchStatusContext.tsx
+++ b/server/sonar-web/src/main/js/app/components/branch-status/BranchStatusContext.tsx
@@ -42,5 +42,5 @@ export const BranchStatusContext = React.createContext<BranchStatusContextInterf
},
updateBranchStatus: () => {
throw Error('BranchStatusContext is not provided');
- }
+ },
});
diff --git a/server/sonar-web/src/main/js/app/components/branch-status/BranchStatusContextProvider.tsx b/server/sonar-web/src/main/js/app/components/branch-status/BranchStatusContextProvider.tsx
index fc0e828d5a2..cdae7154fd5 100644
--- a/server/sonar-web/src/main/js/app/components/branch-status/BranchStatusContextProvider.tsx
+++ b/server/sonar-web/src/main/js/app/components/branch-status/BranchStatusContextProvider.tsx
@@ -34,7 +34,7 @@ interface State {
export default class BranchStatusContextProvider extends React.PureComponent<{}, State> {
mounted = false;
state: State = {
- branchStatusByComponent: {}
+ branchStatusByComponent: {},
};
componentDidMount() {
@@ -48,7 +48,7 @@ export default class BranchStatusContextProvider extends React.PureComponent<{},
fetchBranchStatus = async (branchLike: BranchLike, projectKey: string) => {
const projectStatus = await getQualityGateProjectStatus({
projectKey,
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
}).catch(() => undefined);
if (!this.mounted || projectStatus === undefined) {
@@ -78,10 +78,10 @@ export default class BranchStatusContextProvider extends React.PureComponent<{},
[branchLikeKey]: {
conditions,
ignoredConditions,
- status
- }
- }
- }
+ status,
+ },
+ },
+ },
}));
};
@@ -91,8 +91,9 @@ export default class BranchStatusContextProvider extends React.PureComponent<{},
value={{
branchStatusByComponent: this.state.branchStatusByComponent,
fetchBranchStatus: this.fetchBranchStatus,
- updateBranchStatus: this.updateBranchStatus
- }}>
+ updateBranchStatus: this.updateBranchStatus,
+ }}
+ >
{this.props.children}
</BranchStatusContext.Provider>
);
diff --git a/server/sonar-web/src/main/js/app/components/branch-status/__tests__/BranchStatusContextProvider-test.tsx b/server/sonar-web/src/main/js/app/components/branch-status/__tests__/BranchStatusContextProvider-test.tsx
index 8dc38012f1d..0b6304626b6 100644
--- a/server/sonar-web/src/main/js/app/components/branch-status/__tests__/BranchStatusContextProvider-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/branch-status/__tests__/BranchStatusContextProvider-test.tsx
@@ -26,7 +26,7 @@ import { QualityGateProjectStatus } from '../../../../types/quality-gates';
import BranchStatusContextProvider from '../BranchStatusContextProvider';
jest.mock('../../../../api/quality-gates', () => ({
- getQualityGateProjectStatus: jest.fn().mockResolvedValue({})
+ getQualityGateProjectStatus: jest.fn().mockResolvedValue({}),
}));
describe('fetchBranchStatus', () => {
@@ -36,7 +36,7 @@ describe('fetchBranchStatus', () => {
const status: QualityGateProjectStatus = {
status: 'OK',
conditions: [],
- ignoredConditions: false
+ ignoredConditions: false,
};
(getQualityGateProjectStatus as jest.Mock).mockResolvedValueOnce(status);
const wrapper = shallowRender();
@@ -48,7 +48,7 @@ describe('fetchBranchStatus', () => {
await waitAndUpdate(wrapper);
expect(wrapper.state().branchStatusByComponent).toEqual({
- [projectKey]: { [`branch-${branchName}`]: status }
+ [projectKey]: { [`branch-${branchName}`]: status },
});
});
diff --git a/server/sonar-web/src/main/js/app/components/componentContext/ComponentContext.ts b/server/sonar-web/src/main/js/app/components/componentContext/ComponentContext.ts
index 10db938858d..84960fbe182 100644
--- a/server/sonar-web/src/main/js/app/components/componentContext/ComponentContext.ts
+++ b/server/sonar-web/src/main/js/app/components/componentContext/ComponentContext.ts
@@ -24,5 +24,5 @@ import { ComponentContextShape } from '../../../types/component';
export const ComponentContext = React.createContext<ComponentContextShape>({
branchLikes: [],
onBranchesChange: noop,
- onComponentChange: noop
+ onComponentChange: noop,
});
diff --git a/server/sonar-web/src/main/js/app/components/componentContext/withComponentContext.tsx b/server/sonar-web/src/main/js/app/components/componentContext/withComponentContext.tsx
index a9071e2ebb2..da1146596ef 100644
--- a/server/sonar-web/src/main/js/app/components/componentContext/withComponentContext.tsx
+++ b/server/sonar-web/src/main/js/app/components/componentContext/withComponentContext.tsx
@@ -33,7 +33,7 @@ export default function withComponentContext<P extends Partial<ComponentContextS
render() {
return (
<ComponentContext.Consumer>
- {componentContext => <WrappedComponent {...componentContext} {...(this.props as P)} />}
+ {(componentContext) => <WrappedComponent {...componentContext} {...(this.props as P)} />}
</ComponentContext.Consumer>
);
}
diff --git a/server/sonar-web/src/main/js/app/components/current-user/CurrentUserContextProvider.tsx b/server/sonar-web/src/main/js/app/components/current-user/CurrentUserContextProvider.tsx
index 2ec9e3de4f7..59ea979bd0d 100644
--- a/server/sonar-web/src/main/js/app/components/current-user/CurrentUserContextProvider.tsx
+++ b/server/sonar-web/src/main/js/app/components/current-user/CurrentUserContextProvider.tsx
@@ -36,17 +36,17 @@ export default class CurrentUserContextProvider extends React.PureComponent<Prop
}
updateCurrentUserHomepage = (homepage: HomePage) => {
- this.setState(prevState => ({
- currentUser: { ...prevState.currentUser, homepage }
+ this.setState((prevState) => ({
+ currentUser: { ...prevState.currentUser, homepage },
}));
};
updateDismissedNotices = (key: NoticeType, value: boolean) => {
- this.setState(prevState => ({
+ this.setState((prevState) => ({
currentUser: {
...prevState.currentUser,
- dismissedNotices: { ...prevState.currentUser.dismissedNotices, [key]: value }
- }
+ dismissedNotices: { ...prevState.currentUser.dismissedNotices, [key]: value },
+ },
}));
};
@@ -56,8 +56,9 @@ export default class CurrentUserContextProvider extends React.PureComponent<Prop
value={{
currentUser: this.state.currentUser,
updateCurrentUserHomepage: this.updateCurrentUserHomepage,
- updateDismissedNotices: this.updateDismissedNotices
- }}>
+ updateDismissedNotices: this.updateDismissedNotices,
+ }}
+ >
{this.props.children}
</CurrentUserContext.Provider>
);
diff --git a/server/sonar-web/src/main/js/app/components/extensions/CreateApplicationForm.tsx b/server/sonar-web/src/main/js/app/components/extensions/CreateApplicationForm.tsx
index aec1e6a6607..01d7929b908 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/CreateApplicationForm.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/CreateApplicationForm.tsx
@@ -49,7 +49,7 @@ export default class CreateApplicationForm extends React.PureComponent<Props, St
description: '',
key: '',
name: '',
- visibility: Visibility.Public
+ visibility: Visibility.Public,
};
}
@@ -84,7 +84,7 @@ export default class CreateApplicationForm extends React.PureComponent<Props, St
if (this.mounted) {
this.props.onCreate({
key: application.key,
- qualifier: ComponentQualifier.Application
+ qualifier: ComponentQualifier.Application,
});
}
}
@@ -101,7 +101,8 @@ export default class CreateApplicationForm extends React.PureComponent<Props, St
header={header}
onClose={this.props.onClose}
onSubmit={this.handleFormSubmit}
- size="small">
+ size="small"
+ >
{({ onCloseClick, onFormSubmit, submitting }) => (
<form className="views-form" onSubmit={onFormSubmit}>
<div className="modal-head">
@@ -156,13 +157,14 @@ export default class CreateApplicationForm extends React.PureComponent<Props, St
<div className="modal-field">
<label>{translate('visibility')}</label>
<div className="little-spacer-top">
- {[Visibility.Public, Visibility.Private].map(v => (
+ {[Visibility.Public, Visibility.Private].map((v) => (
<Radio
className={`big-spacer-right visibility-${v}`}
key={v}
checked={visibility === v}
value={v}
- onCheck={this.handleVisibilityChange}>
+ onCheck={this.handleVisibilityChange}
+ >
{translate('visibility', v)}
</Radio>
))}
@@ -178,7 +180,8 @@ export default class CreateApplicationForm extends React.PureComponent<Props, St
<ResetButtonLink
className="js-modal-close"
id="view-edit-cancel"
- onClick={onCloseClick}>
+ onClick={onCloseClick}
+ >
{translate('cancel')}
</ResetButtonLink>
</div>
diff --git a/server/sonar-web/src/main/js/app/components/extensions/Extension.tsx b/server/sonar-web/src/main/js/app/components/extensions/Extension.tsx
index 5d6ce37936d..5845fffa24d 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/Extension.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/Extension.tsx
@@ -84,7 +84,7 @@ export class Extension extends React.PureComponent<Props, State> {
// See SONAR-16207 and core-extension-enterprise-server/src/main/js/portfolios/components/Header.tsx
// for more information on why we're passing this as a prop to an extension.
updateCurrentUserHomepage: this.props.updateCurrentUserHomepage,
- ...this.props.options
+ ...this.props.options,
});
if (result) {
@@ -120,7 +120,7 @@ export class Extension extends React.PureComponent<Props, State> {
{this.state.extensionElement ? (
this.state.extensionElement
) : (
- <div ref={container => (this.container = container)} />
+ <div ref={(container) => (this.container = container)} />
)}
</div>
);
diff --git a/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.tsx b/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.tsx
index 388aab27464..1b71c6bc32f 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/GlobalAdminPageExtension.tsx
@@ -27,6 +27,6 @@ export default function GlobalAdminPageExtension() {
const { pluginKey, extensionKey } = useParams();
const { adminPages } = useOutletContext<AdminPagesContext>();
- const extension = (adminPages || []).find(p => p.key === `${pluginKey}/${extensionKey}`);
+ const extension = (adminPages || []).find((p) => p.key === `${pluginKey}/${extensionKey}`);
return extension ? <Extension extension={extension} /> : <NotFound withContainer={false} />;
}
diff --git a/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.tsx b/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.tsx
index 6216cf5f55e..9c22a846101 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/GlobalPageExtension.tsx
@@ -35,7 +35,7 @@ export interface GlobalPageExtensionProps {
function GlobalPageExtension(props: GlobalPageExtensionProps) {
const {
appState: { globalPages },
- params
+ params,
} = props;
const { extensionKey, pluginKey } = useParams();
@@ -44,7 +44,7 @@ function GlobalPageExtension(props: GlobalPageExtensionProps) {
? `${params.pluginKey}/${params.extensionKey}`
: `${pluginKey}/${extensionKey}`;
- const extension = (globalPages || []).find(p => p.key === fullKey);
+ const extension = (globalPages || []).find((p) => p.key === fullKey);
return extension ? <Extension extension={extension} /> : <NotFound withContainer={false} />;
}
diff --git a/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.tsx b/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.tsx
index 58e16dc1093..11f2f15fe38 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.tsx
@@ -30,7 +30,9 @@ export default function ProjectAdminPageExtension() {
const extension =
component &&
component.configuration &&
- (component.configuration.extensions || []).find(p => p.key === `${pluginKey}/${extensionKey}`);
+ (component.configuration.extensions || []).find(
+ (p) => p.key === `${pluginKey}/${extensionKey}`
+ );
return extension ? (
<Extension extension={extension} options={{ component }} />
diff --git a/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx b/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx
index de3ef4ce9ff..b96eb8cc39d 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/ProjectPageExtension.tsx
@@ -43,7 +43,7 @@ export default function ProjectPageExtension({ params }: ProjectPageExtensionPro
? `${params.pluginKey}/${params.extensionKey}`
: `${pluginKey}/${extensionKey}`;
- const extension = component.extensions && component.extensions.find(p => p.key === fullKey);
+ const extension = component.extensions && component.extensions.find((p) => p.key === fullKey);
return extension ? (
<Extension extension={extension} options={{ branchLike, component }} />
) : (
diff --git a/server/sonar-web/src/main/js/app/components/extensions/__tests__/CreateApplicationForm-test.tsx b/server/sonar-web/src/main/js/app/components/extensions/__tests__/CreateApplicationForm-test.tsx
index 91dd44a17ac..1de25703462 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/__tests__/CreateApplicationForm-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/__tests__/CreateApplicationForm-test.tsx
@@ -26,7 +26,7 @@ import { ComponentQualifier, Visibility } from '../../../../types/component';
import CreateApplicationForm from '../CreateApplicationForm';
jest.mock('../../../../api/application', () => ({
- createApplication: jest.fn().mockResolvedValue({ application: { key: 'foo' } })
+ createApplication: jest.fn().mockResolvedValue({ application: { key: 'foo' } }),
}));
beforeEach(jest.clearAllMocks);
@@ -47,17 +47,14 @@ it('should correctly create application on form submit', async () => {
instance.handleNameChange(mockEvent({ currentTarget: { value: 'name' } }));
instance.handleVisibilityChange(Visibility.Private);
- wrapper
- .find(SimpleModal)
- .props()
- .onSubmit();
+ wrapper.find(SimpleModal).props().onSubmit();
expect(createApplication).toHaveBeenCalledWith('name', 'description', 'key', Visibility.Private);
await waitAndUpdate(wrapper);
expect(onCreate).toHaveBeenCalledWith(
expect.objectContaining({
key: 'foo',
- qualifier: ComponentQualifier.Application
+ qualifier: ComponentQualifier.Application,
})
);
diff --git a/server/sonar-web/src/main/js/app/components/extensions/__tests__/Extension-test.tsx b/server/sonar-web/src/main/js/app/components/extensions/__tests__/Extension-test.tsx
index ab75057a69f..8931e4a497d 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/__tests__/Extension-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/__tests__/Extension-test.tsx
@@ -25,17 +25,17 @@ import {
mockAppState,
mockCurrentUser,
mockLocation,
- mockRouter
+ mockRouter,
} from '../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../helpers/testUtils';
import { Extension } from '../Extension';
jest.mock('../../../../helpers/extensions', () => ({
- getExtensionStart: jest.fn().mockResolvedValue({})
+ getExtensionStart: jest.fn().mockResolvedValue({}),
}));
jest.mock('react-helmet-async', () => ({
- Helmet: () => null
+ Helmet: () => null,
}));
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/app/components/extensions/__tests__/GlobalPageExtension-test.tsx b/server/sonar-web/src/main/js/app/components/extensions/__tests__/GlobalPageExtension-test.tsx
index fe5dce024dd..df89257ad82 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/__tests__/GlobalPageExtension-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/__tests__/GlobalPageExtension-test.tsx
@@ -28,7 +28,7 @@ jest.mock('../Extension', () => ({
__esModule: true,
default(props: { extension: { key: string; name: string } }) {
return <h1>{props.extension.name}</h1>;
- }
+ },
}));
const extensions = [{ key: 'plugin123/ext42', name: 'extension 42' }];
@@ -60,6 +60,6 @@ function renderGlobalPageExtension(
) {
renderApp(`extension/:pluginKey/:extensionKey`, <GlobalPageExtension params={params} />, {
appState: mockAppState({ globalPages }),
- navigateTo
+ navigateTo,
});
}
diff --git a/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectAdminPageExtension-test.tsx b/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectAdminPageExtension-test.tsx
index 685a32e0897..b87259c00ff 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectAdminPageExtension-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectAdminPageExtension-test.tsx
@@ -30,13 +30,13 @@ import { ComponentContext } from '../../componentContext/ComponentContext';
import ProjectAdminPageExtension from '../ProjectAdminPageExtension';
jest.mock('../../../../helpers/extensions', () => ({
- getExtensionStart: jest.fn().mockResolvedValue(jest.fn())
+ getExtensionStart: jest.fn().mockResolvedValue(jest.fn()),
}));
it('should render correctly when the extension is found', () => {
renderProjectAdminPageExtension(
mockComponent({
- configuration: { extensions: [{ key: 'pluginId/extensionId', name: 'name' }] }
+ configuration: { extensions: [{ key: 'pluginId/extensionId', name: 'name' }] },
}),
{ pluginKey: 'pluginId', extensionKey: 'extensionId' }
);
diff --git a/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectPageExtension-test.tsx b/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectPageExtension-test.tsx
index 43120a4ccb1..9cd345c3ed5 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectPageExtension-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/extensions/__tests__/ProjectPageExtension-test.tsx
@@ -30,7 +30,7 @@ import { ComponentContext } from '../../componentContext/ComponentContext';
import ProjectPageExtension, { ProjectPageExtensionProps } from '../ProjectPageExtension';
jest.mock('../../../../helpers/extensions', () => ({
- getExtensionStart: jest.fn().mockResolvedValue(jest.fn())
+ getExtensionStart: jest.fn().mockResolvedValue(jest.fn()),
}));
it('should not render when no component is passed', () => {
diff --git a/server/sonar-web/src/main/js/app/components/extensions/exposeLibraries.ts b/server/sonar-web/src/main/js/app/components/extensions/exposeLibraries.ts
index cfc22f9265b..a582df13f88 100644
--- a/server/sonar-web/src/main/js/app/components/extensions/exposeLibraries.ts
+++ b/server/sonar-web/src/main/js/app/components/extensions/exposeLibraries.ts
@@ -27,7 +27,7 @@ import {
Button,
EditButton,
ResetButtonLink,
- SubmitButton
+ SubmitButton,
} from '../../../components/controls/buttons';
import ButtonToggle from '../../../components/controls/ButtonToggle';
import Checkbox from '../../../components/controls/Checkbox';
@@ -85,7 +85,7 @@ import {
isBranch,
isMainBranch,
isPullRequest,
- sortBranches
+ sortBranches,
} from '../../../helpers/branch-like';
import { throwGlobalError } from '../../../helpers/error';
import { addGlobalSuccessMessage } from '../../../helpers/globalMessages';
@@ -101,7 +101,7 @@ import {
post,
postJSON,
postJSONBody,
- request
+ request,
} from '../../../helpers/request';
import { sanitizeStringRestricted } from '../../../helpers/sanitize';
import {
@@ -110,7 +110,7 @@ import {
renderOwaspTop102021Category,
renderOwaspTop10Category,
renderSansTop25Category,
- renderSonarSourceSecurityCategory
+ renderSonarSourceSecurityCategory,
} from '../../../helpers/security-standard';
import {
getCodeUrl,
@@ -118,7 +118,7 @@ import {
getComponentIssuesUrl,
getComponentSecurityHotspotsUrl,
getMeasureHistoryUrl,
- getRulesUrl
+ getRulesUrl,
} from '../../../helpers/urls';
const exposeLibraries = () => {
@@ -135,7 +135,7 @@ const exposeLibraries = () => {
postJSON,
postJSONBody,
throwGlobalError,
- addGlobalSuccessMessage
+ addGlobalSuccessMessage,
};
global.t = translate;
global.tp = translateWithParameters;
@@ -166,9 +166,9 @@ const exposeLibraries = () => {
getComponentSecurityHotspotsUrl,
getMeasureHistoryUrl,
getRulesUrl,
- sanitizeStringRestricted
+ sanitizeStringRestricted,
};
- }
+ },
});
/**
@@ -179,7 +179,7 @@ const exposeLibraries = () => {
// eslint-disable-next-line no-console
console.warn('SonarMeasures usages are deprecated since SonarQube 8.7');
return { ...measures };
- }
+ },
});
/**
@@ -253,9 +253,9 @@ const exposeLibraries = () => {
Suggestions,
Tooltip,
VulnerabilityIcon,
- WarningIcon
+ WarningIcon,
};
- }
+ },
});
};
diff --git a/server/sonar-web/src/main/js/app/components/indexation/IndexationNotification.tsx b/server/sonar-web/src/main/js/app/components/indexation/IndexationNotification.tsx
index 28c9eae4420..df0f9de39b9 100644
--- a/server/sonar-web/src/main/js/app/components/indexation/IndexationNotification.tsx
+++ b/server/sonar-web/src/main/js/app/components/indexation/IndexationNotification.tsx
@@ -19,7 +19,7 @@
*/
import * as React from 'react';
import withIndexationContext, {
- WithIndexationContextProps
+ WithIndexationContextProps,
} from '../../../components/hoc/withIndexationContext';
import { hasGlobalPermission } from '../../../helpers/users';
import { IndexationNotificationType } from '../../../types/indexation';
@@ -70,13 +70,13 @@ export class IndexationNotification extends React.PureComponent<Props, State> {
this.setState({
notificationType: hasFailures
? IndexationNotificationType.InProgressWithFailure
- : IndexationNotificationType.InProgress
+ : IndexationNotificationType.InProgress,
});
} else if (hasFailures) {
this.setState({ notificationType: IndexationNotificationType.CompletedWithFailure });
} else if (IndexationNotificationHelper.shouldDisplayCompletedNotification()) {
this.setState({
- notificationType: IndexationNotificationType.Completed
+ notificationType: IndexationNotificationType.Completed,
});
IndexationNotificationHelper.markCompletedNotificationAsDisplayed();
@@ -93,8 +93,8 @@ export class IndexationNotification extends React.PureComponent<Props, State> {
const { notificationType } = this.state;
const {
indexationContext: {
- status: { percentCompleted }
- }
+ status: { percentCompleted },
+ },
} = this.props;
if (notificationType === undefined) {
diff --git a/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationHelper.ts b/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationHelper.ts
index d975000fa7a..92897d64e76 100644
--- a/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationHelper.ts
+++ b/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationHelper.ts
@@ -32,7 +32,7 @@ export default class IndexationNotificationHelper {
this.stopPolling();
// eslint-disable-next-line promise/catch-or-return
- this.poll(onNewStatus).then(status => {
+ this.poll(onNewStatus).then((status) => {
if (!status.isCompleted) {
this.interval = setInterval(() => this.poll(onNewStatus), POLLING_INTERVAL_MS);
}
diff --git a/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationRenderer.tsx b/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationRenderer.tsx
index c63bf4def70..08c1a85da72 100644
--- a/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationRenderer.tsx
+++ b/server/sonar-web/src/main/js/app/components/indexation/IndexationNotificationRenderer.tsx
@@ -39,7 +39,7 @@ const NOTIFICATION_VARIANTS: { [key in IndexationNotificationType]: AlertProps['
[IndexationNotificationType.InProgress]: 'warning',
[IndexationNotificationType.InProgressWithFailure]: 'error',
[IndexationNotificationType.Completed]: 'success',
- [IndexationNotificationType.CompletedWithFailure]: 'error'
+ [IndexationNotificationType.CompletedWithFailure]: 'error',
};
export default function IndexationNotificationRenderer(props: IndexationNotificationRendererProps) {
@@ -50,7 +50,8 @@ export default function IndexationNotificationRenderer(props: IndexationNotifica
<Alert
className="indexation-notification-banner"
display="banner"
- variant={NOTIFICATION_VARIANTS[type]}>
+ variant={NOTIFICATION_VARIANTS[type]}
+ >
<div className="display-flex-center">
{type === IndexationNotificationType.Completed && renderCompletedBanner(props)}
{type === IndexationNotificationType.CompletedWithFailure &&
@@ -79,7 +80,7 @@ function renderCompletedWithFailureBanner(props: IndexationNotificationRendererP
values={{
link: isSystemAdmin
? renderBackgroundTasksPageLink(true, translate('indexation.completed_with_error.link'))
- : translate('indexation.completed_with_error.link')
+ : translate('indexation.completed_with_error.link'),
}}
/>
</span>
@@ -102,7 +103,7 @@ function renderInProgressBanner(props: IndexationNotificationRendererProps) {
id="indexation.admin_link"
defaultMessage={translate('indexation.admin_link')}
values={{
- link: renderBackgroundTasksPageLink(false, translate('background_tasks.page'))
+ link: renderBackgroundTasksPageLink(false, translate('background_tasks.page')),
}}
/>
</span>
@@ -131,7 +132,7 @@ function renderInProgressWithFailureBanner(props: IndexationNotificationRenderer
true,
translate('indexation.progression_with_error.link')
)
- : translate('indexation.progression_with_error.link')
+ : translate('indexation.progression_with_error.link'),
}}
/>
</span>
@@ -146,9 +147,10 @@ function renderBackgroundTasksPageLink(hasError: boolean, text: string) {
pathname: '/admin/background_tasks',
search: queryToSearch({
taskType: TaskTypes.IssueSync,
- status: hasError ? TaskStatuses.Failed : undefined
- })
- }}>
+ status: hasError ? TaskStatuses.Failed : undefined,
+ }),
+ }}
+ >
{text}
</Link>
);
diff --git a/server/sonar-web/src/main/js/app/components/indexation/PageUnavailableDueToIndexation.tsx b/server/sonar-web/src/main/js/app/components/indexation/PageUnavailableDueToIndexation.tsx
index 2e869a6007f..84effbfdc8f 100644
--- a/server/sonar-web/src/main/js/app/components/indexation/PageUnavailableDueToIndexation.tsx
+++ b/server/sonar-web/src/main/js/app/components/indexation/PageUnavailableDueToIndexation.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import withIndexationContext, {
- WithIndexationContextProps
+ WithIndexationContextProps,
} from '../../../components/hoc/withIndexationContext';
import { Alert } from '../../../components/ui/Alert';
import { translate } from '../../../helpers/l10n';
@@ -33,7 +33,7 @@ interface Props extends WithIndexationContextProps {
export enum PageContext {
Issues = 'issues',
- Portfolios = 'portfolios'
+ Portfolios = 'portfolios',
}
export class PageUnavailableDueToIndexation extends React.PureComponent<Props> {
@@ -63,7 +63,7 @@ export class PageUnavailableDueToIndexation extends React.PureComponent<Props> {
defaultMessage={translate(messageKey)}
values={{
componentQualifier: translate('qualifier', component?.qualifier ?? ''),
- componentName: <em>{component?.name}</em>
+ componentName: <em>{component?.name}</em>,
}}
/>
</h1>
diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx
index c6c383cf158..7d60c9c0dc7 100644
--- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx
@@ -24,7 +24,7 @@ import { IndexationStatus } from '../../../../types/indexation';
import { IndexationContext } from '../IndexationContext';
import {
IndexationContextProvider,
- IndexationContextProviderProps
+ IndexationContextProviderProps,
} from '../IndexationContextProvider';
import IndexationNotificationHelper from '../IndexationNotificationHelper';
@@ -48,7 +48,7 @@ it('should not start polling if no issue sync is needed', () => {
const expectedStatus: IndexationStatus = {
isCompleted: true,
percentCompleted: 100,
- hasFailures: false
+ hasFailures: false,
};
expect(wrapper.state().status).toEqual(expectedStatus);
});
@@ -61,7 +61,7 @@ it('should update the state on new status', () => {
const newStatus: IndexationStatus = {
isCompleted: true,
percentCompleted: 100,
- hasFailures: false
+ hasFailures: false,
};
triggerNewStatus(newStatus);
diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx
index b144dd38fa4..dac346b4db2 100644
--- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx
@@ -30,16 +30,16 @@ jest.mock('../IndexationNotificationHelper');
describe('Completed banner', () => {
it('should be displayed', () => {
- (IndexationNotificationHelper.shouldDisplayCompletedNotification as jest.Mock).mockReturnValueOnce(
- true
- );
+ (
+ IndexationNotificationHelper.shouldDisplayCompletedNotification as jest.Mock
+ ).mockReturnValueOnce(true);
const wrapper = shallowRender();
wrapper.setProps({
indexationContext: {
- status: { isCompleted: true, percentCompleted: 100, hasFailures: false }
- }
+ status: { isCompleted: true, percentCompleted: 100, hasFailures: false },
+ },
});
expect(IndexationNotificationHelper.shouldDisplayCompletedNotification).toHaveBeenCalled();
@@ -47,14 +47,14 @@ describe('Completed banner', () => {
});
it('should be displayed at startup', () => {
- (IndexationNotificationHelper.shouldDisplayCompletedNotification as jest.Mock).mockReturnValueOnce(
- true
- );
+ (
+ IndexationNotificationHelper.shouldDisplayCompletedNotification as jest.Mock
+ ).mockReturnValueOnce(true);
const wrapper = shallowRender({
indexationContext: {
- status: { isCompleted: true, percentCompleted: 100, hasFailures: false }
- }
+ status: { isCompleted: true, percentCompleted: 100, hasFailures: false },
+ },
});
expect(IndexationNotificationHelper.shouldDisplayCompletedNotification).toHaveBeenCalled();
@@ -63,14 +63,14 @@ describe('Completed banner', () => {
it('should be hidden once displayed', () => {
jest.useFakeTimers();
- (IndexationNotificationHelper.shouldDisplayCompletedNotification as jest.Mock).mockReturnValueOnce(
- true
- );
+ (
+ IndexationNotificationHelper.shouldDisplayCompletedNotification as jest.Mock
+ ).mockReturnValueOnce(true);
const wrapper = shallowRender({
indexationContext: {
- status: { isCompleted: true, percentCompleted: 100, hasFailures: false }
- }
+ status: { isCompleted: true, percentCompleted: 100, hasFailures: false },
+ },
});
expect(wrapper.state().notificationType).toBe(IndexationNotificationType.Completed);
@@ -85,7 +85,7 @@ describe('Completed banner', () => {
it('should display the completed-with-failure banner', () => {
const wrapper = shallowRender({
- indexationContext: { status: { isCompleted: true, percentCompleted: 100, hasFailures: true } }
+ indexationContext: { status: { isCompleted: true, percentCompleted: 100, hasFailures: true } },
});
expect(wrapper.state().notificationType).toBe(IndexationNotificationType.CompletedWithFailure);
@@ -93,7 +93,7 @@ it('should display the completed-with-failure banner', () => {
it('should display the progress banner', () => {
const wrapper = shallowRender({
- indexationContext: { status: { isCompleted: false, percentCompleted: 23, hasFailures: false } }
+ indexationContext: { status: { isCompleted: false, percentCompleted: 23, hasFailures: false } },
});
expect(IndexationNotificationHelper.markCompletedNotificationAsToDisplay).toHaveBeenCalled();
@@ -102,7 +102,7 @@ it('should display the progress banner', () => {
it('should display the progress-with-failure banner', () => {
const wrapper = shallowRender({
- indexationContext: { status: { isCompleted: false, percentCompleted: 23, hasFailures: true } }
+ indexationContext: { status: { isCompleted: false, percentCompleted: 23, hasFailures: true } },
});
expect(IndexationNotificationHelper.markCompletedNotificationAsToDisplay).toHaveBeenCalled();
@@ -114,7 +114,7 @@ function shallowRender(props?: Partial<IndexationNotification['props']>) {
<IndexationNotification
currentUser={mockCurrentUser()}
indexationContext={{
- status: { isCompleted: false, percentCompleted: 23, hasFailures: false }
+ status: { isCompleted: false, percentCompleted: 23, hasFailures: false },
}}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationHelper-test.tsx b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationHelper-test.tsx
index fb5c3defb5a..a5fc5e3aa96 100644
--- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationHelper-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationHelper-test.tsx
@@ -34,13 +34,13 @@ afterEach(() => {
});
jest.mock('../../../../api/ce', () => ({
- getIndexationStatus: jest.fn().mockResolvedValue({})
+ getIndexationStatus: jest.fn().mockResolvedValue({}),
}));
jest.mock('../../../../helpers/storage', () => ({
get: jest.fn(),
remove: jest.fn(),
- save: jest.fn()
+ save: jest.fn(),
}));
it('should properly start & stop polling for indexation status', async () => {
@@ -48,7 +48,7 @@ it('should properly start & stop polling for indexation status', async () => {
const newStatus: IndexationStatus = {
isCompleted: false,
percentCompleted: 100,
- hasFailures: false
+ hasFailures: false,
};
(getIndexationStatus as jest.Mock).mockResolvedValueOnce(newStatus);
diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationRenderer-test.tsx b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationRenderer-test.tsx
index 38428a88fa4..c4e531abc7b 100644
--- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotificationRenderer-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import { IndexationNotificationType } from '../../../../types/indexation';
import IndexationNotificationRenderer, {
- IndexationNotificationRendererProps
+ IndexationNotificationRendererProps,
} from '../IndexationNotificationRenderer';
it.each([
@@ -32,7 +32,7 @@ it.each([
[IndexationNotificationType.Completed, false],
[IndexationNotificationType.Completed, true],
[IndexationNotificationType.CompletedWithFailure, false],
- [IndexationNotificationType.CompletedWithFailure, true]
+ [IndexationNotificationType.CompletedWithFailure, true],
])(
'should render correctly for type=%p & isSystemAdmin=%p',
(type: IndexationNotificationType, isSystemAdmin: boolean) => {
diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/PageUnavailableDueToIndexation-test.tsx b/server/sonar-web/src/main/js/app/components/indexation/__tests__/PageUnavailableDueToIndexation-test.tsx
index 3bd0d2922dc..0059f299f22 100644
--- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/PageUnavailableDueToIndexation-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/PageUnavailableDueToIndexation-test.tsx
@@ -32,7 +32,7 @@ it('should not refresh the page once the indexation is complete if there were fa
Object.defineProperty(window, 'location', {
writable: true,
- value: { reload }
+ value: { reload },
});
const wrapper = shallowRender();
@@ -40,7 +40,7 @@ it('should not refresh the page once the indexation is complete if there were fa
expect(reload).not.toHaveBeenCalled();
wrapper.setProps({
- indexationContext: { status: { isCompleted: true, percentCompleted: 100, hasFailures: true } }
+ indexationContext: { status: { isCompleted: true, percentCompleted: 100, hasFailures: true } },
});
wrapper.update();
@@ -52,7 +52,7 @@ it('should refresh the page once the indexation is complete if there were NO fai
Object.defineProperty(window, 'location', {
writable: true,
- value: { reload }
+ value: { reload },
});
const wrapper = shallowRender();
@@ -60,7 +60,7 @@ it('should refresh the page once the indexation is complete if there were NO fai
expect(reload).not.toHaveBeenCalled();
wrapper.setProps({
- indexationContext: { status: { isCompleted: true, percentCompleted: 100, hasFailures: false } }
+ indexationContext: { status: { isCompleted: true, percentCompleted: 100, hasFailures: false } },
});
wrapper.update();
@@ -71,7 +71,7 @@ function shallowRender(props?: PageUnavailableDueToIndexation['props']) {
return shallow<PageUnavailableDueToIndexation>(
<PageUnavailableDueToIndexation
indexationContext={{
- status: { isCompleted: false, percentCompleted: 23, hasFailures: false }
+ status: { isCompleted: false, percentCompleted: 23, hasFailures: false },
}}
pageContext={PageContext.Issues}
component={{ qualifier: ComponentQualifier.Portfolio, name: 'test-portfolio' }}
diff --git a/server/sonar-web/src/main/js/app/components/languages/LanguagesContextProvider.tsx b/server/sonar-web/src/main/js/app/components/languages/LanguagesContextProvider.tsx
index 72b531e6b60..496da3c3f51 100644
--- a/server/sonar-web/src/main/js/app/components/languages/LanguagesContextProvider.tsx
+++ b/server/sonar-web/src/main/js/app/components/languages/LanguagesContextProvider.tsx
@@ -30,7 +30,7 @@ interface State {
export default class LanguagesContextProvider extends React.PureComponent<{}, State> {
mounted = false;
state: State = {
- languages: {}
+ languages: {},
};
componentDidMount() {
diff --git a/server/sonar-web/src/main/js/app/components/languages/__tests__/LanguagesContextProvider-test.tsx b/server/sonar-web/src/main/js/app/components/languages/__tests__/LanguagesContextProvider-test.tsx
index aab258a5dc0..b8d3d693ebe 100644
--- a/server/sonar-web/src/main/js/app/components/languages/__tests__/LanguagesContextProvider-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/languages/__tests__/LanguagesContextProvider-test.tsx
@@ -24,7 +24,7 @@ import { waitAndUpdate } from '../../../../helpers/testUtils';
import LanguagesContextProvider from '../LanguagesContextProvider';
jest.mock('../../../../api/languages', () => ({
- getLanguages: jest.fn().mockResolvedValue({})
+ getLanguages: jest.fn().mockResolvedValue({}),
}));
it('should call language', async () => {
diff --git a/server/sonar-web/src/main/js/app/components/languages/__tests__/withLanguagesContext-test.tsx b/server/sonar-web/src/main/js/app/components/languages/__tests__/withLanguagesContext-test.tsx
index 4cf91576b65..2d3891d830b 100644
--- a/server/sonar-web/src/main/js/app/components/languages/__tests__/withLanguagesContext-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/languages/__tests__/withLanguagesContext-test.tsx
@@ -27,8 +27,8 @@ jest.mock('../LanguagesContext', () => {
LanguagesContext: {
Consumer: ({ children }: { children: (props: {}) => React.ReactNode }) => {
return children({ c: { key: 'c', name: 'c' } });
- }
- }
+ },
+ },
};
});
diff --git a/server/sonar-web/src/main/js/app/components/languages/withLanguagesContext.tsx b/server/sonar-web/src/main/js/app/components/languages/withLanguagesContext.tsx
index 1a7c61bc9f1..2e73fb365c7 100644
--- a/server/sonar-web/src/main/js/app/components/languages/withLanguagesContext.tsx
+++ b/server/sonar-web/src/main/js/app/components/languages/withLanguagesContext.tsx
@@ -37,7 +37,7 @@ export default function withLanguagesContext<P>(
render() {
return (
<LanguagesContext.Consumer>
- {languages => <WrappedComponent languages={languages} {...(this.props as P)} />}
+ {(languages) => <WrappedComponent languages={languages} {...(this.props as P)} />}
</LanguagesContext.Consumer>
);
}
diff --git a/server/sonar-web/src/main/js/app/components/metrics/MetricsContextProvider.tsx b/server/sonar-web/src/main/js/app/components/metrics/MetricsContextProvider.tsx
index c1a0d81711c..df2de73ad25 100644
--- a/server/sonar-web/src/main/js/app/components/metrics/MetricsContextProvider.tsx
+++ b/server/sonar-web/src/main/js/app/components/metrics/MetricsContextProvider.tsx
@@ -31,7 +31,7 @@ interface State {
export default class MetricsContextProvider extends React.PureComponent<{}, State> {
mounted = false;
state: State = {
- metrics: {}
+ metrics: {},
};
componentDidMount() {
diff --git a/server/sonar-web/src/main/js/app/components/metrics/__tests__/MetricsContextProvider-test.tsx b/server/sonar-web/src/main/js/app/components/metrics/__tests__/MetricsContextProvider-test.tsx
index 169d7765aa3..9a788d7cbdf 100644
--- a/server/sonar-web/src/main/js/app/components/metrics/__tests__/MetricsContextProvider-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/metrics/__tests__/MetricsContextProvider-test.tsx
@@ -26,7 +26,7 @@ import { waitAndUpdate } from '../../../../helpers/testUtils';
import MetricsContextProvider from '../MetricsContextProvider';
jest.mock('../../../../api/metrics', () => ({
- getAllMetrics: jest.fn().mockResolvedValue({})
+ getAllMetrics: jest.fn().mockResolvedValue({}),
}));
it('should call metric', async () => {
diff --git a/server/sonar-web/src/main/js/app/components/metrics/__tests__/withMetricsContext-test.tsx b/server/sonar-web/src/main/js/app/components/metrics/__tests__/withMetricsContext-test.tsx
index f4d43f73a5a..b0e234da071 100644
--- a/server/sonar-web/src/main/js/app/components/metrics/__tests__/withMetricsContext-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/metrics/__tests__/withMetricsContext-test.tsx
@@ -24,7 +24,7 @@ import { Dict, Metric } from '../../../../types/types';
import withMetricsContext from '../withMetricsContext';
const metrics = {
- coverage: mockMetric()
+ coverage: mockMetric(),
};
jest.mock('../MetricsContext', () => {
@@ -32,8 +32,8 @@ jest.mock('../MetricsContext', () => {
MetricsContext: {
Consumer: ({ children }: { children: (props: {}) => React.ReactNode }) => {
return children({ metrics });
- }
- }
+ },
+ },
};
});
diff --git a/server/sonar-web/src/main/js/app/components/metrics/withMetricsContext.tsx b/server/sonar-web/src/main/js/app/components/metrics/withMetricsContext.tsx
index e9d3d9ee741..7d3643e343c 100644
--- a/server/sonar-web/src/main/js/app/components/metrics/withMetricsContext.tsx
+++ b/server/sonar-web/src/main/js/app/components/metrics/withMetricsContext.tsx
@@ -38,7 +38,7 @@ export default function withMetricsContext<P>(
render() {
return (
<MetricsContext.Consumer>
- {metrics => <WrappedComponent metrics={metrics} {...(this.props as P)} />}
+ {(metrics) => <WrappedComponent metrics={metrics} {...(this.props as P)} />}
</MetricsContext.Consumer>
);
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx b/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx
index ab7f8f58528..c0112319d51 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/Breadcrumb.tsx
@@ -35,7 +35,7 @@ export interface BreadcrumbProps {
export function Breadcrumb(props: BreadcrumbProps) {
const {
component: { breadcrumbs },
- currentBranchLike
+ currentBranchLike,
} = props;
const lastBreadcrumbElement = last(breadcrumbs);
const isNotMainBranch = currentBranchLike && !isMainBranch(currentBranchLike);
@@ -60,7 +60,8 @@ export function Breadcrumb(props: BreadcrumbProps) {
)}
<Link
className="link-no-underline"
- to={getComponentOverviewUrl(breadcrumbElement.key, breadcrumbElement.qualifier)}>
+ to={getComponentOverviewUrl(breadcrumbElement.key, breadcrumbElement.qualifier)}
+ >
{showQualifierIcon && isNotMainBranch && (
<QualifierIcon
className="spacer-right"
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
index 5e8149cae12..131c666ad4a 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import ContextNavBar from '../../../../components/ui/ContextNavBar';
import {
ProjectAlmBindingConfigurationErrors,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../../../../types/alm-settings';
import { BranchLike } from '../../../../types/branch-like';
import { ComponentQualifier } from '../../../../types/component';
@@ -67,7 +67,7 @@ export default function ComponentNav(props: ComponentNavProps) {
isPending,
projectBinding,
projectBindingErrors,
- warnings
+ warnings,
} = props;
const { contextNavHeightRaw, globalNavHeightRaw } = rawSizes;
@@ -81,7 +81,7 @@ export default function ComponentNav(props: ComponentNavProps) {
ComponentQualifier.Project,
ComponentQualifier.Portfolio,
ComponentQualifier.Application,
- ComponentQualifier.Developper
+ ComponentQualifier.Developper,
].includes(qualifier as ComponentQualifier)
) {
RecentHistory.add(key, name, qualifier.toLowerCase());
@@ -123,12 +123,14 @@ export default function ComponentNav(props: ComponentNavProps) {
{bgTaskNotifComponent}
{prDecoNotifComponent}
</>
- }>
+ }
+ >
<div
className={classNames('display-flex-center display-flex-space-between', {
'padded-bottom little-padded-top': warnings.length === 0,
- 'little-padded-bottom': warnings.length > 0
- })}>
+ 'little-padded-bottom': warnings.length > 0,
+ })}
+ >
<Header
branchLikes={branchLikes}
component={component}
@@ -154,7 +156,8 @@ export default function ComponentNav(props: ComponentNavProps) {
<InfoDrawer
displayed={displayProjectInfo}
onClose={() => setDisplayProjectInfo(false)}
- top={globalNavHeightRaw + contextNavHeight}>
+ top={globalNavHeightRaw + contextNavHeight}
+ >
<ProjectInformation
branchLike={currentBranchLike}
component={component}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavWarnings.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavWarnings.tsx
index abe6c291e8c..600bac0462d 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavWarnings.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavWarnings.tsx
@@ -65,11 +65,11 @@ export default class ComponentNavWarnings extends React.PureComponent<Props, Sta
defaultMessage={translate('component_navigation.x_warnings')}
id="component_navigation.x_warnings"
values={{
- warningsCount: this.props.warnings.length
+ warningsCount: this.props.warnings.length,
}}
/>
</a>
- )
+ ),
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/HeaderMeta.tsx b/server/sonar-web/src/main/js/app/components/nav/component/HeaderMeta.tsx
index 4d7ba4f3bea..b1b28173a02 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/HeaderMeta.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/HeaderMeta.tsx
@@ -70,7 +70,8 @@ export function HeaderMeta(props: HeaderMetaProps) {
'overview.project.last_analysis.date_time',
lastAnalysisDate
)}
- className="spacer-left nowrap note">
+ className="spacer-left nowrap note"
+ >
{lastAnalysisDate}
</span>
)}
@@ -90,7 +91,8 @@ export function HeaderMeta(props: HeaderMetaProps) {
className="link-no-underline big-spacer-right"
to={branchLike.url}
target="_blank"
- size={12}>
+ size={12}
+ >
{translate('branches.see_the_pr')}
</Link>
)}
@@ -115,7 +117,7 @@ export function getCurrentPage(component: Component, branchLike: BranchLike | un
currentPage = {
type: 'APPLICATION',
component: component.key,
- branch
+ branch,
};
break;
case ComponentQualifier.Project:
@@ -123,7 +125,7 @@ export function getCurrentPage(component: Component, branchLike: BranchLike | un
currentPage = {
type: 'PROJECT',
component: component.key,
- branch
+ branch,
};
break;
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx
index 825823e4763..6f74bd5714a 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx
@@ -34,7 +34,7 @@ import { ComponentQualifier, isPortfolioLike } from '../../../../types/component
import { Feature } from '../../../../types/features';
import { Component, Dict, Extension } from '../../../../types/types';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../available-features/withAvailableFeatures';
import './Menu.css';
@@ -51,7 +51,7 @@ const SETTINGS_URLS = [
'background_tasks',
'/project/key',
'/project/deletion',
- '/project/webhooks'
+ '/project/webhooks',
];
interface Props extends WithAvailableFeaturesProps {
@@ -112,10 +112,10 @@ export class Menu extends React.PureComponent<Props> {
isGovernanceEnabled = () => {
const {
- component: { extensions }
+ component: { extensions },
} = this.props;
- return extensions && extensions.some(extension => extension.key.startsWith('governance/'));
+ return extensions && extensions.some((extension) => extension.key.startsWith('governance/'));
};
getConfiguration = () => {
@@ -133,7 +133,8 @@ export class Menu extends React.PureComponent<Props> {
overlay={translateWithParameters(
'layout.all_project_must_be_accessible',
translate('qualifier', this.props.component.qualifier)
- )}>
+ )}
+ >
<a aria-disabled="true" className="disabled-link">
{label}
</a>
@@ -145,7 +146,7 @@ export class Menu extends React.PureComponent<Props> {
renderMenuLink = ({
label,
pathname,
- additionalQueryParams = {}
+ additionalQueryParams = {},
}: {
label: React.ReactNode;
pathname: string;
@@ -163,8 +164,9 @@ export class Menu extends React.PureComponent<Props> {
<NavLink
to={{
pathname,
- search: new URLSearchParams({ ...query, ...additionalQueryParams }).toString()
- }}>
+ search: new URLSearchParams({ ...query, ...additionalQueryParams }).toString(),
+ }}
+ >
{label}
</NavLink>
) : (
@@ -204,7 +206,7 @@ export class Menu extends React.PureComponent<Props> {
return this.isPortfolio() && this.isGovernanceEnabled()
? this.renderMenuLink({
label: translate('portfolio_breakdown.page'),
- pathname: '/code'
+ pathname: '/code',
})
: null;
};
@@ -228,7 +230,7 @@ export class Menu extends React.PureComponent<Props> {
return this.renderMenuLink({
label: translate('project_activity.page'),
- pathname: '/project/activity'
+ pathname: '/project/activity',
});
};
@@ -236,14 +238,14 @@ export class Menu extends React.PureComponent<Props> {
return this.renderMenuLink({
label: translate('issues.page'),
pathname: '/project/issues',
- additionalQueryParams: { resolved: 'false' }
+ additionalQueryParams: { resolved: 'false' },
});
};
renderComponentMeasuresLink = () => {
return this.renderMenuLink({
label: translate('layout.measures'),
- pathname: '/component_measures'
+ pathname: '/component_measures',
});
};
@@ -253,7 +255,7 @@ export class Menu extends React.PureComponent<Props> {
!isPortfolio &&
this.renderMenuLink({
label: translate('layout.security_hotspots'),
- pathname: '/security_hotspots'
+ pathname: '/security_hotspots',
})
);
};
@@ -266,7 +268,7 @@ export class Menu extends React.PureComponent<Props> {
return null;
}
- const hasSecurityReportsEnabled = extensions.some(extension =>
+ const hasSecurityReportsEnabled = extensions.some((extension) =>
extension.key.startsWith('securityreport/')
);
@@ -276,7 +278,7 @@ export class Menu extends React.PureComponent<Props> {
return this.renderMenuLink({
label: translate('layout.security_reports'),
- pathname: '/project/extension/securityreport/securityreport'
+ pathname: '/project/extension/securityreport/securityreport',
});
};
@@ -291,10 +293,10 @@ export class Menu extends React.PureComponent<Props> {
return null;
}
- const isSettingsActive = SETTINGS_URLS.some(url => window.location.href.indexOf(url) !== -1);
+ const isSettingsActive = SETTINGS_URLS.some((url) => window.location.href.indexOf(url) !== -1);
const adminLinks = this.renderAdministrationLinks(query, isProject, isApplication, isPortfolio);
- if (!adminLinks.some(link => link != null)) {
+ if (!adminLinks.some((link) => link != null)) {
return null;
}
@@ -302,14 +304,16 @@ export class Menu extends React.PureComponent<Props> {
<Dropdown
data-test="administration"
overlay={<ul className="menu">{adminLinks}</ul>}
- tagName="li">
+ tagName="li"
+ >
{({ onToggleClick, open }) => (
<ButtonLink
aria-expanded={open}
aria-haspopup="menu"
className={classNames('dropdown-toggle', { active: isSettingsActive || open })}
id="component-navigation-admin"
- onClick={onToggleClick}>
+ onClick={onToggleClick}
+ >
{hasMessage('layout.settings', component.qualifier)
? translate('layout.settings', component.qualifier)
: translate('layout.settings')}
@@ -339,7 +343,7 @@ export class Menu extends React.PureComponent<Props> {
this.renderBackgroundTasksLink(query),
this.renderUpdateKeyLink(query),
this.renderWebhooksLink(query, isProject),
- this.renderDeletionLink(query)
+ this.renderDeletionLink(query),
];
};
@@ -363,9 +367,10 @@ export class Menu extends React.PureComponent<Props> {
<ButtonLink
className="show-project-info-button"
onClick={this.props.onToggleProjectInfo}
- innerRef={node => {
+ innerRef={(node) => {
this.projectInfoLink = node;
- }}>
+ }}
+ >
<BulletListIcon className="little-spacer-right" />
{label}
</ButtonLink>
@@ -381,7 +386,8 @@ export class Menu extends React.PureComponent<Props> {
return (
<li key="settings">
<NavLink
- to={{ pathname: '/project/settings', search: new URLSearchParams(query).toString() }}>
+ to={{ pathname: '/project/settings', search: new URLSearchParams(query).toString() }}
+ >
{translate('project_settings.page')}
</NavLink>
</li>
@@ -400,7 +406,8 @@ export class Menu extends React.PureComponent<Props> {
return (
<li key="branches">
<NavLink
- to={{ pathname: '/project/branches', search: new URLSearchParams(query).toString() }}>
+ to={{ pathname: '/project/branches', search: new URLSearchParams(query).toString() }}
+ >
{translate('project_branch_pull_request.page')}
</NavLink>
</li>
@@ -414,7 +421,8 @@ export class Menu extends React.PureComponent<Props> {
return (
<li key="baseline">
<NavLink
- to={{ pathname: '/project/baseline', search: new URLSearchParams(query).toString() }}>
+ to={{ pathname: '/project/baseline', search: new URLSearchParams(query).toString() }}
+ >
{translate('project_baseline.page')}
</NavLink>
</li>
@@ -430,8 +438,9 @@ export class Menu extends React.PureComponent<Props> {
<NavLink
to={{
pathname: '/project/import_export',
- search: new URLSearchParams(query).toString()
- }}>
+ search: new URLSearchParams(query).toString(),
+ }}
+ >
{translate('project_dump.page')}
</NavLink>
</li>
@@ -447,8 +456,9 @@ export class Menu extends React.PureComponent<Props> {
<NavLink
to={{
pathname: '/project/quality_profiles',
- search: new URLSearchParams(query).toString()
- }}>
+ search: new URLSearchParams(query).toString(),
+ }}
+ >
{translate('project_quality_profiles.page')}
</NavLink>
</li>
@@ -462,7 +472,8 @@ export class Menu extends React.PureComponent<Props> {
return (
<li key="quality_gate">
<NavLink
- to={{ pathname: '/project/quality_gate', search: new URLSearchParams(query).toString() }}>
+ to={{ pathname: '/project/quality_gate', search: new URLSearchParams(query).toString() }}
+ >
{translate('project_quality_gate.page')}
</NavLink>
</li>
@@ -504,8 +515,9 @@ export class Menu extends React.PureComponent<Props> {
<NavLink
to={{
pathname: '/project/background_tasks',
- search: new URLSearchParams(query).toString()
- }}>
+ search: new URLSearchParams(query).toString(),
+ }}
+ >
{translate('background_tasks.page')}
</NavLink>
</li>
@@ -532,7 +544,8 @@ export class Menu extends React.PureComponent<Props> {
return (
<li key="webhooks">
<NavLink
- to={{ pathname: '/project/webhooks', search: new URLSearchParams(query).toString() }}>
+ to={{ pathname: '/project/webhooks', search: new URLSearchParams(query).toString() }}
+ >
{translate('webhooks.page')}
</NavLink>
</li>
@@ -550,7 +563,7 @@ export class Menu extends React.PureComponent<Props> {
![
ComponentQualifier.Project,
ComponentQualifier.Portfolio,
- ComponentQualifier.Application
+ ComponentQualifier.Application,
].includes(qualifier as ComponentQualifier)
) {
return null;
@@ -559,7 +572,8 @@ export class Menu extends React.PureComponent<Props> {
return (
<li key="project_delete">
<NavLink
- to={{ pathname: '/project/deletion', search: new URLSearchParams(query).toString() }}>
+ to={{ pathname: '/project/deletion', search: new URLSearchParams(query).toString() }}
+ >
{translate('deletion.page')}
</NavLink>
</li>
@@ -579,15 +593,15 @@ export class Menu extends React.PureComponent<Props> {
renderAdminExtensions = (query: Query, isApplication: boolean) => {
const extensions = this.getConfiguration().extensions || [];
return extensions
- .filter(e => !isApplication || e.key !== 'governance/console')
- .map(e => this.renderExtension(e, true, query));
+ .filter((e) => !isApplication || e.key !== 'governance/console')
+ .map((e) => this.renderExtension(e, true, query));
};
renderExtensions = () => {
const query = this.getQuery();
const extensions = this.props.component.extensions || [];
const withoutSecurityExtension = extensions.filter(
- extension =>
+ (extension) =>
!extension.key.startsWith('securityreport/') && !extension.key.startsWith('governance/')
);
@@ -600,17 +614,19 @@ export class Menu extends React.PureComponent<Props> {
data-test="extensions"
overlay={
<ul className="menu">
- {withoutSecurityExtension.map(e => this.renderExtension(e, false, query))}
+ {withoutSecurityExtension.map((e) => this.renderExtension(e, false, query))}
</ul>
}
- tagName="li">
+ tagName="li"
+ >
{({ onToggleClick, open }) => (
<ButtonLink
aria-expanded={open}
aria-haspopup="menu"
className={classNames('dropdown-toggle', { active: open })}
id="component-navigation-more"
- onClick={onToggleClick}>
+ onClick={onToggleClick}
+ >
{translate('more')}
<DropdownIcon className="little-spacer-left" />
</ButtonLink>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx
index 58372411efb..85a8c920948 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Breadcrumb-test.tsx
@@ -38,11 +38,11 @@ it('should render correctly when not on a main branch', () => {
{
key: 'project',
name: 'My Project',
- qualifier: ComponentQualifier.Project
- }
- ]
+ qualifier: ComponentQualifier.Project,
+ },
+ ],
}),
- currentBranchLike: mockBranch()
+ currentBranchLike: mockBranch(),
});
expect(
screen.getByRole('link', { name: `qualifier.${ComponentQualifier.Project} My Project` })
@@ -57,14 +57,14 @@ function renderBreadcrumb(props: Partial<BreadcrumbProps> = {}) {
{
key: 'parent-portfolio',
name: 'Parent portfolio',
- qualifier: ComponentQualifier.Portfolio
+ qualifier: ComponentQualifier.Portfolio,
},
{
key: 'child-portfolio',
name: 'Child portfolio',
- qualifier: ComponentQualifier.SubPortfolio
- }
- ]
+ qualifier: ComponentQualifier.SubPortfolio,
+ },
+ ],
})}
currentBranchLike={mockMainBranch()}
{...props}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx
index edefa213b80..a41b942c525 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx
@@ -57,7 +57,7 @@ it('renders correctly when there is a failing background task', () => {
it('renders correctly when the project binding is incorrect', () => {
renderComponentNav({
- projectBindingErrors: mockProjectAlmBindingConfigurationErrors()
+ projectBindingErrors: mockProjectAlmBindingConfigurationErrors(),
});
expect(
screen.getByText('component_navigation.pr_deco.error_detected_X', { exact: false })
@@ -79,7 +79,7 @@ function renderComponentNav(props: Partial<ComponentNavProps> = {}) {
<ComponentNav
branchLikes={[]}
component={mockComponent({
- breadcrumbs: [{ key: 'foo', name: 'Foo', qualifier: ComponentQualifier.Project }]
+ breadcrumbs: [{ key: 'foo', name: 'Foo', qualifier: ComponentQualifier.Project }],
})}
currentBranchLike={undefined}
isInProgress={false}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
index 0d7ee55a610..cf058c3a875 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBgTaskNotif-test.tsx
@@ -30,7 +30,7 @@ import { ComponentNavBgTaskNotif } from '../ComponentNavBgTaskNotif';
jest.mock('../../../../../helpers/l10n', () => ({
...jest.requireActual('../../../../../helpers/l10n'),
- hasMessage: jest.fn().mockReturnValue(true)
+ hasMessage: jest.fn().mockReturnValue(true),
}));
const UNKNOWN_TASK_TYPE: TaskTypes = 'UNKOWN' as TaskTypes;
@@ -42,8 +42,8 @@ it('renders correctly', () => {
currentTask: mockTask({
status: TaskStatuses.Failed,
errorType: 'LICENSING',
- errorMessage: 'Foo'
- })
+ errorMessage: 'Foo',
+ }),
})
).toMatchSnapshot('license issue');
expect(shallowRender({ currentTask: undefined }).type()).toBeNull(); // No task.
@@ -58,7 +58,7 @@ it.each([
false,
false,
false,
- false
+ false,
],
[
'component_navigation.status.failed_X',
@@ -67,7 +67,7 @@ it.each([
false,
false,
false,
- false
+ false,
],
[
'component_navigation.status.failed.admin.link',
@@ -76,7 +76,7 @@ it.each([
false,
false,
true,
- false
+ false,
],
[
'component_navigation.status.failed_X.admin.link',
@@ -85,7 +85,7 @@ it.each([
false,
false,
true,
- false
+ false,
],
[
'component_navigation.status.failed.admin.help',
@@ -94,7 +94,7 @@ it.each([
false,
false,
true,
- true
+ true,
],
[
'component_navigation.status.failed_X.admin.help',
@@ -103,7 +103,7 @@ it.each([
false,
false,
true,
- true
+ true,
],
// failed_branch
[
@@ -113,7 +113,7 @@ it.each([
false,
false,
false,
- false
+ false,
],
[
'component_navigation.status.failed_branch_X',
@@ -122,7 +122,7 @@ it.each([
false,
false,
false,
- false
+ false,
],
[
'component_navigation.status.failed_branch.admin.link',
@@ -131,7 +131,7 @@ it.each([
false,
false,
true,
- false
+ false,
],
[
'component_navigation.status.failed_branch_X.admin.link',
@@ -140,7 +140,7 @@ it.each([
false,
false,
true,
- false
+ false,
],
[
'component_navigation.status.failed_branch.admin.help',
@@ -149,7 +149,7 @@ it.each([
false,
false,
true,
- true
+ true,
],
[
'component_navigation.status.failed_branch_X.admin.help',
@@ -158,7 +158,7 @@ it.each([
false,
false,
true,
- true
+ true,
],
// pending
[
@@ -168,7 +168,7 @@ it.each([
true,
false,
false,
- false
+ false,
],
['component_navigation.status.pending_X', 'info', mockTask(), true, false, false, false],
[
@@ -178,7 +178,7 @@ it.each([
true,
false,
true,
- false
+ false,
],
[
'component_navigation.status.pending_X.admin.link',
@@ -187,7 +187,7 @@ it.each([
true,
false,
true,
- false
+ false,
],
[
'component_navigation.status.pending.admin.help',
@@ -196,7 +196,7 @@ it.each([
true,
false,
true,
- true
+ true,
],
[
'component_navigation.status.pending_X.admin.help',
@@ -205,7 +205,7 @@ it.each([
true,
false,
true,
- true
+ true,
],
// in_progress
[
@@ -215,7 +215,7 @@ it.each([
true,
true,
false,
- false
+ false,
],
['component_navigation.status.in_progress_X', 'info', mockTask(), true, true, false, false],
[
@@ -225,7 +225,7 @@ it.each([
true,
true,
true,
- false
+ false,
],
[
'component_navigation.status.in_progress_X.admin.link',
@@ -234,7 +234,7 @@ it.each([
true,
true,
true,
- false
+ false,
],
[
'component_navigation.status.in_progress.admin.help',
@@ -243,7 +243,7 @@ it.each([
true,
true,
true,
- true
+ true,
],
[
'component_navigation.status.in_progress_X.admin.help',
@@ -252,8 +252,8 @@ it.each([
true,
true,
true,
- true
- ]
+ true,
+ ],
])(
'should render the expected message=%p',
(
@@ -276,8 +276,8 @@ it.each([
isPending,
isInProgress,
location: mockLocation({
- pathname: onBackgroudTaskPage ? '/project/background_tasks' : '/foo/bar'
- })
+ pathname: onBackgroudTaskPage ? '/project/background_tasks' : '/foo/bar',
+ }),
});
const messageProps = wrapper.find<FormattedMessage>(FormattedMessage).props();
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx
index 292790dfdce..495da548085 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavLicenseNotif-test.tsx
@@ -28,11 +28,11 @@ import { ComponentNavLicenseNotif } from '../ComponentNavLicenseNotif';
jest.mock('../../../../../helpers/l10n', () => ({
...jest.requireActual('../../../../../helpers/l10n'),
- hasMessage: jest.fn().mockReturnValue(true)
+ hasMessage: jest.fn().mockReturnValue(true),
}));
jest.mock('../../../../../api/editions', () => ({
- isValidLicense: jest.fn().mockResolvedValue({ isValidLicense: false })
+ isValidLicense: jest.fn().mockResolvedValue({ isValidLicense: false }),
}));
beforeEach(() => {
@@ -44,8 +44,8 @@ it('renders background task license info correctly', async () => {
currentTask: mockTask({
status: TaskStatuses.Failed,
errorType: 'LICENSING',
- errorMessage: 'Foo'
- })
+ errorMessage: 'Foo',
+ }),
});
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot();
@@ -55,8 +55,8 @@ it('renders background task license info correctly', async () => {
currentTask: mockTask({
status: TaskStatuses.Failed,
errorType: 'LICENSING',
- errorMessage: 'Foo'
- })
+ errorMessage: 'Foo',
+ }),
});
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot();
@@ -68,8 +68,8 @@ it('renders a different message if the license is valid', async () => {
currentTask: mockTask({
status: TaskStatuses.Failed,
errorType: 'LICENSING',
- errorMessage: 'Foo'
- })
+ errorMessage: 'Foo',
+ }),
});
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot();
@@ -81,8 +81,8 @@ it('renders correctly for LICENSING_LOC error', async () => {
currentTask: mockTask({
status: TaskStatuses.Failed,
errorType: 'LICENSING_LOC',
- errorMessage: 'Foo'
- })
+ errorMessage: 'Foo',
+ }),
});
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavProjectBindingErrorNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavProjectBindingErrorNotif-test.tsx
index 5028cca1edc..5e71d4b85d2 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavProjectBindingErrorNotif-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavProjectBindingErrorNotif-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { mockComponent } from '../../../../../helpers/mocks/component';
import {
ComponentNavProjectBindingErrorNotif,
- ComponentNavProjectBindingErrorNotifProps
+ ComponentNavProjectBindingErrorNotifProps,
} from '../ComponentNavProjectBindingErrorNotif';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/HeaderMeta-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/HeaderMeta-test.tsx
index bc5ff09ba86..4c9df3a0c0c 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/HeaderMeta-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/HeaderMeta-test.tsx
@@ -29,8 +29,8 @@ import { getCurrentPage, HeaderMeta, HeaderMetaProps } from '../HeaderMeta';
jest.mock('react-intl', () => ({
useIntl: jest.fn().mockImplementation(() => ({
- formatDate: jest.fn().mockImplementation(() => '2017-01-02T00:00:00.000Z')
- }))
+ formatDate: jest.fn().mockImplementation(() => '2017-01-02T00:00:00.000Z'),
+ })),
}));
it('should render correctly for a branch', () => {
@@ -40,14 +40,14 @@ it('should render correctly for a branch', () => {
it('should render correctly for a main project branch', () => {
const wrapper = shallowRender({
- branchLike: mockBranch({ isMain: true })
+ branchLike: mockBranch({ isMain: true }),
});
expect(wrapper).toMatchSnapshot();
});
it('should render correctly for a portfolio', () => {
const wrapper = shallowRender({
- component: mockComponent({ key: 'foo', qualifier: ComponentQualifier.Portfolio })
+ component: mockComponent({ key: 'foo', qualifier: ComponentQualifier.Portfolio }),
});
expect(wrapper).toMatchSnapshot();
});
@@ -55,8 +55,8 @@ it('should render correctly for a portfolio', () => {
it('should render correctly for a pull request', () => {
const wrapper = shallowRender({
branchLike: mockPullRequest({
- url: 'https://example.com/pull/1234'
- })
+ url: 'https://example.com/pull/1234',
+ }),
});
expect(wrapper).toMatchSnapshot();
});
@@ -75,7 +75,7 @@ describe('#getCurrentPage', () => {
)
).toEqual({
type: 'PORTFOLIO',
- component: 'foo'
+ component: 'foo',
});
});
@@ -92,7 +92,7 @@ describe('#getCurrentPage', () => {
expect(getCurrentPage(mockComponent(), mockBranch({ name: 'feature/foo' }))).toEqual({
type: 'PROJECT',
component: 'my-project',
- branch: 'feature/foo'
+ branch: 'feature/foo',
});
});
});
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Menu-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Menu-test.tsx
index fe446883e96..bda66dc8b46 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Menu-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Menu-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import {
mockBranch,
mockMainBranch,
- mockPullRequest
+ mockPullRequest,
} from '../../../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../../../helpers/mocks/component';
import { renderComponent } from '../../../../../helpers/testReactTestingUtils';
@@ -32,7 +32,7 @@ import { Menu } from '../Menu';
const BASE_COMPONENT = mockComponent({
analysisDate: '2019-12-01',
key: 'foo',
- name: 'foo'
+ name: 'foo',
});
it('should render correctly', () => {
@@ -43,14 +43,14 @@ it('should render correctly', () => {
extensions: [
{ key: 'foo', name: 'Foo' },
{ key: 'bar', name: 'Bar' },
- { key: 'securityreport/foo', name: 'Foo' }
- ]
+ { key: 'securityreport/foo', name: 'Foo' },
+ ],
},
extensions: [
{ key: 'component-foo', name: 'ComponentFoo' },
{ key: 'component-bar', name: 'ComponentBar' },
- { key: 'securityreport/foo', name: 'Security Report' }
- ]
+ { key: 'securityreport/foo', name: 'Security Report' },
+ ],
};
renderMenu({ component });
@@ -71,8 +71,8 @@ it('should render correctly when on a branch', () => {
component: {
...BASE_COMPONENT,
configuration: { showSettings: true },
- extensions: [{ key: 'component-foo', name: 'ComponentFoo' }]
- }
+ extensions: [{ key: 'component-foo', name: 'ComponentFoo' }],
+ },
});
expect(screen.getByRole('link', { name: 'overview.page' })).toBeInTheDocument();
@@ -93,8 +93,8 @@ it('should render correctly when on a pull request', () => {
component: {
...BASE_COMPONENT,
configuration: { showSettings: true },
- extensions: [{ key: 'component-foo', name: 'ComponentFoo' }]
- }
+ extensions: [{ key: 'component-foo', name: 'ComponentFoo' }],
+ },
});
expect(screen.getByRole('link', { name: 'overview.page' })).toBeInTheDocument();
@@ -111,8 +111,8 @@ it('should disable links if no analysis has been done', () => {
renderMenu({
component: {
...BASE_COMPONENT,
- analysisDate: undefined
- }
+ analysisDate: undefined,
+ },
});
expect(screen.getByRole('link', { name: 'overview.page' })).toBeInTheDocument();
expect(screen.queryByRole('link', { name: 'issues.page' })).not.toBeInTheDocument();
@@ -125,8 +125,8 @@ it('should disable links if application has inaccessible projects', () => {
component: {
...BASE_COMPONENT,
qualifier: ComponentQualifier.Application,
- canBrowseAllChildProjects: false
- }
+ canBrowseAllChildProjects: false,
+ },
});
expect(screen.queryByRole('link', { name: 'overview.page' })).not.toBeInTheDocument();
expect(screen.queryByRole('link', { name: 'issues.page' })).not.toBeInTheDocument();
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/BranchLikeNavigation.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/BranchLikeNavigation.tsx
index 8a7dff79217..75781499872 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/BranchLikeNavigation.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/BranchLikeNavigation.tsx
@@ -26,7 +26,7 @@ import { BranchLike } from '../../../../../types/branch-like';
import { Feature } from '../../../../../types/features';
import { Component } from '../../../../../types/types';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../available-features/withAvailableFeatures';
import './BranchLikeNavigation.css';
import CurrentBranchLike from './CurrentBranchLike';
@@ -45,7 +45,7 @@ export function BranchLikeNavigation(props: BranchLikeNavigationProps) {
component,
component: { configuration },
currentBranchLike,
- projectBinding
+ projectBinding,
} = props;
const [isMenuOpen, setIsMenuOpen] = React.useState(false);
@@ -70,9 +70,10 @@ export function BranchLikeNavigation(props: BranchLikeNavigationProps) {
className={classNames(
'big-spacer-left flex-0 branch-like-navigation-toggler-container display-flex-center',
{
- dropdown: isMenuEnabled
+ dropdown: isMenuEnabled,
}
- )}>
+ )}
+ >
{isMenuEnabled ? (
<Toggler
onRequestClose={() => setIsMenuOpen(false)}
@@ -85,12 +86,14 @@ export function BranchLikeNavigation(props: BranchLikeNavigationProps) {
currentBranchLike={currentBranchLike}
onClose={() => setIsMenuOpen(false)}
/>
- }>
+ }
+ >
<ButtonPlain
className={classNames('branch-like-navigation-toggler', { open: isMenuOpen })}
onClick={() => setIsMenuOpen(!isMenuOpen)}
aria-expanded={isMenuOpen}
- aria-haspopup="menu">
+ aria-haspopup="menu"
+ >
{currentBranchLikeElement}
</ButtonPlain>
</Toggler>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx
index 3cbee80e9e5..926fd1684e2 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx
@@ -48,7 +48,7 @@ export function CurrentBranchLike(props: CurrentBranchLikeProps) {
component: { configuration },
currentBranchLike,
hasManyBranches,
- projectBinding
+ projectBinding,
} = props;
const displayName = getBranchLikeDisplayName(currentBranchLike);
@@ -75,7 +75,8 @@ export function CurrentBranchLike(props: CurrentBranchLikeProps) {
{translate('application.branches.link')}
</Link>
</>
- }>
+ }
+ >
{plusIcon}
</HelpTooltip>
);
@@ -97,8 +98,8 @@ export function CurrentBranchLike(props: CurrentBranchLikeProps) {
{
href: 'https://redirect.sonarsource.com/editions/developer.html',
label: translate('learn_more'),
- doc: false
- }
+ doc: false,
+ },
]}
title={
projectBinding !== undefined
@@ -107,7 +108,8 @@ export function CurrentBranchLike(props: CurrentBranchLikeProps) {
isGitLab ? 'mr' : 'pr'
)
: translate('branch_like_navigation.no_branch_support.title')
- }>
+ }
+ >
{plusIcon}
</DocumentationTooltip>
);
@@ -121,20 +123,21 @@ export function CurrentBranchLike(props: CurrentBranchLikeProps) {
links={[
{
href: '/branches/overview/',
- label: translate('branch_like_navigation.only_one_branch.documentation')
+ label: translate('branch_like_navigation.only_one_branch.documentation'),
},
{
href: '/analysis/pull-request/',
- label: translate('branch_like_navigation.only_one_branch.pr_analysis')
+ label: translate('branch_like_navigation.only_one_branch.pr_analysis'),
},
{
href: `/tutorials?id=${component.key}`,
label: translate('branch_like_navigation.tutorial_for_ci'),
inPlace: true,
- doc: false
- }
+ doc: false,
+ },
]}
- title={translate('branch_like_navigation.only_one_branch.title')}>
+ title={translate('branch_like_navigation.only_one_branch.title')}
+ >
{plusIcon}
</DocumentationTooltip>
);
@@ -149,7 +152,8 @@ export function CurrentBranchLike(props: CurrentBranchLikeProps) {
<BranchLikeIcon branchLike={currentBranchLike} fill={colors.info500} />
<span
className="spacer-left spacer-right flex-shrink text-ellipsis js-branch-like-name"
- title={displayName}>
+ title={displayName}
+ >
{displayName}
</span>
{additionalIcon()}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLikeMergeInformation.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLikeMergeInformation.tsx
index 002f917e810..1f71622160f 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLikeMergeInformation.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLikeMergeInformation.tsx
@@ -41,7 +41,7 @@ export function CurrentBranchLikeMergeInformation(props: CurrentBranchLikeMergeI
id="branch_like_navigation.for_merge_into_x_from_y"
values={{
target: <strong>{currentBranchLike.target}</strong>,
- branch: <strong>{currentBranchLike.branch}</strong>
+ branch: <strong>{currentBranchLike.branch}</strong>,
}}
/>
</span>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx
index e171e41daff..f6cf75af2f3 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx
@@ -26,7 +26,7 @@ import {
getBrancheLikesAsTree,
isBranch,
isPullRequest,
- isSameBranchLike
+ isSameBranchLike,
} from '../../../../../helpers/branch-like';
import { KeyboardKeys } from '../../../../../helpers/keycodes';
import { translate } from '../../../../../helpers/l10n';
@@ -58,7 +58,7 @@ export class Menu extends React.PureComponent<Props, State> {
let selectedBranchLike = undefined;
- if (props.branchLikes.some(b => isSameBranchLike(b, props.currentBranchLike))) {
+ if (props.branchLikes.some((b) => isSameBranchLike(b, props.currentBranchLike))) {
selectedBranchLike = props.currentBranchLike;
} else if (props.branchLikes.length > 0) {
selectedBranchLike = props.branchLikes[0];
@@ -67,7 +67,7 @@ export class Menu extends React.PureComponent<Props, State> {
this.state = {
query: '',
selectedBranchLike,
- ...this.processBranchLikes(props.branchLikes)
+ ...this.processBranchLikes(props.branchLikes),
};
}
@@ -80,9 +80,9 @@ export class Menu extends React.PureComponent<Props, State> {
: []),
...tree.branchTree.reduce((prev, t) => [...prev, t.branch, ...t.pullRequests], []),
...tree.parentlessPullRequests,
- ...tree.orphanPullRequests
+ ...tree.orphanPullRequests,
],
- branchLikesToDisplayTree: tree
+ branchLikesToDisplayTree: tree,
};
};
@@ -93,7 +93,7 @@ export class Menu extends React.PureComponent<Props, State> {
};
highlightSiblingBranchlike = (indexDelta: number) => {
- const selectBranchLikeIndex = this.state.branchLikesToDisplay.findIndex(b =>
+ const selectBranchLikeIndex = this.state.branchLikesToDisplay.findIndex((b) =>
isSameBranchLike(b, this.state.selectedBranchLike)
);
const newIndex = selectBranchLikeIndex + indexDelta;
@@ -104,7 +104,7 @@ export class Menu extends React.PureComponent<Props, State> {
newIndex < this.state.branchLikesToDisplay.length
) {
this.setState(({ branchLikesToDisplay }) => ({
- selectedBranchLike: branchLikesToDisplay[newIndex]
+ selectedBranchLike: branchLikesToDisplay[newIndex],
}));
}
};
@@ -135,13 +135,13 @@ export class Menu extends React.PureComponent<Props, State> {
isPullRequest(pr) && (pr.title.toLowerCase().includes(q) || pr.key.toLowerCase().includes(q));
const filteredBranchLikes = this.props.branchLikes.filter(
- bl => filterBranch(bl) || filterPullRequest(bl)
+ (bl) => filterBranch(bl) || filterPullRequest(bl)
);
this.setState({
query: q,
selectedBranchLike: filteredBranchLikes.length > 0 ? filteredBranchLikes[0] : undefined,
- ...this.processBranchLikes(filteredBranchLikes)
+ ...this.processBranchLikes(filteredBranchLikes),
});
};
@@ -154,12 +154,8 @@ export class Menu extends React.PureComponent<Props, State> {
render() {
const { canAdminComponent, component, onClose } = this.props;
- const {
- branchLikesToDisplay,
- branchLikesToDisplayTree,
- query,
- selectedBranchLike
- } = this.state;
+ const { branchLikesToDisplay, branchLikesToDisplayTree, query, selectedBranchLike } =
+ this.state;
const showManageLink = component.qualifier === ComponentQualifier.Project && canAdminComponent;
const hasResults = branchLikesToDisplay.length > 0;
@@ -190,7 +186,8 @@ export class Menu extends React.PureComponent<Props, State> {
<div className="hint-container text-right">
<Link
onClick={() => onClose()}
- to={{ pathname: '/project/branches', search: queryToSearch({ id: component.key }) }}>
+ to={{ pathname: '/project/branches', search: queryToSearch({ id: component.key }) }}
+ >
{translate('branch_like_navigation.manage')}
</Link>
</div>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItem.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItem.tsx
index 298ae9448f0..ac96b0e5d0d 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItem.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItem.tsx
@@ -42,14 +42,16 @@ export function MenuItem(props: MenuItemProps) {
return (
<li
className={classNames('item', {
- active: selected
+ active: selected,
})}
onClick={() => onSelect(branchLike)}
- ref={selected ? setSelectedNode : undefined}>
+ ref={selected ? setSelectedNode : undefined}
+ >
<div
className={classNames('display-flex-center display-flex-space-between', {
- 'big-spacer-left': indent
- })}>
+ 'big-spacer-left': indent,
+ })}
+ >
<div className="item-name text-ellipsis" title={displayName}>
<BranchLikeIcon branchLike={branchLike} />
<span className="spacer-left">{displayName}</span>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItemList.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItemList.tsx
index 50c99ecb63f..b8b52818db9 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItemList.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItemList.tsx
@@ -55,12 +55,12 @@ export function MenuItemList(props: MenuItemListProps) {
key={getBranchLikeKey(branchLike)}
onSelect={onSelect}
selected={isSameBranchLike(branchLike, selectedBranchLike)}
- setSelectedNode={node => (selectedNode = node)}
+ setSelectedNode={(node) => (selectedNode = node)}
/>
);
return (
- <ul className="item-list" ref={node => (listNode = node)}>
+ <ul className="item-list" ref={(node) => (listNode = node)}>
{!hasResults && (
<li className="item">
<span className="note">{translate('no_results')}</span>
@@ -68,28 +68,30 @@ export function MenuItemList(props: MenuItemListProps) {
)}
{/* BRANCHES & PR */}
- {[branchLikeTree.mainBranchTree, ...branchLikeTree.branchTree].filter(isDefined).map(tree => (
- <React.Fragment key={getBranchLikeKey(tree.branch)}>
- {renderItem(tree.branch)}
- {tree.pullRequests.length > 0 && (
- <>
- <li className="item header">
- <span className="big-spacer-left">
- {translate('branch_like_navigation.pull_requests')}
- </span>
- </li>
- {tree.pullRequests.map(pr => renderItem(pr, true))}
- </>
- )}
- <hr />
- </React.Fragment>
- ))}
+ {[branchLikeTree.mainBranchTree, ...branchLikeTree.branchTree]
+ .filter(isDefined)
+ .map((tree) => (
+ <React.Fragment key={getBranchLikeKey(tree.branch)}>
+ {renderItem(tree.branch)}
+ {tree.pullRequests.length > 0 && (
+ <>
+ <li className="item header">
+ <span className="big-spacer-left">
+ {translate('branch_like_navigation.pull_requests')}
+ </span>
+ </li>
+ {tree.pullRequests.map((pr) => renderItem(pr, true))}
+ </>
+ )}
+ <hr />
+ </React.Fragment>
+ ))}
{/* PARENTLESS PR (for display during search) */}
{branchLikeTree.parentlessPullRequests.length > 0 && (
<>
<li className="item header">{translate('branch_like_navigation.pull_requests')}</li>
- {branchLikeTree.parentlessPullRequests.map(pr => renderItem(pr))}
+ {branchLikeTree.parentlessPullRequests.map((pr) => renderItem(pr))}
</>
)}
@@ -103,7 +105,7 @@ export function MenuItemList(props: MenuItemListProps) {
overlay={translate('branch_like_navigation.orphan_pull_requests.tooltip')}
/>
</li>
- {branchLikeTree.orphanPullRequests.map(pr => renderItem(pr))}
+ {branchLikeTree.orphanPullRequests.map((pr) => renderItem(pr))}
</>
)}
</ul>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/BranchLikeNavigation-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/BranchLikeNavigation-test.tsx
index 3278a79b8c4..9b560d0686b 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/BranchLikeNavigation-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/BranchLikeNavigation-test.tsx
@@ -54,10 +54,7 @@ it('should properly close menu when toggler asks for', () => {
click(wrapper.find(ButtonPlain));
expect(wrapper.find(Toggler).props().open).toBe(true);
- wrapper
- .find(Toggler)
- .props()
- .onRequestClose();
+ wrapper.find(Toggler).props().onRequestClose();
expect(wrapper.find(Toggler).props().open).toBe(false);
});
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLike-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLike-test.tsx
index 6905e107555..0d0b67f92b0 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLike-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLike-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
mockProjectGithubBindingResponse,
- mockProjectGitLabBindingResponse
+ mockProjectGitLabBindingResponse,
} from '../../../../../../helpers/mocks/alm-settings';
import { mockMainBranch } from '../../../../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../../../../helpers/mocks/component';
@@ -33,9 +33,9 @@ describe('applications', () => {
const wrapper = shallowRender({
component: mockComponent({
configuration: { showSettings: true },
- qualifier: ComponentQualifier.Application
+ qualifier: ComponentQualifier.Application,
}),
- hasManyBranches: false
+ hasManyBranches: false,
});
expect(wrapper).toMatchSnapshot();
});
@@ -44,9 +44,9 @@ describe('applications', () => {
const wrapper = shallowRender({
component: mockComponent({
configuration: { showSettings: false },
- qualifier: ComponentQualifier.Application
+ qualifier: ComponentQualifier.Application,
}),
- hasManyBranches: false
+ hasManyBranches: false,
});
expect(wrapper).toMatchSnapshot();
});
@@ -55,9 +55,9 @@ describe('applications', () => {
const wrapper = shallowRender({
branchesEnabled: true,
component: mockComponent({
- qualifier: ComponentQualifier.Application
+ qualifier: ComponentQualifier.Application,
}),
- hasManyBranches: true
+ hasManyBranches: true,
});
expect(wrapper).toMatchSnapshot();
});
@@ -69,26 +69,26 @@ describe('projects', () => {
shallowRender({
branchesEnabled: false,
component: mockComponent({
- qualifier: ComponentQualifier.Project
- })
+ qualifier: ComponentQualifier.Project,
+ }),
})
).toMatchSnapshot('default');
expect(
shallowRender({
branchesEnabled: false,
component: mockComponent({
- qualifier: ComponentQualifier.Project
+ qualifier: ComponentQualifier.Project,
}),
- projectBinding: mockProjectGithubBindingResponse()
+ projectBinding: mockProjectGithubBindingResponse(),
})
).toMatchSnapshot('alm with prs');
expect(
shallowRender({
branchesEnabled: false,
component: mockComponent({
- qualifier: ComponentQualifier.Project
+ qualifier: ComponentQualifier.Project,
}),
- projectBinding: mockProjectGitLabBindingResponse()
+ projectBinding: mockProjectGitLabBindingResponse(),
})
).toMatchSnapshot('alm with mrs');
});
@@ -97,9 +97,9 @@ describe('projects', () => {
const wrapper = shallowRender({
branchesEnabled: true,
component: mockComponent({
- qualifier: ComponentQualifier.Project
+ qualifier: ComponentQualifier.Project,
}),
- hasManyBranches: false
+ hasManyBranches: false,
});
expect(wrapper).toMatchSnapshot();
});
@@ -108,9 +108,9 @@ describe('projects', () => {
const wrapper = shallowRender({
branchesEnabled: true,
component: mockComponent({
- qualifier: ComponentQualifier.Project
+ qualifier: ComponentQualifier.Project,
}),
- hasManyBranches: true
+ hasManyBranches: true,
});
expect(wrapper).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLikeMergeInformation-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLikeMergeInformation-test.tsx
index 8885bd5d397..e650372bdd9 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLikeMergeInformation-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/CurrentBranchLikeMergeInformation-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { mockMainBranch, mockPullRequest } from '../../../../../../helpers/mocks/branch-like';
import {
CurrentBranchLikeMergeInformation,
- CurrentBranchLikeMergeInformationProps
+ CurrentBranchLikeMergeInformationProps,
} from '../CurrentBranchLikeMergeInformation';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx
index f11ac90ad01..45fa22ce757 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/Menu-test.tsx
@@ -24,7 +24,7 @@ import SearchBox from '../../../../../../components/controls/SearchBox';
import { KeyboardKeys } from '../../../../../../helpers/keycodes';
import {
mockPullRequest,
- mockSetOfBranchAndPullRequest
+ mockSetOfBranchAndPullRequest,
} from '../../../../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../../../../helpers/mocks/component';
import { mockRouter } from '../../../../../../helpers/testMocks';
@@ -60,18 +60,15 @@ it('should change url and close menu when an element is selected', () => {
const wrapper = shallowRender({ component, onClose, router });
- wrapper
- .find(MenuItemList)
- .props()
- .onSelect(pr);
+ wrapper.find(MenuItemList).props().onSelect(pr);
expect(onClose).toHaveBeenCalled();
expect(push).toHaveBeenCalledWith(
expect.objectContaining({
search: queryToSearch({
id: component.key,
- pullRequest: pr.key
- })
+ pullRequest: pr.key,
+ }),
})
);
});
@@ -79,10 +76,7 @@ it('should change url and close menu when an element is selected', () => {
it('should filter branchlike list correctly', () => {
const wrapper = shallowRender();
- wrapper
- .find(SearchBox)
- .props()
- .onChange('PR');
+ wrapper.find(SearchBox).props().onChange('PR');
expect(wrapper.state().branchLikesToDisplay.length).toBe(3);
});
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItemList-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItemList-test.tsx
index 90bacadd703..9dffa5931db 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItemList-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/__tests__/MenuItemList-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { getBrancheLikesAsTree } from '../../../../../../helpers/branch-like';
import {
mockPullRequest,
- mockSetOfBranchAndPullRequest
+ mockSetOfBranchAndPullRequest,
} from '../../../../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../../../../helpers/mocks/component';
import { MenuItemList, MenuItemListProps } from '../MenuItemList';
@@ -35,7 +35,7 @@ it('should render correctly', () => {
function shallowRender(props?: Partial<MenuItemListProps>) {
const branchLikes = [
...mockSetOfBranchAndPullRequest(),
- mockPullRequest({ base: 'not-in-the-list' })
+ mockPullRequest({ base: 'not-in-the-list' }),
];
const branchLikeTree = getBrancheLikesAsTree(branchLikes);
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/DrawerLink.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/DrawerLink.tsx
index fbcf1437de3..7a9cdea9d7f 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/DrawerLink.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/DrawerLink.tsx
@@ -34,7 +34,8 @@ export function DrawerLink<P>(props: DrawerLinkProps<P>) {
className="display-flex-space-between bordered-bottom big-padded"
onClick={() => props.onPageChange(to)}
role="link"
- tabIndex={0}>
+ tabIndex={0}
+ >
{label}
<ChevronRightIcon />
</a>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/InfoDrawer.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/InfoDrawer.tsx
index cc45d2574a5..d49f882d98e 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/InfoDrawer.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/InfoDrawer.tsx
@@ -38,7 +38,8 @@ export default function InfoDrawer(props: InfoDrawerProps) {
return (
<div
className={classNames('info-drawer info-drawer-pane', { open: displayed })}
- style={{ top }}>
+ style={{ top }}
+ >
{displayed && (
<>
<div className="close-button">
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/InfoDrawerPage.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/InfoDrawerPage.tsx
index 26d210e5231..a13e8d12a23 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/InfoDrawerPage.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/InfoDrawerPage.tsx
@@ -35,16 +35,18 @@ export default function InfoDrawerPage(props: InfoDrawerPageProps) {
className={classNames(
'info-drawer-page info-drawer-pane display-flex-column overflow-hidden',
{
- open: displayed
+ open: displayed,
}
- )}>
+ )}
+ >
{displayed && (
<>
<a
className="h2 back-button big-padded bordered-bottom"
onClick={() => onPageChange()}
role="link"
- tabIndex={-1}>
+ tabIndex={-1}
+ >
<BackIcon className="little-spacer-right" />
{translate('back')}
</a>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformation.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformation.tsx
index 3010c8f5564..d5f8f321952 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformation.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformation.tsx
@@ -49,7 +49,7 @@ interface State {
export class ProjectInformation extends React.PureComponent<Props, State> {
mounted = false;
state: State = {
- page: ProjectInformationPages.main
+ page: ProjectInformationPages.main,
};
componentDidMount() {
@@ -67,13 +67,13 @@ export class ProjectInformation extends React.PureComponent<Props, State> {
loadMeasures = () => {
const {
- component: { key }
+ component: { key },
} = this.props;
return getMeasures({
component: key,
- metricKeys: [MetricKey.ncloc, MetricKey.projects].join()
- }).then(measures => {
+ metricKeys: [MetricKey.ncloc, MetricKey.projects].join(),
+ }).then((measures) => {
if (this.mounted) {
this.setState({ measures });
}
@@ -105,14 +105,16 @@ export class ProjectInformation extends React.PureComponent<Props, State> {
{canUseBadges && (
<InfoDrawerPage
displayed={page === ProjectInformationPages.badges}
- onPageChange={this.setPage}>
+ onPageChange={this.setPage}
+ >
<ProjectBadges branchLike={branchLike} component={component} />
</InfoDrawerPage>
)}
{canConfigureNotifications && (
<InfoDrawerPage
displayed={page === ProjectInformationPages.notifications}
- onPageChange={this.setPage}>
+ onPageChange={this.setPage}
+ >
<ProjectNotifications component={component} />
</InfoDrawerPage>
)}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformationPages.ts b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformationPages.ts
index 3c89f91a4f2..484f9ca36e0 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformationPages.ts
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformationPages.ts
@@ -20,5 +20,5 @@
export enum ProjectInformationPages {
main,
badges,
- notifications
+ notifications,
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformationRenderer.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformationRenderer.tsx
index 8402bd8e277..9d47545d798 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformationRenderer.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/ProjectInformationRenderer.tsx
@@ -27,7 +27,7 @@ import { ComponentQualifier } from '../../../../../types/component';
import { Feature } from '../../../../../types/features';
import { Component, Measure } from '../../../../../types/types';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../available-features/withAvailableFeatures';
import DrawerLink from './DrawerLink';
import MetaKey from './meta/MetaKey';
@@ -144,7 +144,8 @@ export function ProjectInformationRenderer(props: ProjectInformationRendererProp
branchLike={branchLike}
onClose={onClose}
/>
- )}>
+ )}
+ >
{({ onClick }) => (
<ButtonLink onClick={onClick}>{translate('regulatory_report.page')}</ButtonLink>
)}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformation-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformation-test.tsx
index b1006634dee..194de71df4c 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformation-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformation-test.tsx
@@ -30,7 +30,7 @@ import { ProjectInformationPages } from '../ProjectInformationPages';
jest.mock('../../../../../../api/measures', () => {
const { mockMeasure } = jest.requireActual('../../../../../../helpers/testMocks');
return {
- getMeasures: jest.fn().mockResolvedValue([mockMeasure()])
+ getMeasures: jest.fn().mockResolvedValue([mockMeasure()]),
};
});
@@ -57,7 +57,7 @@ it('should handle page change', async () => {
it('should display badge', () => {
const wrapper = shallowRender({
- component: mockComponent({ qualifier: ComponentQualifier.Project })
+ component: mockComponent({ qualifier: ComponentQualifier.Project }),
});
expect(wrapper.find(ProjectBadges).type).toBeDefined();
@@ -72,7 +72,7 @@ function shallowRender(props: Partial<ProjectInformation['props']> = {}) {
component={mockComponent()}
currentUser={mockCurrentUser()}
metrics={{
- coverage: mockMetric()
+ coverage: mockMetric(),
}}
onComponentChange={jest.fn()}
{...props}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformationRenderer-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformationRenderer-test.tsx
index bec0684abee..40f09aa2e9c 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformationRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/__tests__/ProjectInformationRenderer-test.tsx
@@ -22,14 +22,14 @@ import * as React from 'react';
import { mockComponent } from '../../../../../../helpers/mocks/component';
import {
ProjectInformationRenderer,
- ProjectInformationRendererProps
+ ProjectInformationRendererProps,
} from '../ProjectInformationRenderer';
jest.mock('react', () => {
return {
...jest.requireActual('react'),
- useEffect: jest.fn().mockImplementation(f => f()),
- useRef: jest.fn().mockReturnValue(document.createElement('h2'))
+ useEffect: jest.fn().mockImplementation((f) => f()),
+ useRef: jest.fn().mockReturnValue(document.createElement('h2')),
};
});
@@ -59,7 +59,7 @@ it('should render with description', () => {
it('should handle missing quality profiles and quality gates', () => {
expect(
shallowRender({
- component: mockComponent({ qualityGate: undefined, qualityProfiles: undefined })
+ component: mockComponent({ qualityGate: undefined, qualityProfiles: undefined }),
})
).toMatchSnapshot();
});
@@ -67,7 +67,7 @@ it('should handle missing quality profiles and quality gates', () => {
it('should render app correctly when regulatoryReport feature is not enabled', () => {
expect(
shallowRender({
- hasFeature: jest.fn().mockReturnValue(false)
+ hasFeature: jest.fn().mockReturnValue(false),
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/BadgeParams.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/BadgeParams.tsx
index d2a3fb1e650..b08792b91dc 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/BadgeParams.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/BadgeParams.tsx
@@ -54,11 +54,11 @@ export class BadgeParams extends React.PureComponent<Props> {
fetchBadgeMetrics() {
fetchWebApi(false).then(
- webservices => {
+ (webservices) => {
if (this.mounted) {
- const domain = webservices.find(d => d.path === 'api/project_badges');
- const ws = domain && domain.actions.find(w => w.key === 'measure');
- const param = ws && ws.params && ws.params.find(p => p.key === 'metric');
+ const domain = webservices.find((d) => d.path === 'api/project_badges');
+ const ws = domain && domain.actions.find((w) => w.key === 'measure');
+ const param = ws && ws.params && ws.params.find((p) => p.key === 'metric');
if (param && param.possibleValues) {
this.setState({ badgeMetrics: param.possibleValues });
}
@@ -69,25 +69,25 @@ export class BadgeParams extends React.PureComponent<Props> {
}
getColorOptions = () => {
- return ['white', 'black', 'orange'].map(color => ({
+ return ['white', 'black', 'orange'].map((color) => ({
label: translate('overview.badges.options.colors', color),
- value: color
+ value: color,
}));
};
getFormatOptions = () => {
- return ['md', 'url'].map(format => ({
+ return ['md', 'url'].map((format) => ({
label: translate('overview.badges.options.formats', format),
- value: format as BadgeFormats
+ value: format as BadgeFormats,
}));
};
getMetricOptions = () => {
- return this.state.badgeMetrics.map(key => {
+ return this.state.badgeMetrics.map((key) => {
const metric = this.props.metrics[key];
return {
value: key,
- label: metric ? getLocalizedMetricName(metric) : key
+ label: metric ? getLocalizedMetricName(metric) : key,
};
});
};
@@ -114,7 +114,7 @@ export class BadgeParams extends React.PureComponent<Props> {
isSearchable={false}
onChange={this.handleMetricChange}
options={metricOptions}
- value={metricOptions.find(o => o.value === options.metric)}
+ value={metricOptions.find((o) => o.value === options.metric)}
/>
</>
);
@@ -131,9 +131,10 @@ export class BadgeParams extends React.PureComponent<Props> {
<label
className={classNames('spacer-right', {
- 'spacer-top': type !== BadgeType.qualityGate
+ 'spacer-top': type !== BadgeType.qualityGate,
})}
- htmlFor="badge-format">
+ htmlFor="badge-format"
+ >
{translate('format')}:
</label>
<Select
@@ -142,8 +143,8 @@ export class BadgeParams extends React.PureComponent<Props> {
isSearchable={false}
onChange={this.handleFormatChange}
options={formatOptions}
- value={formatOptions.find(o => o.value === options.format)}
- defaultValue={formatOptions.find(o => o.value === 'md')}
+ value={formatOptions.find((o) => o.value === options.format)}
+ defaultValue={formatOptions.find((o) => o.value === 'md')}
/>
</div>
);
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/ProjectBadges.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/ProjectBadges.tsx
index 29202829f5c..f15c69e2f90 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/ProjectBadges.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/ProjectBadges.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import {
getProjectBadgesToken,
- renewProjectBadgesToken
+ renewProjectBadgesToken,
} from '../../../../../../api/project-badges';
import CodeSnippet from '../../../../../../components/common/CodeSnippet';
import { Button } from '../../../../../../components/controls/buttons';
@@ -55,7 +55,7 @@ export default class ProjectBadges extends React.PureComponent<Props, State> {
isRenewing: false,
token: '',
selectedType: BadgeType.measure,
- badgeOptions: { metric: MetricKey.alert_status }
+ badgeOptions: { metric: MetricKey.alert_status },
};
componentDidMount() {
@@ -72,7 +72,7 @@ export default class ProjectBadges extends React.PureComponent<Props, State> {
async fetchToken() {
const {
- component: { key }
+ component: { key },
} = this.props;
const token = await getProjectBadgesToken(key).catch(() => '');
if (this.mounted) {
@@ -85,14 +85,14 @@ export default class ProjectBadges extends React.PureComponent<Props, State> {
};
handleUpdateOptions = (options: Partial<BadgeOptions>) => {
- this.setState(state => ({
- badgeOptions: { ...state.badgeOptions, ...options }
+ this.setState((state) => ({
+ badgeOptions: { ...state.badgeOptions, ...options },
}));
};
handleRenew = async () => {
const {
- component: { key }
+ component: { key },
} = this.props;
this.setState({ isRenewing: true });
@@ -106,13 +106,13 @@ export default class ProjectBadges extends React.PureComponent<Props, State> {
render() {
const {
branchLike,
- component: { key: project, qualifier, configuration }
+ component: { key: project, qualifier, configuration },
} = this.props;
const { isRenewing, selectedType, badgeOptions, token } = this.state;
const fullBadgeOptions = {
project,
...badgeOptions,
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
};
const canRenew = configuration?.showSettings;
@@ -166,7 +166,8 @@ export default class ProjectBadges extends React.PureComponent<Props, State> {
<Button
disabled={isRenewing}
className="spacer-top it__project-info-renew-badge"
- onClick={this.handleRenew}>
+ onClick={this.handleRenew}
+ >
{translate('overview.badges.renew')}
</Button>
)}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/BadgeParams-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/BadgeParams-test.tsx
index 6955585fe1d..6140b0c9961 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/BadgeParams-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/BadgeParams-test.tsx
@@ -31,16 +31,16 @@ jest.mock('../../../../../../../api/web-api', () => ({
actions: [
{
key: 'measure',
- params: [{ key: 'metric', possibleValues: ['alert_status', 'coverage'] }]
- }
- ]
- }
- ])
+ params: [{ key: 'metric', possibleValues: ['alert_status', 'coverage'] }],
+ },
+ ],
+ },
+ ]),
}));
const METRICS = {
alert_status: { key: 'alert_status', name: 'Quality Gate' } as Metric,
- coverage: { key: 'coverage', name: 'Coverage' } as Metric
+ coverage: { key: 'coverage', name: 'Coverage' } as Metric,
};
it('should display measure badge params', () => {
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/ProjectBadges-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/ProjectBadges-test.tsx
index 411a300e020..31d60ae9dad 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/ProjectBadges-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/ProjectBadges-test.tsx
@@ -32,18 +32,18 @@ import ProjectBadges from '../ProjectBadges';
jest.mock('../../../../../../../helpers/urls', () => ({
getHostUrl: () => 'host',
getPathUrlAsString: (l: Location) => l.pathname,
- getProjectUrl: () => ({ pathname: '/dashboard' } as Location)
+ getProjectUrl: () => ({ pathname: '/dashboard' } as Location),
}));
jest.mock('../../../../../../../api/project-badges', () => ({
getProjectBadgesToken: jest.fn().mockResolvedValue('foo'),
- renewProjectBadgesToken: jest.fn().mockResolvedValue({})
+ renewProjectBadgesToken: jest.fn().mockResolvedValue({}),
}));
jest.mock('react', () => {
return {
...jest.requireActual('react'),
- createRef: jest.fn().mockReturnValue({ current: document.createElement('h3') })
+ createRef: jest.fn().mockReturnValue({ current: document.createElement('h3') }),
};
});
@@ -56,7 +56,7 @@ it('should display correctly', async () => {
it('should renew token', async () => {
(getProjectBadgesToken as jest.Mock).mockResolvedValueOnce('foo').mockResolvedValueOnce('bar');
const wrapper = shallowRender({
- component: mockComponent({ configuration: { showSettings: true } })
+ component: mockComponent({ configuration: { showSettings: true } }),
});
await waitAndUpdate(wrapper);
wrapper.find('.it__project-info-renew-badge').simulate('click');
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/utils-test.ts b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/utils-test.ts
index ecee525da3c..2c9a49fd625 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/__tests__/utils-test.ts
@@ -23,13 +23,13 @@ import { BadgeOptions, BadgeType, getBadgeSnippet, getBadgeUrl } from '../utils'
jest.mock('../../../../../../../helpers/urls', () => ({
...jest.requireActual('../../../../../../../helpers/urls'),
getHostUrl: () => 'host',
- getPathUrlAsString: (o: Location) => `host${o.pathname}${o.search}`
+ getPathUrlAsString: (o: Location) => `host${o.pathname}${o.search}`,
}));
const options: BadgeOptions = {
branch: 'master',
metric: 'alert_status',
- project: 'foo'
+ project: 'foo',
};
describe('#getBadgeUrl', () => {
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/utils.ts b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/utils.ts
index 8c8dcc73253..1a044ba54c8 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/utils.ts
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/badges/utils.ts
@@ -34,7 +34,7 @@ export interface BadgeOptions {
export enum BadgeType {
measure = 'measure',
- qualityGate = 'quality_gate'
+ qualityGate = 'quality_gate',
}
export function getBadgeSnippet(type: BadgeType, options: BadgeOptions, token: string) {
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaLink.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaLink.tsx
index 651a748a5e2..568eb329007 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaLink.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaLink.tsx
@@ -61,7 +61,8 @@ export default class MetaLink extends React.PureComponent<Props, State> {
onClick={isValid ? undefined : this.handleClick}
rel="nofollow noreferrer noopener"
target="_blank"
- title={linkTitle}>
+ title={linkTitle}
+ >
<ProjectLinkIcon className="little-spacer-right" type={link.type} />
{!iconOnly && linkTitle}
</a>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaLinks.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaLinks.tsx
index 6176f47240f..be2b75516ce 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaLinks.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaLinks.tsx
@@ -53,7 +53,7 @@ export default class MetaLinks extends React.PureComponent<Props, State> {
loadLinks = () =>
getProjectLinks(this.props.component.key).then(
- links => {
+ (links) => {
if (this.mounted) {
this.setState({ links });
}
@@ -75,7 +75,7 @@ export default class MetaLinks extends React.PureComponent<Props, State> {
<div className="big-padded bordered-bottom">
<h3>{translate('overview.external_links')}</h3>
<ul className="project-info-list">
- {orderedLinks.map(link => (
+ {orderedLinks.map((link) => (
<MetaLink key={link.id} link={link} />
))}
</ul>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityProfiles.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityProfiles.tsx
index 50794431cef..6186e4714ea 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityProfiles.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaQualityProfiles.tsx
@@ -51,12 +51,12 @@ export class MetaQualityProfiles extends React.PureComponent<Props, State> {
}
loadDeprecatedRules() {
- const existingProfiles = this.props.profiles.filter(p => !p.deleted);
- const requests = existingProfiles.map(profile =>
+ const existingProfiles = this.props.profiles.filter((p) => !p.deleted);
+ const requests = existingProfiles.map((profile) =>
this.loadDeprecatedRulesForProfile(profile.key)
);
Promise.all(requests).then(
- responses => {
+ (responses) => {
if (this.mounted) {
const deprecatedByKey: Dict<number> = {};
responses.forEach((count, i) => {
@@ -75,9 +75,9 @@ export class MetaQualityProfiles extends React.PureComponent<Props, State> {
activation: 'true',
ps: 1,
qprofile: profileKey,
- statuses: 'DEPRECATED'
+ statuses: 'DEPRECATED',
};
- return searchRules(data).then(r => r.total);
+ return searchRules(data).then((r) => r.total);
}
getDeprecatedRulesCount(profile: { key: string }) {
@@ -101,7 +101,8 @@ export class MetaQualityProfiles extends React.PureComponent<Props, State> {
'overview.link_to_x_profile_y',
languageName,
profile.name
- )}>
+ )}
+ >
{profile.name}
</span>
</Link>
@@ -140,7 +141,7 @@ export class MetaQualityProfiles extends React.PureComponent<Props, State> {
<h3 className={headerClassName}>{translate('overview.quality_profiles')}</h3>
<ul className="project-info-list">
- {profiles.map(profile => this.renderProfile(profile))}
+ {profiles.map((profile) => this.renderProfile(profile))}
</ul>
</>
);
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaSize.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaSize.tsx
index 640038b0fc4..f0e38e0d952 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaSize.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaSize.tsx
@@ -33,9 +33,9 @@ export interface MetaSizeProps {
export default function MetaSize({ component, measures }: MetaSizeProps) {
const isApp = component.qualifier === ComponentQualifier.Application;
- const ncloc = measures.find(measure => measure.metric === MetricKey.ncloc);
+ const ncloc = measures.find((measure) => measure.metric === MetricKey.ncloc);
const projects = isApp
- ? measures.find(measure => measure.metric === MetricKey.projects)
+ ? measures.find((measure) => measure.metric === MetricKey.projects)
: undefined;
return (
@@ -52,7 +52,8 @@ export default function MetaSize({ component, measures }: MetaSizeProps) {
aria-label={translateWithParameters(
'project.info.see_more_info_on_x_locs',
ncloc.value
- )}>
+ )}
+ >
{formatMeasure(ncloc.value, 'SHORT_INT')}
</span>
</DrilldownLink>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaTags.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaTags.tsx
index 4e2f7efc4b6..c21f5a3598d 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaTags.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaTags.tsx
@@ -45,7 +45,7 @@ export default class MetaTags extends React.PureComponent<Props> {
getPopupPos = (eltPos: ClientRect, containerPos: ClientRect) => ({
top: eltPos.height,
- right: containerPos.width - eltPos.width
+ right: containerPos.width - eltPos.width,
});
setTags = (values: string[]) => {
@@ -54,12 +54,12 @@ export default class MetaTags extends React.PureComponent<Props> {
if (component.qualifier === ComponentQualifier.Application) {
return setApplicationTags({
application: component.key,
- tags: values.join(',')
+ tags: values.join(','),
});
} else {
return setProjectTags({
project: component.key,
- tags: values.join(',')
+ tags: values.join(','),
});
}
};
@@ -76,15 +76,16 @@ export default class MetaTags extends React.PureComponent<Props> {
if (this.canUpdateTags()) {
return (
- <div className="big-spacer-top project-info-tags" ref={card => (this.card = card)}>
+ <div className="big-spacer-top project-info-tags" ref={(card) => (this.card = card)}>
<Dropdown
closeOnClick={false}
closeOnClickOutside={true}
overlay={
<MetaTagsSelector selectedTags={tags} setProjectTags={this.handleSetProjectTags} />
}
- overlayPlacement={PopupPlacement.BottomLeft}>
- <ButtonLink innerRef={tagsList => (this.tagsList = tagsList)} stopPropagation={true}>
+ overlayPlacement={PopupPlacement.BottomLeft}
+ >
+ <ButtonLink innerRef={(tagsList) => (this.tagsList = tagsList)} stopPropagation={true}>
<TagsList allowUpdate={true} tags={tags.length ? tags : [translate('no_tags')]} />
</ButtonLink>
</Dropdown>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaTagsSelector.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaTagsSelector.tsx
index d6713dcb72a..203fbd7cfd1 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaTagsSelector.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/MetaTagsSelector.tsx
@@ -48,7 +48,7 @@ export default class MetaTagsSelector extends React.PureComponent<Props, State>
onSearch = (query: string) => {
return searchProjectTags({
q: query,
- ps: Math.min(this.props.selectedTags.length - 1 + LIST_SIZE, 100)
+ ps: Math.min(this.props.selectedTags.length - 1 + LIST_SIZE, 100),
}).then(
({ tags }) => {
if (this.mounted) {
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaLink-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaLink-test.tsx
index 5b74cb48f79..806e3b85994 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaLink-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaLink-test.tsx
@@ -27,7 +27,7 @@ const DANGEROUS_LINK = {
id: '1',
name: 'Dangerous',
url: 'javascript:alert("hi")',
- type: 'dangerous'
+ type: 'dangerous',
};
it('should match snapshot', () => {
@@ -64,7 +64,7 @@ function shallowRender(props: Partial<MetaLink['props']> = {}) {
id: '1',
name: 'Foo',
url: 'http://example.com',
- type: 'foo'
+ type: 'foo',
}}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaQualityProfiles-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaQualityProfiles-test.tsx
index b0723fa199e..d00036bb9e8 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaQualityProfiles-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaQualityProfiles-test.tsx
@@ -27,8 +27,8 @@ import { MetaQualityProfiles } from '../MetaQualityProfiles';
jest.mock('../../../../../../../api/rules', () => {
return {
searchRules: jest.fn().mockResolvedValue({
- total: 10
- })
+ total: 10,
+ }),
};
});
@@ -51,8 +51,8 @@ function shallowRender(props: Partial<MetaQualityProfiles['props']> = {}) {
{ ...mockQualityProfile({ key: 'js' }), deleted: true },
{
...mockQualityProfile({ key: 'css', language: 'css', languageName: 'CSS' }),
- deleted: false
- }
+ deleted: false,
+ },
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaSize-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaSize-test.tsx
index a22c02e69df..66f7992419c 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaSize-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaSize-test.tsx
@@ -38,7 +38,7 @@ function shallowRender(props: Partial<MetaSizeProps> = {}) {
component={mockComponent()}
measures={[
mockMeasure({ metric: MetricKey.ncloc }),
- mockMeasure({ metric: MetricKey.projects })
+ mockMeasure({ metric: MetricKey.projects }),
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTags-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTags-test.tsx
index 5c93f7adeda..627da3e91a1 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTags-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTags-test.tsx
@@ -26,7 +26,7 @@ import MetaTags from '../MetaTags';
jest.mock('../../../../../../../api/components', () => ({
setApplicationTags: jest.fn().mockResolvedValue(true),
- setProjectTags: jest.fn().mockResolvedValue(true)
+ setProjectTags: jest.fn().mockResolvedValue(true),
}));
beforeEach(() => {
@@ -42,9 +42,9 @@ it('should render with tags and admin rights', () => {
key: 'my-second-project',
tags: ['foo', 'bar'],
configuration: {
- showSettings: true
+ showSettings: true,
},
- name: 'MySecondProject'
+ name: 'MySecondProject',
});
expect(shallowRender({ component })).toMatchSnapshot();
@@ -61,7 +61,7 @@ it('should set tags for a project', () => {
it('should set tags for an app', () => {
const wrapper = shallowRender({
- component: mockComponent({ qualifier: ComponentQualifier.Application })
+ component: mockComponent({ qualifier: ComponentQualifier.Application }),
});
wrapper.instance().handleSetProjectTags(['tag1', 'tag2']);
@@ -73,8 +73,8 @@ it('should set tags for an app', () => {
function shallowRender(overrides: Partial<MetaTags['props']> = {}) {
const component = mockComponent({
configuration: {
- showSettings: false
- }
+ showSettings: false,
+ },
});
return shallow<MetaTags>(
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTagsSelector-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTagsSelector-test.tsx
index 0306128976c..e6d00e3314c 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTagsSelector-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/meta/__tests__/MetaTagsSelector-test.tsx
@@ -24,12 +24,12 @@ import { searchProjectTags } from '../../../../../../../api/components';
import MetaTagsSelector from '../MetaTagsSelector';
jest.mock('../../../../../../../api/components', () => ({
- searchProjectTags: jest.fn()
+ searchProjectTags: jest.fn(),
}));
jest.mock('lodash', () => {
const lodash = jest.requireActual('lodash');
- lodash.debounce = jest.fn(fn => fn);
+ lodash.debounce = jest.fn((fn) => fn);
return lodash;
});
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/ProjectNotifications.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/ProjectNotifications.tsx
index a6c18ff29d3..9fe0b44c442 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/ProjectNotifications.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/ProjectNotifications.tsx
@@ -21,7 +21,7 @@ import * as React from 'react';
import NotificationsList from '../../../../../../apps/account/notifications/NotificationsList';
import {
withNotifications,
- WithNotificationsProps
+ WithNotificationsProps,
} from '../../../../../../components/hoc/withNotifications';
import { Alert } from '../../../../../../components/ui/Alert';
import DeferredSpinner from '../../../../../../components/ui/DeferredSpinner';
@@ -51,7 +51,7 @@ export function ProjectNotifications(props: WithNotificationsProps & Props) {
props.removeNotification({
project: component.key,
channel,
- type
+ type,
});
};
@@ -59,7 +59,9 @@ export function ProjectNotifications(props: WithNotificationsProps & Props) {
return `project-notification-${component.key}-${type}-${channel}`;
};
- const projectNotifications = notifications.filter(n => n.project && n.project === component.key);
+ const projectNotifications = notifications.filter(
+ (n) => n.project && n.project === component.key
+ );
return (
<>
@@ -76,7 +78,7 @@ export function ProjectNotifications(props: WithNotificationsProps & Props) {
<thead>
<tr>
<th aria-label={translate('project')} />
- {channels.map(channel => (
+ {channels.map((channel) => (
<th className="text-center" key={channel}>
<h4>{translate('notification.channel', channel)}</h4>
</th>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/__tests__/ProjectNotifications-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/__tests__/ProjectNotifications-test.tsx
index ae3263ae9b5..fc9aca67652 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/__tests__/ProjectNotifications-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/notifications/__tests__/ProjectNotifications-test.tsx
@@ -25,8 +25,8 @@ import { ProjectNotifications } from '../ProjectNotifications';
jest.mock('react', () => {
return {
...jest.requireActual('react'),
- useEffect: jest.fn().mockImplementation(f => f()),
- useRef: jest.fn().mockReturnValue({ current: document.createElement('h3') })
+ useEffect: jest.fn().mockImplementation((f) => f()),
+ useRef: jest.fn().mockReturnValue({ current: document.createElement('h3') }),
};
});
@@ -40,7 +40,7 @@ it('should add and remove a notification for the project', () => {
const wrapper = shallowRender({ addNotification, removeNotification });
const notification = {
channel: 'EmailNotificationChannel',
- type: 'SQ-MyNewIssues'
+ type: 'SQ-MyNewIssues',
};
wrapper.find('NotificationsList').prop<Function>('onAdd')(notification);
@@ -72,20 +72,20 @@ function shallowRender(props = {}) {
channel: 'channel1',
type: 'type-global',
project: 'foo',
- projectName: 'Foo'
+ projectName: 'Foo',
},
{
channel: 'channel1',
type: 'type-common',
project: 'bar',
- projectName: 'Bar'
+ projectName: 'Bar',
},
{
channel: 'channel2',
type: 'type-common',
project: 'qux',
- projectName: 'Qux'
- }
+ projectName: 'Qux',
+ },
]}
perProjectTypes={['type-common']}
removeNotification={jest.fn()}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/projectRegulatoryReport/RegulatoryReport.tsx b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/projectRegulatoryReport/RegulatoryReport.tsx
index 0baf7f66974..6f76fb4f0ea 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/projectRegulatoryReport/RegulatoryReport.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/projectInformation/projectRegulatoryReport/RegulatoryReport.tsx
@@ -27,7 +27,7 @@ import Select, { BasicSelectOption } from '../../../../../../components/controls
import {
getBranchLikeDisplayName,
isBranch,
- isMainBranch
+ isMainBranch,
} from '../../../../../../helpers/branch-like';
import { translate } from '../../../../../../helpers/l10n';
import { Component } from '../../../../../../types/types';
@@ -51,26 +51,26 @@ export default class RegulatoryReport extends React.PureComponent<Props, State>
this.state = {
downloadStarted: false,
selectedBranch: '',
- branchLikesOptions: []
+ branchLikesOptions: [],
};
}
componentDidMount() {
const { component, branchLike } = this.props;
getBranches(component.key)
- .then(data => {
+ .then((data) => {
const mainBranch = data.find(isMainBranch);
const otherBranchSorted = orderBy(
- data.filter(isBranch).filter(b => !isMainBranch(b)),
- b => b.name
+ data.filter(isBranch).filter((b) => !isMainBranch(b)),
+ (b) => b.name
);
const sortedBranch = mainBranch ? [mainBranch, ...otherBranchSorted] : otherBranchSorted;
const options = sortedBranch
- .filter(br => br.excludedFromPurge)
- .map(br => {
+ .filter((br) => br.excludedFromPurge)
+ .map((br) => {
return {
value: getBranchLikeDisplayName(br),
- label: getBranchLikeDisplayName(br)
+ label: getBranchLikeDisplayName(br),
};
});
@@ -120,7 +120,7 @@ export default class RegulatoryReport extends React.PureComponent<Props, State>
id="regulatory-report-branch-select-input"
onChange={this.onBranchSelect}
options={branchLikesOptions}
- value={branchLikesOptions.find(o => o.value === selectedBranch)}
+ value={branchLikesOptions.find((o) => o.value === selectedBranch)}
/>
</div>
<div className="modal-field big-spacer-top">
@@ -134,15 +134,16 @@ export default class RegulatoryReport extends React.PureComponent<Props, State>
<div className="modal-foot">
<a
className={classNames('button button-primary big-spacer-right', {
- disabled: downloadStarted
+ disabled: downloadStarted,
})}
download={[component.name, selectedBranch, 'regulatory report.zip']
- .filter(s => !!s)
+ .filter((s) => !!s)
.join(' - ')}
onClick={() => this.setState({ downloadStarted: true })}
href={getRegulatoryReportUrl(component.key, selectedBranch)}
target="_blank"
- rel="noopener noreferrer">
+ rel="noopener noreferrer"
+ >
{translate('download_verb')}
</a>
<ButtonLink onClick={onClose}>{translate('close')}</ButtonLink>
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx
index 79dee1dc5c2..00cf2a9ab7f 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx
@@ -50,7 +50,8 @@ export class GlobalNavMenu extends React.PureComponent<Props> {
<Link
aria-current={active ? 'page' : undefined}
className={classNames({ active })}
- to="/projects">
+ to="/projects"
+ >
{translate('projects.page')}
</Link>
</li>
@@ -68,16 +69,18 @@ export class GlobalNavMenu extends React.PureComponent<Props> {
}
renderIssuesLink() {
- const search = (this.props.currentUser.isLoggedIn && isMySet()
- ? new URLSearchParams({ resolved: 'false', myIssues: 'true' })
- : new URLSearchParams({ resolved: 'false' })
+ const search = (
+ this.props.currentUser.isLoggedIn && isMySet()
+ ? new URLSearchParams({ resolved: 'false', myIssues: 'true' })
+ : new URLSearchParams({ resolved: 'false' })
).toString();
return (
<li>
<NavLink
className={({ isActive }) => (isActive ? ACTIVE_CLASS_NAME : '')}
- to={{ pathname: '/issues', search }}>
+ to={{ pathname: '/issues', search }}
+ >
{translate('issues.page')}
</NavLink>
</li>
@@ -89,7 +92,8 @@ export class GlobalNavMenu extends React.PureComponent<Props> {
<li>
<NavLink
className={({ isActive }) => (isActive ? ACTIVE_CLASS_NAME : '')}
- to="/coding_rules">
+ to="/coding_rules"
+ >
{translate('coding_rules.page')}
</NavLink>
</li>
@@ -111,7 +115,8 @@ export class GlobalNavMenu extends React.PureComponent<Props> {
<li>
<NavLink
className={({ isActive }) => (isActive ? ACTIVE_CLASS_NAME : '')}
- to={getQualityGatesUrl()}>
+ to={getQualityGatesUrl()}
+ >
{translate('quality_gates.page')}
</NavLink>
</li>
@@ -142,14 +147,15 @@ export class GlobalNavMenu extends React.PureComponent<Props> {
renderMore() {
const { globalPages = [] } = this.props.appState;
- const withoutPortfolios = globalPages.filter(page => page.key !== 'governance/portfolios');
+ const withoutPortfolios = globalPages.filter((page) => page.key !== 'governance/portfolios');
if (withoutPortfolios.length === 0) {
return null;
}
return (
<Dropdown
overlay={<ul className="menu">{withoutPortfolios.map(this.renderGlobalPageLink)}</ul>}
- tagName="li">
+ tagName="li"
+ >
{({ onToggleClick, open }) => (
<a
aria-expanded={open}
@@ -158,7 +164,8 @@ export class GlobalNavMenu extends React.PureComponent<Props> {
className={classNames('dropdown-toggle', { active: open })}
href="#"
id="global-navigation-more"
- onClick={onToggleClick}>
+ onClick={onToggleClick}
+ >
{translate('more')}
<DropdownIcon className="little-spacer-left text-middle" />
</a>
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx
index 83539d8ce5c..a32aab8c699 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.tsx
@@ -66,7 +66,8 @@ export class GlobalNavUser extends React.PureComponent<Props> {
{currentUser.email != null && (
<div
className="little-spacer-top text-ellipsis text-muted"
- title={currentUser.email}>
+ title={currentUser.email}
+ >
{currentUser.email}
</div>
)}
@@ -83,7 +84,8 @@ export class GlobalNavUser extends React.PureComponent<Props> {
</a>
</li>
</ul>
- }>
+ }
+ >
<a className="dropdown-toggle navbar-avatar" href="#" title={currentUser.name}>
<Avatar
hash={currentUser.avatar}
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavBranding-test.tsx b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavBranding-test.tsx
index f182f4d43e7..9d6aa782ad5 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavBranding-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavBranding-test.tsx
@@ -28,9 +28,9 @@ it('should render correctly', () => {
shallowRender({
appState: mockAppState({
settings: {
- 'sonar.lf.logoUrl': 'http://sonarsource.com/custom-logo.svg'
- }
- })
+ 'sonar.lf.logoUrl': 'http://sonarsource.com/custom-logo.svg',
+ },
+ }),
})
).toMatchSnapshot('with logo');
expect(
@@ -38,9 +38,9 @@ it('should render correctly', () => {
appState: mockAppState({
settings: {
'sonar.lf.logoUrl': 'http://sonarsource.com/custom-logo.svg',
- 'sonar.lf.logoWidthPx': '200'
- }
- })
+ 'sonar.lf.logoWidthPx': '200',
+ },
+ }),
})
).toMatchSnapshot('with logo and width');
});
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavMenu-test.tsx b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavMenu-test.tsx
index b93c16c239e..d131e5e8397 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavMenu-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavMenu-test.tsx
@@ -26,12 +26,12 @@ import { GlobalNavMenu } from '../GlobalNavMenu';
it('should work with extensions', () => {
const appState = mockAppState({
globalPages: [{ key: 'foo', name: 'Foo' }],
- qualifiers: ['TRK']
+ qualifiers: ['TRK'],
});
const currentUser = {
isLoggedIn: false,
- dismissedNotices: {}
+ dismissedNotices: {},
};
renderGlobalNavMenu({ appState, currentUser });
expect(screen.getByText('more')).toBeInTheDocument();
@@ -41,11 +41,11 @@ it('should show administration menu if the user has the rights', () => {
const appState = mockAppState({
canAdmin: true,
globalPages: [],
- qualifiers: ['TRK']
+ qualifiers: ['TRK'],
});
const currentUser = {
isLoggedIn: false,
- dismissedNotices: {}
+ dismissedNotices: {},
};
renderGlobalNavMenu({ appState, currentUser });
@@ -55,7 +55,7 @@ it('should show administration menu if the user has the rights', () => {
function renderGlobalNavMenu({
appState = mockAppState(),
currentUser = mockCurrentUser(),
- location = { pathname: '' }
+ location = { pathname: '' },
}: Partial<GlobalNavMenu['props']>) {
renderComponent(
<GlobalNavMenu appState={appState} currentUser={currentUser} location={location} />
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/PendingPluginsActionNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/PendingPluginsActionNotif.tsx
index 1444bd9e20d..0c470283ff4 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/PendingPluginsActionNotif.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/PendingPluginsActionNotif.tsx
@@ -56,7 +56,7 @@ export default class PendingPluginsActionNotif extends React.PureComponent<Props
{[
{ length: installing.length, msg: 'marketplace.install_x_plugins' },
{ length: updating.length, msg: 'marketplace.update_x_plugins' },
- { length: removing.length, msg: 'marketplace.uninstall_x_plugins' }
+ { length: removing.length, msg: 'marketplace.uninstall_x_plugins' },
]
.filter(({ length }) => length > 0)
.map(({ length, msg }, idx) => (
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx
index e84059e8629..169dc13bb51 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx
@@ -47,7 +47,7 @@ const ALERT_HEIGHT = 30;
export class SettingsNav extends React.PureComponent<Props> {
static defaultProps = {
- extensions: []
+ extensions: [],
};
isSomethingActive = (urls: string[]) => {
@@ -60,7 +60,7 @@ export class SettingsNav extends React.PureComponent<Props> {
'/admin/users',
'/admin/groups',
'/admin/permissions',
- '/admin/permission_templates'
+ '/admin/permission_templates',
];
return this.isSomethingActive(urls);
}
@@ -95,7 +95,7 @@ export class SettingsNav extends React.PureComponent<Props> {
renderConfigurationTab() {
const extensionsWithoutSupport = this.props.extensions.filter(
- extension => extension.key !== 'license/support'
+ (extension) => extension.key !== 'license/support'
);
return (
<Dropdown
@@ -119,7 +119,8 @@ export class SettingsNav extends React.PureComponent<Props> {
{extensionsWithoutSupport.map(this.renderExtension)}
</ul>
}
- tagName="li">
+ tagName="li"
+ >
{({ onToggleClick, open }) => (
<a
aria-expanded={open}
@@ -133,11 +134,12 @@ export class SettingsNav extends React.PureComponent<Props> {
!this.isSystemActive() &&
!this.isSomethingActive(['/admin/extension/license/support']) &&
!this.isMarketplace() &&
- !this.isAudit())
+ !this.isAudit()),
})}
href="#"
id="settings-navigation-configuration"
- onClick={onToggleClick}>
+ onClick={onToggleClick}
+ >
{translate('sidebar.project_settings')}
<DropdownIcon className="little-spacer-left" />
</a>
@@ -163,7 +165,8 @@ export class SettingsNav extends React.PureComponent<Props> {
</li>
</ul>
}
- tagName="li">
+ tagName="li"
+ >
{({ onToggleClick, open }) => (
<a
aria-expanded={open}
@@ -171,7 +174,8 @@ export class SettingsNav extends React.PureComponent<Props> {
role="button"
className={classNames('dropdown-toggle', { active: open || this.isProjectsActive() })}
href="#"
- onClick={onToggleClick}>
+ onClick={onToggleClick}
+ >
{translate('sidebar.projects')}
<DropdownIcon className="little-spacer-left" />
</a>
@@ -207,7 +211,8 @@ export class SettingsNav extends React.PureComponent<Props> {
</li>
</ul>
}
- tagName="li">
+ tagName="li"
+ >
{({ onToggleClick, open }) => (
<a
aria-expanded={open}
@@ -215,7 +220,8 @@ export class SettingsNav extends React.PureComponent<Props> {
role="button"
className={classNames('dropdown-toggle', { active: open || this.isSecurityActive() })}
href="#"
- onClick={onToggleClick}>
+ onClick={onToggleClick}
+ >
{translate('sidebar.security')}
<DropdownIcon className="little-spacer-left" />
</a>
@@ -226,9 +232,9 @@ export class SettingsNav extends React.PureComponent<Props> {
render() {
const { extensions, pendingPlugins } = this.props;
- const hasSupportExtension = extensions.find(extension => extension.key === 'license/support');
+ const hasSupportExtension = extensions.find((extension) => extension.key === 'license/support');
const hasGovernanceExtension = extensions.find(
- e => e.key === AdminPageExtension.GovernanceConsole
+ (e) => e.key === AdminPageExtension.GovernanceConsole
);
const totalPendingPlugins =
pendingPlugins.installing.length +
@@ -253,7 +259,8 @@ export class SettingsNav extends React.PureComponent<Props> {
<ContextNavBar
height={notifComponent ? contextNavHeight + ALERT_HEIGHT : contextNavHeight}
id="context-navigation"
- notif={notifComponent}>
+ notif={notifComponent}
+ >
<div className="navbar-context-header">
<h1>{translate('layout.settings')}</h1>
</div>
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SystemRestartNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/SystemRestartNotif.tsx
index da0436e8c69..c1c5dfc03f4 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/SystemRestartNotif.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/SystemRestartNotif.tsx
@@ -32,7 +32,7 @@ export default function SystemRestartNotif() {
id="system.instance_restarting"
values={{
instance: getInstance(),
- link: <Link to="/admin/background_tasks">{translate('background_tasks.page')}</Link>
+ link: <Link to="/admin/background_tasks">{translate('background_tasks.page')}</Link>,
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx
index 9519b1d1cda..edb30a37774 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/PendingPluginsActionNotif-test.tsx
@@ -23,7 +23,7 @@ import { click } from '../../../../../helpers/testUtils';
import PendingPluginsActionNotif from '../PendingPluginsActionNotif';
jest.mock('../../../../../api/plugins', () => ({
- cancelPendingPlugins: jest.fn(() => Promise.resolve())
+ cancelPendingPlugins: jest.fn(() => Promise.resolve()),
}));
const cancelPendingPlugins = require('../../../../../api/plugins')
@@ -62,15 +62,15 @@ function getWrapper(props = {}) {
name: 'Foo',
description: 'foo description',
version: 'fooversion',
- implementationBuild: 'foobuild'
+ implementationBuild: 'foobuild',
},
{
key: 'bar',
name: 'Bar',
description: 'bar description',
version: 'barversion',
- implementationBuild: 'barbuild'
- }
+ implementationBuild: 'barbuild',
+ },
],
updating: [],
removing: [
@@ -79,9 +79,9 @@ function getWrapper(props = {}) {
name: 'Baz',
description: 'baz description',
version: 'bazversion',
- implementationBuild: 'bazbuild'
- }
- ]
+ implementationBuild: 'bazbuild',
+ },
+ ],
}}
refreshPending={() => {}}
systemStatus="UP"
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx
index c2264d9e1d6..f5edd4bf0ea 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.tsx
@@ -37,12 +37,12 @@ it('should display a pending plugin notif', () => {
key: 'foo',
name: 'Foo',
version: '1.0',
- implementationBuild: '1'
- }
+ implementationBuild: '1',
+ },
],
removing: [],
- updating: []
- }
+ updating: [],
+ },
});
expect(wrapper.find('ContextNavBar').prop('notif')).toMatchSnapshot();
});
@@ -55,7 +55,7 @@ it('should display restart notif', () => {
it('should render correctly when governance is active', () => {
expect(
shallowRender({
- extensions: [{ key: AdminPageExtension.GovernanceConsole, name: 'governance' }]
+ extensions: [{ key: AdminPageExtension.GovernanceConsole, name: 'governance' }],
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/app/components/promotion-notification/PromotionNotification.tsx b/server/sonar-web/src/main/js/app/components/promotion-notification/PromotionNotification.tsx
index e4f4934f5ba..aac278a82f9 100644
--- a/server/sonar-web/src/main/js/app/components/promotion-notification/PromotionNotification.tsx
+++ b/server/sonar-web/src/main/js/app/components/promotion-notification/PromotionNotification.tsx
@@ -63,7 +63,8 @@ export function PromotionNotification(props: PromotionNotificationProps) {
href="https://www.sonarqube.org/sonarlint/?referrer=sonarqube-welcome"
rel="noreferrer"
onClick={onClick}
- target="_blank">
+ target="_blank"
+ >
{translate('learn_more')}
</a>
<ButtonLink className="toaster-link" onClick={onClick}>
diff --git a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx b/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx
index 860a97fd810..7f60f449bcc 100644
--- a/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/promotion-notification/__tests__/PromotionNotification-test.tsx
@@ -26,7 +26,7 @@ import { NoticeType } from '../../../../types/users';
import { PromotionNotification, PromotionNotificationProps } from '../PromotionNotification';
jest.mock('../../../../api/users', () => ({
- dismissNotice: jest.fn().mockResolvedValue({})
+ dismissNotice: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
@@ -37,7 +37,7 @@ it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot('anonymous');
expect(
shallowRender({
- currentUser: mockLoggedInUser({ dismissedNotices: { [NoticeType.SONARLINT_AD]: true } })
+ currentUser: mockLoggedInUser({ dismissedNotices: { [NoticeType.SONARLINT_AD]: true } }),
})
).toMatchSnapshot('adAlreadySeen');
expect(shallowRender({ currentUser: mockLoggedInUser() })).toMatchSnapshot('loggedIn');
@@ -47,7 +47,7 @@ it('should remove the toaster when click on dismiss', async () => {
const updateDismissedNotices = jest.fn();
const wrapper = shallowRender({
currentUser: mockLoggedInUser({ dismissedNotices: { [NoticeType.SONARLINT_AD]: false } }),
- updateDismissedNotices
+ updateDismissedNotices,
});
wrapper.find('.toaster-actions ButtonLink').simulate('click');
expect(dismissNotice).toHaveBeenCalled();
@@ -59,7 +59,7 @@ it('should remove the toaster and navigate to sonarlint when click on learn more
const updateDismissedNotices = jest.fn();
const wrapper = shallowRender({
currentUser: mockLoggedInUser({ dismissedNotices: { [NoticeType.SONARLINT_AD]: false } }),
- updateDismissedNotices
+ updateDismissedNotices,
});
wrapper.find('.toaster-actions .button-primary').simulate('click');
expect(dismissNotice).toHaveBeenCalled();
diff --git a/server/sonar-web/src/main/js/app/components/search/Search.tsx b/server/sonar-web/src/main/js/app/components/search/Search.tsx
index e2457e43a34..0099a3a09a1 100644
--- a/server/sonar-web/src/main/js/app/components/search/Search.tsx
+++ b/server/sonar-web/src/main/js/app/components/search/Search.tsx
@@ -73,7 +73,7 @@ export class Search extends React.PureComponent<Props, State> {
open: false,
query: '',
results: {},
- shortQuery: false
+ shortQuery: false,
};
}
@@ -134,7 +134,7 @@ export class Search extends React.PureComponent<Props, State> {
query: '',
results: {},
selected: undefined,
- shortQuery: false
+ shortQuery: false,
});
} else {
this.setState({ open: false });
@@ -143,7 +143,7 @@ export class Search extends React.PureComponent<Props, State> {
getPlainComponentsList = (results: Results, more: More) =>
sortQualifiers(Object.keys(results)).reduce((components, qualifier) => {
- const next = [...components, ...results[qualifier].map(component => component.key)];
+ const next = [...components, ...results[qualifier].map((component) => component.key)];
if (more[qualifier]) {
next.push('qualifier###' + qualifier);
}
@@ -159,16 +159,16 @@ export class Search extends React.PureComponent<Props, State> {
search = (query: string) => {
if (query.length === 0 || query.length >= MIN_SEARCH_QUERY_LENGTH) {
this.setState({ loading: true });
- const recentlyBrowsed = RecentHistory.get().map(component => component.key);
- getSuggestions(query, recentlyBrowsed).then(response => {
+ const recentlyBrowsed = RecentHistory.get().map((component) => component.key);
+ getSuggestions(query, recentlyBrowsed).then((response) => {
// compare `this.state.query` and `query` to handle two request done almost at the same time
// in this case only the request that matches the current query should be taken
if (this.mounted && this.state.query === query) {
const results: Results = {};
const more: More = {};
this.nodes = {};
- response.results.forEach(group => {
- results[group.q] = group.items.map(item => ({ ...item, qualifier: group.q }));
+ response.results.forEach((group) => {
+ results[group.q] = group.items.map((item) => ({ ...item, qualifier: group.q }));
more[group.q] = group.more;
});
const list = this.getPlainComponentsList(results, more);
@@ -177,7 +177,8 @@ export class Search extends React.PureComponent<Props, State> {
more,
results,
selected: list.length > 0 ? list[0] : undefined,
- shortQuery: query.length > MIN_SEARCH_QUERY_LENGTH && response.warning === 'short_input'
+ shortQuery:
+ query.length > MIN_SEARCH_QUERY_LENGTH && response.warning === 'short_input',
});
}
}, this.stopLoading);
@@ -193,20 +194,20 @@ export class Search extends React.PureComponent<Props, State> {
}
this.setState({ loading: true, loadingMore: qualifier });
- const recentlyBrowsed = RecentHistory.get().map(component => component.key);
- getSuggestions(query, recentlyBrowsed, qualifier).then(response => {
+ const recentlyBrowsed = RecentHistory.get().map((component) => component.key);
+ getSuggestions(query, recentlyBrowsed, qualifier).then((response) => {
if (this.mounted) {
- const group = response.results.find(group => group.q === qualifier);
- const moreResults = (group ? group.items : []).map(item => ({ ...item, qualifier }));
- this.setState(state => ({
+ const group = response.results.find((group) => group.q === qualifier);
+ const moreResults = (group ? group.items : []).map((item) => ({ ...item, qualifier }));
+ this.setState((state) => ({
loading: false,
loadingMore: undefined,
more: { ...state.more, [qualifier]: 0 },
results: {
...state.results,
- [qualifier]: uniqBy([...state.results[qualifier], ...moreResults], 'key')
+ [qualifier]: uniqBy([...state.results[qualifier], ...moreResults], 'key'),
},
- selected: moreResults.length > 0 ? moreResults[0].key : state.selected
+ selected: moreResults.length > 0 ? moreResults[0].key : state.selected,
}));
this.focusInput();
}
@@ -252,9 +253,9 @@ export class Search extends React.PureComponent<Props, State> {
} else {
let qualifier = ComponentQualifier.Project;
- if ((results[ComponentQualifier.Portfolio] ?? []).find(r => r.key === selected)) {
+ if ((results[ComponentQualifier.Portfolio] ?? []).find((r) => r.key === selected)) {
qualifier = ComponentQualifier.Portfolio;
- } else if ((results[ComponentQualifier.SubPortfolio] ?? []).find(r => r.key === selected)) {
+ } else if ((results[ComponentQualifier.SubPortfolio] ?? []).find((r) => r.key === selected)) {
qualifier = ComponentQualifier.SubPortfolio;
}
@@ -367,7 +368,7 @@ export class Search extends React.PureComponent<Props, State> {
{this.state.open && Object.keys(this.state.results).length > 0 && (
<DropdownOverlay noPadding={true}>
- <div className="global-navbar-search-dropdown" ref={node => (this.node = node)}>
+ <div className="global-navbar-search-dropdown" ref={(node) => (this.node = node)}>
<SearchResults
allowMore={this.state.query.length !== 1}
loadingMore={this.state.loadingMore}
@@ -388,7 +389,7 @@ export class Search extends React.PureComponent<Props, State> {
defaultMessage={translate('search.shortcut_hint')}
id="search.shortcut_hint"
values={{
- shortcut: <span className="shortcut-button shortcut-button-small">s</span>
+ shortcut: <span className="shortcut-button shortcut-button-small">s</span>,
}}
/>
</div>
diff --git a/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx b/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx
index 31a39057c5d..c3ed82cba77 100644
--- a/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx
+++ b/server/sonar-web/src/main/js/app/components/search/SearchResult.tsx
@@ -43,13 +43,14 @@ export default class SearchResult extends React.PureComponent<Props> {
const to = getComponentOverviewUrl(component.key, component.qualifier);
return (
- <li key={component.key} ref={node => this.props.innerRef(component.key, node)}>
+ <li key={component.key} ref={(node) => this.props.innerRef(component.key, node)}>
<Link
className={this.props.selected ? 'hover' : undefined}
data-key={component.key}
onClick={this.props.onClose}
onFocus={this.doSelect}
- to={to}>
+ to={to}
+ >
<div className="navbar-search-item-link little-padded-top" onMouseEnter={this.doSelect}>
<div className="display-flex-center">
<span className="navbar-search-item-icons little-spacer-right">
diff --git a/server/sonar-web/src/main/js/app/components/search/SearchResults.tsx b/server/sonar-web/src/main/js/app/components/search/SearchResults.tsx
index 66160c2dd13..2e9227e8919 100644
--- a/server/sonar-web/src/main/js/app/components/search/SearchResults.tsx
+++ b/server/sonar-web/src/main/js/app/components/search/SearchResults.tsx
@@ -38,7 +38,7 @@ export default function SearchResults(props: Props): React.ReactElement<Props> {
const qualifiers = Object.keys(props.results);
const renderedComponents: React.ReactNode[] = [];
- sortQualifiers(qualifiers).forEach(qualifier => {
+ sortQualifiers(qualifiers).forEach((qualifier) => {
const components = props.results[qualifier];
if (components.length > 0) {
@@ -49,7 +49,7 @@ export default function SearchResults(props: Props): React.ReactElement<Props> {
<li className="menu-header" role="presentation">
{translate('qualifiers', qualifier)}
</li>
- {components.map(component => props.renderResult(component))}
+ {components.map((component) => props.renderResult(component))}
{more !== undefined && more > 0 && (
<SearchShowMore
allowMore={props.allowMore}
diff --git a/server/sonar-web/src/main/js/app/components/search/SearchShowMore.tsx b/server/sonar-web/src/main/js/app/components/search/SearchShowMore.tsx
index 2fe6b6f2252..9a3777d6f23 100644
--- a/server/sonar-web/src/main/js/app/components/search/SearchShowMore.tsx
+++ b/server/sonar-web/src/main/js/app/components/search/SearchShowMore.tsx
@@ -61,13 +61,14 @@ export default class SearchShowMore extends React.PureComponent<Props> {
data-qualifier={qualifier}
href="#"
onClick={this.handleMoreClick}
- onMouseEnter={this.handleMoreMouseEnter}>
+ onMouseEnter={this.handleMoreMouseEnter}
+ >
<div className="pull-right text-muted-2 menu-footer-note">
<FormattedMessage
defaultMessage={translate('search.show_more.hint')}
id="search.show_more.hint"
values={{
- key: <span className="shortcut-button shortcut-button-small">Enter</span>
+ key: <span className="shortcut-button shortcut-button-small">Enter</span>,
}}
/>
</div>
diff --git a/server/sonar-web/src/main/js/app/components/search/__tests__/Search-test.tsx b/server/sonar-web/src/main/js/app/components/search/__tests__/Search-test.tsx
index cfd39892c41..4cd7cc1aed0 100644
--- a/server/sonar-web/src/main/js/app/components/search/__tests__/Search-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/search/__tests__/Search-test.tsx
@@ -32,9 +32,9 @@ it('selects results', () => {
more: { TRK: 15 },
open: true,
results: {
- TRK: [component('foo'), component('bar')]
+ TRK: [component('foo'), component('bar')],
},
- selected: 'foo'
+ selected: 'foo',
});
expect(form.state().selected).toBe('foo');
next(form, 'bar');
@@ -65,13 +65,13 @@ it('opens selected project on enter', () => {
form.setState({
open: true,
results: { [ComponentQualifier.Project]: [component(selectedKey)] },
- selected: selectedKey
+ selected: selectedKey,
});
keydown({ key: KeyboardKeys.Enter });
expect(router.push).toHaveBeenCalledWith({
pathname: '/dashboard',
- search: queryToSearch({ id: selectedKey })
+ search: queryToSearch({ id: selectedKey }),
});
});
@@ -82,15 +82,15 @@ it('opens selected portfolio on enter', () => {
form.setState({
open: true,
results: {
- [ComponentQualifier.Portfolio]: [component(selectedKey, ComponentQualifier.Portfolio)]
+ [ComponentQualifier.Portfolio]: [component(selectedKey, ComponentQualifier.Portfolio)],
},
- selected: selectedKey
+ selected: selectedKey,
});
keydown({ key: KeyboardKeys.Enter });
expect(router.push).toHaveBeenCalledWith({
pathname: '/portfolio',
- search: queryToSearch({ id: selectedKey })
+ search: queryToSearch({ id: selectedKey }),
});
});
@@ -101,15 +101,15 @@ it('opens selected subportfolio on enter', () => {
form.setState({
open: true,
results: {
- [ComponentQualifier.SubPortfolio]: [component(selectedKey, ComponentQualifier.SubPortfolio)]
+ [ComponentQualifier.SubPortfolio]: [component(selectedKey, ComponentQualifier.SubPortfolio)],
},
- selected: selectedKey
+ selected: selectedKey,
});
keydown({ key: KeyboardKeys.Enter });
expect(router.push).toHaveBeenCalledWith({
pathname: '/portfolio',
- search: queryToSearch({ id: selectedKey })
+ search: queryToSearch({ id: selectedKey }),
});
});
diff --git a/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResult-test.tsx b/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResult-test.tsx
index 47e4f2c9b14..0ea13dcc5bb 100644
--- a/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResult-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResult-test.tsx
@@ -34,7 +34,7 @@ it('renders match', () => {
key: 'foo',
name: 'foo',
match: 'f<mark>o</mark>o',
- qualifier: ComponentQualifier.Project
+ qualifier: ComponentQualifier.Project,
};
const wrapper = shallowRender({ component });
expect(wrapper).toMatchSnapshot();
@@ -45,7 +45,7 @@ it('renders favorite', () => {
isFavorite: true,
key: 'foo',
name: 'foo',
- qualifier: ComponentQualifier.Project
+ qualifier: ComponentQualifier.Project,
};
const wrapper = shallowRender({ component });
expect(wrapper).toMatchSnapshot();
@@ -56,7 +56,7 @@ it('renders recently browsed', () => {
isRecentlyBrowsed: true,
key: 'foo',
name: 'foo',
- qualifier: ComponentQualifier.Project
+ qualifier: ComponentQualifier.Project,
};
const wrapper = shallowRender({ component });
expect(wrapper).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResults-test.tsx b/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResults-test.tsx
index 54a177c1ff7..4f9388c1acf 100644
--- a/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResults-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/search/__tests__/SearchResults-test.tsx
@@ -30,10 +30,10 @@ it('renders different components and dividers between them', () => {
onMoreClick={jest.fn()}
onSelect={jest.fn()}
renderNoResults={() => <div />}
- renderResult={component => <span key={component.key}>{component.name}</span>}
+ renderResult={(component) => <span key={component.key}>{component.name}</span>}
results={{
TRK: [component('foo'), component('bar')],
- FIL: [component('zux', 'FIL')]
+ FIL: [component('zux', 'FIL')],
}}
/>
)
@@ -49,9 +49,9 @@ it('renders "Show More" link', () => {
onMoreClick={jest.fn()}
onSelect={jest.fn()}
renderNoResults={() => <div />}
- renderResult={component => <span key={component.key}>{component.name}</span>}
+ renderResult={(component) => <span key={component.key}>{component.name}</span>}
results={{
- TRK: [component('foo'), component('bar')]
+ TRK: [component('foo'), component('bar')],
}}
/>
)
diff --git a/server/sonar-web/src/main/js/app/components/search/__tests__/SearchShowMore-test.tsx b/server/sonar-web/src/main/js/app/components/search/__tests__/SearchShowMore-test.tsx
index 71431b7d59c..e9d4503a32b 100644
--- a/server/sonar-web/src/main/js/app/components/search/__tests__/SearchShowMore-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/search/__tests__/SearchShowMore-test.tsx
@@ -34,8 +34,8 @@ it('should trigger showing more', () => {
blur() {},
dataset: { qualifier: 'TRK' },
preventDefault() {},
- stopPropagation() {}
- }
+ stopPropagation() {},
+ },
});
expect(onMoreClick).toHaveBeenCalledWith('TRK');
});
diff --git a/server/sonar-web/src/main/js/app/components/search/utils.ts b/server/sonar-web/src/main/js/app/components/search/utils.ts
index c8398d5f695..ce86478f0a9 100644
--- a/server/sonar-web/src/main/js/app/components/search/utils.ts
+++ b/server/sonar-web/src/main/js/app/components/search/utils.ts
@@ -25,11 +25,11 @@ const ORDER = [
ComponentQualifier.Portfolio,
ComponentQualifier.SubPortfolio,
ComponentQualifier.Application,
- ComponentQualifier.Project
+ ComponentQualifier.Project,
];
export function sortQualifiers(qualifiers: string[]) {
- return sortBy(qualifiers, qualifier => ORDER.indexOf(qualifier as ComponentQualifier));
+ return sortBy(qualifiers, (qualifier) => ORDER.indexOf(qualifier as ComponentQualifier));
}
export interface ComponentResult {
diff --git a/server/sonar-web/src/main/js/app/components/update-notification/UpdateNotification.tsx b/server/sonar-web/src/main/js/app/components/update-notification/UpdateNotification.tsx
index 123260509da..5f8704c1d76 100644
--- a/server/sonar-web/src/main/js/app/components/update-notification/UpdateNotification.tsx
+++ b/server/sonar-web/src/main/js/app/components/update-notification/UpdateNotification.tsx
@@ -45,7 +45,7 @@ const MAP_VARIANT: Dict<AlertVariant> = {
[UpdateUseCase.NewMinorVersion]: 'info',
[UpdateUseCase.NewPatch]: 'warning',
[UpdateUseCase.PreLTS]: 'warning',
- [UpdateUseCase.PreviousLTS]: 'error'
+ [UpdateUseCase.PreviousLTS]: 'error',
};
interface Props {
@@ -73,7 +73,7 @@ export class UpdateNotification extends React.PureComponent<Props, State> {
systemUpgrades: [],
latestLTS: '',
canSeeNotification: false,
- useCase: UpdateUseCase.NewMinorVersion
+ useCase: UpdateUseCase.NewMinorVersion,
};
}
@@ -122,7 +122,7 @@ export class UpdateNotification extends React.PureComponent<Props, State> {
const allMinor = systemUpgrades[currentMajor];
return Object.keys(allMinor)
.map(Number)
- .some(minor => minor > currentMinor);
+ .some((minor) => minor > currentMinor);
}
isPatchUpdate(parsedVersion: number[], systemUpgrades: GroupedSystemUpdate) {
@@ -154,7 +154,7 @@ export class UpdateNotification extends React.PureComponent<Props, State> {
return;
}
regExpParsedVersion.shift();
- const parsedVersion = regExpParsedVersion.map(Number).map(n => (isNaN(n) ? 0 : n));
+ const parsedVersion = regExpParsedVersion.map(Number).map((n) => (isNaN(n) ? 0 : n));
const { upgrades, latestLTS } = await getSystemUpgrades();
@@ -164,12 +164,12 @@ export class UpdateNotification extends React.PureComponent<Props, State> {
return;
}
const systemUpgrades = mapValues(
- groupBy(upgrades, upgrade => {
+ groupBy(upgrades, (upgrade) => {
const [major] = upgrade.version.split('.');
return major;
}),
- upgrades =>
- groupBy(upgrades, upgrade => {
+ (upgrades) =>
+ groupBy(upgrades, (upgrade) => {
const [, minor] = upgrade.version.split('.');
return minor;
})
@@ -201,7 +201,7 @@ export class UpdateNotification extends React.PureComponent<Props, State> {
useCase,
dismissKey,
systemUpgrades: upgrades,
- canSeeNotification: true
+ canSeeNotification: true,
});
}
}
@@ -222,7 +222,8 @@ export class UpdateNotification extends React.PureComponent<Props, State> {
<DismissableAlert
alertKey={dismissKey}
variant={MAP_VARIANT[useCase]}
- className={`promote-update-notification it__upgrade-prompt-${useCase}`}>
+ className={`promote-update-notification it__upgrade-prompt-${useCase}`}
+ >
{translate('admin_notification.update', useCase)}
<SystemUpgradeButton
systemUpgrades={systemUpgrades}
diff --git a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx b/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx
index c850f77dc87..d4bdcd6041a 100644
--- a/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/update-notification/__tests__/UpdateNotification-test.tsx
@@ -33,7 +33,7 @@ jest.mock('../../../../api/system', () => {
return {
getSystemUpgrades: jest
.fn()
- .mockResolvedValue({ upgrades: [mockSystemUpgrade({ version: '9.1' })], latestLTS: '8.9' })
+ .mockResolvedValue({ upgrades: [mockSystemUpgrade({ version: '9.1' })], latestLTS: '8.9' }),
};
});
@@ -44,14 +44,14 @@ function formatDate(date: Date): string {
it('should render correctly', async () => {
let wrapper = shallowRender({
appState: mockAppState({ version: '9.0' }),
- currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } })
+ currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }),
});
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot('default');
wrapper = shallowRender({
appState: mockAppState({ version: '9.0' }),
- currentUser: mockCurrentUser()
+ currentUser: mockCurrentUser(),
});
expect(wrapper.type()).toBeNull();
});
@@ -78,7 +78,7 @@ it('should not show prompt when no upgrade', async () => {
(getSystemUpgrades as jest.Mock).mockResolvedValueOnce({ upgrades: [], latestLTS: '8.9' });
const wrapper = shallowRender({
appState: mockAppState({ version: '9.1' }),
- currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } })
+ currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }),
});
await waitAndUpdate(wrapper);
expect(wrapper.type()).toBeNull();
@@ -87,11 +87,11 @@ it('should not show prompt when no upgrade', async () => {
it('should show prompt when no lts date', async () => {
(getSystemUpgrades as jest.Mock).mockResolvedValueOnce({
upgrades: [mockSystemUpgrade({ version: '8.9', releaseDate: 'INVALID' })],
- latestLTS: '8.9'
+ latestLTS: '8.9',
});
const wrapper = shallowRender({
appState: mockAppState({ version: '8.1' }),
- currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } })
+ currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }),
});
await waitAndUpdate(wrapper);
expect(wrapper.find(DismissableAlert).props().alertKey).toBe('previous_lts8.9');
@@ -101,11 +101,11 @@ it('should show prompt when no lts date', async () => {
it('should show prompt when minor upgrade', async () => {
(getSystemUpgrades as jest.Mock).mockResolvedValueOnce({
upgrades: [mockSystemUpgrade({ version: '9.2' }), mockSystemUpgrade({ version: '9.1' })],
- latestLTS: '8.9'
+ latestLTS: '8.9',
});
const wrapper = shallowRender({
appState: mockAppState({ version: '9.1' }),
- currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } })
+ currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }),
});
await waitAndUpdate(wrapper);
expect(wrapper.find(DismissableAlert).props().alertKey).toBe('new_minor_version9.2');
@@ -115,11 +115,11 @@ it('should show prompt when minor upgrade', async () => {
it('should show prompt when patch upgrade', async () => {
(getSystemUpgrades as jest.Mock).mockResolvedValueOnce({
upgrades: [mockSystemUpgrade({ version: '9.2' }), mockSystemUpgrade({ version: '9.1.1' })],
- latestLTS: '8.9'
+ latestLTS: '8.9',
});
const wrapper = shallowRender({
appState: mockAppState({ version: '9.1' }),
- currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } })
+ currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }),
});
await waitAndUpdate(wrapper);
expect(wrapper.find(DismissableAlert).props().alertKey).toBe('new_patch9.2');
@@ -131,13 +131,13 @@ it('should show prompt when lts upgrade', async () => {
upgrades: [
mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(new Date(Date.now())) }),
mockSystemUpgrade({ version: '9.2' }),
- mockSystemUpgrade({ version: '9.1.1' })
+ mockSystemUpgrade({ version: '9.1.1' }),
],
- latestLTS: '8.9'
+ latestLTS: '8.9',
});
const wrapper = shallowRender({
appState: mockAppState({ version: '8.8' }),
- currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } })
+ currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }),
});
await waitAndUpdate(wrapper);
expect(wrapper.find(DismissableAlert).props().alertKey).toBe('pre_lts8.9');
@@ -151,13 +151,13 @@ it('should show prompt when lts upgrade is more than 6 month', async () => {
upgrades: [
mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(ltsDate) }),
mockSystemUpgrade({ version: '9.2' }),
- mockSystemUpgrade({ version: '9.1.1' })
+ mockSystemUpgrade({ version: '9.1.1' }),
],
- latestLTS: '8.9'
+ latestLTS: '8.9',
});
const wrapper = shallowRender({
appState: mockAppState({ version: '8.8' }),
- currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } })
+ currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }),
});
await waitAndUpdate(wrapper);
expect(wrapper.find(DismissableAlert).props().alertKey).toBe('previous_lts8.9');
@@ -169,13 +169,13 @@ it('should show correct alert when not dismissable', async () => {
upgrades: [
mockSystemUpgrade({ version: '8.9', releaseDate: formatDate(new Date(Date.now())) }),
mockSystemUpgrade({ version: '9.2' }),
- mockSystemUpgrade({ version: '9.1.1' })
+ mockSystemUpgrade({ version: '9.1.1' }),
],
- latestLTS: '8.9'
+ latestLTS: '8.9',
});
const wrapper = shallowRender({
appState: mockAppState({ version: '8.8' }),
- currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } })
+ currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Admin] } }),
});
await waitAndUpdate(wrapper);
expect(wrapper.find(DismissableAlert).type).toBeDefined();
diff --git a/server/sonar-web/src/main/js/app/index.ts b/server/sonar-web/src/main/js/app/index.ts
index 02c1cb1ffa0..de93d485559 100644
--- a/server/sonar-web/src/main/js/app/index.ts
+++ b/server/sonar-web/src/main/js/app/index.ts
@@ -34,14 +34,14 @@ async function initApplication() {
loadL10nBundle(),
isMainApp() ? getCurrentUser() : undefined,
isMainApp() ? getGlobalNavigation() : undefined,
- isMainApp() ? getAvailableFeatures() : undefined
- ]).catch(error => {
+ isMainApp() ? getAvailableFeatures() : undefined,
+ ]).catch((error) => {
// eslint-disable-next-line no-console
console.error('Application failed to start', error);
throw error;
});
- const startReactApp = await import('./utils/startReactApp').then(i => i.default);
+ const startReactApp = await import('./utils/startReactApp').then((i) => i.default);
startReactApp(l10nBundle.locale, currentUser, appState, availableFeatures);
}
diff --git a/server/sonar-web/src/main/js/app/theme.js b/server/sonar-web/src/main/js/app/theme.js
index 79428ee7c58..f84b78a6ebd 100644
--- a/server/sonar-web/src/main/js/app/theme.js
+++ b/server/sonar-web/src/main/js/app/theme.js
@@ -186,7 +186,7 @@ module.exports = {
blacka38: 'rgba(0, 0, 0, 0.38)',
blacka60: 'rgba(0, 0, 0, 0.60)',
blacka75: 'rgba(0, 0, 0, 0.75)',
- blacka87: 'rgba(0, 0, 0, 0.87)'
+ blacka87: 'rgba(0, 0, 0, 0.87)',
},
sizes: {
@@ -212,7 +212,7 @@ module.exports = {
maxPageWidth: '1320px',
minPageWidth: '1080px',
- pagePadding: '20px'
+ pagePadding: '20px',
},
rawSizes: {
@@ -220,13 +220,13 @@ module.exports = {
baseFontSizeRaw,
globalNavHeightRaw: 6 * grid,
globalNavContentHeightRaw: 4 * grid,
- contextNavHeightRaw: 9 * grid
+ contextNavHeightRaw: 9 * grid,
},
fonts: {
baseFontFamily: "'Helvetica Neue', Helvetica, Arial, sans-serif",
systemFontFamily: "-apple-system,'BlinkMacSystemFont','Helvetica','Arial',sans-serif",
- sourceCodeFontFamily: "Consolas, 'Ubuntu Mono', 'Liberation Mono', Menlo, Courier, monospace"
+ sourceCodeFontFamily: "Consolas, 'Ubuntu Mono', 'Liberation Mono', Menlo, Courier, monospace",
},
// z-index
@@ -259,10 +259,10 @@ module.exports = {
modalZIndex: '6001',
modalOverlayZIndex: '6000',
- popupZIndex: '5000'
+ popupZIndex: '5000',
},
others: {
- defaultShadow: '0 6px 12px rgba(0, 0, 0, 0.175)'
- }
+ defaultShadow: '0 6px 12px rgba(0, 0, 0, 0.175)',
+ },
};
diff --git a/server/sonar-web/src/main/js/app/utils/NavigateWithParams.tsx b/server/sonar-web/src/main/js/app/utils/NavigateWithParams.tsx
index 6550da209a3..e3a402b592c 100644
--- a/server/sonar-web/src/main/js/app/utils/NavigateWithParams.tsx
+++ b/server/sonar-web/src/main/js/app/utils/NavigateWithParams.tsx
@@ -33,7 +33,7 @@ export default function NavigateWithParams({ pathname, transformParams }: Naviga
/* Append transformed path params to search params */
const transformedParams = transformParams(urlParams);
- Object.keys(transformedParams).forEach(key => {
+ Object.keys(transformedParams).forEach((key) => {
searchParams.append(key, transformedParams[key]);
});
diff --git a/server/sonar-web/src/main/js/app/utils/__tests__/handleRequiredAuthorization-test.ts b/server/sonar-web/src/main/js/app/utils/__tests__/handleRequiredAuthorization-test.ts
index 46d46be6202..6a54e4ec64c 100644
--- a/server/sonar-web/src/main/js/app/utils/__tests__/handleRequiredAuthorization-test.ts
+++ b/server/sonar-web/src/main/js/app/utils/__tests__/handleRequiredAuthorization-test.ts
@@ -30,18 +30,18 @@ beforeAll(() => {
pathname: '/path',
search: '?id=12',
hash: '#tag',
- replace
+ replace,
};
Object.defineProperty(window, 'location', {
writable: true,
- value: location
+ value: location,
});
});
afterAll(() => {
Object.defineProperty(window, 'location', {
writable: true,
- value: originalLocation
+ value: originalLocation,
});
});
diff --git a/server/sonar-web/src/main/js/app/utils/exportModulesAsGlobals.ts b/server/sonar-web/src/main/js/app/utils/exportModulesAsGlobals.ts
index df3a3308f43..7ed61d72348 100644
--- a/server/sonar-web/src/main/js/app/utils/exportModulesAsGlobals.ts
+++ b/server/sonar-web/src/main/js/app/utils/exportModulesAsGlobals.ts
@@ -32,7 +32,7 @@ import * as ReactRouterDom from 'react-router-dom';
* Expose dependencies to extensions
*/
export default function exportModulesAsGlobals() {
- const w = (window as unknown) as any;
+ const w = window as unknown as any;
w.EmotionReact = EmotionReact;
w.EmotionStyled = EmotionStyled;
w.DateFns = DateFns;
diff --git a/server/sonar-web/src/main/js/app/utils/isValidUri.ts b/server/sonar-web/src/main/js/app/utils/isValidUri.ts
index 1880ebd45e2..0c2d35d39b6 100644
--- a/server/sonar-web/src/main/js/app/utils/isValidUri.ts
+++ b/server/sonar-web/src/main/js/app/utils/isValidUri.ts
@@ -19,6 +19,6 @@
*/
import { isWebUri } from 'valid-url';
-export default function(url: string): boolean {
+export default function (url: string): boolean {
return /^(\/|scm:)/.test(url) || !!isWebUri(url);
}
diff --git a/server/sonar-web/src/main/js/app/utils/startReactApp.tsx b/server/sonar-web/src/main/js/app/utils/startReactApp.tsx
index 44f1ac28530..ae74f0c467d 100644
--- a/server/sonar-web/src/main/js/app/utils/startReactApp.tsx
+++ b/server/sonar-web/src/main/js/app/utils/startReactApp.tsx
@@ -68,7 +68,7 @@ import { DEFAULT_APP_STATE } from '../components/app-state/AppStateContext';
import AppStateContextProvider from '../components/app-state/AppStateContextProvider';
import {
AvailableFeaturesContext,
- DEFAULT_AVAILABLE_FEATURES
+ DEFAULT_AVAILABLE_FEATURES,
} from '../components/available-features/AvailableFeaturesContext';
import ComponentContainer from '../components/ComponentContainer';
import CurrentUserContextProvider from '../components/current-user/CurrentUserContextProvider';
@@ -119,7 +119,7 @@ function renderRedirects() {
element={
<NavigateWithParams
pathname="/dashboard"
- transformParams={params => omitNil({ id: params['key'] })}
+ transformParams={(params) => omitNil({ id: params['key'] })}
/>
}
/>
diff --git a/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx b/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx
index 77336f98400..e5b10e019ea 100644
--- a/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx
+++ b/server/sonar-web/src/main/js/apps/account/__tests__/Account-it.tsx
@@ -38,13 +38,13 @@ jest.mock('../../../api/notifications');
jest.mock('../../../helpers/preferences', () => ({
getKeyboardShortcutEnabled: jest.fn().mockResolvedValue(true),
- setKeyboardShortcutEnabled: jest.fn()
+ setKeyboardShortcutEnabled: jest.fn(),
}));
jest.mock('../../../helpers/dates', () => {
return {
...jest.requireActual('../../../helpers/dates'),
- now: jest.fn(() => new Date('2022-06-01T12:00:00Z'))
+ now: jest.fn(() => new Date('2022-06-01T12:00:00Z')),
};
});
@@ -55,9 +55,9 @@ jest.mock('../../../api/settings', () => {
getAllValues: jest.fn().mockResolvedValue([
{
key: SettingsKey.TokenMaxAllowedLifetime,
- value: 'No expiration'
- }
- ])
+ value: 'No expiration',
+ },
+ ]),
};
});
@@ -71,35 +71,35 @@ jest.mock('../../../api/components', () => ({
links: [
{
type: 'homepage',
- href: 'http://www.sonarsource.com/proj1'
+ href: 'http://www.sonarsource.com/proj1',
},
{
type: 'issue',
- href: 'http://jira.sonarsource.com/'
+ href: 'http://jira.sonarsource.com/',
},
{
type: 'scm',
- href: 'https://github.com/SonarSource/project1'
+ href: 'https://github.com/SonarSource/project1',
},
{
type: 'ci',
- href: 'https://travis.com/project1'
+ href: 'https://travis.com/project1',
},
{
type: 'other',
- href: 'https://apidocs.project1.net'
- }
+ href: 'https://apidocs.project1.net',
+ },
],
description: 'project description',
lastAnalysisDate: '2019-01-04T09:51:48+0000',
- qualityGate: 'OK'
+ qualityGate: 'OK',
},
{
key: 'proj2',
name: 'Project 2',
- links: []
- }
- ]
+ links: [],
+ },
+ ],
}),
getSuggestions: jest.fn().mockResolvedValue({
results: [
@@ -112,7 +112,7 @@ jest.mock('../../../api/components', () => ({
key: 'sonarqube',
match: 'SonarQube',
name: 'SonarQube',
- project: ''
+ project: '',
},
{
isFavorite: false,
@@ -120,24 +120,24 @@ jest.mock('../../../api/components', () => ({
key: 'sonarcloud',
match: 'Sonarcloud',
name: 'Sonarcloud',
- project: ''
- }
- ]
- }
- ]
+ project: '',
+ },
+ ],
+ },
+ ],
}),
getScannableProjects: jest.fn().mockResolvedValue({
projects: [
{
key: 'project-key-1',
- name: 'Project Name 1'
+ name: 'Project Name 1',
},
{
key: 'project-key-2',
- name: 'Project Name 2'
- }
- ]
- })
+ name: 'Project Name 2',
+ },
+ ],
+ }),
}));
jest.mock('../../../api/users', () => ({
@@ -147,21 +147,21 @@ jest.mock('../../../api/users', () => ({
key: 'github',
name: 'GitHub',
iconPath: '/images/alm/github-white.svg',
- backgroundColor: '#444444'
- }
- ]
+ backgroundColor: '#444444',
+ },
+ ],
}),
- changePassword: jest.fn().mockResolvedValue(true)
+ changePassword: jest.fn().mockResolvedValue(true),
}));
it('should handle a currentUser not logged in', () => {
const replace = jest.fn();
- const locationMock = jest.spyOn(window, 'location', 'get').mockReturnValue(({
+ const locationMock = jest.spyOn(window, 'location', 'get').mockReturnValue({
pathname: '/account',
search: '',
hash: '',
- replace
- } as unknown) as Location);
+ replace,
+ } as unknown as Location);
renderAccountApp(mockCurrentUser());
@@ -188,7 +188,7 @@ describe('profile page', () => {
const loggedInUser = mockLoggedInUser({
email: 'email@company.com',
groups: ['group1'],
- scmAccounts: ['account1']
+ scmAccounts: ['account1'],
});
renderAccountApp(loggedInUser);
@@ -211,7 +211,7 @@ describe('profile page', () => {
it('should handle known external Providers', async () => {
const loggedInUser = mockLoggedInUser({
externalProvider: 'github',
- externalIdentity: 'gh_id'
+ externalIdentity: 'gh_id',
});
renderAccountApp(loggedInUser);
@@ -221,7 +221,7 @@ describe('profile page', () => {
it('should handle unknown external Providers', async () => {
const loggedInUser = mockLoggedInUser({
externalProvider: 'swag',
- externalIdentity: 'king_of_swag'
+ externalIdentity: 'king_of_swag',
});
renderAccountApp(loggedInUser);
@@ -235,7 +235,7 @@ describe('profile page', () => {
renderAccountApp(mockLoggedInUser());
const toggle = screen.getByRole('button', {
- name: 'my_account.preferences.keyboard_shortcuts.enabled'
+ name: 'my_account.preferences.keyboard_shortcuts.enabled',
});
expect(toggle).toBeInTheDocument();
@@ -261,7 +261,7 @@ describe('security page', () => {
it.each([
['user', TokenType.User],
['global', TokenType.Global],
- ['project analysis', TokenType.Project]
+ ['project analysis', TokenType.Project],
])(
'should allow %s token creation/revocation and display existing tokens',
async (_, tokenTypeOption) => {
@@ -325,7 +325,7 @@ describe('security page', () => {
expect(screen.getAllByRole('row')).toHaveLength(4); // 3 tokens + header
const row = screen.getByRole('row', {
- name: new RegExp(`^${newTokenName}`)
+ name: new RegExp(`^${newTokenName}`),
});
expect(await within(row).findByText(tokenTypeShortLabel)).toBeInTheDocument();
@@ -337,7 +337,7 @@ describe('security page', () => {
// Revoke the token
const revokeButtons = within(row).getByRole('button', {
- name: 'users.tokens.revoke_token'
+ name: 'users.tokens.revoke_token',
});
await user.click(revokeButtons);
@@ -356,7 +356,7 @@ describe('security page', () => {
mockUserToken({
name: 'expired token',
isExpired: true,
- expirationDate: '2021-01-23T19:25:19+0000'
+ expirationDate: '2021-01-23T19:25:19+0000',
})
);
@@ -380,7 +380,7 @@ describe('security page', () => {
it("should not suggest creating a Project token if the user doesn't have at least one scannable Projects", () => {
(getScannableProjects as jest.Mock).mockResolvedValueOnce({
- projects: []
+ projects: [],
});
renderAccountApp(
mockLoggedInUser({ permissions: { global: [Permissions.Scan] } }),
@@ -393,7 +393,7 @@ describe('security page', () => {
it('should preselect the user token type if the user has no scan rights', async () => {
(getScannableProjects as jest.Mock).mockResolvedValueOnce({
- projects: []
+ projects: [],
});
renderAccountApp(mockLoggedInUser(), securityPagePath);
@@ -406,9 +406,9 @@ describe('security page', () => {
projects: [
{
key: 'project-key-1',
- name: 'Project Name 1'
- }
- ]
+ name: 'Project Name 1',
+ },
+ ],
});
renderAccountApp(
mockLoggedInUser({ permissions: { global: [Permissions.Scan] } }),
@@ -416,7 +416,7 @@ describe('security page', () => {
);
await selectEvent.select(screen.getAllByRole('textbox')[1], [
- `users.tokens.${TokenType.Project}`
+ `users.tokens.${TokenType.Project}`,
]);
expect(screen.getByText('Project Name 1')).toBeInTheDocument();
@@ -432,16 +432,16 @@ describe('security page', () => {
const oldPasswordField = screen.getByLabelText('my_profile.password.old', {
selector: 'input',
- exact: false
+ exact: false,
});
const newPasswordField = screen.getByLabelText('my_profile.password.new', {
selector: 'input',
- exact: false
+ exact: false,
});
const confirmPasswordField = screen.getByLabelText('my_profile.password.confirm', {
selector: 'input',
- exact: false
+ exact: false,
});
await fillTextField(user, oldPasswordField, '123456old');
@@ -493,11 +493,11 @@ describe('notifications page', () => {
// first row is the header: skip it!
const otherRows = screen
.getAllByRole('row', {
- name: (n: string) => n !== 'notification.dispatcher.ChangesOnMyIssue'
+ name: (n: string) => n !== 'notification.dispatcher.ChangesOnMyIssue',
})
.slice(1);
- otherRows.forEach(row => {
+ otherRows.forEach((row) => {
expect(within(row).getByRole('checkbox')).not.toBeChecked();
});
@@ -602,7 +602,7 @@ describe('projects page', () => {
it('should handle no projects', async () => {
(getMyProjects as jest.Mock).mockResolvedValueOnce({
paging: { total: 0, pageIndex: 1, pageSize: 10 },
- projects: []
+ projects: [],
});
renderAccountApp(mockLoggedInUser(), projectsPagePath);
@@ -619,9 +619,9 @@ describe('projects page', () => {
{
key: 'proj1',
name: 'Project 1',
- links: []
- }
- ]
+ links: [],
+ },
+ ],
})
.mockResolvedValueOnce({
paging: { total: 2, pageIndex: 2, pageSize: 1 },
@@ -629,9 +629,9 @@ describe('projects page', () => {
{
key: 'proj2',
name: 'Project 2',
- links: []
- }
- ]
+ links: [],
+ },
+ ],
});
renderAccountApp(mockLoggedInUser(), projectsPagePath);
@@ -656,7 +656,7 @@ async function fillTextField(user: UserEvent, field: HTMLElement, value: string)
function getProjectBlock(projectName: string) {
const result = screen
.getAllByRole('listitem')
- .find(element => within(element).queryByRole('heading', { name: projectName }) !== null);
+ .find((element) => within(element).queryByRole('heading', { name: projectName }) !== null);
if (!result) {
// eslint-disable-next-line testing-library/no-debugging-utils
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx b/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx
index f5e1a228160..44dbc35be40 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/GlobalNotifications.tsx
@@ -40,7 +40,7 @@ export default function GlobalNotifications(props: Props) {
<thead>
<tr>
<th />
- {props.channels.map(channel => (
+ {props.channels.map((channel) => (
<th className="text-center" key={channel}>
<h4>{translate('notification.channel', channel)}</h4>
</th>
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx b/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx
index 348bbdc114b..140ec4f687f 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/Notifications.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import {
withNotifications,
- WithNotificationsProps
+ WithNotificationsProps,
} from '../../../components/hoc/withNotifications';
import { Alert } from '../../../components/ui/Alert';
import DeferredSpinner from '../../../components/ui/DeferredSpinner';
@@ -38,10 +38,10 @@ export function Notifications(props: WithNotificationsProps) {
loading,
notifications,
perProjectTypes,
- removeNotification
+ removeNotification,
} = props;
- const [globalNotifications, projectNotifications] = partition(notifications, n => !n.project);
+ const [globalNotifications, projectNotifications] = partition(notifications, (n) => !n.project);
return (
<div className="account-body account-container">
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx b/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx
index 4b1e5815514..4724837223f 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/NotificationsList.tsx
@@ -35,7 +35,7 @@ interface Props {
export default class NotificationsList extends React.PureComponent<Props> {
isEnabled(type: string, channel: string) {
return !!this.props.notifications.find(
- notification => notification.type === type && notification.channel === channel
+ (notification) => notification.type === type && notification.channel === channel
);
}
@@ -61,15 +61,15 @@ export default class NotificationsList extends React.PureComponent<Props> {
return (
<tbody>
- {types.map(type => (
+ {types.map((type) => (
<tr key={type}>
<td>{this.getDispatcherLabel(type)}</td>
- {channels.map(channel => (
+ {channels.map((channel) => (
<td className="text-center" key={channel}>
<Checkbox
checked={this.isEnabled(type, channel)}
id={checkboxId(type, channel)}
- onCheck={checked => this.handleCheck(type, channel, checked)}
+ onCheck={(checked) => this.handleCheck(type, channel, checked)}
/>
</td>
))}
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/ProjectModal.tsx b/server/sonar-web/src/main/js/apps/account/notifications/ProjectModal.tsx
index 98a57c6e893..ef595b9cee5 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/ProjectModal.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/ProjectModal.tsx
@@ -82,7 +82,7 @@ export default class ProjectModal extends React.PureComponent<Props, State> {
getCurrentIndex = () => {
const { highlighted, suggestions } = this.state;
return highlighted && suggestions
- ? suggestions.findIndex(suggestion => suggestion.project === highlighted.project)
+ ? suggestions.findIndex((suggestion) => suggestion.project === highlighted.project)
: -1;
};
@@ -95,7 +95,7 @@ export default class ProjectModal extends React.PureComponent<Props, State> {
index = 0;
}
this.setState({
- highlighted: suggestions[index]
+ highlighted: suggestions[index],
});
}
};
@@ -129,16 +129,16 @@ export default class ProjectModal extends React.PureComponent<Props, State> {
this.setState({ loading: true, query });
return getSuggestions(query).then(
- r => {
+ (r) => {
if (this.mounted) {
let suggestions = undefined;
- const projects = r.results.find(domain => domain.q === 'TRK');
+ const projects = r.results.find((domain) => domain.q === 'TRK');
if (projects && projects.items.length > 0) {
suggestions = projects.items
- .filter(item => !addedProjects.find(p => p.project === item.key))
- .map(item => ({
+ .filter((item) => !addedProjects.find((p) => p.project === item.key))
+ .map((item) => ({
project: item.key,
- projectName: item.name
+ projectName: item.name,
}));
}
this.setState({ loading: false, open: true, suggestions });
@@ -156,7 +156,7 @@ export default class ProjectModal extends React.PureComponent<Props, State> {
this.setState({
open: false,
query: selectedProject.projectName,
- selectedProject
+ selectedProject,
});
};
@@ -196,13 +196,14 @@ export default class ProjectModal extends React.PureComponent<Props, State> {
<DropdownOverlay className="abs-width-400" noPadding={true}>
{suggestions && suggestions.length > 0 ? (
<ul className="notifications-add-project-search-results">
- {suggestions.map(suggestion => (
+ {suggestions.map((suggestion) => (
<li
className={classNames({
- active: highlighted && highlighted.project === suggestion.project
+ active: highlighted && highlighted.project === suggestion.project,
})}
key={suggestion.project}
- onClick={() => this.handleSelect(suggestion)}>
+ onClick={() => this.handleSelect(suggestion)}
+ >
{suggestion.projectName}
</li>
))}
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx b/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx
index a1c31104d19..f97ac66cf14 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/ProjectNotifications.tsx
@@ -49,7 +49,7 @@ export default function ProjectNotifications(props: Props) {
props.removeNotification({
...props.project,
channel,
- type
+ type,
});
};
@@ -59,12 +59,13 @@ export default function ProjectNotifications(props: Props) {
<BoxedGroupAccordion
onClick={toggleExpanded}
open={!isCollapsed}
- title={<h4 className="display-inline-block">{project.projectName}</h4>}>
+ title={<h4 className="display-inline-block">{project.projectName}</h4>}
+ >
<table className="data zebra notifications-table" key={project.project}>
<thead>
<tr>
<th aria-label={translate('project')} />
- {channels.map(channel => (
+ {channels.map((channel) => (
<th className="text-center" key={channel}>
<h4>{translate('notification.channel', channel)}</h4>
</th>
diff --git a/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx b/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx
index 8e76d5f3a06..c8b4218b86f 100644
--- a/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx
+++ b/server/sonar-web/src/main/js/apps/account/notifications/Projects.tsx
@@ -53,7 +53,7 @@ export default class Projects extends React.PureComponent<Props, State> {
state: State = {
addedProjects: [],
search: '',
- showModal: false
+ showModal: false,
};
filterSearch = (project: NotificationProject, search: string) => {
@@ -61,9 +61,9 @@ export default class Projects extends React.PureComponent<Props, State> {
};
handleAddProject = (project: NotificationProject) => {
- this.setState(state => {
+ this.setState((state) => {
return {
- addedProjects: [...state.addedProjects, project]
+ addedProjects: [...state.addedProjects, project],
};
});
};
@@ -89,7 +89,7 @@ export default class Projects extends React.PureComponent<Props, State> {
};
removeNotification = (removed: Notification, allProjects: NotificationProject[]) => {
- const projectToRemove = allProjects.find(p => p.project === removed.project);
+ const projectToRemove = allProjects.find((p) => p.project === removed.project);
if (projectToRemove) {
this.handleAddProject(projectToRemove);
}
@@ -104,9 +104,9 @@ export default class Projects extends React.PureComponent<Props, State> {
const projects = uniqBy(notifications, ({ project }) => project).filter(
isNotificationProject
) as NotificationProject[];
- const notificationsByProject = groupBy(notifications, n => n.project);
- const allProjects = uniqBy([...addedProjects, ...projects], project => project.project);
- const filteredProjects = sortBy(allProjects, 'projectName').filter(p =>
+ const notificationsByProject = groupBy(notifications, (n) => n.project);
+ const allProjects = uniqBy([...addedProjects, ...projects], (project) => project.project);
+ const filteredProjects = sortBy(allProjects, 'projectName').filter((p) =>
this.filterSearch(p, search)
);
const shouldBeCollapsed = Object.keys(notificationsByProject).length > THRESHOLD_COLLAPSED;
@@ -147,8 +147,8 @@ export default class Projects extends React.PureComponent<Props, State> {
</div>
)}
- {filteredProjects.map(project => {
- const collapsed = addedProjects.find(p => p.project === project.project)
+ {filteredProjects.map((project) => {
+ const collapsed = addedProjects.find((p) => p.project === project.project)
? false
: shouldBeCollapsed;
return (
@@ -159,7 +159,7 @@ export default class Projects extends React.PureComponent<Props, State> {
key={project.project}
notifications={notificationsByProject[project.project] || []}
project={project}
- removeNotification={n => this.removeNotification(n, allProjects)}
+ removeNotification={(n) => this.removeNotification(n, allProjects)}
types={this.props.types}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/account/profile/Preferences.tsx b/server/sonar-web/src/main/js/apps/account/profile/Preferences.tsx
index 694beea4c39..1572941c1cb 100644
--- a/server/sonar-web/src/main/js/apps/account/profile/Preferences.tsx
+++ b/server/sonar-web/src/main/js/apps/account/profile/Preferences.tsx
@@ -23,7 +23,7 @@ import Toggle from '../../../components/controls/Toggle';
import { translate } from '../../../helpers/l10n';
import {
getKeyboardShortcutEnabled,
- setKeyboardShortcutEnabled
+ setKeyboardShortcutEnabled,
} from '../../../helpers/preferences';
export function Preferences() {
@@ -60,7 +60,7 @@ export function Preferences() {
<span className="markdown">
<code>?</code>
</span>
- )
+ ),
}}
/>
</div>
diff --git a/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx b/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx
index 3ce6a0460e1..cecf44811b6 100644
--- a/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx
+++ b/server/sonar-web/src/main/js/apps/account/profile/Profile.tsx
@@ -86,7 +86,7 @@ export function Profile({ currentUser }: ProfileProps) {
<div className="boxed-group-inner">
<h2 className="spacer-bottom">{translate('my_profile.groups')}</h2>
<ul id="groups">
- {currentUser.groups.map(group => (
+ {currentUser.groups.map((group) => (
<li className="little-spacer-bottom" key={group} title={group}>
{group}
</li>
@@ -129,7 +129,7 @@ export function Profile({ currentUser }: ProfileProps) {
{currentUser.scmAccounts &&
currentUser.scmAccounts.length > 0 &&
- currentUser.scmAccounts.map(scmAccount => (
+ currentUser.scmAccounts.map((scmAccount) => (
<li className="little-spacer-bottom" key={scmAccount} title={scmAccount}>
{scmAccount}
</li>
diff --git a/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx b/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx
index c97fb3e6adb..87c2d9e83bc 100644
--- a/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx
+++ b/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.tsx
@@ -40,7 +40,7 @@ export default class UserExternalIdentity extends React.PureComponent<
> {
mounted = false;
state: State = {
- loading: true
+ loading: true,
};
componentDidMount() {
@@ -61,11 +61,11 @@ export default class UserExternalIdentity extends React.PureComponent<
fetchIdentityProviders() {
this.setState({ loading: true });
getIdentityProviders()
- .then(r => r.identityProviders)
- .then(providers => {
+ .then((r) => r.identityProviders)
+ .then((providers) => {
if (this.mounted) {
const identityProvider = providers.find(
- provider => provider.key === this.props.user.externalProvider
+ (provider) => provider.key === this.props.user.externalProvider
);
this.setState({ loading: false, identityProvider });
}
@@ -100,8 +100,9 @@ export default class UserExternalIdentity extends React.PureComponent<
className="identity-provider"
style={{
backgroundColor: identityProvider.backgroundColor,
- color: getTextColor(identityProvider.backgroundColor, colors.secondFontColor)
- }}>
+ color: getTextColor(identityProvider.backgroundColor, colors.secondFontColor),
+ }}
+ >
<img
alt={identityProvider.name}
className="little-spacer-right"
diff --git a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
index 1a80ff210ed..b1b31f1db4d 100644
--- a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
+++ b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
@@ -42,7 +42,7 @@ export default function ProjectCard({ project }: Props) {
id: `link-${i}`,
name,
type,
- url: href
+ url: href,
};
})
);
@@ -55,7 +55,7 @@ export default function ProjectCard({ project }: Props) {
{lastAnalysisDate !== undefined ? (
<div className="account-project-analysis">
<DateFromNow date={lastAnalysisDate}>
- {fromNow => translateWithParameters('my_account.projects.analyzed_x', fromNow)}
+ {(fromNow) => translateWithParameters('my_account.projects.analyzed_x', fromNow)}
</DateFromNow>
</div>
) : (
@@ -84,7 +84,7 @@ export default function ProjectCard({ project }: Props) {
{orderedLinks.length > 0 && (
<div className="account-project-links">
<ul className="list-inline">
- {orderedLinks.map(link => (
+ {orderedLinks.map((link) => (
<MetaLink iconOnly={true} key={link.id} link={link} />
))}
</ul>
diff --git a/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx b/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx
index d702b8140e7..26ebee8af7e 100644
--- a/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx
+++ b/server/sonar-web/src/main/js/apps/account/projects/Projects.tsx
@@ -43,7 +43,7 @@ export default function Projects(props: Props) {
{projects.length > 0 && (
<ul className="account-projects-list">
- {projects.map(project => (
+ {projects.map((project) => (
<li key={project.key}>
<ProjectCard project={project} />
</li>
diff --git a/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx b/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx
index d67265e6abb..417d30bd677 100644
--- a/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/account/projects/ProjectsContainer.tsx
@@ -48,11 +48,11 @@ export default class ProjectsContainer extends React.PureComponent<{}, State> {
this.setState({ loading: true });
const data = { p: page, ps: 100 };
return getMyProjects(data).then(({ paging, projects }) => {
- this.setState(state => ({
+ this.setState((state) => ({
projects: page > 1 ? [...(state.projects || []), ...projects] : projects,
loading: false,
page: paging.pageIndex,
- total: paging.total
+ total: paging.total,
}));
});
}
diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx
index 7cce3ac91ed..bda03c0d5ce 100644
--- a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx
+++ b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx
@@ -45,7 +45,7 @@ export class AuditApp extends React.PureComponent<Props, State> {
this.state = {
downloadStarted: false,
housekeepingPolicy: HousekeepingPolicy.Monthly,
- selection: RangeOption.Today
+ selection: RangeOption.Today,
};
}
@@ -60,13 +60,13 @@ export class AuditApp extends React.PureComponent<Props, State> {
this.setState({
housekeepingPolicy:
- (result?.value as HousekeepingPolicy | undefined) ?? HousekeepingPolicy.Monthly
+ (result?.value as HousekeepingPolicy | undefined) ?? HousekeepingPolicy.Monthly,
});
};
hasGovernanceExtension = () => {
return Boolean(
- this.props.adminPages?.find(e => e.key === AdminPageExtension.GovernanceConsole)
+ this.props.adminPages?.find((e) => e.key === AdminPageExtension.GovernanceConsole)
);
};
diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx
index d191cc46fb3..caeed7a6f8b 100644
--- a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx
@@ -49,7 +49,7 @@ const HOUSEKEEPING_POLICY_VALUES = {
[HousekeepingPolicy.Weekly]: 7,
[HousekeepingPolicy.Monthly]: 30,
[HousekeepingPolicy.Trimestrial]: 90,
- [HousekeepingPolicy.Yearly]: 365
+ [HousekeepingPolicy.Yearly]: 365,
};
const getRangeOptions = (housekeepingPolicy: HousekeepingPolicy) => {
@@ -93,11 +93,12 @@ export default function AuditAppRenderer(props: AuditAppRendererProps) {
to={{
pathname: '/admin/settings',
search: queryToSearch({ category: 'housekeeping' }),
- hash: '#auditLogs'
- }}>
+ hash: '#auditLogs',
+ }}
+ >
{translate('audit_logs.page.description.link')}
</Link>
- )
+ ),
}}
/>
</p>
@@ -106,12 +107,13 @@ export default function AuditAppRenderer(props: AuditAppRendererProps) {
<h2 className="big-spacer-bottom">{translate('audit_logs.download')}</h2>
<ul>
- {getRangeOptions(housekeepingPolicy).map(option => (
+ {getRangeOptions(housekeepingPolicy).map((option) => (
<li key={option} className="spacer-bottom">
<Radio
checked={selection === option}
onCheck={props.handleOptionSelection}
- value={option}>
+ value={option}
+ >
{translate('audit_logs.range_option', option)}
</Radio>
</li>
diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx
index ae80edbfffa..d31623b4729 100644
--- a/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx
+++ b/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx
@@ -37,7 +37,7 @@ const RANGE_OPTION_START = {
[RangeOption.Today]: () => now(),
[RangeOption.Week]: () => subDays(now(), 7),
[RangeOption.Month]: () => subDays(now(), 30),
- [RangeOption.Trimester]: () => subDays(now(), 90)
+ [RangeOption.Trimester]: () => subDays(now(), 90),
};
const toISODateString = (date: Date) => date.toISOString();
@@ -53,13 +53,13 @@ function getRangeParams(selection: RangeOption, dateRange?: { from?: Date; to?:
return new URLSearchParams({
from: toISODateString(startOfDay(dateRange.from)),
- to: toISODateString(endOfDay(dateRange.to))
+ to: toISODateString(endOfDay(dateRange.to)),
}).toString();
}
return new URLSearchParams({
from: toISODateString(startOfDay(RANGE_OPTION_START[selection]())),
- to: toISODateString(now())
+ to: toISODateString(now()),
}).toString();
}
@@ -84,7 +84,8 @@ export default function DownloadButton(props: DownloadButtonProps) {
onClick={downloadDisabled ? undefined : props.onStartDownload}
href={downloadUrl}
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate('download_verb')}
</a>
diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx
index 1130413e4d6..a98d3f2933c 100644
--- a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx
+++ b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-it.tsx
@@ -36,7 +36,7 @@ jest.mock('../../../../api/settings');
const extensions = [
{ key: AdminPageExtension.GovernanceConsole, name: 'Portfolios' },
{ key: 'license/app', name: 'License Manager' },
- { key: 'license/support', name: 'Support' }
+ { key: 'license/support', name: 'Support' },
];
jest.mock('date-fns', () => {
@@ -44,15 +44,15 @@ jest.mock('date-fns', () => {
const dateFns = jest.requireActual('date-fns');
return {
...dateFns,
- endOfDay: jest.fn().mockImplementation(d => d),
- startOfDay: jest.fn().mockImplementation(d => d)
+ endOfDay: jest.fn().mockImplementation((d) => d),
+ startOfDay: jest.fn().mockImplementation((d) => d),
};
});
jest.mock('../../../../helpers/dates', () => {
return {
...jest.requireActual('../../../../helpers/dates'),
- now: jest.fn(() => new Date('2020-07-21T12:00:00Z'))
+ now: jest.fn(() => new Date('2020-07-21T12:00:00Z')),
};
});
@@ -66,7 +66,7 @@ const ui = {
customRadio: byRole('radio', { name: 'audit_logs.range_option.custom' }),
downloadSentenceStart: byText('audit_logs.download_start.sentence.1'),
startDateInput: byPlaceholderText('start_date'),
- endDateInput: byPlaceholderText('end_date')
+ endDateInput: byPlaceholderText('end_date'),
};
let handler: SettingsServiceMock;
@@ -116,19 +116,19 @@ it('should handle download button click', async () => {
await user.click(ui.startDateInput.get());
await selectEvent.select(screen.getByRole('textbox', { name: 'select_month' }), [
- getShortMonthName(getMonth(startDay))
+ getShortMonthName(getMonth(startDay)),
]);
await selectEvent.select(screen.getByRole('textbox', { name: 'select_year' }), [
- getYear(startDay)
+ getYear(startDay),
]);
await user.click(screen.getByText(getDate(startDay)));
await user.click(ui.endDateInput.get());
await selectEvent.select(screen.getByRole('textbox', { name: 'select_month' }), [
- getShortMonthName(getMonth(endDate))
+ getShortMonthName(getMonth(endDate)),
]);
await selectEvent.select(screen.getByRole('textbox', { name: 'select_year' }), [
- getYear(endDate)
+ getYear(endDate),
]);
await user.click(screen.getByText(getDate(endDate)));
diff --git a/server/sonar-web/src/main/js/apps/audit-logs/utils.ts b/server/sonar-web/src/main/js/apps/audit-logs/utils.ts
index b59b65ff7ec..28e64eabdbc 100644
--- a/server/sonar-web/src/main/js/apps/audit-logs/utils.ts
+++ b/server/sonar-web/src/main/js/apps/audit-logs/utils.ts
@@ -21,7 +21,7 @@ export enum HousekeepingPolicy {
Weekly = 'Weekly',
Monthly = 'Monthly',
Trimestrial = 'Trimestrial',
- Yearly = 'Yearly'
+ Yearly = 'Yearly',
}
export enum RangeOption {
@@ -29,5 +29,5 @@ export enum RangeOption {
Week = '7days',
Month = '30days',
Trimester = '90days',
- Custom = 'custom'
+ Custom = 'custom',
}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx
index 40a58d65802..d17e204a9a0 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-it.tsx
@@ -59,7 +59,7 @@ describe('The Global background task page', () => {
await user.click(
within(modal).getByLabelText('background_tasks.change_number_of_workers', {
- selector: 'input'
+ selector: 'input',
})
);
@@ -83,13 +83,13 @@ describe('The Global background task page', () => {
submittedAt: '2022-02-03T11:45:35+0200',
executionTimeMs: 167,
status: TaskStatuses.InProgress,
- type: TaskTypes.IssueSync
+ type: TaskTypes.IssueSync,
});
computeEngineServiceMock.addTask({ status: TaskStatuses.Pending, type: TaskTypes.IssueSync });
computeEngineServiceMock.addTask({
componentKey: 'otherComponent',
status: TaskStatuses.Success,
- type: TaskTypes.AppRefresh
+ type: TaskTypes.AppRefresh,
});
renderGlobalBackgroundTasksApp();
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-test.tsx
index 2fe746e08b0..3a0cf783c2d 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/BackgroundTasks-test.tsx
@@ -32,7 +32,7 @@ describe('Search', () => {
onFilterUpdate: () => true,
onReload: () => true,
maxExecutedAt: undefined,
- minSubmittedAt: undefined
+ minSubmittedAt: undefined,
};
it('should render search form', () => {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx
index 20086c31740..c4d5ffac300 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx
@@ -25,7 +25,7 @@ import {
cancelTask as cancelTaskAPI,
getActivity,
getStatus,
- getTypes
+ getTypes,
} from '../../../api/ce';
import withComponentContext from '../../../app/components/componentContext/withComponentContext';
import ListFooter from '../../../components/controls/ListFooter';
@@ -73,7 +73,7 @@ export class BackgroundTasksApp extends React.PureComponent<Props, State> {
failingCount: 0,
loading: true,
pendingCount: 0,
- tasks: []
+ tasks: [],
};
this.loadTasksDebounced = debounce(this.loadTasks, DEBOUNCE_DELAY);
}
@@ -82,7 +82,7 @@ export class BackgroundTasksApp extends React.PureComponent<Props, State> {
this.mounted = true;
getTypes().then(
- types => {
+ (types) => {
this.setState({ types });
this.loadTasks();
},
@@ -144,7 +144,7 @@ export class BackgroundTasksApp extends React.PureComponent<Props, State> {
pendingCount: pending,
pendingTime,
tasks: page === 1 ? newTasks : [...tasks, ...newTasks],
- pagination: paging
+ pagination: paging,
}));
}
},
@@ -172,18 +172,18 @@ export class BackgroundTasksApp extends React.PureComponent<Props, State> {
this.props.router.push({
pathname: this.props.location.pathname,
- query: nextQuery
+ query: nextQuery,
});
};
handleCancelTask = (task: Task) => {
this.setState({ loading: true });
- return cancelTaskAPI(task.id).then(nextTask => {
+ return cancelTaskAPI(task.id).then((nextTask) => {
if (this.mounted) {
- this.setState(state => ({
+ this.setState((state) => ({
tasks: updateTask(state.tasks, nextTask),
- loading: false
+ loading: false,
}));
}
}, this.stopLoading);
@@ -197,7 +197,7 @@ export class BackgroundTasksApp extends React.PureComponent<Props, State> {
this.handleFilterUpdate({
...DEFAULT_FILTERS,
status: TaskStatuses.Failed,
- currents: CURRENTS.ONLY_CURRENTS
+ currents: CURRENTS.ONLY_CURRENTS,
});
};
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/NoWorkersSupportPopup.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/NoWorkersSupportPopup.tsx
index c471a76e5f8..d6e5dfc7690 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/NoWorkersSupportPopup.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/NoWorkersSupportPopup.tsx
@@ -33,7 +33,8 @@ export default function NoWorkersSupportPopup() {
<p>
<Link
to="https://www.sonarqube.org/trial-request/enterprise-edition/?referrer=sonarqube-background-tasks"
- target="_blank">
+ target="_blank"
+ >
{translate('learn_more')}
</Link>
</p>
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx
index 991db25712c..ff08bb995fc 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx
@@ -46,7 +46,7 @@ export default class ScannerContext extends React.PureComponent<Props, State> {
}
loadScannerContext() {
- getTask(this.props.task.id, ['scannerContext']).then(task => {
+ getTask(this.props.task.id, ['scannerContext']).then((task) => {
if (this.mounted) {
this.setState({ scannerContext: task.scannerContext });
}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Search.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Search.tsx
index bede447ef59..874313ef463 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Search.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Search.tsx
@@ -87,16 +87,8 @@ export default class Search extends React.PureComponent<Props> {
}
render() {
- const {
- loading,
- component,
- types,
- status,
- taskType,
- currents,
- minSubmittedAt,
- maxExecutedAt
- } = this.props;
+ const { loading, component, types, status, taskType, currents, minSubmittedAt, maxExecutedAt } =
+ this.props;
return (
<section className="big-spacer-top big-spacer-bottom">
@@ -106,7 +98,8 @@ export default class Search extends React.PureComponent<Props> {
<label
id="background-task-status-filter-label"
className="text-bold little-spacer-bottom"
- htmlFor="status-filter">
+ htmlFor="status-filter"
+ >
{translate('status')}
</label>
<StatusFilter id="status-filter" onChange={this.handleStatusChange} value={status} />
@@ -118,7 +111,8 @@ export default class Search extends React.PureComponent<Props> {
<label
id="background-task-type-filter-label"
className="text-bold little-spacer-bottom"
- htmlFor="types-filter">
+ htmlFor="types-filter"
+ >
{translate('type')}
</label>
<TypesFilter
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx
index 51bfd5da776..7dd5c4bfb69 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx
@@ -48,7 +48,7 @@ export default class Stacktrace extends React.PureComponent<Props, State> {
loadStacktrace() {
getTask(this.props.task.id, ['stacktrace']).then(
- task => {
+ (task) => {
if (this.mounted) {
this.setState({ loading: false, stacktrace: task.errorStacktrace });
}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/StatPendingCount.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/StatPendingCount.tsx
index de54ad439fb..7cd68b21dd3 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/StatPendingCount.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/StatPendingCount.tsx
@@ -49,7 +49,8 @@ export function StatPendingCount({ appState, onCancelAllPending, pendingCount }:
isDestructive={true}
modalBody={translate('background_tasks.cancel_all_tasks.text')}
modalHeader={translate('background_tasks.cancel_all_tasks')}
- onConfirm={onCancelAllPending}>
+ onConfirm={onCancelAllPending}
+ >
{({ onClick }) => (
<Tooltip overlay={translate('background_tasks.cancel_all_tasks')}>
<ClearButton className="little-spacer-left" color={colors.red} onClick={onClick} />
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx
index f797b433719..3294edae9ad 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx
@@ -36,13 +36,13 @@ export default function StatusFilter(props: StatusFilterProps) {
{ value: STATUSES.ALL, label: translate('background_task.status.ALL') },
{
value: STATUSES.ALL_EXCEPT_PENDING,
- label: translate('background_task.status.ALL_EXCEPT_PENDING')
+ label: translate('background_task.status.ALL_EXCEPT_PENDING'),
},
{ value: TaskStatuses.Pending, label: translate('background_task.status.PENDING') },
{ value: TaskStatuses.InProgress, label: translate('background_task.status.IN_PROGRESS') },
{ value: TaskStatuses.Success, label: translate('background_task.status.SUCCESS') },
{ value: TaskStatuses.Failed, label: translate('background_task.status.FAILED') },
- { value: TaskStatuses.Canceled, label: translate('background_task.status.CANCELED') }
+ { value: TaskStatuses.Canceled, label: translate('background_task.status.CANCELED') },
];
const handleChange = React.useCallback(
@@ -59,7 +59,7 @@ export default function StatusFilter(props: StatusFilterProps) {
id={id}
onChange={handleChange}
options={options}
- value={options.find(o => o.value === value)}
+ value={options.find((o) => o.value === value)}
isSearchable={false}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx
index 1d6b7063697..0c5f23df207 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskActions.tsx
@@ -45,7 +45,7 @@ export default class TaskActions extends React.PureComponent<Props, State> {
cancelTaskOpen: false,
scannerContextOpen: false,
stacktraceOpen: false,
- warningsOpen: false
+ warningsOpen: false,
};
handleFilterClick = () => {
@@ -117,28 +117,32 @@ export default class TaskActions extends React.PureComponent<Props, State> {
<ActionsDropdownItem
className="js-task-cancel"
destructive={true}
- onClick={this.handleCancelClick}>
+ onClick={this.handleCancelClick}
+ >
{translate('background_tasks.cancel_task')}
</ActionsDropdownItem>
)}
{task.hasScannerContext && (
<ActionsDropdownItem
className="js-task-show-scanner-context"
- onClick={this.handleShowScannerContextClick}>
+ onClick={this.handleShowScannerContextClick}
+ >
{translate('background_tasks.show_scanner_context')}
</ActionsDropdownItem>
)}
{canShowStacktrace && (
<ActionsDropdownItem
className="js-task-show-stacktrace"
- onClick={this.handleShowStacktraceClick}>
+ onClick={this.handleShowStacktraceClick}
+ >
{translate('background_tasks.show_stacktrace')}
</ActionsDropdownItem>
)}
{canShowWarnings && (
<ActionsDropdownItem
className="js-task-show-warnings"
- onClick={this.handleShowWarningsClick}>
+ onClick={this.handleShowWarningsClick}
+ >
{translate('background_tasks.show_warnings')}
</ActionsDropdownItem>
)}
@@ -151,7 +155,8 @@ export default class TaskActions extends React.PureComponent<Props, State> {
header={translate('background_tasks.cancel_task')}
isDestructive={true}
onClose={this.closeCancelTask}
- onConfirm={this.handleCancelTask}>
+ onConfirm={this.handleCancelTask}
+ >
{translate('background_tasks.cancel_task.text')}
</ConfirmModal>
)}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
index 8248a678513..3554c7cd846 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
@@ -26,7 +26,7 @@ import {
getBranchUrl,
getPortfolioUrl,
getProjectUrl,
- getPullRequestUrl
+ getPullRequestUrl,
} from '../../../helpers/urls';
import { isPortfolioLike } from '../../../types/component';
import { Task } from '../../../types/tasks';
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx
index 57e51f11cfe..987bcff59dd 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.tsx
@@ -33,7 +33,7 @@ interface Props {
export default function Tasks({ tasks, component, loading, onCancelTask, onFilterTask }: Props) {
const className = classNames('data zebra zebra-hover background-tasks', {
- 'new-loading': loading
+ 'new-loading': loading,
});
return (
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx
index 4ef1522f76d..43fe70bd520 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx
@@ -36,16 +36,16 @@ export default class TypesFilter extends React.PureComponent<Props> {
render() {
const { value, types, id } = this.props;
- const options = types.map(t => {
+ const options = types.map((t) => {
return {
value: t,
- label: translate('background_task.type', t)
+ label: translate('background_task.type', t),
};
});
const allOptions: BasicSelectOption[] = [
{ value: ALL_TYPES, label: translate('background_task.type.ALL') },
- ...options
+ ...options,
];
return (
@@ -57,7 +57,7 @@ export default class TypesFilter extends React.PureComponent<Props> {
onChange={this.handleChange}
options={allOptions}
isSearchable={false}
- value={allOptions.find(o => o.value === value)}
+ value={allOptions.find((o) => o.value === value)}
/>
);
}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx
index 1bc53268cc6..aa2a1c988b8 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Workers.tsx
@@ -44,7 +44,7 @@ export default class Workers extends React.PureComponent<{}, State> {
formOpen: false,
loading: true,
noSupportPopup: false,
- workerCount: 1
+ workerCount: 1,
};
componentDidMount() {
@@ -64,7 +64,7 @@ export default class Workers extends React.PureComponent<{}, State> {
this.setState({
canSetWorkerCount,
loading: false,
- workerCount: value
+ workerCount: value,
});
}
},
@@ -95,7 +95,7 @@ export default class Workers extends React.PureComponent<{}, State> {
if (show !== undefined) {
this.setState({ noSupportPopup: show });
} else {
- this.setState(state => ({ noSupportPopup: !state.noSupportPopup }));
+ this.setState((state) => ({ noSupportPopup: !state.noSupportPopup }));
}
};
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.tsx
index 9ed563ce946..cfb05cfdbeb 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/WorkersForm.tsx
@@ -44,7 +44,7 @@ export default class WorkersForm extends React.PureComponent<Props, State> {
super(props);
this.state = {
newWorkerCount: props.workerCount,
- submitting: false
+ submitting: false,
};
}
@@ -90,7 +90,8 @@ export default class WorkersForm extends React.PureComponent<Props, State> {
return (
<Modal
contentLabel={translate('background_tasks.change_number_of_workers')}
- onRequestClose={this.handleClose}>
+ onRequestClose={this.handleClose}
+ >
<header className="modal-head">
<h2 id="background-task-workers-label">
{translate('background_tasks.change_number_of_workers')}
@@ -104,7 +105,7 @@ export default class WorkersForm extends React.PureComponent<Props, State> {
isSearchable={false}
onChange={this.handleWorkerCountChange}
options={options}
- value={options.find(o => o.value === this.state.newWorkerCount)}
+ value={options.find((o) => o.value === this.state.newWorkerCount)}
/>
<Alert className="big-spacer-top" variant="info">
{translate('background_tasks.change_number_of_workers.hint')}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/BackgroundTasksApp-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/BackgroundTasksApp-test.tsx
index 42a3e31baf4..bce1ed12fe0 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/BackgroundTasksApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/BackgroundTasksApp-test.tsx
@@ -26,7 +26,7 @@ import { BackgroundTasksApp } from '../BackgroundTasksApp';
jest.mock('../../../../api/ce', () => ({
getTypes: jest.fn().mockResolvedValue({
- taskTypes: ['REPORT', 'PROJECT_EXPORT', 'PROJECT_IMPORT', 'VIEW_REFRESH']
+ taskTypes: ['REPORT', 'PROJECT_EXPORT', 'PROJECT_IMPORT', 'VIEW_REFRESH'],
}),
getActivity: jest.fn().mockResolvedValue({
tasks: [
@@ -48,7 +48,7 @@ jest.mock('../../../../api/ce', () => ({
hasScannerContext: false,
errorType: 'LICENSING',
warningCount: 0,
- warnings: []
+ warnings: [],
},
{
id: 'AWkGcOThOiAPiP5AE-kL',
@@ -65,14 +65,14 @@ jest.mock('../../../../api/ce', () => ({
logs: false,
hasScannerContext: false,
warningCount: 0,
- warnings: []
- }
+ warnings: [],
+ },
],
- paging: { total: 2, pageIndex: 1 }
+ paging: { total: 2, pageIndex: 1 },
}),
getStatus: jest.fn().mockResolvedValue({ pending: 0, failing: 15, inProgress: 0 }),
cancelAllTasks: jest.fn().mockResolvedValue({}),
- cancelTask: jest.fn().mockResolvedValue({})
+ cancelTask: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx
index a24f0c1d975..11752c7c77e 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/ScannerContext-test.tsx
@@ -25,7 +25,7 @@ import { TaskTypes } from '../../../../types/tasks';
import ScannerContext from '../ScannerContext';
jest.mock('../../../../api/ce', () => ({
- getTask: jest.fn(() => Promise.resolve({ scannerContext: 'context' }))
+ getTask: jest.fn(() => Promise.resolve({ scannerContext: 'context' })),
}));
const getTask = require('../../../../api/ce').getTask as jest.Mock<any>;
@@ -33,7 +33,7 @@ const getTask = require('../../../../api/ce').getTask as jest.Mock<any>;
const task = mockTask({
componentName: 'foo',
id: '123',
- type: TaskTypes.Report
+ type: TaskTypes.Report,
});
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx
index 898ff042508..499b02317ba 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Stacktrace-test.tsx
@@ -25,7 +25,7 @@ import { TaskTypes } from '../../../../types/tasks';
import Stacktrace from '../Stacktrace';
jest.mock('../../../../api/ce', () => ({
- getTask: jest.fn(() => Promise.resolve({ errorStacktrace: 'stacktrace' }))
+ getTask: jest.fn(() => Promise.resolve({ errorStacktrace: 'stacktrace' })),
}));
const getTask = require('../../../../api/ce').getTask as jest.Mock<any>;
@@ -33,7 +33,7 @@ const getTask = require('../../../../api/ce').getTask as jest.Mock<any>;
const task = mockTask({
componentName: 'foo',
id: '123',
- type: TaskTypes.Report
+ type: TaskTypes.Report,
});
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/StatPendingCount-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/StatPendingCount-test.tsx
index 893593f5869..c250c5a5a59 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/StatPendingCount-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/StatPendingCount-test.tsx
@@ -31,11 +31,7 @@ it('should not render', () => {
});
it('should not show cancel pending button', () => {
- expect(
- shallowRender({ pendingCount: 0 })
- .find('ConfirmButton')
- .exists()
- ).toBe(false);
+ expect(shallowRender({ pendingCount: 0 }).find('ConfirmButton').exists()).toBe(false);
expect(
shallowRender({ appState: mockAppState({ canAdmin: false }) })
.find('ConfirmButton')
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/StatPendingTime-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/StatPendingTime-test.tsx
index 4358357622e..d5dc5d9c861 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/StatPendingTime-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/StatPendingTime-test.tsx
@@ -32,16 +32,8 @@ it('should not render', () => {
});
it('should not render when pending time is too small', () => {
- expect(
- shallowRender({ pendingTime: 0 })
- .find('.emphasised-measure')
- .exists()
- ).toBe(false);
- expect(
- shallowRender({ pendingTime: 900 })
- .find('.emphasised-measure')
- .exists()
- ).toBe(false);
+ expect(shallowRender({ pendingTime: 0 }).find('.emphasised-measure').exists()).toBe(false);
+ expect(shallowRender({ pendingTime: 900 }).find('.emphasised-measure').exists()).toBe(false);
});
function shallowRender(props: Partial<Props> = {}) {
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskStatus-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskStatus-test.tsx
index 7ac9dd40de1..0ddaf2c1366 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskStatus-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskStatus-test.tsx
@@ -24,7 +24,7 @@ import TaskStatus from '../TaskStatus';
it('renders', () => {
expect.assertions(5);
const statuses = ['PENDING', 'IN_PROGRESS', 'SUCCESS', 'FAILED', 'CANCELED'];
- statuses.forEach(status => {
+ statuses.forEach((status) => {
expect(shallow(<TaskStatus status={status} />)).toMatchSnapshot();
});
});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Workers-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Workers-test.tsx
index 32e5ada49cb..b5959fa7a04 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Workers-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/Workers-test.tsx
@@ -29,7 +29,7 @@ it('renders', () => {
wrapper.setState({
canSetWorkerCount: true,
loading: false,
- workerCount: 1
+ workerCount: 1,
});
expect(wrapper).toMatchSnapshot();
@@ -46,7 +46,7 @@ it('opens form', () => {
wrapper.setState({
canSetWorkerCount: true,
loading: false,
- workerCount: 1
+ workerCount: 1,
});
expect(wrapper).toMatchSnapshot();
@@ -61,7 +61,7 @@ it('updates worker count', () => {
canSetWorkerCount: true,
formOpen: true,
loading: false,
- workerCount: 1
+ workerCount: 1,
});
expect(wrapper).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/WorkersForm-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/WorkersForm-test.tsx
index 0dad618e70d..cd597f58ece 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/WorkersForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/WorkersForm-test.tsx
@@ -19,7 +19,7 @@
*/
/* eslint-disable import/first */
jest.mock('../../../../api/ce', () => ({
- setWorkerCount: () => Promise.resolve()
+ setWorkerCount: () => Promise.resolve(),
}));
import { shallow } from 'enzyme';
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/constants.ts b/server/sonar-web/src/main/js/apps/background-tasks/constants.ts
index 4873befec41..aed5b4cff77 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/constants.ts
+++ b/server/sonar-web/src/main/js/apps/background-tasks/constants.ts
@@ -21,20 +21,20 @@ import { Query } from './utils';
export const STATUSES = {
ALL: '__ALL__',
- ALL_EXCEPT_PENDING: '__ALL_EXCEPT_PENDING__'
+ ALL_EXCEPT_PENDING: '__ALL_EXCEPT_PENDING__',
};
export const ALL_TYPES = 'ALL_TYPES';
export const CURRENTS = {
ALL: '__ALL__',
- ONLY_CURRENTS: 'CURRENTS'
+ ONLY_CURRENTS: 'CURRENTS',
};
export const DATE = {
ANY: 'ANY',
TODAY: 'TODAY',
- CUSTOM: 'CUSTOM'
+ CUSTOM: 'CUSTOM',
};
export const DEFAULT_FILTERS: Query = {
@@ -43,7 +43,7 @@ export const DEFAULT_FILTERS: Query = {
currents: CURRENTS.ALL,
minSubmittedAt: undefined,
maxExecutedAt: undefined,
- query: ''
+ query: '',
};
export const DATE_FORMAT = 'YYYY-MM-DD';
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/utils.ts b/server/sonar-web/src/main/js/apps/background-tasks/utils.ts
index 404272baadd..93219d14b9e 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/utils.ts
+++ b/server/sonar-web/src/main/js/apps/background-tasks/utils.ts
@@ -31,7 +31,7 @@ export interface Query {
}
export function updateTask(tasks: Task[], newTask: Task) {
- return tasks.map(task => (task.id === newTask.id ? newTask : task));
+ return tasks.map((task) => (task.id === newTask.id ? newTask : task));
}
export function mapFiltersToParameters(filters: Partial<Query> = {}) {
@@ -43,14 +43,14 @@ export function mapFiltersToParameters(filters: Partial<Query> = {}) {
TaskStatuses.InProgress,
TaskStatuses.Success,
TaskStatuses.Failed,
- TaskStatuses.Canceled
+ TaskStatuses.Canceled,
].join();
} else if (filters.status === STATUSES.ALL_EXCEPT_PENDING) {
parameters.status = [
TaskStatuses.InProgress,
TaskStatuses.Success,
TaskStatuses.Failed,
- TaskStatuses.Canceled
+ TaskStatuses.Canceled,
].join();
} else {
parameters.status = filters.status;
diff --git a/server/sonar-web/src/main/js/apps/change-admin-password/ChangeAdminPasswordApp.tsx b/server/sonar-web/src/main/js/apps/change-admin-password/ChangeAdminPasswordApp.tsx
index 3582400a715..e1f564f6456 100644
--- a/server/sonar-web/src/main/js/apps/change-admin-password/ChangeAdminPasswordApp.tsx
+++ b/server/sonar-web/src/main/js/apps/change-admin-password/ChangeAdminPasswordApp.tsx
@@ -48,7 +48,7 @@ export class ChangeAdminPasswordApp extends React.PureComponent<Props, State> {
passwordValue: '',
confirmPasswordValue: '',
submitting: false,
- success: !props.appState.instanceUsesDefaultAdminCredentials
+ success: !props.appState.instanceUsesDefaultAdminCredentials,
};
}
@@ -74,7 +74,7 @@ export class ChangeAdminPasswordApp extends React.PureComponent<Props, State> {
this.setState({ submitting: true });
const success = await changePassword({
login: DEFAULT_ADMIN_LOGIN,
- password: passwordValue
+ password: passwordValue,
}).then(
() => true,
() => false
@@ -87,14 +87,14 @@ export class ChangeAdminPasswordApp extends React.PureComponent<Props, State> {
checkCanSubmit = () => {
this.setState(({ passwordValue, confirmPasswordValue }) => ({
- canSubmit: passwordValue === confirmPasswordValue && passwordValue !== DEFAULT_ADMIN_PASSWORD
+ canSubmit: passwordValue === confirmPasswordValue && passwordValue !== DEFAULT_ADMIN_PASSWORD,
}));
};
render() {
const {
appState: { canAdmin },
- location
+ location,
} = this.props;
const { canSubmit, confirmPasswordValue, passwordValue, submitting, success } = this.state;
return (
diff --git a/server/sonar-web/src/main/js/apps/change-admin-password/ChangeAdminPasswordAppRenderer.tsx b/server/sonar-web/src/main/js/apps/change-admin-password/ChangeAdminPasswordAppRenderer.tsx
index 8536936cac5..3065eb3f92c 100644
--- a/server/sonar-web/src/main/js/apps/change-admin-password/ChangeAdminPasswordAppRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/change-admin-password/ChangeAdminPasswordAppRenderer.tsx
@@ -49,7 +49,7 @@ export default function ChangeAdminPasswordAppRenderer(props: ChangeAdminPasswor
passwordValue,
location,
submitting,
- success
+ success,
} = props;
if (!canAdmin) {
@@ -84,7 +84,8 @@ export default function ChangeAdminPasswordAppRenderer(props: ChangeAdminPasswor
onSubmit={(e: React.SyntheticEvent<HTMLFormElement>) => {
e.preventDefault();
props.onSubmit();
- }}>
+ }}
+ >
<h2 className="big-spacer-bottom big">
{translate('users.change_admin_password.form.header')}
</h2>
diff --git a/server/sonar-web/src/main/js/apps/change-admin-password/__tests__/ChangeAdminPasswordApp-it.tsx b/server/sonar-web/src/main/js/apps/change-admin-password/__tests__/ChangeAdminPasswordApp-it.tsx
index 587875f1dfe..b8feebe3c7b 100644
--- a/server/sonar-web/src/main/js/apps/change-admin-password/__tests__/ChangeAdminPasswordApp-it.tsx
+++ b/server/sonar-web/src/main/js/apps/change-admin-password/__tests__/ChangeAdminPasswordApp-it.tsx
@@ -28,23 +28,23 @@ import ChangeAdminPasswordApp from '../ChangeAdminPasswordApp';
import { DEFAULT_ADMIN_PASSWORD } from '../constants';
jest.mock('../../../api/users', () => ({
- changePassword: jest.fn().mockResolvedValue({})
+ changePassword: jest.fn().mockResolvedValue({}),
}));
const ui = {
updateButton: byRole('button', { name: 'update_verb' }),
passwordInput: byLabelText('users.change_admin_password.form.password', {
selector: 'input',
- exact: false
+ exact: false,
}),
confirmInput: byLabelText('users.change_admin_password.form.confirm', {
selector: 'input',
- exact: false
+ exact: false,
}),
unauthorizedMessage: byText('unauthorized.message'),
defaultPasswordWarningMessage: byText(
'users.change_admin_password.form.cannot_use_default_password'
- )
+ ),
};
it('should disallow change when not an admin', () => {
@@ -68,7 +68,7 @@ it('should allow changing password when using the default admin password', async
await user.click(ui.updateButton.get());
expect(changePassword).toHaveBeenCalledWith({
login: 'admin',
- password: 'password'
+ password: 'password',
});
});
diff --git a/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts b/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts
index 50b2e819f8b..bef9f899cdc 100644
--- a/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts
+++ b/server/sonar-web/src/main/js/apps/code/__tests__/Code-it.ts
@@ -35,7 +35,7 @@ jest.mock('../../../components/SourceViewer/helpers/lines', () => {
const lines = jest.requireActual('../../../components/SourceViewer/helpers/lines');
return {
...lines,
- LINES_TO_LOAD: 20
+ LINES_TO_LOAD: 20,
};
});
diff --git a/server/sonar-web/src/main/js/apps/code/__tests__/buckets-test.tsx b/server/sonar-web/src/main/js/apps/code/__tests__/buckets-test.tsx
index fdb1523e1eb..a40f7b1c462 100644
--- a/server/sonar-web/src/main/js/apps/code/__tests__/buckets-test.tsx
+++ b/server/sonar-web/src/main/js/apps/code/__tests__/buckets-test.tsx
@@ -25,11 +25,11 @@ const component: ComponentMeasure = { key: 'frodo', name: 'frodo', qualifier: 'f
const componentKey: string = 'foo';
const childrenA: ComponentMeasure[] = [
{ key: 'foo', name: 'foo', qualifier: 'foo' },
- { key: 'bar', name: 'bar', qualifier: 'bar' }
+ { key: 'bar', name: 'bar', qualifier: 'bar' },
];
const childrenB: ComponentMeasure[] = [
{ key: 'bart', name: 'bart', qualifier: 'bart' },
- { key: 'simpson', name: 'simpson', qualifier: 'simpson' }
+ { key: 'simpson', name: 'simpson', qualifier: 'simpson' },
];
it('should have empty bucket at start', () => {
diff --git a/server/sonar-web/src/main/js/apps/code/__tests__/utils-test.tsx b/server/sonar-web/src/main/js/apps/code/__tests__/utils-test.tsx
index 88c9cbe9555..1021105a2a3 100644
--- a/server/sonar-web/src/main/js/apps/code/__tests__/utils-test.tsx
+++ b/server/sonar-web/src/main/js/apps/code/__tests__/utils-test.tsx
@@ -23,20 +23,20 @@ import {
addComponent,
addComponentBreadcrumbs,
addComponentChildren,
- getComponentBreadcrumbs
+ getComponentBreadcrumbs,
} from '../bucket';
import {
getCodeMetrics,
loadMoreChildren,
mostCommonPrefix,
retrieveComponent,
- retrieveComponentChildren
+ retrieveComponentChildren,
} from '../utils';
jest.mock('../../../api/components', () => ({
getBreadcrumbs: jest.fn().mockRejectedValue({}),
getChildren: jest.fn().mockRejectedValue({}),
- getComponent: jest.fn().mockRejectedValue({})
+ getComponent: jest.fn().mockRejectedValue({}),
}));
jest.mock('../bucket', () => ({
@@ -45,7 +45,7 @@ jest.mock('../bucket', () => ({
addComponentChildren: jest.fn(),
getComponent: jest.fn(),
getComponentBreadcrumbs: jest.fn(),
- getComponentChildren: jest.fn()
+ getComponentChildren: jest.fn(),
}));
beforeEach(() => {
@@ -79,7 +79,7 @@ describe('retrieveComponentChildren', () => {
const components = [{}, {}];
(getChildren as jest.Mock).mockResolvedValueOnce({
components,
- paging: { total: 2, pageIndex: 0 }
+ paging: { total: 2, pageIndex: 0 },
});
await retrieveComponentChildren('key', 'TRK', { mounted: true }, mockMainBranch());
@@ -95,10 +95,10 @@ describe('retrieveComponent', () => {
const components = [{}, {}];
(getChildren as jest.Mock).mockResolvedValueOnce({
components,
- paging: { total: 2, pageIndex: 0 }
+ paging: { total: 2, pageIndex: 0 },
});
(getComponent as jest.Mock).mockResolvedValueOnce({
- component: {}
+ component: {},
});
(getBreadcrumbs as jest.Mock).mockResolvedValueOnce([]);
@@ -113,10 +113,10 @@ describe('retrieveComponent', () => {
const components = [{}, {}];
(getChildren as jest.Mock).mockResolvedValueOnce({
components,
- paging: { total: 2, pageIndex: 0 }
+ paging: { total: 2, pageIndex: 0 },
});
(getComponent as jest.Mock).mockResolvedValueOnce({
- component: {}
+ component: {},
});
(getBreadcrumbs as jest.Mock).mockResolvedValueOnce([]);
@@ -133,7 +133,7 @@ describe('loadMoreChildren', () => {
const components = [{}, {}, {}];
(getChildren as jest.Mock).mockResolvedValueOnce({
components,
- paging: { total: 6, pageIndex: 1 }
+ paging: { total: 6, pageIndex: 1 },
});
await loadMoreChildren('key', 1, 'TRK', { mounted: true }, mockMainBranch());
diff --git a/server/sonar-web/src/main/js/apps/code/bucket.ts b/server/sonar-web/src/main/js/apps/code/bucket.ts
index ecb146695c8..900520200ce 100644
--- a/server/sonar-web/src/main/js/apps/code/bucket.ts
+++ b/server/sonar-web/src/main/js/apps/code/bucket.ts
@@ -48,9 +48,7 @@ export function addComponentChildren(
childrenBucket[componentKey] = { children, total, page };
}
-export function getComponentChildren(
- componentKey: string
-): {
+export function getComponentChildren(componentKey: string): {
children: ComponentMeasure[];
page: number;
total: number;
diff --git a/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx b/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx
index 6383c73a0a0..bff1dbf41a4 100644
--- a/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx
@@ -44,7 +44,7 @@ import {
getCodeMetrics,
loadMoreChildren,
retrieveComponent,
- retrieveComponentChildren
+ retrieveComponentChildren,
} from '../utils';
import Breadcrumbs from './Breadcrumbs';
import Components from './Components';
@@ -84,7 +84,7 @@ export class CodeApp extends React.Component<Props, State> {
loading: true,
page: 0,
total: 0,
- newCodeSelected: true
+ newCodeSelected: true,
};
this.refreshBranchStatus = debounce(this.refreshBranchStatus, 1000);
}
@@ -117,7 +117,7 @@ export class CodeApp extends React.Component<Props, State> {
this.props.component.qualifier,
this,
this.props.branchLike
- ).then(r => {
+ ).then((r) => {
if (this.mounted) {
if (['FIL', 'UTS'].includes(r.component.qualifier)) {
this.setState({
@@ -127,7 +127,7 @@ export class CodeApp extends React.Component<Props, State> {
page: 0,
searchResults: undefined,
sourceViewer: r.component,
- total: 0
+ total: 0,
});
} else {
this.setState({
@@ -138,7 +138,7 @@ export class CodeApp extends React.Component<Props, State> {
page: r.page,
searchResults: undefined,
sourceViewer: undefined,
- total: r.total
+ total: r.total,
});
}
}
@@ -177,12 +177,12 @@ export class CodeApp extends React.Component<Props, State> {
this.props.component.qualifier,
this,
this.props.branchLike
- ).then(r => {
+ ).then((r) => {
if (this.mounted && r.components.length) {
this.setState({
components: [...components, ...r.components],
page: r.page,
- total: r.total
+ total: r.total,
});
}
}, this.stopLoading);
@@ -260,7 +260,7 @@ export class CodeApp extends React.Component<Props, State> {
newCodeSelected,
total,
searchResults,
- sourceViewer
+ sourceViewer,
} = this.state;
const { canBrowseAllChildProjects, qualifier } = component;
@@ -274,14 +274,14 @@ export class CodeApp extends React.Component<Props, State> {
const componentsClassName = classNames('boxed-group', 'spacer-top', {
'new-loading': loading,
- 'search-results': showSearch
+ 'search-results': showSearch,
});
const metricKeys = intersection(
getCodeMetrics(component.qualifier, branchLike, { newCode: newCodeSelected }),
Object.keys(this.props.metrics)
);
- const metrics = metricKeys.map(metric => this.props.metrics[metric]);
+ const metrics = metricKeys.map((metric) => this.props.metrics[metric]);
const defaultTitle =
baseComponent && ['APP', 'VW', 'SVW'].includes(baseComponent.qualifier)
diff --git a/server/sonar-web/src/main/js/apps/code/components/Component.tsx b/server/sonar-web/src/main/js/apps/code/components/Component.tsx
index 4d6a199c662..58378693386 100644
--- a/server/sonar-web/src/main/js/apps/code/components/Component.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/Component.tsx
@@ -56,7 +56,7 @@ export class Component extends React.PureComponent<Props> {
previous,
rootComponent,
selected = false,
- newCodeSelected
+ newCodeSelected,
} = this.props;
const isFile =
@@ -98,18 +98,20 @@ export class Component extends React.PureComponent<Props> {
</div>
</td>
- {metrics.map(metric => (
+ {metrics.map((metric) => (
<td
className={classNames('thin', {
'text-center': metric.type === MetricType.Rating,
- 'nowrap text-right': metric.type !== MetricType.Rating
+ 'nowrap text-right': metric.type !== MetricType.Rating,
})}
- key={metric.key}>
+ key={metric.key}
+ >
<div
className={classNames({
'code-components-rating-cell': metric.type === MetricType.Rating,
- 'code-components-cell': metric.type !== MetricType.Rating
- })}>
+ 'code-components-cell': metric.type !== MetricType.Rating,
+ })}
+ >
<ComponentMeasure component={component} metric={metric} />
</div>
</td>
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
index f1aea8331ee..2da3901750f 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
@@ -39,7 +39,7 @@ export default class ComponentMeasure extends React.PureComponent<Props> {
const measure =
Array.isArray(component.measures) &&
- component.measures.find(measure => measure.metric === finalMetricKey);
+ component.measures.find((measure) => measure.metric === finalMetricKey);
if (!measure) {
return measure === false ? <span /> : <span>—</span>;
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
index 164d1b1b2a2..6ba62f9fe7d 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
@@ -30,7 +30,7 @@ import {
ComponentQualifier,
isApplication,
isPortfolioLike,
- isProject
+ isProject,
} from '../../../types/component';
import { ComponentMeasure } from '../../../types/types';
import { mostCommonPrefix } from '../utils';
@@ -42,7 +42,7 @@ export function getTooltip(component: ComponentMeasure) {
return component.path + '\n\n' + component.key;
}
- return [component.name, component.key, component.branch].filter(s => !!s).join('\n\n');
+ return [component.name, component.key, component.branch].filter((s) => !!s).join('\n\n');
}
export interface Props {
@@ -62,7 +62,7 @@ export default function ComponentName({
rootComponent,
previous,
canBrowse = false,
- newCodeSelected
+ newCodeSelected,
}: Props) {
const ariaLabel = unclickable ? translate('code.parent_folder') : undefined;
@@ -102,7 +102,8 @@ export default function ComponentName({
<span
className="max-width-100 display-inline-block text-ellipsis"
title={getTooltip(component)}
- aria-label={ariaLabel}>
+ aria-label={ariaLabel}
+ >
{renderNameWithIcon(branchLike, component, previous, rootComponent, unclickable, canBrowse)}
</span>
);
@@ -138,7 +139,8 @@ function renderNameWithIcon(
component.qualifier,
{ branch },
codeType
- )}>
+ )}
+ >
<QualifierIcon
className="little-spacer-right"
qualifier={component.qualifier}
@@ -155,7 +157,8 @@ function renderNameWithIcon(
return (
<Link
className="display-inline-flex-center link-no-underline"
- to={{ pathname: '/code', search: queryToSearch(query) }}>
+ to={{ pathname: '/code', search: queryToSearch(query) }}
+ >
<QualifierIcon
className="little-spacer-right"
qualifier={component.qualifier}
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx
index 848f1c39496..17712035830 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx
@@ -38,7 +38,7 @@ export default class ComponentPin extends React.PureComponent<Props> {
branchLike: this.props.branchLike,
key: this.props.component.key,
name: this.props.component.path,
- qualifier: this.props.component.qualifier
+ qualifier: this.props.component.qualifier,
});
};
@@ -49,7 +49,8 @@ export default class ComponentPin extends React.PureComponent<Props> {
className="link-no-underline"
preventDefault={true}
onClick={this.handleClick}
- title={translateWithParameters('component_viewer.open_in_workspace_X', name)}>
+ title={translateWithParameters('component_viewer.open_in_workspace_X', name)}
+ >
<PinIcon fill={theme.colors.primary} />
</ButtonPlain>
);
diff --git a/server/sonar-web/src/main/js/apps/code/components/Components.tsx b/server/sonar-web/src/main/js/apps/code/components/Components.tsx
index e16cf21bcf3..a2734203420 100644
--- a/server/sonar-web/src/main/js/apps/code/components/Components.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/Components.tsx
@@ -48,7 +48,7 @@ export class Components extends React.PureComponent<Props> {
rootComponent,
selected,
metrics,
- newCodeSelected
+ newCodeSelected,
} = this.props;
const colSpan = metrics.length + BASE_COLUMN_COUNT;
@@ -60,7 +60,7 @@ export class Components extends React.PureComponent<Props> {
<ComponentsHeader
baseComponent={baseComponent}
canBePinned={canBePinned}
- metrics={metrics.map(metric => metric.key)}
+ metrics={metrics.map((metric) => metric.key)}
rootComponent={rootComponent}
/>
)}
@@ -92,9 +92,9 @@ export class Components extends React.PureComponent<Props> {
{components.length ? (
sortBy(
components,
- c => c.qualifier,
- c => c.name.toLowerCase(),
- c => (c.branch ? c.branch.toLowerCase() : '')
+ (c) => c.qualifier,
+ (c) => c.name.toLowerCase(),
+ (c) => (c.branch ? c.branch.toLowerCase() : '')
).map((component, index, list) => (
<Component
branchLike={branchLike}
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx
index 45de89dd4f2..9fbaab8bd3a 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx
@@ -33,14 +33,14 @@ const SHORT_NAME_METRICS = [
'duplicated_lines_density',
'new_lines',
'new_coverage',
- 'new_duplicated_lines_density'
+ 'new_duplicated_lines_density',
];
export default function ComponentsHeader({
baseComponent,
canBePinned = true,
metrics,
- rootComponent
+ rootComponent,
}: Props) {
const isPortfolio = ['VW', 'SVW'].includes(rootComponent.qualifier);
let columns: string[] = [];
@@ -51,10 +51,10 @@ export default function ComponentsHeader({
translate('portfolio.metric_domain.vulnerabilities'),
translate('portfolio.metric_domain.security_hotspots'),
translate('metric_domain.Maintainability'),
- translate('metric', 'ncloc', 'name')
+ translate('metric', 'ncloc', 'name'),
];
} else {
- columns = metrics.map(metric =>
+ columns = metrics.map((metric) =>
translate('metric', metric, SHORT_NAME_METRICS.includes(metric) ? 'short_name' : 'name')
);
}
@@ -71,9 +71,10 @@ export default function ComponentsHeader({
'code-components-cell': !isPortfolio && index > 0,
nowrap: !isPortfolio,
'text-center': isPortfolio && index < columns.length - 1,
- 'text-right': !isPortfolio || index === columns.length - 1
+ 'text-right': !isPortfolio || index === columns.length - 1,
})}
- key={column}>
+ key={column}
+ >
{column}
</th>
))}
diff --git a/server/sonar-web/src/main/js/apps/code/components/Search.tsx b/server/sonar-web/src/main/js/apps/code/components/Search.tsx
index 67c80e5c85f..7aeebf42e5f 100644
--- a/server/sonar-web/src/main/js/apps/code/components/Search.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/Search.tsx
@@ -50,7 +50,7 @@ export class Search extends React.PureComponent<Props, State> {
mounted = false;
state: State = {
query: '',
- loading: false
+ loading: false,
};
componentDidMount() {
@@ -65,7 +65,7 @@ export class Search extends React.PureComponent<Props, State> {
if (nextProps.location.query.id !== this.props.location.query.id) {
this.setState({
query: '',
- loading: false
+ loading: false,
});
this.props.onSearchClear();
}
@@ -92,7 +92,7 @@ export class Search extends React.PureComponent<Props, State> {
this.setState({ loading: true });
router.replace({
pathname: location.pathname,
- query: { ...location.query, search: query }
+ query: { ...location.query, search: query },
});
const isPortfolio = ['VW', 'SVW', 'APP'].includes(component.qualifier);
@@ -103,12 +103,12 @@ export class Search extends React.PureComponent<Props, State> {
q: query,
s: 'qualifier,name',
qualifiers,
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
})
- .then(r => {
+ .then((r) => {
if (this.mounted) {
this.setState({
- loading: false
+ loading: false,
});
this.props.onSearchResults(r.components);
}
@@ -146,12 +146,12 @@ export class Search extends React.PureComponent<Props, State> {
options={[
{
value: true,
- label: translate('projects.view.new_code')
+ label: translate('projects.view.new_code'),
},
{
value: false,
- label: translate('projects.view.overall_code')
- }
+ label: translate('projects.view.overall_code'),
+ },
]}
value={newCodeSelected}
onCheck={this.props.onNewCodeToggle}
diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/CodeApp-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/CodeApp-test.tsx
index bd831db0458..f32f7b18cd3 100644
--- a/server/sonar-web/src/main/js/apps/code/components/__tests__/CodeApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/CodeApp-test.tsx
@@ -38,15 +38,15 @@ jest.mock('../../utils', () => {
component: { qualifier: 'APP' },
components: [],
page: 0,
- total: 1
+ total: 1,
}),
- retrieveComponentChildren: () => Promise.resolve()
+ retrieveComponentChildren: () => Promise.resolve(),
};
});
const METRICS = {
coverage: { id: '2', key: 'coverage', type: 'PERCENT', name: 'Coverage', domain: 'Coverage' },
- new_bugs: { id: '4', key: 'new_bugs', type: 'INT', name: 'New Bugs', domain: 'Reliability' }
+ new_bugs: { id: '4', key: 'new_bugs', type: 'INT', name: 'New Bugs', domain: 'Reliability' },
};
beforeEach(() => {
@@ -57,21 +57,21 @@ it.each([
[ComponentQualifier.Application],
[ComponentQualifier.Project],
[ComponentQualifier.Portfolio],
- [ComponentQualifier.SubPortfolio]
-])('should render correclty when no sub component for %s', async qualifier => {
+ [ComponentQualifier.SubPortfolio],
+])('should render correclty when no sub component for %s', async (qualifier) => {
const component = {
breadcrumbs: [],
name: 'foo',
key: 'foo',
qualifier,
- canBrowseAllChildProjects: true
+ canBrowseAllChildProjects: true,
};
(retrieveComponent as jest.Mock<any>).mockResolvedValueOnce({
breadcrumbs: [],
component,
components: [],
page: 0,
- total: 1
+ total: 1,
});
const wrapper = shallowRender({ component });
await waitAndUpdate(wrapper);
@@ -83,7 +83,7 @@ it.each([
component,
components: [mockComponent({ qualifier: ComponentQualifier.File })],
page: 0,
- total: 1
+ total: 1,
});
wrapper.instance().loadComponent(component.key);
await waitAndUpdate(wrapper);
@@ -109,7 +109,7 @@ it('should load more behave correctly', async () => {
component: mockComponent(),
components: [component1],
page: 0,
- total: 1
+ total: 1,
});
let wrapper = shallowRender();
await waitAndUpdate(wrapper);
@@ -117,7 +117,7 @@ it('should load more behave correctly', async () => {
(loadMoreChildren as jest.Mock<any>).mockResolvedValueOnce({
components: [component2],
page: 0,
- total: 1
+ total: 1,
});
wrapper.instance().handleLoadMore();
@@ -138,7 +138,7 @@ it('should handle go to parent correctly', async () => {
component: mockComponent(),
components: [],
page: 0,
- total: 1
+ total: 1,
});
let wrapper = shallowRender();
await waitAndUpdate(wrapper);
@@ -149,12 +149,12 @@ it('should handle go to parent correctly', async () => {
(retrieveComponent as jest.Mock<any>).mockResolvedValueOnce({
breadcrumbs: [
{ key: 'key1', name: 'name1', qualifier: ComponentQualifier.Directory },
- breadcrumb
+ breadcrumb,
],
component: mockComponent(),
components: [],
page: 0,
- total: 1
+ total: 1,
});
wrapper = shallowRender({ router });
await waitAndUpdate(wrapper);
@@ -162,7 +162,7 @@ it('should handle go to parent correctly', async () => {
expect(wrapper.state().highlighted).toBe(breadcrumb);
expect(router.push).toHaveBeenCalledWith({
pathname: '/code',
- search: queryToSearch({ id: 'foo', line: undefined, selected: 'key1' })
+ search: queryToSearch({ id: 'foo', line: undefined, selected: 'key1' }),
});
});
@@ -174,30 +174,30 @@ it('should correcly display new/overall measure for portfolio', async () => {
key: 'reliability_rating',
type: 'RATING',
name: 'reliability_rating',
- domain: 'reliability_rating'
+ domain: 'reliability_rating',
},
new_reliability_rating: {
id: '4',
key: 'new_reliability_rating',
type: 'RATING',
name: 'new_reliability_rating',
- domain: 'new_reliability_rating'
- }
+ domain: 'new_reliability_rating',
+ },
};
(retrieveComponent as jest.Mock<any>).mockResolvedValueOnce({
breadcrumbs: [],
component: mockComponent(),
components: [component1],
page: 0,
- total: 1
+ total: 1,
});
const wrapper = shallowRender({
component: mockComponent({
qualifier: ComponentQualifier.Portfolio,
- canBrowseAllChildProjects: true
+ canBrowseAllChildProjects: true,
}),
- metrics
+ metrics,
});
await waitAndUpdate(wrapper);
expect(wrapper.find('withKeyboardNavigation(Components)').props()).toMatchSnapshot('new metrics');
@@ -215,7 +215,7 @@ it('should handle select correctly', () => {
wrapper.instance().handleSelect(mockComponentMeasure(true, { refKey: 'test' }));
expect(router.push).toHaveBeenCalledWith({
pathname: '/dashboard',
- search: queryToSearch({ branch: undefined, id: 'test', code_scope: 'new' })
+ search: queryToSearch({ branch: undefined, id: 'test', code_scope: 'new' }),
});
expect(wrapper.state().highlighted).toBeUndefined();
@@ -224,13 +224,13 @@ it('should handle select correctly', () => {
wrapper.instance().handleSelect(mockComponentMeasure(true, { refKey: 'test' }));
expect(router.push).toHaveBeenCalledWith({
pathname: '/dashboard',
- search: queryToSearch({ branch: undefined, id: 'test', code_scope: 'overall' })
+ search: queryToSearch({ branch: undefined, id: 'test', code_scope: 'overall' }),
});
wrapper.instance().handleSelect(mockComponentMeasure());
expect(router.push).toHaveBeenCalledWith({
pathname: '/code',
- search: queryToSearch({ id: 'foo', line: undefined, selected: 'foo' })
+ search: queryToSearch({ id: 'foo', line: undefined, selected: 'foo' }),
});
});
@@ -238,8 +238,8 @@ it('should render a warning message when user does not have access to all projec
const wrapper = shallowRender({
component: mockComponent({
qualifier: ComponentQualifier.Portfolio,
- canBrowseAllChildProjects: false
- })
+ canBrowseAllChildProjects: false,
+ }),
});
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot('Project page with warning');
@@ -248,7 +248,7 @@ it('should render a warning message when user does not have access to all projec
it.each([
[ComponentQualifier.Portfolio, true, false],
[ComponentQualifier.Project, false, false],
- [ComponentQualifier.Portfolio, false, true]
+ [ComponentQualifier.Portfolio, false, true],
])(
'should not render a warning message',
async (
@@ -259,8 +259,8 @@ it.each([
const wrapper = shallowRender({
component: mockComponent({
qualifier: componentQualifier,
- canBrowseAllChildProjects
- })
+ canBrowseAllChildProjects,
+ }),
});
await waitAndUpdate(wrapper);
expect(wrapper.find('Styled(Alert)').exists()).toBe(alertIsVisible);
@@ -274,7 +274,7 @@ function shallowRender(props: Partial<CodeApp['props']> = {}) {
breadcrumbs: [],
name: 'foo',
key: 'foo',
- qualifier: 'FOO'
+ qualifier: 'FOO',
}}
fetchBranchStatus={jest.fn()}
location={mockLocation({ search: queryToSearch({ branch: 'b', id: 'foo', line: '7' }) })}
diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentMeasure-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentMeasure-test.tsx
index 61062448e94..609338ed126 100644
--- a/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentMeasure-test.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentMeasure-test.tsx
@@ -32,7 +32,7 @@ it('renders correctly for leak values', () => {
shallow(
<ComponentMeasure
component={mockComponentMeasure(false, {
- measures: [mockMeasure({ metric: 'new_coverage' })]
+ measures: [mockMeasure({ metric: 'new_coverage' })],
})}
metric={mockMetric({ key: 'new_coverage', name: 'Coverage on New Code' })}
/>
@@ -54,9 +54,9 @@ it('should render correctly for releasability rating', () => {
expect(
shallowRender({
component: mockComponentMeasure(false, {
- measures: [mockMeasure({ metric: 'alert_status' })]
+ measures: [mockMeasure({ metric: 'alert_status' })],
}),
- metric: mockMetric({ key: 'releasability_rating' })
+ metric: mockMetric({ key: 'releasability_rating' }),
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentName-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentName-test.tsx
index b043f9e4f51..fe58c677223 100644
--- a/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentName-test.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/ComponentName-test.tsx
@@ -46,7 +46,7 @@ describe('#ComponentName', () => {
expect(
shallowRender({
component: mockComponentMeasure(true, { branch: 'foo' }),
- rootComponent: mockComponentMeasure(false, { qualifier: 'APP' })
+ rootComponent: mockComponentMeasure(false, { qualifier: 'APP' }),
})
).toMatchSnapshot();
expect(shallowRender({ newCodeSelected: true })).toMatchSnapshot();
@@ -57,13 +57,13 @@ describe('#ComponentName', () => {
expect(
shallowRender({
component: mockComponentMeasure(false, { name: 'src/main/ts/app', qualifier: 'DIR' }),
- previous: mockComponentMeasure(false, { name: 'src/main/ts/tests', qualifier: 'DIR' })
+ previous: mockComponentMeasure(false, { name: 'src/main/ts/tests', qualifier: 'DIR' }),
})
).toMatchSnapshot();
expect(
shallowRender({
component: mockComponentMeasure(false, { name: 'src', qualifier: 'DIR' }),
- previous: mockComponentMeasure(false, { name: 'lib', qualifier: 'DIR' })
+ previous: mockComponentMeasure(false, { name: 'lib', qualifier: 'DIR' }),
})
).toMatchSnapshot();
});
@@ -74,8 +74,8 @@ describe('#ComponentName', () => {
component: mockComponentMeasure(false, {
branch: 'foo',
refKey: 'src/main/ts/app',
- qualifier: ComponentQualifier.Project
- })
+ qualifier: ComponentQualifier.Project,
+ }),
})
).toMatchSnapshot();
expect(
@@ -83,9 +83,9 @@ describe('#ComponentName', () => {
component: mockComponentMeasure(false, {
branch: 'foo',
refKey: 'src/main/ts/app',
- qualifier: ComponentQualifier.Project
+ qualifier: ComponentQualifier.Project,
}),
- rootComponent: mockComponentMeasure(false, { qualifier: ComponentQualifier.Application })
+ rootComponent: mockComponentMeasure(false, { qualifier: ComponentQualifier.Application }),
})
).toMatchSnapshot();
@@ -93,9 +93,9 @@ describe('#ComponentName', () => {
shallowRender({
component: mockComponentMeasure(false, {
refKey: 'src/main/ts/app',
- qualifier: ComponentQualifier.Project
+ qualifier: ComponentQualifier.Project,
}),
- rootComponent: mockComponentMeasure(false, { qualifier: ComponentQualifier.Portfolio })
+ rootComponent: mockComponentMeasure(false, { qualifier: ComponentQualifier.Portfolio }),
})
).toMatchSnapshot();
});
@@ -105,15 +105,15 @@ describe('#ComponentName', () => {
[ComponentQualifier.Portfolio, 'refKey'],
[ComponentQualifier.SubPortfolio, 'refKey'],
[ComponentQualifier.Project, 'refKey'],
- [ComponentQualifier.Project, undefined]
+ [ComponentQualifier.Project, undefined],
])('should render breadcrumb correctly for %s', (qualifier, refKey) => {
expect(
shallowRender({
component: mockComponentMeasure(false, {
refKey,
- qualifier
+ qualifier,
}),
- unclickable: true
+ unclickable: true,
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx
index 58a1c131697..6e9f30e3031 100644
--- a/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/Components-test.tsx
@@ -27,7 +27,7 @@ const COMPONENT = {
key: 'foo',
name: 'Foo',
qualifier: ComponentQualifier.Project,
- branch: 'develop'
+ branch: 'develop',
};
const PORTFOLIO = { key: 'bar', name: 'Bar', qualifier: ComponentQualifier.Portfolio };
const METRICS = [{ id: '1', key: 'coverage', type: 'PERCENT', name: 'Coverage' }];
diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/Search-test.tsx b/server/sonar-web/src/main/js/apps/code/components/__tests__/Search-test.tsx
index 69e243d3ca9..4f6479fc28c 100644
--- a/server/sonar-web/src/main/js/apps/code/components/__tests__/Search-test.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/Search-test.tsx
@@ -35,8 +35,8 @@ jest.mock('../../../../api/components', () => {
getTree: jest.fn().mockResolvedValue({
baseComponent: mockTreeComponent(),
components: [mockComponent()],
- paging: { pageIndex: 0, pageSize: 5, total: 20 }
- })
+ paging: { pageIndex: 0, pageSize: 5, total: 20 },
+ }),
};
});
@@ -48,7 +48,7 @@ it('should render correcly', () => {
expect(
shallowRender({
component: mockComponent({ qualifier: ComponentQualifier.Portfolio }),
- location: mockLocation({ query: { id: 'foo', search: 'bar' } })
+ location: mockLocation({ query: { id: 'foo', search: 'bar' } }),
})
).toMatchSnapshot('new code toggle for portfolio disabled');
});
@@ -57,14 +57,14 @@ it('should search correct query on mount', async () => {
const onSearchResults = jest.fn();
const wrapper = shallowRender({
location: mockLocation({ query: { id: 'foo', search: 'bar' } }),
- onSearchResults
+ onSearchResults,
});
await waitAndUpdate(wrapper);
expect(getTree).toHaveBeenCalledWith({
component: 'my-project',
q: 'bar',
qualifiers: 'UTS,FIL',
- s: 'qualifier,name'
+ s: 'qualifier,name',
});
expect(onSearchResults).toHaveBeenCalledWith([
{
@@ -74,8 +74,8 @@ it('should search correct query on mount', async () => {
qualifier: 'TRK',
qualityGate: { isDefault: true, key: '30', name: 'Sonar way' },
qualityProfiles: [{ deleted: false, key: 'my-qp', language: 'ts', name: 'Sonar way' }],
- tags: []
- }
+ tags: [],
+ },
]);
});
@@ -88,21 +88,21 @@ it('should handle search correctly', async () => {
expect(router.replace).toHaveBeenCalledWith({
pathname: '/path',
query: {
- search: 'foo'
- }
+ search: 'foo',
+ },
});
expect(getTree).toHaveBeenCalledWith({
component: 'my-project',
q: 'foo',
qualifiers: 'UTS,FIL',
- s: 'qualifier,name'
+ s: 'qualifier,name',
});
wrapper.instance().handleQueryChange('');
await waitAndUpdate(wrapper);
expect(router.replace).toHaveBeenCalledWith({
pathname: '/path',
- query: {}
+ query: {},
});
expect(onSearchClear).toHaveBeenCalledWith();
});
diff --git a/server/sonar-web/src/main/js/apps/code/utils.ts b/server/sonar-web/src/main/js/apps/code/utils.ts
index 9476ce4f046..e784aafa641 100644
--- a/server/sonar-web/src/main/js/apps/code/utils.ts
+++ b/server/sonar-web/src/main/js/apps/code/utils.ts
@@ -29,7 +29,7 @@ import {
addComponentChildren,
getComponent as getComponentFromBucket,
getComponentBreadcrumbs,
- getComponentChildren
+ getComponentChildren,
} from './bucket';
const METRICS = [
@@ -39,7 +39,7 @@ const METRICS = [
MetricKey.code_smells,
MetricKey.security_hotspots,
MetricKey.coverage,
- MetricKey.duplicated_lines_density
+ MetricKey.duplicated_lines_density,
];
const APPLICATION_METRICS = [MetricKey.alert_status, ...METRICS];
@@ -50,7 +50,7 @@ const PORTFOLIO_METRICS = [
MetricKey.security_rating,
MetricKey.security_review_rating,
MetricKey.sqale_rating,
- MetricKey.ncloc
+ MetricKey.ncloc,
];
const NEW_PORTFOLIO_METRICS = [
@@ -59,7 +59,7 @@ const NEW_PORTFOLIO_METRICS = [
MetricKey.new_security_rating,
MetricKey.new_security_review_rating,
MetricKey.new_maintainability_rating,
- MetricKey.new_lines
+ MetricKey.new_lines,
];
const LEAK_METRICS = [
@@ -69,7 +69,7 @@ const LEAK_METRICS = [
MetricKey.code_smells,
MetricKey.security_hotspots,
MetricKey.new_coverage,
- MetricKey.new_duplicated_lines_density
+ MetricKey.new_duplicated_lines_density,
];
const PAGE_SIZE = 100;
@@ -84,7 +84,7 @@ function prepareChildren(r: any): Children {
return {
components: r.components,
total: r.paging.total,
- page: r.paging.pageIndex
+ page: r.paging.pageIndex,
};
}
@@ -93,7 +93,7 @@ export function showLeakMeasure(branchLike?: BranchLike) {
}
function skipRootDir(breadcrumbs: ComponentMeasure[]) {
- return breadcrumbs.filter(component => {
+ return breadcrumbs.filter((component) => {
return !(component.qualifier === 'DIR' && component.name === '/');
});
}
@@ -105,7 +105,7 @@ function storeChildrenBase(children: ComponentMeasure[]) {
function storeChildrenBreadcrumbs(parentComponentKey: string, children: Breadcrumb[]) {
const parentBreadcrumbs = getComponentBreadcrumbs(parentComponentKey);
if (parentBreadcrumbs) {
- children.forEach(child => {
+ children.forEach((child) => {
const breadcrumbs = [...parentBreadcrumbs, child];
addComponentBreadcrumbs(child.key, breadcrumbs);
});
@@ -153,7 +153,7 @@ function retrieveComponentBase(
return getComponent({
component: componentKey,
metricKeys: metrics.join(),
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
}).then(({ component }) => {
if (instance.mounted) {
addComponent(component);
@@ -173,21 +173,21 @@ export function retrieveComponentChildren(
return Promise.resolve({
components: existing.children,
total: existing.total,
- page: existing.page
+ page: existing.page,
});
}
const metrics = getCodeMetrics(qualifier, branchLike, {
- includeQGStatus: true
+ includeQGStatus: true,
});
return getChildren(componentKey, metrics, {
ps: PAGE_SIZE,
s: 'qualifier,name',
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
})
.then(prepareChildren)
- .then(r => {
+ .then((r) => {
if (instance.mounted) {
addComponentChildren(componentKey, r.components, r.total, r.page);
storeChildrenBase(r.components);
@@ -209,7 +209,7 @@ function retrieveComponentBreadcrumbs(
return getBreadcrumbs({ component, ...getBranchLikeQuery(branchLike) })
.then(skipRootDir)
- .then(breadcrumbs => {
+ .then((breadcrumbs) => {
if (instance.mounted) {
addComponentBreadcrumbs(component, breadcrumbs);
}
@@ -232,14 +232,14 @@ export function retrieveComponent(
return Promise.all([
retrieveComponentBase(componentKey, qualifier, instance, branchLike),
retrieveComponentChildren(componentKey, qualifier, instance, branchLike),
- retrieveComponentBreadcrumbs(componentKey, instance, branchLike)
- ]).then(r => {
+ retrieveComponentBreadcrumbs(componentKey, instance, branchLike),
+ ]).then((r) => {
return {
breadcrumbs: r[2],
component: r[0],
components: r[1].components,
page: r[1].page,
- total: r[1].total
+ total: r[1].total,
};
});
}
@@ -252,17 +252,17 @@ export function loadMoreChildren(
branchLike?: BranchLike
): Promise<Children> {
const metrics = getCodeMetrics(qualifier, branchLike, {
- includeQGStatus: true
+ includeQGStatus: true,
});
return getChildren(componentKey, metrics, {
ps: PAGE_SIZE,
p: page,
s: 'qualifier,name',
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
})
.then(prepareChildren)
- .then(r => {
+ .then((r) => {
if (instance.mounted) {
addComponentChildren(componentKey, r.components, r.total, r.page);
storeChildrenBase(r.components);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts b/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts
index af7cf936e55..7601614b04f 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts
+++ b/server/sonar-web/src/main/js/apps/coding-rules/__tests__/CodingRules-it.ts
@@ -88,23 +88,23 @@ it('should show hotspot rule section', async () => {
expect(screen.getByText('Introduction to this rule')).toBeInTheDocument();
expect(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.root_cause.SECURITY_HOTSPOT'
+ name: 'coding_rules.description_section.title.root_cause.SECURITY_HOTSPOT',
})
).toBeInTheDocument();
expect(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.assess_the_problem'
+ name: 'coding_rules.description_section.title.assess_the_problem',
})
).toBeInTheDocument();
expect(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
).toBeInTheDocument();
// Check that we render plain html
await user.click(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
);
expect(screen.getByRole('link', { name: 'Awsome Reading' })).toBeInTheDocument();
@@ -119,18 +119,18 @@ it('should show rule advanced section', async () => {
expect(screen.getByText('Introduction to this rule')).toBeInTheDocument();
expect(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.how_to_fix'
+ name: 'coding_rules.description_section.title.how_to_fix',
})
).toBeInTheDocument();
expect(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
).toBeInTheDocument();
// Check that we render plain html
await user.click(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
);
expect(screen.getByRole('link', { name: 'Awsome Reading' })).toBeInTheDocument();
@@ -144,13 +144,13 @@ it('should show rule advanced section with context', async () => {
).toBeInTheDocument();
expect(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.how_to_fix'
+ name: 'coding_rules.description_section.title.how_to_fix',
})
).toBeInTheDocument();
await user.click(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.how_to_fix'
+ name: 'coding_rules.description_section.title.how_to_fix',
})
);
expect(screen.getByRole('button', { name: 'Spring' })).toBeInTheDocument();
@@ -177,7 +177,7 @@ it('should show rule advanced section with context', async () => {
expect(screen.getByText('coding_rules.context.others.description.first')).toBeInTheDocument();
const productBoardLink = screen.getByRole('link', {
- name: 'opens_in_new_window coding_rules.context.others.feedback_description.link'
+ name: 'opens_in_new_window coding_rules.context.others.feedback_description.link',
});
expect(productBoardLink).toBeInTheDocument();
expect(productBoardLink).toHaveAttribute('target', '_blank');
@@ -226,7 +226,7 @@ it('should list all rules', async () => {
await waitFor(() => {
handler
.allRulesName()
- .forEach(name => expect(screen.getByRole('link', { name })).toBeInTheDocument());
+ .forEach((name) => expect(screen.getByRole('link', { name })).toBeInTheDocument());
});
});
@@ -238,8 +238,8 @@ it('should have all type facet', async () => {
'issue.type.BUG',
'issue.type.VULNERABILITY',
'issue.type.CODE_SMELL',
- 'issue.type.SECURITY_HOTSPOT'
- ].forEach(name => expect(screen.getByRole('checkbox', { name })).toBeInTheDocument());
+ 'issue.type.SECURITY_HOTSPOT',
+ ].forEach((name) => expect(screen.getByRole('checkbox', { name })).toBeInTheDocument());
});
});
@@ -253,7 +253,7 @@ it('select the correct quality profile for bulk change base on language search',
await user.click(await screen.findByRole('button', { name: 'bulk_change' }));
await user.click(await screen.findByRole('link', { name: 'coding_rules.activate_in…' }));
const dialog = screen.getByRole('dialog', {
- name: 'coding_rules.activate_in_quality_profile (2 coding_rules._rules)'
+ name: 'coding_rules.activate_in_quality_profile (2 coding_rules._rules)',
});
expect(dialog).toBeInTheDocument();
@@ -270,7 +270,7 @@ it('no quality profile for bulk cahnge base on language search', async () => {
await user.click(await screen.findByRole('button', { name: 'bulk_change' }));
await user.click(await screen.findByRole('link', { name: 'coding_rules.activate_in…' }));
const dialog = screen.getByRole('dialog', {
- name: 'coding_rules.activate_in_quality_profile (1 coding_rules._rules)'
+ name: 'coding_rules.activate_in_quality_profile (1 coding_rules._rules)',
});
expect(dialog).toBeInTheDocument();
@@ -291,7 +291,7 @@ it('should be able to bulk activate quality profile', async () => {
await user.click(await screen.findByRole('link', { name: 'coding_rules.activate_in…' }));
const dialog = screen.getByRole('dialog', {
- name: `coding_rules.activate_in_quality_profile (${handler.allRulesCount()} coding_rules._rules)`
+ name: `coding_rules.activate_in_quality_profile (${handler.allRulesCount()} coding_rules._rules)`,
});
expect(dialog).toBeInTheDocument();
@@ -322,7 +322,7 @@ it('should be able to bulk activate quality profile', async () => {
await user.click(await screen.findByRole('link', { name: 'coding_rules.activate_in…' }));
dialogScreen = within(
screen.getByRole('dialog', {
- name: `coding_rules.activate_in_quality_profile (${handler.allRulesCount()} coding_rules._rules)`
+ name: `coding_rules.activate_in_quality_profile (${handler.allRulesCount()} coding_rules._rules)`,
})
);
await user.click(dialogScreen.getByRole('textbox', { name: 'coding_rules.activate_in' }));
@@ -332,9 +332,9 @@ it('should be able to bulk activate quality profile', async () => {
await user.click(dialogScreen.getByRole('button', { name: 'apply' }));
expect(
dialogScreen.getByText(
- `coding_rules.bulk_change.warning.${selectQPWarning.name}.${
- selectQPWarning.languageName
- }.${handler.allRulesName().length - 1}.1`
+ `coding_rules.bulk_change.warning.${selectQPWarning.name}.${selectQPWarning.languageName}.${
+ handler.allRulesName().length - 1
+ }.1`
)
).toBeInTheDocument();
});
@@ -350,7 +350,7 @@ it('should be able to bulk deactivate quality profile', async () => {
await user.click(await screen.findByRole('link', { name: 'coding_rules.deactivate_in…' }));
const dialogScreen = within(
screen.getByRole('dialog', {
- name: `coding_rules.deactivate_in_quality_profile (${handler.allRulesCount()} coding_rules._rules)`
+ name: `coding_rules.deactivate_in_quality_profile (${handler.allRulesCount()} coding_rules._rules)`,
})
);
await user.click(dialogScreen.getByRole('textbox', { name: 'coding_rules.deactivate_in' }));
@@ -381,40 +381,40 @@ it('should show notification for rule advanced section and remove it after user
renderCodingRulesApp(mockLoggedInUser(), 'coding_rules?open=rule8');
await screen.findByRole('heading', {
level: 3,
- name: 'Awesome Python rule with education principles'
+ name: 'Awesome Python rule with education principles',
});
expect(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
).toBeInTheDocument();
await user.click(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
);
expect(screen.getByText('coding_rules.more_info.notification_message')).toBeInTheDocument();
expect(
screen.getByRole('button', {
- name: 'coding_rules.more_info.scroll_message'
+ name: 'coding_rules.more_info.scroll_message',
})
).toBeInTheDocument();
await user.click(
screen.getByRole('button', {
- name: 'coding_rules.more_info.scroll_message'
+ name: 'coding_rules.more_info.scroll_message',
})
);
// navigate away and come back
await user.click(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.how_to_fix'
+ name: 'coding_rules.description_section.title.how_to_fix',
})
);
await user.click(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
);
expect(screen.queryByText('coding_rules.more_info.notification_message')).not.toBeInTheDocument();
@@ -426,42 +426,42 @@ it('should show notification for rule advanced section and removes it when user
await screen.findByRole('heading', {
level: 3,
- name: 'Awesome Python rule with education principles'
+ name: 'Awesome Python rule with education principles',
});
expect(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
).toBeInTheDocument();
// navigate away and come back
await user.click(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.how_to_fix'
+ name: 'coding_rules.description_section.title.how_to_fix',
})
);
await user.click(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
);
expect(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
).toBeInTheDocument();
await user.click(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
);
expect(screen.getByText('coding_rules.more_info.notification_message')).toBeInTheDocument();
expect(
screen.getByRole('button', {
- name: 'coding_rules.more_info.scroll_message'
+ name: 'coding_rules.more_info.scroll_message',
})
).toBeInTheDocument();
@@ -470,12 +470,12 @@ it('should show notification for rule advanced section and removes it when user
// navigate away and come back
await user.click(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.how_to_fix'
+ name: 'coding_rules.description_section.title.how_to_fix',
})
);
await user.click(
screen.getByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
);
expect(screen.queryByText('coding_rules.more_info.notification_message')).not.toBeInTheDocument();
@@ -487,14 +487,14 @@ it('should not show notification for anonymous users', async () => {
await user.click(
await screen.findByRole('tab', {
- name: 'coding_rules.description_section.title.more_info'
+ name: 'coding_rules.description_section.title.more_info',
})
);
expect(screen.queryByText('coding_rules.more_info.notification_message')).not.toBeInTheDocument();
expect(
screen.queryByRole('button', {
- name: 'coding_rules.more_info.scroll_message'
+ name: 'coding_rules.more_info.scroll_message',
})
).not.toBeInTheDocument();
});
@@ -506,7 +506,7 @@ function renderCodingRulesApp(currentUser?: CurrentUser, navigateTo?: string) {
languages: {
js: { key: 'js', name: 'JavaScript' },
java: { key: 'java', name: 'Java' },
- c: { key: 'c', name: 'C' }
- }
+ c: { key: 'c', name: 'C' },
+ },
});
}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationButton.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationButton.tsx
index 02f78275cf9..169c5b204da 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationButton.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationButton.tsx
@@ -54,7 +54,8 @@ export default class ActivationButton extends React.PureComponent<Props, State>
<Button
className={this.props.className}
id="coding-rules-quality-profile-activate"
- onClick={this.handleButtonClick}>
+ onClick={this.handleButtonClick}
+ >
{this.props.buttonText}
</Button>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx
index a18659665cf..e9dd31a175e 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/ActivationFormModal.tsx
@@ -62,7 +62,7 @@ export default class ActivationFormModal extends React.PureComponent<Props, Stat
params: this.getParams(props),
profile: profilesWithDepth.length > 0 ? profilesWithDepth[0] : undefined,
severity: props.activation ? props.activation.severity : props.rule.severity,
- submitting: false
+ submitting: false,
};
}
@@ -93,16 +93,16 @@ export default class ActivationFormModal extends React.PureComponent<Props, Stat
getQualityProfilesWithDepth = ({ profiles } = this.props) => {
return sortProfiles(
profiles.filter(
- profile =>
+ (profile) =>
!profile.isBuiltIn &&
profile.actions &&
profile.actions.edit &&
profile.language === this.props.rule.lang
)
- ).map(profile => ({
+ ).map((profile) => ({
...profile,
// Decrease depth by 1, so the top level starts at 0
- depth: profile.depth - 1
+ depth: profile.depth - 1,
}));
};
@@ -113,7 +113,7 @@ export default class ActivationFormModal extends React.PureComponent<Props, Stat
key: this.state.profile?.key || '',
params: this.state.params,
rule: this.props.rule.key,
- severity: this.state.severity
+ severity: this.state.severity,
};
activateRule(data)
.then(() => this.props.onDone(data.severity))
@@ -176,7 +176,7 @@ export default class ActivationFormModal extends React.PureComponent<Props, Stat
isClearable={false}
isDisabled={submitting || profilesWithDepth.length === 1}
onChange={this.handleProfileChange}
- getOptionLabel={p => ' '.repeat(p.depth) + p.name}
+ getOptionLabel={(p) => ' '.repeat(p.depth) + p.name}
options={profilesWithDepth}
value={profile}
/>
@@ -195,7 +195,7 @@ export default class ActivationFormModal extends React.PureComponent<Props, Stat
<p className="note">{translate('coding_rules.custom_rule.activation_notice')}</p>
</div>
) : (
- params.map(param => (
+ params.map((param) => (
<div className="modal-field" key={param.key}>
<label title={param.key}>{param.key}</label>
{param.type === 'TEXT' ? (
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx
index fa8ce209274..8b06ba939e5 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx
@@ -39,7 +39,7 @@ import {
addSideBarClass,
addWhitePageClass,
removeSideBarClass,
- removeWhitePageClass
+ removeWhitePageClass,
} from '../../../helpers/pages';
import { scrollToElement } from '../../../helpers/scrolling';
import { SecurityStandard } from '../../../types/security';
@@ -49,7 +49,7 @@ import {
shouldOpenSonarSourceSecurityFacet,
shouldOpenStandardsChildFacet,
shouldOpenStandardsFacet,
- STANDARDS
+ STANDARDS,
} from '../../issues/utils';
import {
Activation,
@@ -66,7 +66,7 @@ import {
parseQuery,
Query,
serializeQuery,
- shouldRequestFacet
+ shouldRequestFacet,
} from '../query';
import '../styles.css';
import BulkChange from './BulkChange';
@@ -116,11 +116,11 @@ export class App extends React.PureComponent<Props, State> {
sansTop25: shouldOpenStandardsChildFacet({}, query, SecurityStandard.SANS_TOP25),
sonarsourceSecurity: shouldOpenSonarSourceSecurityFacet({}, query),
standards: shouldOpenStandardsFacet({}, query),
- types: true
+ types: true,
},
referencedProfiles: {},
referencedRepositories: {},
- rules: []
+ rules: [],
};
}
@@ -184,7 +184,7 @@ export class App extends React.PureComponent<Props, State> {
getOpenRule = (rules: Rule[]) => {
const open = getOpen(this.props.location.query);
- return open && rules.find(rule => rule.key === open);
+ return open && rules.find((rule) => rule.key === open);
};
getSelectedRuleKey = (props: Props) => {
@@ -209,7 +209,7 @@ export class App extends React.PureComponent<Props, State> {
'status',
'sysTags',
'tags',
- 'templateKey'
+ 'templateKey',
];
if (parseQuery(this.props.location.query).profile) {
fields.push('actives', 'params');
@@ -222,7 +222,7 @@ export class App extends React.PureComponent<Props, State> {
facets: this.getFacetsToFetch().join(),
ps: PAGE_SIZE,
s: 'name',
- ...this.props.location.query
+ ...this.props.location.query,
});
stopLoading = () => {
@@ -238,7 +238,7 @@ export class App extends React.PureComponent<Props, State> {
this.setState({
canWrite,
referencedProfiles: keyBy(profiles, 'key'),
- referencedRepositories: keyBy(repositories, 'key')
+ referencedRepositories: keyBy(repositories, 'key'),
});
this.fetchFirstRules();
},
@@ -268,7 +268,7 @@ export class App extends React.PureComponent<Props, State> {
facets,
loading: false,
paging,
- rules
+ rules,
});
}
}, this.stopLoading);
@@ -286,7 +286,7 @@ export class App extends React.PureComponent<Props, State> {
actives: { ...state.actives, ...actives },
loading: false,
paging,
- rules: [...state.rules, ...rules]
+ rules: [...state.rules, ...rules],
}));
}
},
@@ -298,14 +298,14 @@ export class App extends React.PureComponent<Props, State> {
fetchFacet = (facet: FacetKey) => {
this.makeFetchRequest({ ps: 1, facets: getServerFacet(facet) }).then(({ facets }) => {
if (this.mounted) {
- this.setState(state => ({ facets: { ...state.facets, ...facets }, loading: false }));
+ this.setState((state) => ({ facets: { ...state.facets, ...facets }, loading: false }));
}
}, this.stopLoading);
};
getSelectedIndex = ({ rules } = this.state) => {
const selected = this.getSelectedRuleKey(this.props) || getOpen(this.props.location.query);
- const index = rules.findIndex(rule => rule.key === selected);
+ const index = rules.findIndex((rule) => rule.key === selected);
return index !== -1 ? index : undefined;
};
@@ -347,15 +347,15 @@ export class App extends React.PureComponent<Props, State> {
pathname: this.props.location.pathname,
query: {
...serializeQuery(parseQuery(this.props.location.query)),
- open: rule
- }
+ open: rule,
+ },
});
routeSelectedRulePath = (rule?: string) => {
if (rule) {
this.props.router.replace({
pathname: this.props.location.pathname,
- query: { ...serializeQuery(parseQuery(this.props.location.query)), selected: rule }
+ query: { ...serializeQuery(parseQuery(this.props.location.query)), selected: rule },
});
}
};
@@ -382,8 +382,8 @@ export class App extends React.PureComponent<Props, State> {
query: {
...serializeQuery(parseQuery(this.props.location.query)),
selected: this.getOpenRule(this.state.rules)?.key || this.getSelectedRuleKey(this.props),
- open: undefined
- }
+ open: undefined,
+ },
});
this.scrollToSelectedRule(false);
};
@@ -415,8 +415,8 @@ export class App extends React.PureComponent<Props, State> {
};
closeFacet = (facet: string) =>
- this.setState(state => ({
- openFacets: { ...state.openFacets, [facet]: false }
+ this.setState((state) => ({
+ openFacets: { ...state.openFacets, [facet]: false },
}));
handleRuleOpen = (ruleKey: string) => {
@@ -441,24 +441,24 @@ export class App extends React.PureComponent<Props, State> {
handleFilterChange = (changes: Partial<Query>) => {
this.props.router.push({
pathname: this.props.location.pathname,
- query: serializeQuery({ ...parseQuery(this.props.location.query), ...changes })
+ query: serializeQuery({ ...parseQuery(this.props.location.query), ...changes }),
});
this.setState(({ openFacets }) => ({
openFacets: {
...openFacets,
sonarsourceSecurity: shouldOpenSonarSourceSecurityFacet(openFacets, changes),
- standards: shouldOpenStandardsFacet(openFacets, changes)
- }
+ standards: shouldOpenStandardsFacet(openFacets, changes),
+ },
}));
};
handleFacetToggle = (property: string) => {
- this.setState(state => {
+ this.setState((state) => {
const willOpenProperty = !state.openFacets[property];
const newState = {
loading: state.loading,
- openFacets: { ...state.openFacets, [property]: willOpenProperty }
+ openFacets: { ...state.openFacets, [property]: willOpenProperty },
};
// Try to open sonarsource security "subfacet" by default if the standard facet is open
@@ -499,8 +499,8 @@ export class App extends React.PureComponent<Props, State> {
if (parseQuery(this.props.location.query).ruleKey === ruleKey) {
this.handleReset();
} else {
- this.setState(state => {
- const rules = state.rules.filter(rule => rule.key !== ruleKey);
+ this.setState((state) => {
+ const rules = state.rules.filter((rule) => rule.key !== ruleKey);
const selectedIndex = this.getSelectedIndex(state);
const selected = this.pickRuleAround(rules, selectedIndex);
this.routeSelectedRulePath(selected);
@@ -521,7 +521,7 @@ export class App extends React.PureComponent<Props, State> {
});
handleRuleDeactivate = (profile: string, rule: string) =>
- this.setState(state => {
+ this.setState((state) => {
const { actives } = state;
if (actives && actives[rule]) {
const newRule = { ...actives[rule] };
@@ -539,7 +539,7 @@ export class App extends React.PureComponent<Props, State> {
const { currentUser } = this.props;
const { canWrite, paging, referencedProfiles } = this.state;
const query = parseQuery(this.props.location.query);
- const canUpdate = canWrite || Object.values(referencedProfiles).some(p => p.actions?.edit);
+ const canUpdate = canWrite || Object.values(referencedProfiles).some((p) => p.actions?.edit);
if (!isLoggedIn(currentUser) || !canUpdate) {
return <div />;
@@ -613,7 +613,8 @@ export class App extends React.PureComponent<Props, State> {
<a
className="js-back display-inline-flex-center link-no-underline"
href="#"
- onClick={this.handleBack}>
+ onClick={this.handleBack}
+ >
<BackIcon className="spacer-right" />
{usingPermalink
? translate('coding_rules.see_all')
@@ -652,7 +653,7 @@ export class App extends React.PureComponent<Props, State> {
) : (
<>
<div role="tab">
- {rules.map(rule => (
+ {rules.map((rule) => (
<RuleListItem
activation={this.getRuleActivation(rule.key)}
isLoggedIn={isLoggedIn(this.props.currentUser)}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChange.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChange.tsx
index 5ddf87e1a90..e7c1d690dc0 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChange.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChange.tsx
@@ -76,7 +76,7 @@ export default class BulkChange extends React.PureComponent<Props, State> {
render() {
// show "Bulk Change" button only if user is admin of at least one QP
- const canBulkChange = Object.values(this.props.referencedProfiles).some(profile =>
+ const canBulkChange = Object.values(this.props.referencedProfiles).some((profile) =>
Boolean(profile.actions && profile.actions.edit)
);
if (!canBulkChange) {
@@ -128,7 +128,8 @@ export default class BulkChange extends React.PureComponent<Props, State> {
</li>
)}
</ul>
- }>
+ }
+ >
<Button className="js-bulk-change">{translate('bulk_change')}</Button>
</Dropdown>
{this.state.modal && this.state.action && (
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx
index 107b054e0fd..5792550e5fb 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/BulkChangeModal.tsx
@@ -72,7 +72,7 @@ export class BulkChangeModal extends React.PureComponent<Props, State> {
modalWrapperNode: null,
results: [],
selectedProfiles,
- submitting: false
+ submitting: false,
};
}
@@ -95,11 +95,11 @@ export class BulkChangeModal extends React.PureComponent<Props, State> {
getAvailableQualityProfiles = ({ query, referencedProfiles } = this.props) => {
let profiles = Object.values(referencedProfiles);
if (query.languages.length > 0) {
- profiles = profiles.filter(profile => query.languages.includes(profile.language));
+ profiles = profiles.filter((profile) => query.languages.includes(profile.language));
}
return profiles
- .filter(profile => profile.actions && profile.actions.edit)
- .filter(profile => !profile.isBuiltIn);
+ .filter((profile) => profile.actions && profile.actions.edit)
+ .filter((profile) => !profile.isBuiltIn);
};
processResponse = (profile: string, response: any) => {
@@ -107,9 +107,9 @@ export class BulkChangeModal extends React.PureComponent<Props, State> {
const result: ActivationResult = {
failed: response.failed || 0,
profile,
- succeeded: response.succeeded || 0
+ succeeded: response.succeeded || 0,
};
- this.setState(state => ({ results: [...state.results, result] }));
+ this.setState((state) => ({ results: [...state.results, result] }));
}
};
@@ -126,17 +126,17 @@ export class BulkChangeModal extends React.PureComponent<Props, State> {
// otherwise take all profiles selected in the dropdown
const profiles: string[] = this.props.profile
? [this.props.profile.key]
- : this.state.selectedProfiles.map(p => p.key);
+ : this.state.selectedProfiles.map((p) => p.key);
for (const profile of profiles) {
looper = looper
.then(() =>
method({
...data,
- targetKey: profile
+ targetKey: profile,
})
)
- .then(response => this.processResponse(profile, response));
+ .then((response) => this.processResponse(profile, response));
}
return looper;
};
@@ -198,8 +198,8 @@ export class BulkChangeModal extends React.PureComponent<Props, State> {
menuPortalTarget={this.state.modalWrapperNode}
menuPosition="fixed"
noOptionsMessage={() => translate('coding_rules.bulk_change.no_quality_profile')}
- getOptionLabel={profile => `${profile.name} - ${profile.languageName}`}
- getOptionValue={profile => profile.key}
+ getOptionLabel={(profile) => `${profile.name} - ${profile.languageName}`}
+ getOptionValue={(profile) => profile.key}
onChange={this.handleProfileSelect}
options={profiles}
value={this.state.selectedProfiles}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
index 921ad40aae3..74526a0d1b4 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
@@ -77,7 +77,7 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
severity: (props.customRule && props.customRule.severity) || props.templateRule.severity,
status: (props.customRule && props.customRule.status) || props.templateRule.status,
submitting: false,
- type: (props.customRule && props.customRule.type) || props.templateRule.type
+ type: (props.customRule && props.customRule.type) || props.templateRule.type,
};
}
@@ -92,14 +92,14 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
prepareRequest = () => {
const { customRule, templateRule } = this.props;
const params = Object.keys(this.state.params)
- .map(key => `${key}=${csvEscape(this.state.params[key])}`)
+ .map((key) => `${key}=${csvEscape(this.state.params[key])}`)
.join(';');
const ruleData = {
markdown_description: this.state.description,
name: this.state.name,
params,
severity: this.state.severity,
- status: this.state.status
+ status: this.state.status,
};
return customRule
? updateRule({ ...ruleData, key: customRule.key })
@@ -108,7 +108,7 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
custom_key: this.state.key,
prevent_reactivation: !this.state.reactivating,
template_key: templateRule.key,
- type: this.state.type
+ type: this.state.type,
});
};
@@ -116,7 +116,7 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
event.preventDefault();
this.setState({ submitting: true });
this.prepareRequest().then(
- newRuleDetails => {
+ (newRuleDetails) => {
if (this.mounted) {
this.setState({ submitting: false });
this.props.onDone(newRuleDetails);
@@ -132,9 +132,9 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
handleNameChange = (event: React.SyntheticEvent<HTMLInputElement>) => {
const { value: name } = event.currentTarget;
- this.setState(state => ({
+ this.setState((state) => ({
name,
- key: state.keyModifiedByUser ? state.key : latinize(name).replace(/[^A-Za-z0-9]/g, '_')
+ key: state.keyModifiedByUser ? state.key : latinize(name).replace(/[^A-Za-z0-9]/g, '_'),
}));
};
@@ -230,9 +230,9 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
};
renderTypeField = () => {
- const ruleTypeOption = RULE_TYPES.map(type => ({
+ const ruleTypeOption = RULE_TYPES.map((type) => ({
label: translate('issue.type', type),
- value: type
+ value: type,
}));
return (
<div className="modal-field flex-1 spacer-right">
@@ -245,10 +245,10 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
onChange={this.handleTypeChange}
components={{
Option: this.renderTypeOption,
- SingleValue: this.renderTypeSingleValue
+ SingleValue: this.renderTypeSingleValue,
}}
options={ruleTypeOption}
- value={ruleTypeOption.find(t => t.value === this.state.type)}
+ value={ruleTypeOption.find((t) => t.value === this.state.type)}
/>
</div>
);
@@ -267,9 +267,9 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
);
renderStatusField = () => {
- const statusesOptions = RULE_STATUSES.map(status => ({
+ const statusesOptions = RULE_STATUSES.map((status) => ({
label: translate('rules.status', status),
- value: status
+ value: status,
}));
return (
<div className="modal-field flex-1">
@@ -283,7 +283,7 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
onChange={this.handleStatusChange}
options={statusesOptions}
isSearchable={false}
- value={statusesOptions.find(s => s.value === this.state.status)}
+ value={statusesOptions.find((s) => s.value === this.state.status)}
/>
</div>
);
@@ -369,7 +369,8 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat
<ResetButtonLink
disabled={submitting}
id="coding-rules-custom-rule-creation-cancel"
- onClick={this.props.onClose}>
+ onClick={this.props.onClose}
+ >
{translate('cancel')}
</ResetButtonLink>
</div>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/Facet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/Facet.tsx
index f77224b01c7..b8c4024620a 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/Facet.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/Facet.tsx
@@ -100,14 +100,15 @@ export default class Facet extends React.PureComponent<Props> {
(stats &&
sortBy(
Object.keys(stats),
- key => -stats[key],
- key => renderTextName(key).toLowerCase()
+ (key) => -stats[key],
+ (key) => renderTextName(key).toLowerCase()
));
return (
<FacetBox
className={classNames({ 'search-navigator-facet-box-forbidden': disabled })}
- property={this.props.property}>
+ property={this.props.property}
+ >
<FacetHeader
name={translate('coding_rules.facet', this.props.property)}
disabled={disabled}
@@ -115,7 +116,8 @@ export default class Facet extends React.PureComponent<Props> {
onClear={this.handleClear}
onClick={disabled ? undefined : this.handleHeaderClick}
open={this.props.open && !disabled}
- values={values}>
+ values={values}
+ >
{this.props.children}
</FacetHeader>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/LanguageFacet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/LanguageFacet.tsx
index f6f34f1b1fd..aacbc1754e7 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/LanguageFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/LanguageFacet.tsx
@@ -39,7 +39,7 @@ export class LanguageFacet extends React.PureComponent<Props> {
handleSearch = (query: string) => {
const options = this.getAllPossibleOptions();
- const results = options.filter(language =>
+ const results = options.filter((language) =>
language.name.toLowerCase().includes(query.toLowerCase())
);
const paging = { pageIndex: 1, pageSize: results.length, total: results.length };
@@ -53,7 +53,7 @@ export class LanguageFacet extends React.PureComponent<Props> {
// for such language we don't know their display name, so let's just use their key
// and make sure we reference each language only once
return uniqBy<Language>(
- [...Object.values(languages), ...Object.keys(stats).map(key => ({ key, name: key }))],
+ [...Object.values(languages), ...Object.keys(stats).map((key) => ({ key, name: key }))],
(language: Language) => language.key
);
};
@@ -70,8 +70,8 @@ export class LanguageFacet extends React.PureComponent<Props> {
facetHeader={translate('coding_rules.facet.languages')}
fetching={false}
getFacetItemText={this.getLanguageName}
- getSearchResultKey={language => language.key}
- getSearchResultText={language => language.name}
+ getSearchResultKey={(language) => language.key}
+ getSearchResultText={(language) => language.name}
minSearchLength={1}
onChange={this.props.onChange}
onSearch={this.handleSearch}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/ProfileFacet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/ProfileFacet.tsx
index a78cbf07a81..b6103a706d3 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/ProfileFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/ProfileFacet.tsx
@@ -47,7 +47,7 @@ export default class ProfileFacet extends React.PureComponent<Props> {
this.props.onChange({
activation: this.props.activation === undefined ? true : this.props.activation,
compareToProfile: undefined,
- profile: newValue
+ profile: newValue,
});
};
@@ -59,7 +59,7 @@ export default class ProfileFacet extends React.PureComponent<Props> {
activationSeverities: [],
compareToProfile: undefined,
inheritance: undefined,
- profile: undefined
+ profile: undefined,
});
handleActiveClick = (event: React.SyntheticEvent<HTMLElement>) => {
@@ -112,21 +112,23 @@ export default class ProfileFacet extends React.PureComponent<Props> {
<span
aria-checked={activation}
className={classNames('js-active', 'facet-toggle', 'facet-toggle-green', {
- 'facet-toggle-active': activation
+ 'facet-toggle-active': activation,
})}
onClick={isCompare ? this.stopPropagation : this.handleActiveClick}
role="radio"
- tabIndex={-1}>
+ tabIndex={-1}
+ >
active
</span>
<span
aria-checked={!activation}
className={classNames('js-inactive', 'facet-toggle', 'facet-toggle-red', {
- 'facet-toggle-active': !activation
+ 'facet-toggle-active': !activation,
})}
onClick={isCompare ? this.stopPropagation : this.handleInactiveClick}
role="radio"
- tabIndex={-1}>
+ tabIndex={-1}
+ >
inactive
</span>
</>
@@ -154,12 +156,12 @@ export default class ProfileFacet extends React.PureComponent<Props> {
const { languages, referencedProfiles } = this.props;
let profiles = Object.values(referencedProfiles);
if (languages.length > 0) {
- profiles = profiles.filter(profile => languages.includes(profile.language));
+ profiles = profiles.filter((profile) => languages.includes(profile.language));
}
profiles = sortBy(
profiles,
- profile => profile.name.toLowerCase(),
- profile => profile.languageName
+ (profile) => profile.name.toLowerCase(),
+ (profile) => profile.languageName
);
return (
@@ -169,15 +171,16 @@ export default class ProfileFacet extends React.PureComponent<Props> {
onClear={this.handleClear}
onClick={this.handleHeaderClick}
open={this.props.open}
- values={this.getTextValue()}>
+ values={this.getTextValue()}
+ >
<DocumentationTooltip
className="spacer-left"
content={translate('coding_rules.facet.qprofile.help')}
links={[
{
href: '/instance-administration/quality-profiles/',
- label: translate('coding_rules.facet.qprofile.link')
- }
+ label: translate('coding_rules.facet.qprofile.link'),
+ },
]}
/>
</FacetHeader>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RepositoryFacet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RepositoryFacet.tsx
index 550ec661b1a..e02e587ecef 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RepositoryFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RepositoryFacet.tsx
@@ -43,10 +43,10 @@ export class RepositoryFacet extends React.PureComponent<Props> {
};
handleSearch(query: string) {
- return getRuleRepositories({ q: query }).then(repos => {
+ return getRuleRepositories({ q: query }).then((repos) => {
return {
paging: { pageIndex: 1, pageSize: repos.length, total: repos.length },
- results: repos.map(r => r.key)
+ results: repos.map((r) => r.key),
};
});
}
@@ -90,7 +90,7 @@ export class RepositoryFacet extends React.PureComponent<Props> {
facetHeader={translate('coding_rules.facet.repositories')}
fetching={false}
getFacetItemText={this.renderTextName}
- getSearchResultKey={rep => rep}
+ getSearchResultKey={(rep) => rep}
getSearchResultText={this.renderTextName}
onChange={this.props.onChange}
onSearch={this.handleSearch}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx
index 02aa57b0a59..59ded109624 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx
@@ -78,7 +78,7 @@ export default class RuleDetails extends React.PureComponent<Props, State> {
fetchRuleDetails = () => {
return getRuleDetails({
actives: true,
- key: this.props.ruleKey
+ key: this.props.ruleKey,
}).then(
({ actives, rule }) => {
if (this.mounted) {
@@ -102,15 +102,15 @@ export default class RuleDetails extends React.PureComponent<Props, State> {
handleTagsChange = (tags: string[]) => {
// optimistic update
const oldTags = this.state.ruleDetails && this.state.ruleDetails.tags;
- this.setState(state =>
+ this.setState((state) =>
state.ruleDetails ? { ruleDetails: { ...state.ruleDetails, tags } } : null
);
updateRule({
key: this.props.ruleKey,
- tags: tags.join()
+ tags: tags.join(),
}).catch(() => {
if (this.mounted) {
- this.setState(state =>
+ this.setState((state) =>
state.ruleDetails ? { ruleDetails: { ...state.ruleDetails, tags: oldTags } } : null
);
}
@@ -121,7 +121,7 @@ export default class RuleDetails extends React.PureComponent<Props, State> {
return this.fetchRuleDetails().then(() => {
const { ruleKey, selectedProfile } = this.props;
if (selectedProfile && this.state.actives) {
- const active = this.state.actives.find(active => active.qProfile === selectedProfile.key);
+ const active = this.state.actives.find((active) => active.qProfile === selectedProfile.key);
if (active) {
this.props.onActivate(selectedProfile.key, ruleKey, active);
}
@@ -135,7 +135,7 @@ export default class RuleDetails extends React.PureComponent<Props, State> {
if (
selectedProfile &&
this.state.actives &&
- !this.state.actives.find(active => active.qProfile === selectedProfile.key)
+ !this.state.actives.find((active) => active.qProfile === selectedProfile.key)
) {
this.props.onDeactivate(selectedProfile.key, ruleKey);
}
@@ -187,12 +187,14 @@ export default class RuleDetails extends React.PureComponent<Props, State> {
<CustomRuleButton
customRule={ruleDetails}
onDone={this.handleRuleChange}
- templateRule={ruleDetails}>
+ templateRule={ruleDetails}
+ >
{({ onClick }) => (
<Button
className="js-edit-custom"
id="coding-rules-detail-custom-rule-change"
- onClick={onClick}>
+ onClick={onClick}
+ >
{translate('edit')}
</Button>
)}
@@ -205,13 +207,15 @@ export default class RuleDetails extends React.PureComponent<Props, State> {
ruleDetails.name
)}
modalHeader={translate('coding_rules.delete_rule')}
- onConfirm={this.handleDelete}>
+ onConfirm={this.handleDelete}
+ >
{({ onClick }) => (
<>
<Button
className="button-red spacer-left js-delete"
id="coding-rules-detail-rule-delete"
- onClick={onClick}>
+ onClick={onClick}
+ >
{translate('delete')}
</Button>
<HelpTooltip
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx
index 7d3830b3b16..1f372c55f0c 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsCustomRules.tsx
@@ -63,7 +63,7 @@ export default class RuleDetailsCustomRules extends React.PureComponent<Props, S
this.setState({ loading: true });
searchRules({
f: 'name,severity,params',
- template_key: this.props.ruleDetails.key
+ template_key: this.props.ruleDetails.key,
}).then(
({ rules }) => {
if (this.mounted) {
@@ -81,7 +81,7 @@ export default class RuleDetailsCustomRules extends React.PureComponent<Props, S
handleRuleCreate = (newRuleDetails: RuleDetails) => {
if (this.mounted) {
this.setState(({ rules = [] }: State) => ({
- rules: [...rules, newRuleDetails]
+ rules: [...rules, newRuleDetails],
}));
}
};
@@ -90,7 +90,7 @@ export default class RuleDetailsCustomRules extends React.PureComponent<Props, S
return deleteRule({ key: ruleKey }).then(() => {
if (this.mounted) {
this.setState(({ rules = [] }) => ({
- rules: rules.filter(rule => rule.key !== ruleKey)
+ rules: rules.filter((rule) => rule.key !== ruleKey),
}));
}
});
@@ -109,8 +109,8 @@ export default class RuleDetailsCustomRules extends React.PureComponent<Props, S
<td className="coding-rules-detail-list-parameters">
{rule.params &&
rule.params
- .filter(param => param.defaultValue)
- .map(param => (
+ .filter((param) => param.defaultValue)
+ .map((param) => (
<div className="coding-rules-detail-list-parameter" key={param.key}>
<span className="key">{param.key}</span>
<span className="sep">:&nbsp;</span>
@@ -129,7 +129,8 @@ export default class RuleDetailsCustomRules extends React.PureComponent<Props, S
isDestructive={true}
modalBody={translateWithParameters('coding_rules.delete.custom.confirm', rule.name)}
modalHeader={translate('coding_rules.delete_rule')}
- onConfirm={this.handleRuleDelete}>
+ onConfirm={this.handleRuleDelete}
+ >
{({ onClick }) => (
<Button className="button-red js-delete-custom-rule" onClick={onClick}>
{translate('delete')}
@@ -162,7 +163,7 @@ export default class RuleDetailsCustomRules extends React.PureComponent<Props, S
<DeferredSpinner className="spacer-left" loading={loading}>
{rules.length > 0 && (
<table className="coding-rules-detail-list" id="coding-rules-detail-custom-rules">
- <tbody>{sortBy(rules, rule => rule.name).map(this.renderRule)}</tbody>
+ <tbody>{sortBy(rules, (rule) => rule.name).map(this.renderRule)}</tbody>
</table>
)}
</DeferredSpinner>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsDescription.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsDescription.tsx
index 060277b5577..795a6b0e6c3 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsDescription.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsDescription.tsx
@@ -47,7 +47,7 @@ export default class RuleDetailsDescription extends React.PureComponent<Props, S
description: '',
descriptionForm: false,
submitting: false,
- removeDescriptionModal: false
+ removeDescriptionModal: false,
};
componentDidMount() {
@@ -85,9 +85,9 @@ export default class RuleDetailsDescription extends React.PureComponent<Props, S
updateRule({
key: this.props.ruleDetails.key,
- markdown_note: text
+ markdown_note: text,
}).then(
- ruleDetails => {
+ (ruleDetails) => {
this.props.onChange(ruleDetails);
if (this.mounted) {
this.setState({ submitting: false, descriptionForm: false });
@@ -105,7 +105,7 @@ export default class RuleDetailsDescription extends React.PureComponent<Props, S
this.setState({
// set description` to the current `mdNote` each time the form is open
description: this.props.ruleDetails.mdNote || '',
- descriptionForm: true
+ descriptionForm: true,
});
};
@@ -121,7 +121,8 @@ export default class RuleDetailsDescription extends React.PureComponent<Props, S
{this.props.canWrite && (
<Button
id="coding-rules-detail-extend-description"
- onClick={this.handleExtendDescriptionClick}>
+ onClick={this.handleExtendDescriptionClick}
+ >
{translate('coding_rules.extend_description')}
</Button>
)}
@@ -149,7 +150,8 @@ export default class RuleDetailsDescription extends React.PureComponent<Props, S
<Button
disabled={this.state.submitting}
id="coding-rules-detail-extend-description-submit"
- onClick={this.handleSaveClick}>
+ onClick={this.handleSaveClick}
+ >
{translate('save')}
</Button>
{this.props.ruleDetails.mdNote !== undefined && (
@@ -158,7 +160,8 @@ export default class RuleDetailsDescription extends React.PureComponent<Props, S
className="button-red spacer-left"
disabled={this.state.submitting}
id="coding-rules-detail-extend-description-remove"
- onClick={this.handleRemoveDescriptionClick}>
+ onClick={this.handleRemoveDescriptionClick}
+ >
{translate('remove')}
</Button>
{this.state.removeDescriptionModal && (
@@ -173,7 +176,8 @@ export default class RuleDetailsDescription extends React.PureComponent<Props, S
className="spacer-left"
disabled={this.state.submitting}
id="coding-rules-detail-extend-description-cancel"
- onClick={this.handleCancelClick}>
+ onClick={this.handleCancelClick}
+ >
{translate('cancel')}
</ResetButtonLink>
{this.state.submitting && <i className="spinner spacer-left" />}
@@ -204,7 +208,7 @@ export default class RuleDetailsDescription extends React.PureComponent<Props, S
: undefined;
const introductionSection = ruleDetails.descriptionSections?.find(
- section => section.key === RuleDescriptionSections.INTRODUCTION
+ (section) => section.key === RuleDescriptionSections.INTRODUCTION
)?.content;
return (
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx
index 8ca75699c7b..d4c8670df5f 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import { getFacet } from '../../../api/issues';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import Link from '../../../components/common/Link';
import Tooltip from '../../../components/controls/Tooltip';
@@ -68,14 +68,14 @@ export class RuleDetailsIssues extends React.PureComponent<Props, State> {
fetchIssues = () => {
const {
- ruleDetails: { key }
+ ruleDetails: { key },
} = this.props;
this.setState({ loading: true });
getFacet(
{
resolved: 'false',
- rules: key
+ rules: key,
},
'projects'
).then(
@@ -84,7 +84,7 @@ export class RuleDetailsIssues extends React.PureComponent<Props, State> {
const { components = [], paging } = response;
const projects = [];
for (const item of facet) {
- const project = components.find(component => component.key === item.val);
+ const project = components.find((component) => component.key === item.val);
if (project) {
projects.push({ count: item.count, key: project.key, name: project.name });
}
@@ -102,7 +102,7 @@ export class RuleDetailsIssues extends React.PureComponent<Props, State> {
renderTotal = () => {
const {
- ruleDetails: { key }
+ ruleDetails: { key },
} = this.props;
const { total } = this.state;
@@ -130,7 +130,7 @@ export class RuleDetailsIssues extends React.PureComponent<Props, State> {
renderProject = (project: Project) => {
const {
- ruleDetails: { key }
+ ruleDetails: { key },
} = this.props;
const path = getIssuesUrl({ resolved: 'false', rules: key, projects: project.key });
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
index 11059de2b43..45c46eb5fbd 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
@@ -103,7 +103,8 @@ export default class RuleDetailsMeta extends React.PureComponent<Props> {
tags={tags}
/>
}
- overlayPlacement={PopupPlacement.BottomLeft}>
+ overlayPlacement={PopupPlacement.BottomLeft}
+ >
<ButtonLink>
<TagsList
allowUpdate={canWrite}
@@ -234,7 +235,8 @@ export default class RuleDetailsMeta extends React.PureComponent<Props> {
<Link
className="coding-rules-detail-permalink link-no-underline spacer-left text-middle"
title={translate('permalink')}
- to={getRuleUrl(ruleDetails.key)}>
+ to={getRuleUrl(ruleDetails.key)}
+ >
<LinkIcon />
</Link>
)}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx
index 0d621c4e925..e0dd62c6f4d 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsProfiles.tsx
@@ -48,7 +48,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props> {
if (key) {
deactivateRule({
key,
- rule: this.props.ruleDetails.key
+ rule: this.props.ruleDetails.key,
}).then(this.props.onDeactivate, () => {});
}
};
@@ -58,7 +58,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props> {
activateRule({
key,
rule: this.props.ruleDetails.key,
- reset: true
+ reset: true,
}).then(this.props.onActivate, () => {});
}
};
@@ -99,7 +99,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props> {
renderParameter = (param: { key: string; value: string }, parentActivation?: RuleActivation) => {
const originalParam =
- parentActivation && parentActivation.params.find(p => p.key === param.key);
+ parentActivation && parentActivation.params.find((p) => p.key === param.key);
const originalValue = originalParam && originalParam.value;
return (
@@ -120,7 +120,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props> {
renderParameters = (activation: RuleActivation, parentActivation?: RuleActivation) => (
<td className="coding-rules-detail-quality-profile-parameters">
- {activation.params.map(param => this.renderParameter(param, parentActivation))}
+ {activation.params.map((param) => this.renderParameter(param, parentActivation))}
</td>
);
@@ -154,11 +154,13 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props> {
profile.parentName
)}
modalHeader={translate('coding_rules.revert_to_parent_definition')}
- onConfirm={this.handleRevert}>
+ onConfirm={this.handleRevert}
+ >
{({ onClick }) => (
<Button
className="coding-rules-detail-quality-profile-revert button-red spacer-left"
- onClick={onClick}>
+ onClick={onClick}
+ >
{translate('coding_rules.revert_to_parent_definition')}
</Button>
)}
@@ -170,11 +172,13 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props> {
confirmData={profile.key}
modalBody={translate('coding_rules.deactivate.confirm')}
modalHeader={translate('coding_rules.deactivate')}
- onConfirm={this.handleDeactivate}>
+ onConfirm={this.handleDeactivate}
+ >
{({ onClick }) => (
<Button
className="coding-rules-detail-quality-profile-deactivate button-red spacer-left"
- onClick={onClick}>
+ onClick={onClick}
+ >
{translate('coding_rules.deactivate')}
</Button>
)}
@@ -193,7 +197,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props> {
return null;
}
- const parentActivation = activations.find(x => x.qProfile === profile.parentKey);
+ const parentActivation = activations.find((x) => x.qProfile === profile.parentKey);
return (
<tr data-profile={profile.key} key={profile.key}>
@@ -212,7 +216,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props> {
render() {
const { activations = [], referencedProfiles, ruleDetails } = this.props;
- const canActivate = Object.values(referencedProfiles).some(profile =>
+ const canActivate = Object.values(referencedProfiles).some((profile) =>
Boolean(profile.actions && profile.actions.edit && profile.language === ruleDetails.lang)
);
@@ -231,7 +235,7 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props> {
onDone={this.handleActivate}
profiles={filter(
this.props.referencedProfiles,
- profile => !activations.find(activation => activation.qProfile === profile.key)
+ (profile) => !activations.find((activation) => activation.qProfile === profile.key)
)}
rule={ruleDetails}
/>
@@ -240,7 +244,8 @@ export default class RuleDetailsProfiles extends React.PureComponent<Props> {
{activations.length > 0 && (
<table
className="coding-rules-detail-quality-profiles width-100"
- id="coding-rules-detail-quality-profiles">
+ id="coding-rules-detail-quality-profiles"
+ >
<tbody>{activations.map(this.renderActivation)}</tbody>
</table>
)}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsTagsPopup.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsTagsPopup.tsx
index 5e5c1cb78b3..25b9f73cfe2 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsTagsPopup.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsTagsPopup.tsx
@@ -49,9 +49,9 @@ export default class RuleDetailsTagsPopup extends React.PureComponent<Props, Sta
onSearch = (query: string) => {
return getRuleTags({
q: query,
- ps: Math.min(this.props.tags.length + LIST_SIZE, 100)
+ ps: Math.min(this.props.tags.length + LIST_SIZE, 100),
}).then(
- tags => {
+ (tags) => {
if (this.mounted) {
// systems tags can not be unset, don't display them in the results
this.setState({ searchResult: without(tags, ...this.props.sysTags) });
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleInheritanceIcon.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleInheritanceIcon.tsx
index 16ad9787df9..0691d25e672 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleInheritanceIcon.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleInheritanceIcon.tsx
@@ -38,7 +38,8 @@ export default function RuleInheritanceIcon({ className, inheritance, ...other }
width={16}
xmlSpace="preserve"
xmlnsXlink="https://www.w3.org/1999/xlink"
- {...other}>
+ {...other}
+ >
<path
d="M6.25 12.5a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0zm0-9a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0zm5 1a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0zm.75 0a1.5 1.5 0 0 1-.75 1.297c-.023 2.82-2.023 3.445-3.352 3.867-1.242.39-1.648.578-1.648 1.336v.203A1.5 1.5 0 1 1 4 12.5a1.5 1.5 0 0 1 .75-1.297V4.797A1.5 1.5 0 1 1 7 3.5a1.5 1.5 0 0 1-.75 1.297V8.68c.398-.196.82-.328 1.203-.446 1.453-.46 2.281-.804 2.297-2.437A1.5 1.5 0 1 1 12 4.5z"
style={{ fill, fillRule: 'nonzero' }}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx
index d873bec0ecd..8733fae6d76 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx
@@ -52,7 +52,7 @@ export default class RuleListItem extends React.PureComponent<Props> {
if (this.props.selectedProfile) {
const data = {
key: this.props.selectedProfile.key,
- rule: this.props.rule.key
+ rule: this.props.rule.key,
};
deactivateRule(data).then(
() => this.props.onDeactivate(data.key, data.rule),
@@ -65,7 +65,7 @@ export default class RuleListItem extends React.PureComponent<Props> {
if (this.props.selectedProfile) {
this.props.onActivate(this.props.selectedProfile.key, this.props.rule.key, {
severity,
- inherit: 'NONE'
+ inherit: 'NONE',
});
}
return Promise.resolve();
@@ -100,7 +100,8 @@ export default class RuleListItem extends React.PureComponent<Props> {
'coding_rules.overrides',
selectedProfile.name,
selectedProfile.parentName
- )}>
+ )}
+ >
<RuleInheritanceIcon
className="little-spacer-left"
inheritance={activation.inherit}
@@ -113,7 +114,8 @@ export default class RuleListItem extends React.PureComponent<Props> {
'coding_rules.inherits',
selectedProfile.name,
selectedProfile.parentName
- )}>
+ )}
+ >
<RuleInheritanceIcon
className="little-spacer-left"
inheritance={activation.inherit}
@@ -158,11 +160,13 @@ export default class RuleListItem extends React.PureComponent<Props> {
confirmButtonText={translate('yes')}
modalBody={translate('coding_rules.deactivate.confirm')}
modalHeader={translate('coding_rules.deactivate')}
- onConfirm={this.handleDeactivate}>
+ onConfirm={this.handleDeactivate}
+ >
{({ onClick }) => (
<Button
className="coding-rules-detail-quality-profile-deactivate button-red"
- onClick={onClick}>
+ onClick={onClick}
+ >
{translate('coding_rules.deactivate')}
</Button>
)}
@@ -202,7 +206,8 @@ export default class RuleListItem extends React.PureComponent<Props> {
className={classNames('coding-rule', { selected })}
aria-selected={selected}
role="row"
- data-rule={rule.key}>
+ data-rule={rule.key}
+ >
<table className="coding-rule-table">
<tbody>
<tr>
@@ -212,7 +217,8 @@ export default class RuleListItem extends React.PureComponent<Props> {
<Link
className="link-no-underline"
onClick={this.handleNameClick}
- to={getRuleUrl(rule.key)}>
+ to={getRuleUrl(rule.key)}
+ >
{rule.name}
</Link>
{rule.isTemplate && (
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx
index 353da2fbd7f..5a92eed1b25 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx
@@ -33,9 +33,9 @@ export interface SeveritySelectProps {
export function SeveritySelect(props: SeveritySelectProps) {
const { isDisabled, severity, ariaLabelledby } = props;
- const serverityOption = SEVERITIES.map(severity => ({
+ const serverityOption = SEVERITIES.map((severity) => ({
label: translate('severity', severity),
- value: severity
+ value: severity,
}));
function Option(props: OptionProps<OptionTypeBase, false>) {
@@ -62,7 +62,7 @@ export function SeveritySelect(props: SeveritySelectProps) {
components={{ Option, SingleValue }}
options={serverityOption}
isSearchable={false}
- value={serverityOption.find(s => s.value === severity)}
+ value={serverityOption.find((s) => s.value === severity)}
/>
);
}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/SimilarRulesFilter.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/SimilarRulesFilter.tsx
index 312842c0f2b..d0b07bbf003 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/SimilarRulesFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/SimilarRulesFilter.tsx
@@ -80,7 +80,8 @@ export default class SimilarRulesFilter extends React.PureComponent<Props> {
<a
data-test="coding-rules__similar-language"
href="#"
- onClick={this.handleLanguageClick}>
+ onClick={this.handleLanguageClick}
+ >
{rule.langName}
</a>
</li>
@@ -90,7 +91,8 @@ export default class SimilarRulesFilter extends React.PureComponent<Props> {
className="display-flex-center"
data-test="coding-rules__similar-type"
href="#"
- onClick={this.handleTypeClick}>
+ onClick={this.handleTypeClick}
+ >
<IssueTypeIcon query={rule.type} />
<span className="little-spacer-left">{translate('issue.type', rule.type)}</span>
</a>
@@ -101,31 +103,35 @@ export default class SimilarRulesFilter extends React.PureComponent<Props> {
<a
data-test="coding-rules__similar-severity"
href="#"
- onClick={this.handleSeverityClick}>
+ onClick={this.handleSeverityClick}
+ >
<SeverityHelper className="display-flex-center" severity={rule.severity} />
</a>
</li>
)}
{allTags.length > 0 && <li className="divider" />}
- {allTags.map(tag => (
+ {allTags.map((tag) => (
<li key={tag}>
<a
data-tag={tag}
data-test="coding-rules__similar-tag"
href="#"
- onClick={this.handleTagClick}>
+ onClick={this.handleTagClick}
+ >
<TagsIcon className="little-spacer-right text-middle" />
<span className="text-middle">{tag}</span>
</a>
</li>
))}
</ul>
- }>
+ }
+ >
<a
className="js-rule-filter link-no-underline spacer-left dropdown-toggle"
href="#"
- title={translate('coding_rules.filter_similar_rules')}>
+ title={translate('coding_rules.filter_similar_rules')}
+ >
<FilterIcon />
<DropdownIcon />
</a>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/TagFacet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/TagFacet.tsx
index 25b3ab53d7f..b77d44e1b7b 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/TagFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/TagFacet.tsx
@@ -29,9 +29,9 @@ import { BasicProps } from './Facet';
export default class TagFacet extends React.PureComponent<BasicProps> {
handleSearch = (query: string) => {
- return getRuleTags({ ps: 50, q: query }).then(tags => ({
+ return getRuleTags({ ps: 50, q: query }).then((tags) => ({
paging: { pageIndex: 1, pageSize: tags.length, total: tags.length },
- results: tags
+ results: tags,
}));
};
@@ -63,8 +63,8 @@ export default class TagFacet extends React.PureComponent<BasicProps> {
facetHeader={translate('coding_rules.facet.tags')}
fetching={false}
getFacetItemText={this.getTagName}
- getSearchResultKey={tag => tag}
- getSearchResultText={tag => tag}
+ getSearchResultKey={(tag) => tag}
+ getSearchResultText={(tag) => tag}
onChange={this.props.onChange}
onSearch={this.handleSearch}
onToggle={this.props.onToggle}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/TemplateFacet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/TemplateFacet.tsx
index 1b296772ee6..f2d24f4d181 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/TemplateFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/TemplateFacet.tsx
@@ -55,7 +55,8 @@ export default class TemplateFacet extends React.PureComponent<Props> {
renderName={this.renderName}
renderTextName={this.renderName}
singleSelection={true}
- values={value !== undefined ? [String(value)] : []}>
+ values={value !== undefined ? [String(value)] : []}
+ >
<HelpTooltip
className="spacer-left"
overlay={
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/ActivationFormModal-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/ActivationFormModal-test.tsx
index b4138caae36..02484e6ac84 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/ActivationFormModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/ActivationFormModal-test.tsx
@@ -25,12 +25,12 @@ import {
mockRule,
mockRuleActivation,
mockRuleDetails,
- mockRuleDetailsParameter
+ mockRuleDetailsParameter,
} from '../../../../helpers/testMocks';
import ActivationFormModal from '../ActivationFormModal';
jest.mock('../../../../api/quality-profiles', () => ({
- activateRule: jest.fn().mockResolvedValueOnce({})
+ activateRule: jest.fn().mockResolvedValueOnce({}),
}));
it('should render correctly', () => {
@@ -39,8 +39,8 @@ it('should render correctly', () => {
shallowRender({
profiles: [
mockQualityProfile(),
- mockQualityProfile({ depth: 2, actions: { edit: true }, language: 'js' })
- ]
+ mockQualityProfile({ depth: 2, actions: { edit: true }, language: 'js' }),
+ ],
})
).toMatchSnapshot('with deep profiles');
expect(shallowRender({ rule: mockRuleDetails({ templateKey: 'foobar' }) })).toMatchSnapshot(
@@ -54,17 +54,17 @@ it('should render correctly', () => {
it('should activate rule on quality profile when submit', () => {
const wrapper = shallowRender();
- wrapper.instance().handleFormSubmit(({
- preventDefault: jest.fn()
- } as any) as React.SyntheticEvent<HTMLFormElement>);
+ wrapper.instance().handleFormSubmit({
+ preventDefault: jest.fn(),
+ } as any as React.SyntheticEvent<HTMLFormElement>);
expect(activateRule).toHaveBeenCalledWith({
key: '',
params: {
'1': '1',
- '2': '1'
+ '2': '1',
},
rule: 'javascript:S1067',
- severity: 'MAJOR'
+ severity: 'MAJOR',
});
});
@@ -85,8 +85,8 @@ function shallowRender(props: Partial<ActivationFormModal['props']> = {}) {
rule={mockRule({
params: [
mockRuleDetailsParameter(),
- mockRuleDetailsParameter({ key: '2', type: 'TEXT', htmlDesc: undefined })
- ]
+ mockRuleDetailsParameter({ key: '2', type: 'TEXT', htmlDesc: undefined }),
+ ],
})}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/App-test.tsx
index 5b9fab3829d..751b356898c 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/App-test.tsx
@@ -26,7 +26,7 @@ import {
mockCurrentUser,
mockLocation,
mockQualityProfile,
- mockRouter
+ mockRouter,
} from '../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../helpers/testUtils';
import { App } from '../App';
@@ -45,17 +45,17 @@ jest.mock('../../../../api/rules', () => {
p: 0,
ps: 100,
rules: [mockRule(), mockRule()],
- total: 0
- })
+ total: 0,
+ }),
};
});
jest.mock('../../../../api/quality-profiles', () => ({
- searchQualityProfiles: jest.fn().mockResolvedValue({ profiles: [] })
+ searchQualityProfiles: jest.fn().mockResolvedValue({ profiles: [] }),
}));
jest.mock('../../../../helpers/system', () => ({
- getReactDomContainerSelector: () => '#content'
+ getReactDomContainerSelector: () => '#content',
}));
it('should render correctly', async () => {
@@ -72,7 +72,7 @@ it('should render correctly', async () => {
describe('renderBulkButton', () => {
it('should be null when the user is not logged in', () => {
const wrapper = shallowRender({
- currentUser: mockCurrentUser()
+ currentUser: mockCurrentUser(),
});
expect(wrapper.instance().renderBulkButton()).toMatchSnapshot();
});
@@ -95,7 +95,7 @@ describe('renderBulkButton', () => {
it('should show bulk change button when user has edit rights on specific quality profile', async () => {
(getRulesApp as jest.Mock).mockReturnValueOnce({ canWrite: false, repositories: [] });
(searchQualityProfiles as jest.Mock).mockReturnValueOnce({
- profiles: [mockQualityProfile({ key: 'foo', actions: { edit: true } }), mockQualityProfile()]
+ profiles: [mockQualityProfile({ key: 'foo', actions: { edit: true } }), mockQualityProfile()],
});
const wrapper = shallowRender();
@@ -109,7 +109,7 @@ function shallowRender(props: Partial<App['props']> = {}) {
return shallow<App>(
<App
currentUser={mockCurrentUser({
- isLoggedIn: true
+ isLoggedIn: true,
})}
location={mockLocation()}
router={mockRouter()}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/BulkChange-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/BulkChange-test.tsx
index ba30cada723..83bede56900 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/BulkChange-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/BulkChange-test.tsx
@@ -29,8 +29,8 @@ const profile = mockQualityProfile({
setAsDefault: true,
copy: true,
associateProjects: true,
- delete: false
- }
+ delete: false,
+ },
});
it('should render correctly', () => {
@@ -40,7 +40,7 @@ it('should render correctly', () => {
it('should not a disabled button when edition is not possible', () => {
const wrapper = shallowRender({
- referencedProfiles: { key: { ...profile, actions: { ...profile.actions, edit: false } } }
+ referencedProfiles: { key: { ...profile, actions: { ...profile.actions, edit: false } } },
});
expect(wrapper).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/CustomRuleFormModal-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/CustomRuleFormModal-test.tsx
index 2a884db5be6..755b8b4adc3 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/CustomRuleFormModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/CustomRuleFormModal-test.tsx
@@ -47,11 +47,11 @@ function shallowRender(props: Partial<CustomRuleFormModal['props']> = {}) {
...mockRuleDetails({
params: [
mockRuleDetailsParameter(),
- mockRuleDetailsParameter({ key: '2', type: 'TEXT', htmlDesc: undefined })
- ]
+ mockRuleDetailsParameter({ key: '2', type: 'TEXT', htmlDesc: undefined }),
+ ],
}),
createdAt: 'date',
- repo: 'squid'
+ repo: 'squid',
}}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/LanguageFacet-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/LanguageFacet-test.tsx
index 1d2ce59d9f1..2976b0b5885 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/LanguageFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/LanguageFacet-test.tsx
@@ -30,12 +30,12 @@ it('should handle search correctly', async () => {
paging: {
pageIndex: 1,
pageSize: 2,
- total: 2
+ total: 2,
},
results: [
{ key: 'js', name: 'javascript' },
- { key: 'java', name: 'java' }
- ]
+ { key: 'java', name: 'java' },
+ ],
});
});
@@ -65,7 +65,7 @@ function shallowRender(props: Partial<LanguageFacet['props']> = {}) {
<LanguageFacet
languages={{
js: mockLanguage({ key: 'js', name: 'javascript' }),
- c: mockLanguage({ key: 'c', name: 'c' })
+ c: mockLanguage({ key: 'c', name: 'c' }),
}}
onChange={jest.fn()}
onToggle={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RepositoryFacet-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RepositoryFacet-test.tsx
index 455003d6c34..bfae93eff59 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RepositoryFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RepositoryFacet-test.tsx
@@ -25,7 +25,7 @@ import { RepositoryFacet } from '../RepositoryFacet';
jest.mock('../../../../api/rules', () => ({
getRuleRepositories: jest
.fn()
- .mockResolvedValue([{ key: 'clirr', name: 'Clirr', language: 'java' }])
+ .mockResolvedValue([{ key: 'clirr', name: 'Clirr', language: 'java' }]),
}));
it('should handle search correctly', async () => {
@@ -36,9 +36,9 @@ it('should handle search correctly', async () => {
paging: {
pageIndex: 1,
pageSize: 1,
- total: 1
+ total: 1,
},
- results: ['clirr']
+ results: ['clirr'],
});
});
@@ -78,7 +78,7 @@ function shallowRender(props: Partial<RepositoryFacet['props']> = {}) {
languages={{ l: mockLanguage() }}
referencedRepositories={{
l: mockRuleRepository(),
- noName: mockRuleRepository({ name: undefined })
+ noName: mockRuleRepository({ name: undefined }),
}}
onChange={jest.fn()}
onToggle={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetails-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetails-test.tsx
index a0f3fbbae3c..87865920f87 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetails-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetails-test.tsx
@@ -38,11 +38,11 @@ jest.mock('../../../../api/rules', () => {
severity: 'MAJOR',
params: [],
createdAt: '2017-06-16T16:13:38+0200',
- updatedAt: '2017-06-16T16:13:38+0200'
- }
- ]
+ updatedAt: '2017-06-16T16:13:38+0200',
+ },
+ ],
}),
- updateRule: jest.fn().mockResolvedValue(null)
+ updateRule: jest.fn().mockResolvedValue(null),
};
});
@@ -60,7 +60,7 @@ it('should render correctly', async () => {
expect(getRuleDetails).toHaveBeenCalledWith(
expect.objectContaining({
actives: true,
- key: 'squid:S1337'
+ key: 'squid:S1337',
})
);
});
@@ -75,7 +75,7 @@ it('should correctly handle prop changes', async () => {
expect(getRuleDetails).toHaveBeenCalledWith(
expect.objectContaining({
actives: true,
- key: ruleKey
+ key: ruleKey,
})
);
});
@@ -91,7 +91,7 @@ it('should correctly handle tag changes', async () => {
expect(updateRule).toHaveBeenCalledWith({
key: 'squid:S1337',
- tags: 'foo,bar'
+ tags: 'foo,bar',
});
});
@@ -105,7 +105,7 @@ it('should correctly handle rule changes', () => {
repo: 'bar',
severity: 'MAJOR',
status: 'READY',
- type: 'BUG' as RuleType
+ type: 'BUG' as RuleType,
};
wrapper.instance().handleRuleChange(ruleChange);
@@ -124,7 +124,7 @@ it('should correctly handle activation', async () => {
'squid:S1337',
expect.objectContaining({
inherit: 'NONE',
- severity: 'MAJOR'
+ severity: 'MAJOR',
})
);
});
@@ -162,7 +162,7 @@ function shallowRender(props: Partial<RuleDetails['props']> = {}) {
onFilterChange={jest.fn()}
referencedProfiles={{ key: profile }}
referencedRepositories={{
- javascript: { key: 'javascript', language: 'js', name: 'SonarAnalyzer' }
+ javascript: { key: 'javascript', language: 'js', name: 'SonarAnalyzer' },
}}
ruleKey="squid:S1337"
selectedProfile={profile}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsIssues-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsIssues-test.tsx
index 8845367de1e..fc8a76edfc6 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsIssues-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsIssues-test.tsx
@@ -27,16 +27,16 @@ jest.mock('../../../../api/issues', () => ({
getFacet: jest.fn().mockResolvedValue({
facet: [
{ count: 13, val: 'sample-key' },
- { count: 5, val: 'example-key' }
+ { count: 5, val: 'example-key' },
],
response: {
components: [
{ key: 'sample-key', name: 'Sample' },
- { key: 'example-key', name: 'Example' }
+ { key: 'example-key', name: 'Example' },
],
- paging: { total: 18 }
- }
- })
+ paging: { total: 18 },
+ },
+ }),
}));
beforeEach(() => {
@@ -50,7 +50,7 @@ it('should fetch issues and render', async () => {
expect(getFacet).toHaveBeenCalledWith(
{
resolved: 'false',
- rules: 'foo'
+ rules: 'foo',
},
'projects'
);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsMeta-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsMeta-test.tsx
index 014faacb4e9..8d32ea3ba1f 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsMeta-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsMeta-test.tsx
@@ -34,7 +34,7 @@ const RULE: RuleDetails = {
lang: 'java',
langName: 'Java',
scope: 'MAIN',
- type: 'CODE_SMELL'
+ type: 'CODE_SMELL',
};
const EXTERNAL_RULE: RuleDetails = {
@@ -47,7 +47,7 @@ const EXTERNAL_RULE: RuleDetails = {
status: 'READY',
scope: 'ALL',
isExternal: true,
- type: 'UNKNOWN'
+ type: 'UNKNOWN',
};
const EXTERNAL_RULE_WITH_DATA: RuleDetails = {
@@ -63,7 +63,7 @@ const EXTERNAL_RULE_WITH_DATA: RuleDetails = {
langName: 'Xoo',
scope: 'ALL',
isExternal: true,
- type: 'BUG'
+ type: 'BUG',
};
it('should display right meta info', () => {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsTagsPopup-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsTagsPopup-test.tsx
index ca63ef23363..4b4d15b5e60 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsTagsPopup-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleDetailsTagsPopup-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import RuleDetailsTagsPopup, { Props } from '../RuleDetailsTagsPopup';
jest.mock('../../../../api/rules', () => ({
- getRuleTags: jest.fn(() => Promise.resolve(['system', 'foo', 'bar', 'not-system']))
+ getRuleTags: jest.fn(() => Promise.resolve(['system', 'foo', 'bar', 'not-system'])),
}));
const getRuleTags = require('../../../../api/rules').getRuleTags as jest.Mock<any>;
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx
index 3378a7b3c52..a22771d9e74 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/RuleListItem-test.tsx
@@ -26,7 +26,7 @@ import { mockEvent, waitAndUpdate } from '../../../../helpers/testUtils';
import RuleListItem from '../RuleListItem';
jest.mock('../../../../api/quality-profiles', () => ({
- deactivateRule: jest.fn().mockResolvedValue(null)
+ deactivateRule: jest.fn().mockResolvedValue(null),
}));
it('should render correctly', () => {
@@ -50,7 +50,7 @@ it('handle activation', () => {
wrapper.instance().handleActivate('MAJOR');
expect(onActivate).toHaveBeenCalledWith(profile.key, rule.key, {
severity: 'MAJOR',
- inherit: 'NONE'
+ inherit: 'NONE',
});
});
@@ -64,7 +64,7 @@ it('handle deactivation', async () => {
expect(deactivateRule).toHaveBeenCalledWith(
expect.objectContaining({
key: profile.key,
- rule: rule.key
+ rule: rule.key,
})
);
await waitAndUpdate(wrapper);
@@ -74,7 +74,7 @@ it('handle deactivation', async () => {
describe('renderActions', () => {
it('should be null when there is no selected profile', () => {
const wrapper = shallowRender({
- isLoggedIn: true
+ isLoggedIn: true,
});
expect(wrapper.instance().renderActions()).toBeNull();
@@ -83,7 +83,7 @@ describe('renderActions', () => {
it('should be null when I am not logged in', () => {
const wrapper = shallowRender({
isLoggedIn: false,
- selectedProfile: mockQualityProfile()
+ selectedProfile: mockQualityProfile(),
});
expect(wrapper.instance().renderActions()).toBeNull();
@@ -92,7 +92,7 @@ describe('renderActions', () => {
it('should be null when the user does not have the sufficient permissions', () => {
const wrapper = shallowRender({
isLoggedIn: true,
- selectedProfile: mockQualityProfile()
+ selectedProfile: mockQualityProfile(),
});
expect(wrapper.instance().renderActions()).toBeNull();
@@ -102,10 +102,10 @@ describe('renderActions', () => {
const wrapper = shallowRender({
selectedProfile: mockQualityProfile({
actions: {
- copy: true
+ copy: true,
},
- isBuiltIn: true
- })
+ isBuiltIn: true,
+ }),
});
expect(wrapper.instance().renderActions()).toMatchSnapshot('activate');
@@ -117,14 +117,14 @@ describe('renderActions', () => {
const wrapper = shallowRender({
activation: {
inherit: 'NONE',
- severity: 'warning'
+ severity: 'warning',
},
selectedProfile: mockQualityProfile({
actions: {
- edit: true
+ edit: true,
},
- isBuiltIn: false
- })
+ isBuiltIn: false,
+ }),
});
expect(wrapper.instance().renderActions()).toMatchSnapshot();
@@ -133,14 +133,14 @@ describe('renderActions', () => {
it('should render the activate button', () => {
const wrapper = shallowRender({
rule: mockRule({
- isTemplate: false
+ isTemplate: false,
}),
selectedProfile: mockQualityProfile({
actions: {
- edit: true
+ edit: true,
},
- isBuiltIn: false
- })
+ isBuiltIn: false,
+ }),
});
expect(wrapper.instance().renderActions()).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/TagFacet-test.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/TagFacet-test.tsx
index 85c44c8fed1..ee4008ca1cc 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/TagFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/__tests__/TagFacet-test.tsx
@@ -23,7 +23,7 @@ import { getRuleTags } from '../../../../api/rules';
import TagFacet from '../TagFacet';
jest.mock('../../../../api/rules', () => ({
- getRuleTags: jest.fn().mockResolvedValue([])
+ getRuleTags: jest.fn().mockResolvedValue([]),
}));
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/query.ts b/server/sonar-web/src/main/js/apps/coding-rules/query.ts
index b131fd0aa8f..7d5922ce191 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/query.ts
+++ b/server/sonar-web/src/main/js/apps/coding-rules/query.ts
@@ -28,7 +28,7 @@ import {
serializeDateShort,
serializeOptionalBoolean,
serializeString,
- serializeStringArray
+ serializeStringArray,
} from '../../helpers/query';
import { Dict, RawQuery, RuleInheritance } from '../../types/types';
@@ -97,7 +97,7 @@ export function parseQuery(query: RawQuery): Query {
statuses: parseAsArray(query.statuses, parseAsString),
tags: parseAsArray(query.tags, parseAsString),
template: parseAsOptionalBoolean(query.is_template),
- types: parseAsArray(query.types, parseAsString)
+ types: parseAsArray(query.types, parseAsString),
};
}
@@ -122,7 +122,7 @@ export function serializeQuery(query: Query): RawQuery {
sonarsourceSecurity: serializeStringArray(query.sonarsourceSecurity),
statuses: serializeStringArray(query.statuses),
tags: serializeStringArray(query.tags),
- types: serializeStringArray(query.types)
+ types: serializeStringArray(query.types),
});
}
@@ -144,7 +144,7 @@ export function shouldRequestFacet(facet: string): facet is FacetKey {
'standard',
'statuses',
'tags',
- 'types'
+ 'types',
];
return facetsToRequest.includes(facet);
}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/routes.tsx b/server/sonar-web/src/main/js/apps/coding-rules/routes.tsx
index f3b9c92c99c..65e968d8437 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/routes.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/routes.tsx
@@ -28,7 +28,7 @@ const EXPECTED_SPLIT_PARTS = 2;
function parseHash(hash: string): RawQuery {
const query: RawQuery = {};
const parts = hash.split('|');
- parts.forEach(part => {
+ parts.forEach((part) => {
const tokens = part.split('=');
if (tokens.length === EXPECTED_SPLIT_PARTS) {
query[decodeURIComponent(tokens[0])] = decodeURIComponent(tokens[1]);
@@ -47,7 +47,7 @@ function HashEditWrapper() {
const query = parseHash(hash.substr(1));
const normalizedQuery = {
...serializeQuery(parseQuery(query)),
- open: query.open
+ open: query.open,
};
navigate(
{ pathname: location.pathname, search: new URLSearchParams(normalizedQuery).toString() },
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule.ts b/server/sonar-web/src/main/js/apps/coding-rules/rule.ts
index c0482e6d22e..815fce9922a 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule.ts
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule.ts
@@ -23,7 +23,7 @@ export enum RuleDescriptionSections {
ROOT_CAUSE = 'root_cause',
ASSESS_THE_PROBLEM = 'assess_the_problem',
HOW_TO_FIX = 'how_to_fix',
- RESOURCES = 'resources'
+ RESOURCES = 'resources',
}
export interface RuleDescriptionContext {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/component-measures/__tests__/utils-test.ts
index fe29210691c..f73ec2ecf05 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/component-measures/__tests__/utils-test.ts
@@ -29,11 +29,11 @@ const MEASURES = [
key: MetricKey.lines_to_cover,
type: 'INT',
name: 'Lines to Cover',
- domain: 'Coverage'
+ domain: 'Coverage',
},
value: '431',
period: { index: 1, value: '70' },
- leak: '70'
+ leak: '70',
},
{
metric: {
@@ -41,11 +41,11 @@ const MEASURES = [
key: MetricKey.coverage,
type: 'PERCENT',
name: 'Coverage',
- domain: 'Coverage'
+ domain: 'Coverage',
},
value: '99.3',
period: { index: 1, value: '0.0999999999999943' },
- leak: '0.0999999999999943'
+ leak: '0.0999999999999943',
},
{
metric: {
@@ -53,12 +53,12 @@ const MEASURES = [
key: MetricKey.duplicated_lines_density,
type: 'PERCENT',
name: 'Duplicated Lines (%)',
- domain: 'Duplications'
+ domain: 'Duplications',
},
value: '3.2',
period: { index: 1, value: '0.0' },
- leak: '0.0'
- }
+ leak: '0.0',
+ },
];
describe('filterMeasures', () => {
@@ -71,9 +71,9 @@ describe('filterMeasures', () => {
id: '2',
key: MetricKey.critical_violations,
name: 'Critical Violations',
- type: 'INT'
- }
- }
+ type: 'INT',
+ },
+ },
])
).toHaveLength(1);
});
@@ -88,20 +88,20 @@ describe('sortMeasures', () => {
id: '1',
key: MetricKey.reliability_remediation_effort,
name: 'new_bugs',
- type: 'INT'
- }
+ type: 'INT',
+ },
},
{
metric: {
id: '2',
key: MetricKey.new_reliability_remediation_effort,
name: 'bugs',
- type: 'INT'
- }
+ type: 'INT',
+ },
},
{ metric: { id: '3', key: MetricKey.new_bugs, name: 'new_bugs', type: 'INT' } },
{ metric: { id: '4', key: MetricKey.bugs, name: 'bugs', type: 'INT' } },
- 'overall_category'
+ 'overall_category',
])
).toMatchSnapshot();
});
@@ -122,7 +122,7 @@ describe('parseQuery', () => {
expect(utils.parseQuery({})).toEqual({
metric: utils.DEFAULT_METRIC,
selected: '',
- view: utils.DEFAULT_VIEW
+ view: utils.DEFAULT_VIEW,
});
expect(
utils.parseQuery({ metric: 'foo', selected: 'bar', view: 'tree', asc: 'false' })
@@ -130,7 +130,7 @@ describe('parseQuery', () => {
metric: 'foo',
selected: 'bar',
view: 'tree',
- asc: false
+ asc: false,
});
});
@@ -143,11 +143,11 @@ describe('parseQuery', () => {
describe('serializeQuery', () => {
it('should correctly serialize the query', () => {
expect(utils.serializeQuery({ metric: '', selected: '', view: 'list' })).toEqual({
- view: 'list'
+ view: 'list',
});
expect(utils.serializeQuery({ metric: 'foo', selected: 'bar', view: 'tree' })).toEqual({
metric: 'foo',
- selected: 'bar'
+ selected: 'bar',
});
});
@@ -167,19 +167,19 @@ describe('extract measure', () => {
{
metric: 'alert_status',
value: '3.2',
- period: { index: 1, value: '0.0' }
+ period: { index: 1, value: '0.0' },
},
{
metric: 'releasability_rating',
value: '3.2',
- period: { index: 1, value: '0.0' }
+ period: { index: 1, value: '0.0' },
},
{
metric: 'releasability_effort',
value: '3.2',
- period: { index: 1, value: '0.0' }
- }
- ]
+ period: { index: 1, value: '0.0' },
+ },
+ ],
};
};
it('should ban quality gate for app', () => {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx
index b730f43dbfa..f8eaebd934b 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx
@@ -36,13 +36,13 @@ import { getBranchLikeQuery, isPullRequest, isSameBranchLike } from '../../../he
import {
getLocalizedMetricDomain,
translate,
- translateWithParameters
+ translateWithParameters,
} from '../../../helpers/l10n';
import {
addSideBarClass,
addWhitePageClass,
removeSideBarClass,
- removeWhitePageClass
+ removeWhitePageClass,
} from '../../../helpers/pages';
import { BranchLike } from '../../../types/branch-like';
import { ComponentQualifier, isPortfolioLike } from '../../../types/component';
@@ -52,7 +52,7 @@ import {
Issue,
MeasureEnhanced,
Metric,
- Period
+ Period,
} from '../../../types/types';
import Sidebar from '../sidebar/Sidebar';
import '../style.css';
@@ -68,7 +68,7 @@ import {
parseQuery,
Query,
serializeQuery,
- sortMeasures
+ sortMeasures,
} from '../utils';
import MeasureContent from './MeasureContent';
import MeasureOverviewContainer from './MeasureOverviewContainer';
@@ -98,7 +98,7 @@ export class App extends React.PureComponent<Props, State> {
this.state = {
loading: true,
measures: [],
- metrics: {}
+ metrics: {},
};
this.refreshBranchStatus = debounce(this.refreshBranchStatus, 1000);
}
@@ -107,7 +107,7 @@ export class App extends React.PureComponent<Props, State> {
this.mounted = true;
getAllMetrics().then(
- metrics => {
+ (metrics) => {
const byKey = keyBy(metrics, 'key');
this.setState({ metrics: byKey });
this.fetchMeasures(byKey);
@@ -150,7 +150,7 @@ export class App extends React.PureComponent<Props, State> {
getMeasuresWithPeriod(componentKey, filteredKeys, getBranchLikeQuery(branchLike)).then(
({ component, period }) => {
if (this.mounted) {
- const measures = banQualityGateMeasure(component).map(measure =>
+ const measures = banQualityGateMeasure(component).map((measure) =>
enhanceMeasure(measure, metrics)
);
@@ -161,8 +161,8 @@ export class App extends React.PureComponent<Props, State> {
loading: false,
leakPeriod,
measures: measures.filter(
- measure => measure.value !== undefined || measure.leak !== undefined
- )
+ (measure) => measure.value !== undefined || measure.leak !== undefined
+ ),
});
}
},
@@ -223,8 +223,8 @@ export class App extends React.PureComponent<Props, State> {
query: {
...serializeQuery(query),
...getBranchLikeQuery(this.props.branchLike),
- id: this.props.component.key
- }
+ id: this.props.component.key,
+ },
});
};
@@ -320,7 +320,8 @@ export class App extends React.PureComponent<Props, State> {
{!canBrowseAllChildProjects && isPortfolioLike(qualifier) && (
<Alert
className="big-spacer-top big-spacer-right big-spacer-left it__portfolio_warning"
- variant="warning">
+ variant="warning"
+ >
<AlertContent>
{translate('component_measures.not_all_measures_are_shown')}
<HelpTooltip
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.tsx
index 510c721f40d..856b3239a6a 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.tsx
@@ -83,7 +83,7 @@ export default class Breadcrumbs extends React.PureComponent<Props, State> {
return;
}
getBreadcrumbs({ component: component.key, ...getBranchLikeQuery(branchLike) }).then(
- breadcrumbs => {
+ (breadcrumbs) => {
if (this.mounted) {
this.setState({ breadcrumbs });
}
@@ -100,7 +100,7 @@ export default class Breadcrumbs extends React.PureComponent<Props, State> {
const lastItem = breadcrumbs[breadcrumbs.length - 1];
return (
<div className={this.props.className}>
- {breadcrumbs.map(component => (
+ {breadcrumbs.map((component) => (
<Breadcrumb
canBrowse={component.key !== lastItem.key}
component={component}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx
index 744ac1dc509..bb89c2936dd 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx
@@ -43,7 +43,7 @@ import {
Measure,
Metric,
Paging,
- Period
+ Period,
} from '../../../types/types';
import { complementary } from '../config/complementary';
import FilesView from '../drilldown/FilesView';
@@ -84,7 +84,7 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
mounted = false;
state: State = {
components: [],
- loadingMoreComponents: false
+ loadingMoreComponents: false,
};
componentDidMount() {
@@ -113,7 +113,7 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
const { asc, branchLike, metrics, requestedMetric, rootComponent, selected, view } = this.props;
// if asc is undefined we dont want to pass it inside options
const { metricKeys, opts, strategy } = this.getComponentRequestParams(view, requestedMetric, {
- ...(asc !== undefined && { asc })
+ ...(asc !== undefined && { asc }),
});
const componentKey = selected || rootComponent.key;
const baseComponentMetrics = [requestedMetric.key];
@@ -125,18 +125,18 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
getMeasures({
component: componentKey,
metricKeys: baseComponentMetrics.join(),
- ...getBranchLikeQuery(branchLike)
- })
+ ...getBranchLikeQuery(branchLike),
+ }),
]).then(
([tree, measures]) => {
if (this.mounted) {
- const metric = tree.metrics.find(m => m.key === requestedMetric.key);
- const components = tree.components.map(component =>
+ const metric = tree.metrics.find((m) => m.key === requestedMetric.key);
+ const components = tree.components.map((component) =>
enhanceComponent(component, metric, metrics)
);
- const measure = measures.find(m => m.metric === requestedMetric.key);
- const secondaryMeasure = measures.find(m => m.metric !== requestedMetric.key);
+ const measure = measures.find((m) => m.metric === requestedMetric.key);
+ const secondaryMeasure = measures.find((m) => m.metric !== requestedMetric.key);
this.setState(({ selectedComponent }) => ({
baseComponent: tree.baseComponent,
@@ -148,12 +148,12 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
selectedComponent:
components.length > 0 &&
components.find(
- c =>
+ (c) =>
getComponentMeasureUniqueKey(c) ===
getComponentMeasureUniqueKey(selectedComponent)
)
? selectedComponent
- : undefined
+ : undefined,
}));
}
},
@@ -172,19 +172,19 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
// if asc is undefined we dont want to pass it inside options
const { metricKeys, opts, strategy } = this.getComponentRequestParams(view, metric, {
p: paging.pageIndex + 1,
- ...(asc !== undefined && { asc })
+ ...(asc !== undefined && { asc }),
});
this.setState({ loadingMoreComponents: true });
getComponentTree(strategy, baseComponent.key, metricKeys, opts).then(
- r => {
+ (r) => {
if (this.mounted && metric.key === this.props.requestedMetric.key) {
- this.setState(state => ({
+ this.setState((state) => ({
components: [
...state.components,
- ...r.components.map(component => enhanceComponent(component, metric, metrics))
+ ...r.components.map((component) => enhanceComponent(component, metric, metrics)),
],
loadingMoreComponents: false,
- paging: r.paging
+ paging: r.paging,
}));
}
},
@@ -206,7 +206,7 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
const opts: RequestData = {
...getBranchLikeQuery(this.props.branchLike),
additionalFields: 'metrics',
- ps: 500
+ ps: 500,
};
const setMetricSort = () => {
@@ -241,7 +241,7 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
updateSelected = (component: string) => {
this.props.updateQuery({
- selected: component !== this.props.rootComponent.key ? component : undefined
+ selected: component !== this.props.rootComponent.key ? component : undefined,
});
};
@@ -252,7 +252,7 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
onOpenComponent = (component: ComponentMeasureIntern) => {
if (isView(this.props.rootComponent.qualifier)) {
const comp = this.state.components.find(
- c =>
+ (c) =>
c.refKey === component.key ||
getComponentMeasureUniqueKey(c) === getComponentMeasureUniqueKey(component)
);
@@ -264,7 +264,7 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
return;
}
- this.setState(state => ({ selectedComponent: state.baseComponent }));
+ this.setState((state) => ({ selectedComponent: state.baseComponent }));
this.updateSelected(component.key);
if (this.container) {
this.container.focus();
@@ -280,7 +280,7 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
? getComponentMeasureUniqueKey(this.state.baseComponent)
: getComponentMeasureUniqueKey(this.state.selectedComponent);
const index = this.state.components.findIndex(
- component => getComponentMeasureUniqueKey(component) === componentKey
+ (component) => getComponentMeasureUniqueKey(component) === componentKey
);
return index !== -1 ? index : undefined;
};
@@ -348,7 +348,10 @@ export default class MeasureContent extends React.PureComponent<Props, State> {
const selectedIdx = this.getSelectedIndex();
return (
- <div className="layout-page-main no-outline" ref={container => (this.container = container)}>
+ <div
+ className="layout-page-main no-outline"
+ ref={(container) => (this.container = container)}
+ >
<A11ySkipTarget anchor="measures_main" />
<div className="layout-page-header-panel layout-page-main-header">
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx
index 73319f882d7..25661468542 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.tsx
@@ -67,7 +67,8 @@ export default function MeasureHeader(props: Props) {
<Tooltip overlay={translate('component_measures.show_metric_history')}>
<Link
className="js-show-history spacer-left button button-small"
- to={getMeasureHistoryUrl(component.key, metric.key, branchLike)}>
+ to={getMeasureHistoryUrl(component.key, metric.key, branchLike)}
+ >
<HistoryIcon />
</Link>
</Tooltip>
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx
index 73eb01ba3cf..a76ecfeef7e 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx
@@ -34,7 +34,7 @@ import {
Issue,
Metric,
Paging,
- Period
+ Period,
} from '../../../types/types';
import BubbleChart from '../drilldown/BubbleChart';
import { BUBBLES_FETCH_LIMIT, enhanceComponent, getBubbleMetrics, hasFullMeasures } from '../utils';
@@ -94,24 +94,24 @@ export default class MeasureOverview extends React.PureComponent<Props, State> {
const { x, y, size, colors } = getBubbleMetrics(domain, metrics);
const metricsKey = [x.key, y.key, size.key];
if (colors) {
- metricsKey.push(...colors.map(metric => metric.key));
+ metricsKey.push(...colors.map((metric) => metric.key));
}
const options = {
...getBranchLikeQuery(branchLike),
s: 'metric',
metricSort: size.key,
asc: false,
- ps: BUBBLES_FETCH_LIMIT
+ ps: BUBBLES_FETCH_LIMIT,
};
this.props.updateLoading({ bubbles: true });
getComponentLeaves(component.key, metricsKey, options).then(
- r => {
+ (r) => {
if (domain === this.props.domain) {
if (this.mounted) {
this.setState({
- components: r.components.map(c => enhanceComponent(c, undefined, metrics)),
- paging: r.paging
+ components: r.components.map((c) => enhanceComponent(c, undefined, metrics)),
+ paging: r.paging,
});
}
this.props.updateLoading({ bubbles: false });
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverviewContainer.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverviewContainer.tsx
index 3fc1dc8d30e..75419016632 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverviewContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverviewContainer.tsx
@@ -30,7 +30,7 @@ import {
Dict,
Issue,
Metric,
- Period
+ Period,
} from '../../../types/types';
import { Query } from '../utils';
import MeasureOverview from './MeasureOverview';
@@ -62,7 +62,7 @@ export default class MeasureOverviewContainer extends React.PureComponent<Props,
mounted = false;
state: State = {
- loading: { bubbles: false, component: false }
+ loading: { bubbles: false, component: false },
};
componentDidMount() {
@@ -107,7 +107,7 @@ export default class MeasureOverviewContainer extends React.PureComponent<Props,
updateLoading = (loading: Partial<LoadingState>) => {
if (this.mounted) {
- this.setState(state => ({ loading: { ...state.loading, ...loading } }));
+ this.setState((state) => ({ loading: { ...state.loading, ...loading } }));
}
};
@@ -116,7 +116,7 @@ export default class MeasureOverviewContainer extends React.PureComponent<Props,
this.props.router.push(getProjectUrl(component.refKey || component.key, component.branch));
} else {
this.props.updateQuery({
- selected: component.key !== this.props.rootComponent.key ? component.key : undefined
+ selected: component.key !== this.props.rootComponent.key ? component.key : undefined,
});
}
};
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx
index 8c0d2a31e8a..16df3b6a4cf 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.tsx
@@ -49,21 +49,21 @@ export default class MeasureViewSelect extends React.PureComponent<Props> {
options.push({
icon: <TreeIcon />,
label: translate('component_measures.tab.tree'),
- value: 'tree'
+ value: 'tree',
});
}
if (hasList(metric.key)) {
options.push({
icon: <ListIcon />,
label: translate('component_measures.tab.list'),
- value: 'list'
+ value: 'list',
});
}
if (hasTreemap(metric.key, metric.type)) {
options.push({
icon: <TreemapIcon />,
label: translate('component_measures.tab.treemap'),
- value: 'treemap'
+ value: 'treemap',
});
}
return options;
@@ -99,11 +99,11 @@ export default class MeasureViewSelect extends React.PureComponent<Props> {
onChange={this.handleChange}
components={{
Option: this.renderOption,
- SingleValue: this.renderValue
+ SingleValue: this.renderValue,
}}
options={options}
isSearchable={false}
- value={options.find(o => o.value === view)}
+ value={options.find((o) => o.value === view)}
/>
);
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/App-test.tsx
index 802f3d49598..06c408b9689 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/App-test.tsx
@@ -36,40 +36,40 @@ jest.mock('../../../../api/metrics', () => ({
key: 'lines_to_cover',
type: 'INT',
name: 'Lines to Cover',
- domain: 'Coverage'
+ domain: 'Coverage',
},
{
id: '2',
key: 'coverage',
type: 'PERCENT',
name: 'Coverage',
- domain: 'Coverage'
+ domain: 'Coverage',
},
{
id: '3',
key: 'duplicated_lines_density',
type: 'PERCENT',
name: 'Duplicated Lines (%)',
- domain: 'Duplications'
+ domain: 'Duplications',
},
{
id: '4',
key: 'new_bugs',
type: 'INT',
name: 'New Bugs',
- domain: 'Reliability'
- }
- ])
+ domain: 'Reliability',
+ },
+ ]),
}));
jest.mock('../../../../api/measures', () => ({
- getMeasuresWithPeriod: jest.fn()
+ getMeasuresWithPeriod: jest.fn(),
}));
beforeEach(() => {
(getMeasuresWithPeriod as jest.Mock).mockResolvedValue({
component: { measures: [{ metric: 'coverage', value: '80.0' }] },
- period: { mode: 'previous_version' }
+ period: { mode: 'previous_version' },
});
});
@@ -82,7 +82,7 @@ it('should render correctly', async () => {
it('should render a measure overview', async () => {
const wrapper = shallowRender({
- location: mockLocation({ pathname: '/component_measures', query: { metric: 'Reliability' } })
+ location: mockLocation({ pathname: '/component_measures', query: { metric: 'Reliability' } }),
});
expect(wrapper.find('.spinner')).toHaveLength(1);
await waitAndUpdate(wrapper);
@@ -92,7 +92,7 @@ it('should render a measure overview', async () => {
it('should render a message when there are no measures', async () => {
(getMeasuresWithPeriod as jest.Mock).mockResolvedValue({
component: { measures: [] },
- period: { mode: 'previous_version' }
+ period: { mode: 'previous_version' },
});
const wrapper = shallowRender();
await waitAndUpdate(wrapper);
@@ -120,8 +120,8 @@ it('should render a warning message when user does not have access to all projec
const wrapper = shallowRender({
component: mockComponent({
qualifier: ComponentQualifier.Portfolio,
- canBrowseAllChildProjects: false
- })
+ canBrowseAllChildProjects: false,
+ }),
});
await waitAndUpdate(wrapper);
expect(wrapper.find(ScreenPositionHelper).dive()).toMatchSnapshot(
@@ -132,7 +132,7 @@ it('should render a warning message when user does not have access to all projec
it.each([
[ComponentQualifier.Portfolio, true, false],
[ComponentQualifier.Project, false, false],
- [ComponentQualifier.Portfolio, false, true]
+ [ComponentQualifier.Portfolio, false, true],
])(
'should not render a warning message',
async (
@@ -143,17 +143,11 @@ it.each([
const wrapper = shallowRender({
component: mockComponent({
qualifier: componentQualifier,
- canBrowseAllChildProjects
- })
+ canBrowseAllChildProjects,
+ }),
});
await waitAndUpdate(wrapper);
- expect(
- wrapper
- .find(ScreenPositionHelper)
- .dive()
- .find(Alert)
- .exists()
- ).toBe(alertIsVisible);
+ expect(wrapper.find(ScreenPositionHelper).dive().find(Alert).exists()).toBe(alertIsVisible);
}
);
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumb-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumb-test.tsx
index d4afe864b37..202eec49c96 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumb-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumb-test.tsx
@@ -29,7 +29,7 @@ it('should show the last element without clickable link', () => {
component={{
key: 'foo',
name: 'Foo',
- qualifier: 'TRK'
+ qualifier: 'TRK',
}}
handleSelect={() => {}}
isLast={true}
@@ -46,7 +46,7 @@ it('should correctly show a middle element', () => {
component={{
key: 'foo',
name: 'Foo',
- qualifier: 'TRK'
+ qualifier: 'TRK',
}}
handleSelect={() => {}}
isLast={false}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumbs-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumbs-test.tsx
index 9da19435ad3..1cbc9db0074 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumbs-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumbs-test.tsx
@@ -28,20 +28,20 @@ jest.mock('../../../../api/components', () => ({
getBreadcrumbs: jest.fn().mockResolvedValue([
{ key: 'anc1', name: 'Ancestor1' },
{ key: 'anc2', name: 'Ancestor2' },
- { key: 'bar', name: 'Bar' }
- ])
+ { key: 'bar', name: 'Bar' },
+ ]),
}));
const componentFoo = {
key: 'foo',
name: 'Foo',
- qualifier: 'TRK'
+ qualifier: 'TRK',
};
const componentBar = {
key: 'bar',
name: 'Bar',
- qualifier: 'TRK'
+ qualifier: 'TRK',
};
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/LeakPeriodLegend-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/LeakPeriodLegend-test.tsx
index 5b04a88b080..60f1808fffc 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/LeakPeriodLegend-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/LeakPeriodLegend-test.tsx
@@ -32,27 +32,27 @@ jest.mock('date-fns', () => {
const PROJECT = {
key: 'foo',
name: 'Foo',
- qualifier: 'TRK'
+ qualifier: 'TRK',
};
const APP = {
key: 'bar',
name: 'Bar',
- qualifier: 'APP'
+ qualifier: 'APP',
};
const PERIOD: Period = {
date: '2017-05-16T13:50:02+0200',
index: 1,
mode: 'previous_version',
- parameter: '6,4'
+ parameter: '6,4',
};
const PERIOD_DAYS: Period = {
date: '2017-05-16T13:50:02+0200',
index: 1,
mode: 'days',
- parameter: '18'
+ parameter: '18',
};
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureContent-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureContent-test.tsx
index de6447408c5..ff60b7a14fd 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureContent-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureContent-test.tsx
@@ -26,7 +26,7 @@ import { waitAndUpdate } from '../../../../helpers/testUtils';
import MeasureContent from '../MeasureContent';
jest.mock('../../../../helpers/scrolling', () => ({
- scrollToElement: jest.fn()
+ scrollToElement: jest.fn(),
}));
jest.mock('../../../../api/components', () => {
@@ -47,19 +47,19 @@ jest.mock('../../../../api/components', () => {
key: 'bugs',
name: 'Bugs',
qualitative: true,
- type: 'INT'
- }
- ]
- })
+ type: 'INT',
+ },
+ ],
+ }),
};
});
jest.mock('../../../../api/measures', () => ({
- getMeasures: jest.fn().mockResolvedValue([{ metric: 'bugs', value: '12', bestValue: false }])
+ getMeasures: jest.fn().mockResolvedValue([{ metric: 'bugs', value: '12', bestValue: false }]),
}));
const METRICS = {
- bugs: { id: '1', key: 'bugs', type: 'INT', name: 'Bugs', domain: 'Reliability' }
+ bugs: { id: '1', key: 'bugs', type: 'INT', name: 'Bugs', domain: 'Reliability' },
};
const WINDOW_HEIGHT = 800;
@@ -73,7 +73,7 @@ beforeAll(() => {
Object.defineProperty(window, 'innerHeight', {
writable: true,
configurable: true,
- value: WINDOW_HEIGHT
+ value: WINDOW_HEIGHT,
});
});
@@ -81,7 +81,7 @@ afterAll(() => {
Object.defineProperty(window, 'innerHeight', {
writable: true,
configurable: true,
- value: originalHeight
+ value: originalHeight,
});
});
@@ -111,7 +111,7 @@ it('should render correctly for a file', async () => {
paging: { pageIndex: 1, pageSize: 500, total: 0 },
baseComponent: mockComponentMeasure(true),
components: [],
- metrics: [METRICS.bugs]
+ metrics: [METRICS.bugs],
});
const wrapper = shallowRender();
expect(wrapper.type()).toBeNull();
@@ -124,7 +124,7 @@ it('should test fetchMoreComponents to work correctly', async () => {
paging: { pageIndex: 12, pageSize: 500, total: 0 },
baseComponent: mockComponentMeasure(false),
components: [],
- metrics: [METRICS.bugs]
+ metrics: [METRICS.bugs],
});
const wrapper = shallowRender();
await waitAndUpdate(wrapper);
@@ -136,7 +136,7 @@ it('should test getComponentRequestParams response for different arguments', ()
const wrapper = shallowRender({ asc: false });
const metric = {
direction: -1,
- key: 'new_reliability_rating'
+ key: 'new_reliability_rating',
};
const reqParamsList = {
metricKeys: ['new_reliability_rating'],
@@ -147,9 +147,9 @@ it('should test getComponentRequestParams response for different arguments', ()
metricSort: 'new_reliability_rating',
metricSortFilter: 'withMeasuresOnly',
ps: 500,
- s: 'metricPeriod'
+ s: 'metricPeriod',
},
- strategy: 'leaves'
+ strategy: 'leaves',
};
expect(wrapper.instance().getComponentRequestParams('list', metric, { asc: true })).toEqual(
reqParamsList
@@ -167,9 +167,9 @@ it('should test getComponentRequestParams response for different arguments', ()
metricSort: 'new_lines',
metricSortFilter: 'withMeasuresOnly',
ps: 500,
- s: 'metricPeriod'
+ s: 'metricPeriod',
},
- strategy: 'children'
+ strategy: 'children',
};
expect(wrapper.instance().getComponentRequestParams('treemap', metric, { asc: true })).toEqual(
reqParamsTreeMap
@@ -186,9 +186,9 @@ it('should test getComponentRequestParams response for different arguments', ()
additionalFields: 'metrics',
asc: false,
ps: 500,
- s: 'qualifier,name'
+ s: 'qualifier,name',
},
- strategy: 'children'
+ strategy: 'children',
};
expect(wrapper.instance().getComponentRequestParams('tree', metric, { asc: false })).toEqual(
reqParamsTree
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureHeader-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureHeader-test.tsx
index 443e596f754..3a08d8b0ea6 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureHeader-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureHeader-test.tsx
@@ -27,21 +27,21 @@ const METRIC = {
id: '1',
key: 'reliability_rating',
type: 'RATING',
- name: 'Reliability Rating'
+ name: 'Reliability Rating',
};
const LEAK_METRIC = {
id: '2',
key: 'new_reliability_rating',
type: 'RATING',
- name: 'Reliability Rating on New Code'
+ name: 'Reliability Rating on New Code',
};
const LEAK_MEASURE = '3.0';
const SECONDARY = {
value: 'java=175123;js=26382',
- metric: 'ncloc_language_distribution'
+ metric: 'ncloc_language_distribution',
};
const PROPS = {
@@ -50,10 +50,10 @@ const PROPS = {
date: '2017-05-16T13:50:02+0200',
index: 1,
mode: 'previous_version',
- parameter: '6,4'
+ parameter: '6,4',
} as Period,
measureValue: '3.0',
- metric: METRIC
+ metric: METRIC,
};
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureOverview-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureOverview-test.tsx
index 4b2a4b71b2e..ff18669d29e 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureOverview-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureOverview-test.tsx
@@ -24,13 +24,13 @@ import { getComponentLeaves } from '../../../../api/components';
import { mockBranch } from '../../../../helpers/mocks/branch-like';
import {
mockComponentMeasure,
- mockComponentMeasureEnhanced
+ mockComponentMeasureEnhanced,
} from '../../../../helpers/mocks/component';
import {
mockMeasure,
mockMeasureEnhanced,
mockMetric,
- mockPeriod
+ mockPeriod,
} from '../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../helpers/testUtils';
import { MetricKey } from '../../../../types/metrics';
@@ -40,7 +40,7 @@ import MeasureOverview from '../MeasureOverview';
jest.mock('../../../../api/components', () => ({
getComponentLeaves: jest
.fn()
- .mockResolvedValue({ components: [], paging: { total: 200, pageIndex: 1, pageSize: 100 } })
+ .mockResolvedValue({ components: [], paging: { total: 200, pageIndex: 1, pageSize: 100 } }),
}));
beforeEach(jest.clearAllMocks);
@@ -57,8 +57,8 @@ it('should render correctly', () => {
it('should correctly enhance leaf components', async () => {
(getComponentLeaves as jest.Mock).mockResolvedValueOnce({
components: [
- mockComponentMeasure(false, { measures: [mockMeasure({ metric: MetricKey.bugs })] })
- ]
+ mockComponentMeasure(false, { measures: [mockMeasure({ metric: MetricKey.bugs })] }),
+ ],
});
const updateLoading = jest.fn();
const wrapper = shallowRender({ updateLoading });
@@ -70,7 +70,7 @@ it('should correctly enhance leaf components', async () => {
MetricKey.ncloc,
MetricKey.reliability_remediation_effort,
MetricKey.bugs,
- MetricKey.reliability_rating
+ MetricKey.reliability_rating,
],
expect.objectContaining({ metricSort: MetricKey.bugs, s: 'metric', ps: BUBBLES_FETCH_LIMIT })
);
@@ -82,10 +82,10 @@ it('should correctly enhance leaf components', async () => {
measures: [
mockMeasureEnhanced({
leak: '1.0',
- metric: mockMetric({ key: MetricKey.bugs, type: 'INT' })
- })
- ]
- })
+ metric: mockMetric({ key: MetricKey.bugs, type: 'INT' }),
+ }),
+ ],
+ }),
]);
expect(updateLoading).toHaveBeenLastCalledWith({ bubbles: false });
});
@@ -114,15 +114,15 @@ function shallowRender(props: Partial<MeasureOverview['props']> = {}) {
mockMetric({ key: MetricKey.ncloc, type: 'INT' }),
mockMetric({
key: MetricKey.reliability_remediation_effort,
- type: 'INT'
+ type: 'INT',
}),
mockMetric({ key: MetricKey.bugs, type: 'INT' }),
mockMetric({
key: MetricKey.reliability_rating,
- type: 'DATA'
- })
+ type: 'DATA',
+ }),
],
- m => m.key
+ (m) => m.key
)}
updateLoading={jest.fn()}
updateSelected={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/config/bubbles.ts b/server/sonar-web/src/main/js/apps/component-measures/config/bubbles.ts
index 7f7b9e730b6..ade8665f94d 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/config/bubbles.ts
+++ b/server/sonar-web/src/main/js/apps/component-measures/config/bubbles.ts
@@ -32,36 +32,36 @@ export const bubbles: {
x: MetricKey.ncloc,
y: MetricKey.reliability_remediation_effort,
size: MetricKey.bugs,
- colors: [MetricKey.reliability_rating]
+ colors: [MetricKey.reliability_rating],
},
Security: {
x: MetricKey.ncloc,
y: MetricKey.security_remediation_effort,
size: MetricKey.vulnerabilities,
- colors: [MetricKey.security_rating]
+ colors: [MetricKey.security_rating],
},
Maintainability: {
x: MetricKey.ncloc,
y: MetricKey.sqale_index,
size: MetricKey.code_smells,
- colors: [MetricKey.sqale_rating]
+ colors: [MetricKey.sqale_rating],
},
Coverage: {
x: MetricKey.complexity,
y: MetricKey.coverage,
size: MetricKey.uncovered_lines,
- yDomain: [100, 0]
+ yDomain: [100, 0],
},
Duplications: {
x: MetricKey.ncloc,
y: MetricKey.duplicated_lines,
- size: MetricKey.duplicated_blocks
+ size: MetricKey.duplicated_blocks,
},
project_overview: {
x: MetricKey.sqale_index,
y: MetricKey.coverage,
size: MetricKey.ncloc,
colors: [MetricKey.reliability_rating, MetricKey.security_rating],
- yDomain: [100, 0]
- }
+ yDomain: [100, 0],
+ },
};
diff --git a/server/sonar-web/src/main/js/apps/component-measures/config/complementary.ts b/server/sonar-web/src/main/js/apps/component-measures/config/complementary.ts
index 0e4bc18615d..1564db07630 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/config/complementary.ts
+++ b/server/sonar-web/src/main/js/apps/component-measures/config/complementary.ts
@@ -35,5 +35,5 @@ export const complementary: Dict<string[]> = {
duplicated_lines_density: ['duplicated_lines'],
new_duplicated_lines_density: ['new_duplicated_lines'],
duplicated_lines: ['duplicated_lines_density'],
- new_duplicated_lines: ['new_duplicated_lines_density']
+ new_duplicated_lines: ['new_duplicated_lines_density'],
};
diff --git a/server/sonar-web/src/main/js/apps/component-measures/config/domains.ts b/server/sonar-web/src/main/js/apps/component-measures/config/domains.ts
index 9af0afb804f..a6d0d962384 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/config/domains.ts
+++ b/server/sonar-web/src/main/js/apps/component-measures/config/domains.ts
@@ -35,8 +35,8 @@ export const domains: Domains = {
'overall_category',
MetricKey.bugs,
MetricKey.reliability_rating,
- MetricKey.reliability_remediation_effort
- ]
+ MetricKey.reliability_remediation_effort,
+ ],
},
Security: {
@@ -50,8 +50,8 @@ export const domains: Domains = {
'overall_category',
MetricKey.vulnerabilities,
MetricKey.security_rating,
- MetricKey.security_remediation_effort
- ]
+ MetricKey.security_remediation_effort,
+ ],
},
SecurityReview: {
@@ -65,8 +65,8 @@ export const domains: Domains = {
'overall_category',
MetricKey.security_hotspots,
MetricKey.security_review_rating,
- MetricKey.security_hotspots_reviewed
- ]
+ MetricKey.security_hotspots_reviewed,
+ ],
},
Maintainability: {
@@ -83,8 +83,8 @@ export const domains: Domains = {
MetricKey.sqale_index,
MetricKey.sqale_debt_ratio,
MetricKey.sqale_rating,
- MetricKey.effort_to_reach_maintainability_rating_a
- ]
+ MetricKey.effort_to_reach_maintainability_rating_a,
+ ],
},
Coverage: {
@@ -114,8 +114,8 @@ export const domains: Domains = {
MetricKey.test_failures,
MetricKey.skipped_tests,
MetricKey.test_success_density,
- MetricKey.test_execution_time
- ]
+ MetricKey.test_execution_time,
+ ],
},
Duplications: {
@@ -130,8 +130,8 @@ export const domains: Domains = {
MetricKey.duplicated_lines_density,
MetricKey.duplicated_lines,
MetricKey.duplicated_blocks,
- MetricKey.duplicated_files
- ]
+ MetricKey.duplicated_files,
+ ],
},
Size: {
@@ -144,16 +144,16 @@ export const domains: Domains = {
MetricKey.functions,
MetricKey.classes,
MetricKey.files,
- MetricKey.directories
- ]
+ MetricKey.directories,
+ ],
},
Complexity: {
- order: ['complexity', 'function_complexity', 'file_complexity', 'class_complexity']
+ order: ['complexity', 'function_complexity', 'file_complexity', 'class_complexity'],
},
Releasability: {
- order: ['releasability_rating', 'releasability_effort', 'alert_status']
+ order: ['releasability_rating', 'releasability_effort', 'alert_status'],
},
Issues: {
@@ -174,7 +174,7 @@ export const domains: Domains = {
MetricKey.open_issues,
MetricKey.reopened_issues,
MetricKey.confirmed_issues,
- MetricKey.false_positive_issues
- ]
- }
+ MetricKey.false_positive_issues,
+ ],
+ },
};
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx
index 9d711a94208..bfc31200735 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.tsx
@@ -28,7 +28,7 @@ import {
getLocalizedMetricDomain,
getLocalizedMetricName,
translate,
- translateWithParameters
+ translateWithParameters,
} from '../../../helpers/l10n';
import { formatMeasure, isDiffMetric } from '../../../helpers/measures';
import { isDefined } from '../../../helpers/types';
@@ -41,13 +41,13 @@ import {
ComponentMeasureIntern,
Dict,
Metric,
- Paging
+ Paging,
} from '../../../types/types';
import {
BUBBLES_FETCH_LIMIT,
getBubbleMetrics,
getBubbleYDomain,
- isProjectOverview
+ isProjectOverview,
} from '../utils';
import EmptyResult from './EmptyResult';
@@ -69,11 +69,11 @@ interface State {
export default class BubbleChart extends React.PureComponent<Props, State> {
state: State = {
- ratingFilters: {}
+ ratingFilters: {},
};
getMeasureVal = (component: ComponentMeasureEnhanced, metric: Metric) => {
- const measure = component.measures.find(measure => measure.metric.key === metric.key);
+ const measure = component.measures.find((measure) => measure.metric.key === metric.key);
if (!measure) {
return undefined;
}
@@ -87,12 +87,12 @@ export default class BubbleChart extends React.PureComponent<Props, State> {
) {
const inner = [
[component.name, isProject(component.qualifier) ? component.branch : undefined]
- .filter(s => !!s)
+ .filter((s) => !!s)
.join(' / '),
`${metrics.x.name}: ${formatMeasure(values.x, metrics.x.type)}`,
`${metrics.y.name}: ${formatMeasure(values.y, metrics.y.type)}`,
- `${metrics.size.name}: ${formatMeasure(values.size, metrics.size.type)}`
- ].filter(s => !!s);
+ `${metrics.size.name}: ${formatMeasure(values.size, metrics.size.type)}`,
+ ].filter((s) => !!s);
const { colors: valuesColors } = values;
const { colors: metricColors } = metrics;
if (valuesColors && metricColors) {
@@ -136,12 +136,12 @@ export default class BubbleChart extends React.PureComponent<Props, State> {
const { ratingFilters } = this.state;
const items = this.props.components
- .map(component => {
+ .map((component) => {
const x = this.getMeasureVal(component, metrics.x);
const y = this.getMeasureVal(component, metrics.y);
const size = this.getMeasureVal(component, metrics.size);
const colors =
- metrics.colors && metrics.colors.map(metric => this.getMeasureVal(component, metric));
+ metrics.colors && metrics.colors.map((metric) => this.getMeasureVal(component, metric));
if ((!x && x !== 0) || (!y && y !== 0) || (!size && size !== 0)) {
return undefined;
}
@@ -162,7 +162,7 @@ export default class BubbleChart extends React.PureComponent<Props, State> {
? RATING_COLORS[colorRating - 1]
: { fill: theme.colors.primary, stroke: theme.colors.primary },
data: component,
- tooltip: this.getTooltip(component, { x, y, size, colors }, metrics)
+ tooltip: this.getTooltip(component, { x, y, size, colors }, metrics),
};
})
.filter(isDefined);
@@ -225,7 +225,7 @@ export default class BubbleChart extends React.PureComponent<Props, State> {
colorsMetric.length > 1
? translateWithParameters(
'component_measures.legend.worse_of_x_y',
- ...colorsMetric.map(metric => getLocalizedMetricName(metric))
+ ...colorsMetric.map((metric) => getLocalizedMetricName(metric))
)
: getLocalizedMetricName(colorsMetric[0])
)}
@@ -265,8 +265,9 @@ export default class BubbleChart extends React.PureComponent<Props, State> {
componentKey,
branchLike,
metric: isProjectOverview(domain) ? MetricKey.violations : metrics.size.key,
- listView: true
- })}>
+ listView: true,
+ })}
+ >
{translate('component_measures.overview.see_data_as_list')}
</Link>
</div>
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx
index ec93e70f7fd..df96cbcbfa7 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.tsx
@@ -32,7 +32,7 @@ import {
ComponentQualifier,
isApplication,
isPortfolioLike,
- isProject
+ isProject,
} from '../../../types/component';
import { MeasurePageView } from '../../../types/measures';
import { MetricKey } from '../../../types/metrics';
@@ -54,11 +54,13 @@ export default function ComponentCell(props: ComponentCellProps) {
if (
view === 'list' &&
- ([
- ComponentQualifier.File,
- ComponentQualifier.TestFile,
- ComponentQualifier.Directory
- ] as string[]).includes(component.qualifier) &&
+ (
+ [
+ ComponentQualifier.File,
+ ComponentQualifier.TestFile,
+ ComponentQualifier.Directory,
+ ] as string[]
+ ).includes(component.qualifier) &&
component.path
) {
({ head, tail } = splitPath(component.path));
@@ -96,7 +98,8 @@ export default function ComponentCell(props: ComponentCellProps) {
<Link
className="link-no-underline"
to={path}
- id={'component-measures-component-link-' + component.key}>
+ id={'component-measures-component-link-' + component.key}
+ >
{component.refKey && (
<span className="big-spacer-right">
<LinkIcon />
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx
index 07c897bd0b4..e246b479814 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.tsx
@@ -42,7 +42,7 @@ export default function ComponentsList({ components, metric, metrics, ...props }
return <EmptyResult />;
}
- const otherMetrics = (complementary[metric.key] || []).map(key => metrics[key]);
+ const otherMetrics = (complementary[metric.key] || []).map((key) => metrics[key]);
return (
<table className="data zebra zebra-hover">
{otherMetrics.length > 0 && (
@@ -52,7 +52,7 @@ export default function ComponentsList({ components, metric, metrics, ...props }
<th className="text-right">
<span className="small">{getLocalizedMetricName(metric)}</span>
</th>
- {otherMetrics.map(metric => (
+ {otherMetrics.map((metric) => (
<th className="text-right" key={metric.key}>
<span className="small">{getLocalizedMetricName(metric)}</span>
</th>
@@ -62,7 +62,7 @@ export default function ComponentsList({ components, metric, metrics, ...props }
)}
<tbody>
- {components.map(component => (
+ {components.map((component) => (
<ComponentsListRow
component={component}
isSelected={
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx
index 8a58ac4731f..b70f3f828b9 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.tsx
@@ -37,12 +37,12 @@ interface Props {
export default function ComponentsListRow(props: Props) {
const { branchLike, component, rootComponent } = props;
- const otherMeasures = props.otherMetrics.map(metric => {
- const measure = component.measures.find(measure => measure.metric.key === metric.key);
+ const otherMeasures = props.otherMetrics.map((metric) => {
+ const measure = component.measures.find((measure) => measure.metric.key === metric.key);
return { ...measure, metric };
});
const rowClass = classNames('measure-details-component-row', {
- selected: props.isSelected
+ selected: props.isSelected,
});
return (
<tr className={rowClass}>
@@ -56,7 +56,7 @@ export default function ComponentsListRow(props: Props) {
<MeasureCell component={component} metric={props.metric} />
- {otherMeasures.map(measure => (
+ {otherMeasures.map((measure) => (
<MeasureCell
component={component}
key={measure.metric.key}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx
index c35f5500921..bff1752ee6f 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.tsx
@@ -34,7 +34,7 @@ import {
ComponentMeasureEnhanced,
Dict,
Metric,
- Paging
+ Paging,
} from '../../../types/types';
import ComponentsList from './ComponentsList';
@@ -113,7 +113,7 @@ export default class FilesView extends React.PureComponent<Props, State> {
if (this.state.showBestMeasures) {
return components;
}
- const filtered = components.filter(component => !this.hasBestValue(component));
+ const filtered = components.filter((component) => !this.hasBestValue(component));
if (filtered.length === 0) {
return components;
}
@@ -126,7 +126,7 @@ export default class FilesView extends React.PureComponent<Props, State> {
hasBestValue = (component: ComponentMeasureEnhanced) => {
const { metric } = this.props;
- const focusedMeasure = component.measures.find(measure => measure.metric.key === metric.key);
+ const focusedMeasure = component.measures.find((measure) => measure.metric.key === metric.key);
if (focusedMeasure && isDiffMetric(metric.key)) {
return isPeriodBestValue(focusedMeasure);
}
@@ -173,7 +173,7 @@ export default class FilesView extends React.PureComponent<Props, State> {
const filteredComponents = this.getVisibleComponents();
const hidingBestMeasures = filteredComponents.length < components.length;
return (
- <div ref={elem => (this.listContainer = elem)}>
+ <div ref={(elem) => (this.listContainer = elem)}>
<ComponentsList
branchLike={this.props.branchLike}
components={filteredComponents}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx
index a06cf271e3e..108d31dad8e 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx
@@ -50,7 +50,7 @@ const LEVEL_COLORS = [
colors.error500,
colors.orange,
colors.success500,
- colors.disabledQualityGate
+ colors.disabledQualityGate,
];
const NA_GRADIENT = `linear-gradient(-45deg, ${colors.gray71} 25%, ${colors.gray60} 25%, ${colors.gray60} 50%, ${colors.gray71} 50%, ${colors.gray71} 75%, ${colors.gray60} 75%, ${colors.gray60} 100%)`;
@@ -71,9 +71,11 @@ export default class TreeMapView extends React.PureComponent<Props, State> {
getTreemapComponents = ({ components, metric }: Props) => {
const colorScale = this.getColorScale(metric);
return components
- .map(component => {
- const colorMeasure = component.measures.find(measure => measure.metric.key === metric.key);
- const sizeMeasure = component.measures.find(measure => measure.metric.key !== metric.key);
+ .map((component) => {
+ const colorMeasure = component.measures.find(
+ (measure) => measure.metric.key === metric.key
+ );
+ const sizeMeasure = component.measures.find((measure) => measure.metric.key !== metric.key);
if (!sizeMeasure) {
return undefined;
}
@@ -95,7 +97,7 @@ export default class TreeMapView extends React.PureComponent<Props, State> {
gradient: !colorValue ? NA_GRADIENT : undefined,
icon: <QualifierIcon fill={colors.baseFontColor} qualifier={component.qualifier} />,
key: getComponentMeasureUniqueKey(component) ?? '',
- label: [component.name, component.branch].filter(s => !!s).join(' / '),
+ label: [component.name, component.branch].filter((s) => !!s).join(' / '),
size: sizeValue,
measureValue: colorValue,
metric,
@@ -104,18 +106,16 @@ export default class TreeMapView extends React.PureComponent<Props, State> {
colorValue,
component,
sizeMetric: sizeMeasure.metric,
- sizeValue
+ sizeValue,
}),
- component
+ component,
};
})
.filter(isDefined);
};
getLevelColorScale = () =>
- scaleOrdinal<string, string>()
- .domain(['ERROR', 'WARN', 'OK', 'NONE'])
- .range(LEVEL_COLORS);
+ scaleOrdinal<string, string>().domain(['ERROR', 'WARN', 'OK', 'NONE']).range(LEVEL_COLORS);
getPercentColorScale = (metric: Metric) => {
const color = scaleLinear<string, string>().domain([0, 25, 50, 75, 100]);
@@ -123,10 +123,7 @@ export default class TreeMapView extends React.PureComponent<Props, State> {
return color;
};
- getRatingColorScale = () =>
- scaleLinear<string, string>()
- .domain([1, 2, 3, 4, 5])
- .range(COLORS);
+ getRatingColorScale = () => scaleLinear<string, string>().domain([1, 2, 3, 4, 5]).range(COLORS);
getColorScale = (metric: Metric) => {
if (metric.type === 'LEVEL') {
@@ -143,7 +140,7 @@ export default class TreeMapView extends React.PureComponent<Props, State> {
colorValue,
component,
sizeMetric,
- sizeValue
+ sizeValue,
}: {
colorMetric: Metric;
colorValue?: string;
@@ -155,7 +152,7 @@ export default class TreeMapView extends React.PureComponent<Props, State> {
colorMetric && colorValue !== undefined ? formatMeasure(colorValue, colorMetric.type) : '—';
return (
<div className="text-left">
- {[component.name, component.branch].filter(s => !!s).join(' / ')}
+ {[component.name, component.branch].filter((s) => !!s).join(' / ')}
<br />
{`${getLocalizedMetricName(sizeMetric)}: ${formatMeasure(sizeValue, sizeMetric.type)}`}
<br />
@@ -195,7 +192,7 @@ export default class TreeMapView extends React.PureComponent<Props, State> {
const { components, metric } = this.props;
const sizeMeasure =
components.length > 0
- ? components[0].measures.find(measure => measure.metric.key !== metric.key)
+ ? components[0].measures.find((measure) => measure.metric.key !== metric.key)
: null;
return (
<div className="measure-details-treemap">
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/BubbleChart-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/BubbleChart-test.tsx
index 682b417074b..f4b305495cc 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/BubbleChart-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/BubbleChart-test.tsx
@@ -32,9 +32,9 @@ const metrics = keyBy(
mockMetric({ key: MetricKey.ncloc, type: 'INT' }),
mockMetric({ key: MetricKey.security_remediation_effort, type: 'DATA' }),
mockMetric({ key: MetricKey.vulnerabilities, type: 'INT' }),
- mockMetric({ key: MetricKey.security_rating, type: 'RATING' })
+ mockMetric({ key: MetricKey.security_rating, type: 'RATING' }),
],
- m => m.key
+ (m) => m.key
);
it('should render correctly', () => {
@@ -51,13 +51,13 @@ it('should render correctly', () => {
mockMeasure({ value: '0', metric: MetricKey.ncloc }),
mockMeasure({ value: '0', metric: MetricKey.security_remediation_effort }),
mockMeasure({ value: '0', metric: MetricKey.vulnerabilities }),
- mockMeasure({ value: '0', metric: MetricKey.security_rating })
- ]
+ mockMeasure({ value: '0', metric: MetricKey.security_rating }),
+ ],
}),
metrics[MetricKey.vulnerabilities],
metrics
- )
- ]
+ ),
+ ],
})
).toMatchSnapshot('all on x=0');
});
@@ -83,12 +83,12 @@ function shallowRender(overrides: Partial<BubbleChart['props']> = {}) {
mockMeasure({ value: '236', metric: MetricKey.ncloc }),
mockMeasure({ value: '10', metric: MetricKey.security_remediation_effort }),
mockMeasure({ value: '3', metric: MetricKey.vulnerabilities }),
- mockMeasure({ value: '2', metric: MetricKey.security_rating })
- ]
+ mockMeasure({ value: '2', metric: MetricKey.security_rating }),
+ ],
}),
metrics[MetricKey.vulnerabilities],
metrics
- )
+ ),
]}
domain="Security"
metrics={metrics}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx
index 706051bd81a..06e8e61dd35 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentCell-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import Link from '../../../../components/common/Link';
import {
mockComponentMeasure,
- mockComponentMeasureEnhanced
+ mockComponentMeasureEnhanced,
} from '../../../../helpers/mocks/component';
import { mockMetric } from '../../../../helpers/testMocks';
import { ComponentQualifier } from '../../../../types/component';
@@ -40,14 +40,14 @@ it.each([
[ComponentQualifier.Application, undefined],
[ComponentQualifier.Application, 'develop'],
[ComponentQualifier.Portfolio, undefined],
- [ComponentQualifier.Portfolio, 'develop']
+ [ComponentQualifier.Portfolio, 'develop'],
])(
'should render correctly for a "%s" root component and a component with branch "%s"',
(rootComponentQualifier: ComponentQualifier, componentBranch: string | undefined) => {
expect(
shallowRender({
rootComponent: mockComponentMeasure(false, { qualifier: rootComponentQualifier }),
- component: mockComponentMeasureEnhanced({ branch: componentBranch })
+ component: mockComponentMeasureEnhanced({ branch: componentBranch }),
})
).toMatchSnapshot();
}
@@ -58,26 +58,22 @@ it('should properly deal with key and refKey', () => {
shallowRender({
component: mockComponentMeasureEnhanced({
qualifier: ComponentQualifier.SubPortfolio,
- refKey: 'port-key'
- })
+ refKey: 'port-key',
+ }),
})
.find(Link)
.props().to
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
- search: '?id=port-key&metric=bugs&view=list'
+ search: '?id=port-key&metric=bugs&view=list',
})
);
- expect(
- shallowRender()
- .find(Link)
- .props().to
- ).toEqual(
+ expect(shallowRender().find(Link).props().to).toEqual(
expect.objectContaining({
pathname: '/component_measures',
- search: '?id=foo&metric=bugs&view=list&selected=foo%3Asrc%2Findex.tsx'
+ search: '?id=foo&metric=bugs&view=list&selected=foo%3Asrc%2Findex.tsx',
})
);
});
@@ -88,57 +84,57 @@ it.each([
MetricKey.bugs,
{
pathname: '/component_measures',
- search: `?id=foo&metric=${MetricKey.bugs}&branch=develop&view=list&selected=foo`
- }
+ search: `?id=foo&metric=${MetricKey.bugs}&branch=develop&view=list&selected=foo`,
+ },
],
[
ComponentQualifier.Directory,
MetricKey.bugs,
{
pathname: '/component_measures',
- search: `?id=foo&metric=${MetricKey.bugs}&branch=develop&view=list&selected=foo`
- }
+ search: `?id=foo&metric=${MetricKey.bugs}&branch=develop&view=list&selected=foo`,
+ },
],
[
ComponentQualifier.Project,
MetricKey.projects,
{
pathname: '/dashboard',
- search: '?id=foo&branch=develop'
- }
+ search: '?id=foo&branch=develop',
+ },
],
[
ComponentQualifier.Application,
MetricKey.releasability_rating,
{
pathname: '/dashboard',
- search: '?id=foo&branch=develop'
- }
+ search: '?id=foo&branch=develop',
+ },
],
[
ComponentQualifier.Project,
MetricKey.releasability_rating,
{
pathname: '/dashboard',
- search: '?id=foo&branch=develop'
- }
+ search: '?id=foo&branch=develop',
+ },
],
[
ComponentQualifier.Application,
MetricKey.alert_status,
{
pathname: '/dashboard',
- search: '?id=foo&branch=develop'
- }
+ search: '?id=foo&branch=develop',
+ },
],
[
ComponentQualifier.Project,
MetricKey.alert_status,
{
pathname: '/dashboard',
- search: '?id=foo&branch=develop'
- }
- ]
+ search: '?id=foo&branch=develop',
+ },
+ ],
])(
'should display the proper link path for %s component qualifier and %s metric key',
(
@@ -150,8 +146,8 @@ it.each([
{
component: mockComponentMeasureEnhanced({
qualifier: componentQualifier,
- branch: 'develop'
- })
+ branch: 'develop',
+ }),
},
metricKey
);
@@ -164,7 +160,7 @@ function shallowRender(overrides: Partial<ComponentCellProps> = {}, metricKey =
const metric = mockMetric({ key: metricKey });
const component = enhanceComponent(
mockComponentMeasure(true, {
- measures: [{ metric: metric.key, value: '1', bestValue: false }]
+ measures: [{ metric: metric.key, value: '1', bestValue: false }],
}),
metric,
{ [metric.key]: metric }
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentList-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentList-test.tsx
index 3f00758d70a..8bb32fd9d2c 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/ComponentList-test.tsx
@@ -26,15 +26,15 @@ const COMPONENTS = [
key: 'foo',
measures: [],
name: 'Foo',
- qualifier: 'TRK'
- }
+ qualifier: 'TRK',
+ },
];
const METRICS = {
coverage: { id: '1', key: 'coverage', type: 'PERCENT', name: 'Coverage' },
new_bugs: { id: '2', key: 'new_bugs', type: 'INT', name: 'New Bugs' },
uncovered_lines: { id: '3', key: 'uncovered_lines', type: 'INT', name: 'Lines' },
- uncovered_conditions: { id: '4', key: 'uncovered_conditions', type: 'INT', name: 'Conditions' }
+ uncovered_conditions: { id: '4', key: 'uncovered_conditions', type: 'INT', name: 'Conditions' },
};
it('should renders correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/FilesView-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/FilesView-test.tsx
index 3a772b9fea6..db285cf53ec 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/FilesView-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/__tests__/FilesView-test.tsx
@@ -29,8 +29,8 @@ const COMPONENTS = [
key: 'foo',
measures: [],
name: 'Foo',
- qualifier: 'TRK'
- }
+ qualifier: 'TRK',
+ },
];
const METRICS = { coverage: { id: '1', key: 'coverage', type: 'PERCENT', name: 'Coverage' } };
@@ -48,9 +48,9 @@ it('should render with best values hidden', () => {
key: 'bar',
measures: [{ bestValue: true, metric: mockMetric({ key: 'coverage' }) }],
name: 'Bar',
- qualifier: 'TRK'
- }
- ]
+ qualifier: 'TRK',
+ },
+ ],
})
).toMatchSnapshot();
});
@@ -63,27 +63,27 @@ it('should correctly bind key events for file navigation', () => {
key: 'foo',
measures: [],
name: 'Foo',
- qualifier: 'TRK'
+ qualifier: 'TRK',
},
{
key: 'bar',
measures: [],
name: 'Bar',
- qualifier: 'TRK'
+ qualifier: 'TRK',
},
{
key: 'yoo',
measures: [],
name: 'Yoo',
- qualifier: 'TRK'
- }
+ qualifier: 'TRK',
+ },
];
shallowRender({
handleSelect,
handleOpen,
selectedComponent: FILES[0],
- components: FILES
+ components: FILES,
});
keydown({ key: KeyboardKeys.DownArrow });
@@ -115,7 +115,7 @@ function shallowRender(props: Partial<FilesView['props']> = {}) {
key: 'parent',
measures: [],
name: 'Parent',
- qualifier: 'TRK'
+ qualifier: 'TRK',
}}
view="tree"
{...props}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/routes.tsx b/server/sonar-web/src/main/js/apps/component-measures/routes.tsx
index 04e9d573fb4..6b838d4f2c0 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/routes.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/routes.tsx
@@ -32,9 +32,9 @@ const routes = () => (
element={
<NavigateWithParams
pathname="/component_measures"
- transformParams={params =>
+ transformParams={(params) =>
omitNil({
- metric: params['domainName']
+ metric: params['domainName'],
})
}
/>
@@ -57,9 +57,9 @@ function MetricRedirect() {
omitNil({
id: searchParams.get('id') ?? undefined,
graph: 'custom',
- custom_metrics: params.metricKey
+ custom_metrics: params.metricKey,
})
- ).toString()
+ ).toString(),
};
return <Navigate to={to} replace={true} />;
}
@@ -69,9 +69,9 @@ function MetricRedirect() {
omitNil({
...searchParamsToQuery(searchParams),
metric: params.metricKey,
- view: params.view
+ view: params.view,
})
- ).toString()
+ ).toString(),
};
return <Navigate to={to} replace={true} />;
}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.tsx
index bcec882f07f..feb4e3f3339 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.tsx
@@ -28,7 +28,7 @@ import {
getLocalizedMetricDomain,
getLocalizedMetricName,
hasMessage,
- translate
+ translate,
} from '../../../helpers/l10n';
import { MeasureEnhanced } from '../../../types/types';
import {
@@ -36,7 +36,7 @@ import {
filterMeasures,
hasBubbleChart,
hasFacetStat,
- sortMeasures
+ sortMeasures,
} from '../utils';
import FacetMeasureValue from './FacetMeasureValue';
@@ -52,7 +52,7 @@ interface Props {
export default class DomainFacet extends React.PureComponent<Props> {
getValues = () => {
const { domain, selected } = this.props;
- const measureSelected = domain.measures.find(measure => measure.metric.key === selected);
+ const measureSelected = domain.measures.find((measure) => measure.metric.key === selected);
const overviewSelected = domain.name === selected && this.hasOverview(domain.name);
if (measureSelected) {
return [getLocalizedMetricName(measureSelected.metric)];
@@ -65,7 +65,7 @@ export default class DomainFacet extends React.PureComponent<Props> {
};
hasFacetSelected = (domain: { name: string }, measures: MeasureEnhanced[], selected: string) => {
- const measureSelected = measures.find(measure => measure.metric.key === selected);
+ const measureSelected = measures.find((measure) => measure.metric.key === selected);
const overviewSelected = domain.name === selected && this.hasOverview(domain.name);
return measureSelected || overviewSelected;
};
@@ -91,7 +91,7 @@ export default class DomainFacet extends React.PureComponent<Props> {
renderItemsFacet = () => {
const { domain, selected } = this.props;
const items = addMeasureCategories(domain.name, filterMeasures(domain.measures));
- const hasCategories = items.some(item => typeof item === 'string');
+ const hasCategories = items.some((item) => typeof item === 'string');
const translateMetric = hasCategories ? getLocalizedCategoryMetricName : getLocalizedMetricName;
let sortedItems = sortMeasures(domain.name, items);
@@ -102,7 +102,7 @@ export default class DomainFacet extends React.PureComponent<Props> {
);
});
- return sortedItems.map(item =>
+ return sortedItems.map((item) =>
typeof item === 'string' ? (
this.renderCategoryItem(item)
) : (
diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.tsx
index 815e461de91..234b78db19d 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.tsx
@@ -33,7 +33,8 @@ export default function FacetMeasureValue({ measure, displayLeak }: Props) {
return (
<div
className={classNames('domain-measures-value', { 'leak-box': displayLeak })}
- id={`measure-${measure.metric.key}-leak`}>
+ id={`measure-${measure.metric.key}-leak`}
+ >
<Measure
metricKey={measure.metric.key}
metricType={measure.metric.type}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx
index 611320a1e92..d5408dd65ef 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx
@@ -42,12 +42,12 @@ export default class Sidebar extends React.PureComponent<Props, State> {
}
state: State = {
- openFacets: {}
+ openFacets: {},
};
toggleFacet = (name: string) => {
this.setState(({ openFacets }) => ({
- openFacets: { ...openFacets, [name]: !openFacets[name] }
+ openFacets: { ...openFacets, [name]: !openFacets[name] },
}));
};
@@ -69,7 +69,7 @@ export default class Sidebar extends React.PureComponent<Props, State> {
selected={this.props.selectedMetric}
value={PROJECT_OVERVEW}
/>
- {groupByDomains(this.props.measures).map(domain => (
+ {groupByDomains(this.props.measures).map((domain) => (
<DomainFacet
domain={domain}
key={domain.name}
@@ -87,7 +87,7 @@ export default class Sidebar extends React.PureComponent<Props, State> {
function getOpenFacets(openFacets: Dict<boolean>, { measures, selectedMetric }: Props) {
const newOpenFacets = { ...openFacets };
- const measure = measures.find(measure => measure.metric.key === selectedMetric);
+ const measure = measures.find((measure) => measure.metric.key === selectedMetric);
if (measure && measure.metric && measure.metric.domain) {
newOpenFacets[measure.metric.domain] = true;
} else if (KNOWN_DOMAINS.includes(selectedMetric)) {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/DomainFacet-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/DomainFacet-test.tsx
index ed32256d594..95676bddf2b 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/DomainFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/DomainFacet-test.tsx
@@ -39,7 +39,7 @@ it('should render without overview', () => {
expect(
wrapper
.find('FacetItem')
- .filterWhere(node => node.getElement().key === 'Reliability')
+ .filterWhere((node) => node.getElement().key === 'Reliability')
.exists()
).toBe(false);
});
@@ -50,9 +50,9 @@ it('should not display subtitles of new measures if there is none', () => {
measures: [
{
metric: { id: '1', key: 'bugs', type: 'INT', name: 'Bugs', domain: 'Reliability' },
- value: '5'
- }
- ]
+ value: '5',
+ },
+ ],
};
expect(shallowRender({ domain })).toMatchSnapshot();
@@ -64,9 +64,9 @@ it('should not display subtitles of new measures if there is none, even on last
measures: [
{
metric: { id: '2', key: 'new_bugs', type: 'INT', name: 'New Bugs', domain: 'Reliability' },
- value: '5'
- }
- ]
+ value: '5',
+ },
+ ],
};
expect(shallowRender({ domain })).toMatchSnapshot();
@@ -84,11 +84,11 @@ function shallowRender(props: Partial<DomainFacet['props']> = {}) {
key: 'bugs',
type: 'INT',
name: 'Bugs',
- domain: 'Reliability'
+ domain: 'Reliability',
},
value: '5',
period: { index: 1, value: '5' },
- leak: '5'
+ leak: '5',
},
{
metric: {
@@ -96,12 +96,12 @@ function shallowRender(props: Partial<DomainFacet['props']> = {}) {
key: 'new_bugs',
type: 'INT',
name: 'New Bugs',
- domain: 'Reliability'
+ domain: 'Reliability',
},
period: { index: 1, value: '5' },
- leak: '5'
- }
- ]
+ leak: '5',
+ },
+ ],
}}
onChange={() => {}}
onToggle={() => {}}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/FacetMeasureValue-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/FacetMeasureValue-test.tsx
index 3cbfe8cfeda..953fa6e894b 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/FacetMeasureValue-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/FacetMeasureValue-test.tsx
@@ -27,11 +27,11 @@ const MEASURE = {
key: 'bugs',
type: 'INT',
name: 'Bugs',
- domain: 'Reliability'
+ domain: 'Reliability',
},
value: '5',
period: { index: 1, value: '5' },
- leak: '5'
+ leak: '5',
};
const LEAK_MEASURE = {
metric: {
@@ -39,10 +39,10 @@ const LEAK_MEASURE = {
key: 'new_bugs',
type: 'INT',
name: 'New Bugs',
- domain: 'Reliability'
+ domain: 'Reliability',
},
period: { index: 1, value: '5' },
- leak: '5'
+ leak: '5',
};
it('should display measure value', () => {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/Sidebar-test.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/Sidebar-test.tsx
index 679a0cc04d3..e02bae9a97e 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/Sidebar-test.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/__tests__/Sidebar-test.tsx
@@ -44,11 +44,11 @@ function shallowRender(props = {}) {
key: 'lines_to_cover',
type: 'INT',
name: 'Lines to Cover',
- domain: 'Coverage'
+ domain: 'Coverage',
},
value: '431',
period: { index: 1, value: '70' },
- leak: '70'
+ leak: '70',
},
{
metric: {
@@ -56,11 +56,11 @@ function shallowRender(props = {}) {
key: 'coverage',
type: 'PERCENT',
name: 'Coverage',
- domain: 'Coverage'
+ domain: 'Coverage',
},
value: '99.3',
period: { index: 1, value: '0.0999999999999943' },
- leak: '0.0999999999999943'
+ leak: '0.0999999999999943',
},
{
metric: {
@@ -68,12 +68,12 @@ function shallowRender(props = {}) {
key: 'duplicated_lines_density',
type: 'PERCENT',
name: 'Duplicated Lines (%)',
- domain: 'Duplications'
+ domain: 'Duplications',
},
value: '3.2',
period: { index: 1, value: '0.0' },
- leak: '0.0'
- }
+ leak: '0.0',
+ },
]}
selectedMetric="duplicated_lines_density"
showFullMeasures={true}
diff --git a/server/sonar-web/src/main/js/apps/component-measures/utils.ts b/server/sonar-web/src/main/js/apps/component-measures/utils.ts
index 34e88b9aae6..999dbba9bf1 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/utils.ts
+++ b/server/sonar-web/src/main/js/apps/component-measures/utils.ts
@@ -26,7 +26,7 @@ import {
cleanQuery,
parseAsOptionalBoolean,
parseAsString,
- serializeString
+ serializeString,
} from '../../helpers/query';
import { BranchLike } from '../../types/branch-like';
import { ComponentQualifier } from '../../types/component';
@@ -39,7 +39,7 @@ import {
Measure,
MeasureEnhanced,
Metric,
- RawQuery
+ RawQuery,
} from '../../types/types';
import { bubbles } from './config/bubbles';
import { domains } from './config/domains';
@@ -57,7 +57,7 @@ export const KNOWN_DOMAINS = [
'Coverage',
'Duplications',
'Size',
- 'Complexity'
+ 'Complexity',
];
const BANNED_MEASURES = [
'blocker_violations',
@@ -69,11 +69,11 @@ const BANNED_MEASURES = [
'minor_violations',
'new_minor_violations',
'info_violations',
- 'new_info_violations'
+ 'new_info_violations',
];
export function filterMeasures(measures: MeasureEnhanced[]): MeasureEnhanced[] {
- return measures.filter(measure => !BANNED_MEASURES.includes(measure.metric.key));
+ return measures.filter((measure) => !BANNED_MEASURES.includes(measure.metric.key));
}
export function sortMeasures(
@@ -91,7 +91,7 @@ export function sortMeasures(
return idx >= 0 ? idx : configOrder.length;
},
(item: MeasureEnhanced | string) =>
- typeof item === 'string' ? item : getLocalizedMetricName(item.metric)
+ typeof item === 'string' ? item : getLocalizedMetricName(item.metric),
]);
}
@@ -112,8 +112,8 @@ export function enhanceComponent(
return { ...component, measures: [] };
}
- const enhancedMeasures = component.measures.map(measure => enhanceMeasure(measure, metrics));
- const measure = metric && enhancedMeasures.find(measure => measure.metric.key === metric.key);
+ const enhancedMeasures = component.measures.map((measure) => enhanceMeasure(measure, metrics));
+ const measure = metric && enhancedMeasures.find((measure) => measure.metric.key === metric.key);
const value = measure && measure.value;
const leak = measure && measure.leak;
return { ...component, value, leak, measures: enhancedMeasures };
@@ -126,7 +126,7 @@ export function isSecurityReviewMetric(metricKey: MetricKey | string): boolean {
MetricKey.security_review_rating,
MetricKey.new_security_hotspots,
MetricKey.new_security_hotspots_reviewed,
- MetricKey.new_security_review_rating
+ MetricKey.new_security_review_rating,
].includes(metricKey as MetricKey);
}
@@ -138,13 +138,13 @@ export function banQualityGateMeasure({ measures = [], qualifier }: ComponentMea
if (qualifier === ComponentQualifier.Application) {
bannedMetrics.push('releasability_rating', 'releasability_effort');
}
- return measures.filter(measure => !bannedMetrics.includes(measure.metric));
+ return measures.filter((measure) => !bannedMetrics.includes(measure.metric));
}
export const groupByDomains = memoize((measures: MeasureEnhanced[]) => {
- const domains = toPairs(groupBy(measures, measure => measure.metric.domain)).map(r => ({
+ const domains = toPairs(groupBy(measures, (measure) => measure.metric.domain)).map((r) => ({
name: r[0],
- measures: r[1]
+ measures: r[1],
}));
return sortBy(domains, [
@@ -152,7 +152,7 @@ export const groupByDomains = memoize((measures: MeasureEnhanced[]) => {
const idx = KNOWN_DOMAINS.indexOf(domain.name);
return idx >= 0 ? idx : KNOWN_DOMAINS.length;
},
- 'name'
+ 'name',
]);
});
@@ -181,10 +181,10 @@ export function hasFullMeasures(branch?: BranchLike) {
}
export function getMeasuresPageMetricKeys(metrics: Dict<Metric>, branch?: BranchLike) {
- const metricKeys = getDisplayMetrics(Object.values(metrics)).map(metric => metric.key);
+ const metricKeys = getDisplayMetrics(Object.values(metrics)).map((metric) => metric.key);
if (isPullRequest(branch)) {
- return metricKeys.filter(key => isDiffMetric(key));
+ return metricKeys.filter((key) => isDiffMetric(key));
} else {
return metricKeys;
}
@@ -196,7 +196,7 @@ export function getBubbleMetrics(domain: string, metrics: Dict<Metric>) {
x: metrics[conf.x],
y: metrics[conf.y],
size: metrics[conf.size],
- colors: conf.colors && conf.colors.map(color => metrics[color])
+ colors: conf.colors && conf.colors.map((color) => metrics[color]),
};
}
@@ -225,22 +225,20 @@ export interface Query {
asc?: boolean;
}
-export const parseQuery = memoize(
- (urlQuery: RawQuery): Query => {
- const metric = parseAsString(urlQuery['metric']) || DEFAULT_METRIC;
- return {
- metric,
- selected: parseAsString(urlQuery['selected']),
- view: parseView(metric, urlQuery['view']),
- asc: parseAsOptionalBoolean(urlQuery['asc'])
- };
- }
-);
+export const parseQuery = memoize((urlQuery: RawQuery): Query => {
+ const metric = parseAsString(urlQuery['metric']) || DEFAULT_METRIC;
+ return {
+ metric,
+ selected: parseAsString(urlQuery['selected']),
+ view: parseView(metric, urlQuery['view']),
+ asc: parseAsOptionalBoolean(urlQuery['asc']),
+ };
+});
export const serializeQuery = memoize((query: Query) => {
return cleanQuery({
metric: query.metric === DEFAULT_METRIC ? undefined : serializeString(query.metric),
selected: serializeString(query.selected),
- view: query.view === DEFAULT_VIEW ? undefined : serializeString(query.view)
+ view: query.view === DEFAULT_VIEW ? undefined : serializeString(query.view),
});
});
diff --git a/server/sonar-web/src/main/js/apps/create/project/AzurePersonalAccessTokenForm.tsx b/server/sonar-web/src/main/js/apps/create/project/AzurePersonalAccessTokenForm.tsx
index cb86bc63023..1de8de0ac52 100644
--- a/server/sonar-web/src/main/js/apps/create/project/AzurePersonalAccessTokenForm.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/AzurePersonalAccessTokenForm.tsx
@@ -42,7 +42,7 @@ export default function AzurePersonalAccessTokenForm(props: AzurePersonalAccessT
const {
almSetting: { alm, url },
submitting = false,
- validationFailed
+ validationFailed,
} = props;
const [touched, setTouched] = React.useState(false);
@@ -82,7 +82,7 @@ export default function AzurePersonalAccessTokenForm(props: AzurePersonalAccessT
<strong>
<em>Code (Read & Write)</em>
</strong>
- )
+ ),
}}
/>
</div>
@@ -91,18 +91,20 @@ export default function AzurePersonalAccessTokenForm(props: AzurePersonalAccessT
onSubmit={(e: React.SyntheticEvent<HTMLFormElement>) => {
e.preventDefault();
props.onPersonalAccessTokenCreate(token);
- }}>
+ }}
+ >
<ValidationInput
error={errorMessage}
id="personal_access_token"
isInvalid={isInvalid}
isValid={false}
label={translate('onboarding.create_project.enter_pat')}
- required={true}>
+ required={true}
+ >
<input
autoFocus={true}
className={classNames('width-100 little-spacer-bottom', {
- 'is-invalid': isInvalid
+ 'is-invalid': isInvalid,
})}
id="personal_access_token"
minLength={1}
diff --git a/server/sonar-web/src/main/js/apps/create/project/AzureProjectAccordion.tsx b/server/sonar-web/src/main/js/apps/create/project/AzureProjectAccordion.tsx
index e590fdbdbe1..32a58c06978 100644
--- a/server/sonar-web/src/main/js/apps/create/project/AzureProjectAccordion.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/AzureProjectAccordion.tsx
@@ -72,7 +72,7 @@ export default function AzureProjectAccordion(props: AzureProjectAccordionProps)
project,
repositories = [],
searchQuery,
- selectedRepository
+ selectedRepository,
} = props;
const [open, setOpen] = React.useState(startsOpen);
@@ -92,11 +92,12 @@ export default function AzureProjectAccordion(props: AzureProjectAccordionProps)
return (
<BoxedGroupAccordion
className={classNames('big-spacer-bottom', {
- open
+ open,
})}
onClick={handleClick}
open={open}
- title={<h3 title={project.description}>{highlight(project.name, searchQuery, true)}</h3>}>
+ title={<h3 title={project.description}>{highlight(project.name, searchQuery, true)}</h3>}
+ >
{open && (
<DeferredSpinner loading={loading}>
{/* The extra loading guard is to prevent the flash of the Alert */}
@@ -110,21 +111,26 @@ export default function AzureProjectAccordion(props: AzureProjectAccordionProps)
<Link
to={{
pathname: '/projects/create',
- search: queryToSearch({ mode: CreateProjectModes.AzureDevOps, resetPat: 1 })
- }}>
+ search: queryToSearch({
+ mode: CreateProjectModes.AzureDevOps,
+ resetPat: 1,
+ }),
+ }}
+ >
{translate('onboarding.create_project.update_your_token')}
</Link>
- )
+ ),
}}
/>
</Alert>
) : (
<>
<div className="display-flex-wrap">
- {limitedRepositories.map(repo => (
+ {limitedRepositories.map((repo) => (
<div
className="create-project-azdo-repo display-flex-start spacer-bottom padded-right"
- key={repo.name}>
+ key={repo.name}
+ >
{repo.sqProjectKey ? (
<>
<CheckIcon className="spacer-right" fill={colors.green} size={14} />
@@ -143,7 +149,8 @@ export default function AzureProjectAccordion(props: AzureProjectAccordionProps)
className="overflow-hidden"
disabled={importing}
onCheck={() => props.onSelectRepository(repo)}
- value={repo.name}>
+ value={repo.name}
+ >
<span className="text-ellipsis" title={repo.name}>
{highlight(repo.name, searchQuery)}
</span>
@@ -155,7 +162,7 @@ export default function AzureProjectAccordion(props: AzureProjectAccordionProps)
<ListFooter
count={limitedRepositories.length}
total={repositories.length}
- loadMore={() => setPage(p => p + 1)}
+ loadMore={() => setPage((p) => p + 1)}
/>
</>
)}
diff --git a/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreate.tsx
index 50144f74416..fb2ffd7920d 100644
--- a/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreate.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreate.tsx
@@ -24,7 +24,7 @@ import {
getAzureRepositories,
importAzureRepository,
searchAzureRepositories,
- setAlmPersonalAccessToken
+ setAlmPersonalAccessToken,
} from '../../../api/alm-integrations';
import { Location, Router } from '../../../components/hoc/withRouter';
import { AzureProject, AzureRepository } from '../../../types/alm-integration';
@@ -70,7 +70,7 @@ export default class AzureProjectCreate extends React.PureComponent<Props, State
loading: false,
loadingRepositories: {},
repositories: {},
- tokenValidationFailed: false
+ tokenValidationFailed: false,
};
}
@@ -110,7 +110,7 @@ export default class AzureProjectCreate extends React.PureComponent<Props, State
firstProjectName = projects[0].name;
this.setState(({ loadingRepositories }) => ({
- loadingRepositories: { ...loadingRepositories, [firstProjectName]: true }
+ loadingRepositories: { ...loadingRepositories, [firstProjectName]: true },
}));
const repos = await this.fetchAzureRepositories(firstProjectName);
@@ -128,7 +128,7 @@ export default class AzureProjectCreate extends React.PureComponent<Props, State
loading: false,
loadingRepositories: { ...loadingRepositories },
projects,
- repositories
+ repositories,
};
});
}
@@ -168,14 +168,14 @@ export default class AzureProjectCreate extends React.PureComponent<Props, State
}
this.setState(({ loadingRepositories }) => ({
- loadingRepositories: { ...loadingRepositories, [projectName]: true }
+ loadingRepositories: { ...loadingRepositories, [projectName]: true },
}));
const projectRepos = await this.fetchAzureRepositories(projectName);
this.setState(({ loadingRepositories, repositories }) => ({
loadingRepositories: { ...loadingRepositories, [projectName]: false },
- repositories: { ...repositories, [projectName]: projectRepos }
+ repositories: { ...repositories, [projectName]: projectRepos },
}));
};
@@ -204,7 +204,7 @@ export default class AzureProjectCreate extends React.PureComponent<Props, State
this.setState({
searching: false,
searchResults,
- searchQuery
+ searchQuery,
});
}
};
@@ -291,7 +291,7 @@ export default class AzureProjectCreate extends React.PureComponent<Props, State
selectedRepository,
settings,
submittingToken,
- tokenValidationFailed
+ tokenValidationFailed,
} = this.state;
return (
diff --git a/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx b/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx
index 214fa15ee87..fc5b4823c9d 100644
--- a/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/AzureProjectCreateRenderer.tsx
@@ -73,7 +73,7 @@ export default function AzureProjectCreateRenderer(props: AzureProjectCreateRend
settings,
showPersonalAccessTokenForm,
submittingToken,
- tokenValidationFailed
+ tokenValidationFailed,
} = props;
const settingIsValid = settings && settings.url;
@@ -91,7 +91,8 @@ export default function AzureProjectCreateRenderer(props: AzureProjectCreateRend
<Button
className="button-large button-primary"
disabled={!selectedRepository || importing}
- onClick={props.onImportRepository}>
+ onClick={props.onImportRepository}
+ >
{translate('onboarding.create_project.import_selected_repo')}
</Button>
</div>
@@ -124,7 +125,7 @@ export default function AzureProjectCreateRenderer(props: AzureProjectCreateRend
<Link to={getGlobalSettingsUrl(ALM_INTEGRATION_CATEGORY)}>
{translate('settings.page')}
</Link>
- )
+ ),
}}
/>
) : (
diff --git a/server/sonar-web/src/main/js/apps/create/project/AzureProjectsList.tsx b/server/sonar-web/src/main/js/apps/create/project/AzureProjectsList.tsx
index 09e18f2efae..ff36f9e6887 100644
--- a/server/sonar-web/src/main/js/apps/create/project/AzureProjectsList.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/AzureProjectsList.tsx
@@ -52,7 +52,7 @@ export default function AzureProjectsList(props: AzureProjectsListProps) {
repositories,
searchResults,
searchQuery,
- selectedRepository
+ selectedRepository,
} = props;
const [page, setPage] = React.useState(1);
@@ -76,11 +76,12 @@ export default function AzureProjectsList(props: AzureProjectsListProps) {
<Link
to={{
pathname: '/projects/create',
- search: queryToSearch({ mode: CreateProjectModes.AzureDevOps, resetPat: 1 })
- }}>
+ search: queryToSearch({ mode: CreateProjectModes.AzureDevOps, resetPat: 1 }),
+ }}
+ >
{translate('onboarding.create_project.update_your_token')}
</Link>
- )
+ ),
}}
/>
</Alert>
@@ -90,14 +91,14 @@ export default function AzureProjectsList(props: AzureProjectsListProps) {
let filteredProjects: AzureProject[];
if (searchResults !== undefined) {
filteredProjects = uniqBy(
- searchResults.map(r => {
+ searchResults.map((r) => {
return (
- projects.find(p => p.name === r.projectName) || {
+ projects.find((p) => p.name === r.projectName) || {
name: r.projectName,
description: translateWithParameters(
'onboarding.create_project.azure.search_results_for_project_X',
r.projectName
- )
+ ),
}
);
}),
@@ -125,7 +126,7 @@ export default function AzureProjectsList(props: AzureProjectsListProps) {
project={p}
repositories={
searchResults
- ? searchResults.filter(s => s.projectName === p.name)
+ ? searchResults.filter((s) => s.projectName === p.name)
: repositories[p.name]
}
selectedRepository={selectedRepository}
@@ -136,7 +137,7 @@ export default function AzureProjectsList(props: AzureProjectsListProps) {
<ListFooter
count={displayedProjects.length}
- loadMore={() => setPage(p => p + 1)}
+ loadMore={() => setPage((p) => p + 1)}
total={filteredProjects.length}
/>
</div>
diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudProjectCreate.tsx
index 74fe4a49838..a091375ccad 100644
--- a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudProjectCreate.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudProjectCreate.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import {
importBitbucketCloudRepository,
- searchForBitbucketCloudRepositories
+ searchForBitbucketCloudRepositories,
} from '../../../api/alm-integrations';
import { Location, Router } from '../../../components/hoc/withRouter';
import { BitbucketCloudRepository } from '../../../types/alm-integration';
@@ -68,7 +68,7 @@ export default class BitbucketCloudProjectCreate extends React.PureComponent<Pro
searching: false,
searchQuery: '',
settings: props.settings[0],
- showPersonalAccessTokenForm: true
+ showPersonalAccessTokenForm: true,
};
}
@@ -101,7 +101,7 @@ export default class BitbucketCloudProjectCreate extends React.PureComponent<Pro
settings,
searchQuery,
projectsPaging: { pageIndex, pageSize },
- showPersonalAccessTokenForm
+ showPersonalAccessTokenForm,
} = this.state;
if (settings && !showPersonalAccessTokenForm) {
const { isLastPage, repositories } = await searchForBitbucketCloudRepositories(
@@ -115,9 +115,9 @@ export default class BitbucketCloudProjectCreate extends React.PureComponent<Pro
});
if (this.mounted && isLastPage !== undefined && repositories !== undefined) {
if (more) {
- this.setState(state => ({
+ this.setState((state) => ({
isLastPage,
- repositories: [...state.repositories, ...repositories]
+ repositories: [...state.repositories, ...repositories],
}));
} else {
this.setState({ isLastPage, repositories });
@@ -132,7 +132,7 @@ export default class BitbucketCloudProjectCreate extends React.PureComponent<Pro
projectsPaging: { pageIndex: 1, pageSize: BITBUCKET_CLOUD_PROJECTS_PAGESIZE },
repositories: [],
resetPat: true,
- showPersonalAccessTokenForm: true
+ showPersonalAccessTokenForm: true,
});
}
@@ -144,7 +144,7 @@ export default class BitbucketCloudProjectCreate extends React.PureComponent<Pro
{
searching: true,
projectsPaging: { pageIndex: 1, pageSize: BITBUCKET_CLOUD_PROJECTS_PAGESIZE },
- searchQuery
+ searchQuery,
},
async () => {
await this.fetchData();
@@ -157,12 +157,12 @@ export default class BitbucketCloudProjectCreate extends React.PureComponent<Pro
handleLoadMore = () => {
this.setState(
- state => ({
+ (state) => ({
loadingMore: true,
projectsPaging: {
pageIndex: state.projectsPaging.pageIndex + 1,
- pageSize: state.projectsPaging.pageSize
- }
+ pageSize: state.projectsPaging.pageSize,
+ },
}),
async () => {
await this.fetchData(true);
@@ -207,7 +207,7 @@ export default class BitbucketCloudProjectCreate extends React.PureComponent<Pro
showPersonalAccessTokenForm,
resetPat,
searching,
- searchQuery
+ searchQuery,
} = this.state;
return (
<BitbucketCloudProjectCreateRenderer
diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudProjectCreateRender.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudProjectCreateRender.tsx
index 20f1beeedc9..359b1e65014 100644
--- a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudProjectCreateRender.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudProjectCreateRender.tsx
@@ -59,7 +59,7 @@ export default function BitbucketCloudProjectCreateRenderer(
resetPat,
searching,
searchQuery,
- showPersonalAccessTokenForm
+ showPersonalAccessTokenForm,
} = props;
return (
diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudSearchForm.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudSearchForm.tsx
index de70b76174a..9c5fa3e74dd 100644
--- a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudSearchForm.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloudSearchForm.tsx
@@ -57,7 +57,7 @@ export default function BitbucketCloudSearchForm(props: BitbucketCloudSearchForm
loadingMore,
repositories = [],
searching,
- searchQuery
+ searchQuery,
} = props;
if (repositories.length === 0 && searchQuery.length === 0 && !searching) {
@@ -71,11 +71,12 @@ export default function BitbucketCloudSearchForm(props: BitbucketCloudSearchForm
<Link
to={{
pathname: '/projects/create',
- search: queryToSearch({ mode: CreateProjectModes.BitbucketCloud, resetPat: 1 })
- }}>
+ search: queryToSearch({ mode: CreateProjectModes.BitbucketCloud, resetPat: 1 }),
+ }}
+ >
{translate('onboarding.create_project.update_your_token')}
</Link>
- )
+ ),
}}
/>
</Alert>
@@ -99,7 +100,7 @@ export default function BitbucketCloudSearchForm(props: BitbucketCloudSearchForm
) : (
<table className="data zebra zebra-hover">
<tbody>
- {repositories.map(repository => (
+ {repositories.map((repository) => (
<tr key={repository.uuid}>
<td>
<Tooltip overlay={repository.slug}>
@@ -128,7 +129,8 @@ export default function BitbucketCloudSearchForm(props: BitbucketCloudSearchForm
<Link
className="display-inline-flex-center big-spacer-right"
to={getRepositoryUrl(repository.workspace, repository.slug)}
- target="_blank">
+ target="_blank"
+ >
{translate('onboarding.create_project.bitbucketcloud.link')}
</Link>
</td>
@@ -145,7 +147,8 @@ export default function BitbucketCloudSearchForm(props: BitbucketCloudSearchForm
disabled={Boolean(importingSlug)}
onClick={() => {
props.onImport(repository.slug);
- }}>
+ }}
+ >
{translate('onboarding.create_project.set_up')}
{importingSlug === repository.slug && (
<DeferredSpinner className="spacer-left" />
@@ -170,7 +173,8 @@ export default function BitbucketCloudSearchForm(props: BitbucketCloudSearchForm
className="spacer-left"
disabled={loadingMore}
data-test="show-more"
- onClick={props.onLoadMore}>
+ onClick={props.onLoadMore}
+ >
{translate('show_more')}
</Button>
)}
diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketImportRepositoryForm.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketImportRepositoryForm.tsx
index 5434db6d159..295b27f5058 100644
--- a/server/sonar-web/src/main/js/apps/create/project/BitbucketImportRepositoryForm.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketImportRepositoryForm.tsx
@@ -27,7 +27,7 @@ import { queryToSearch } from '../../../helpers/urls';
import {
BitbucketProject,
BitbucketProjectRepositories,
- BitbucketRepository
+ BitbucketRepository,
} from '../../../types/alm-integration';
import BitbucketRepositories from './BitbucketRepositories';
import BitbucketSearchResults from './BitbucketSearchResults';
@@ -51,7 +51,7 @@ export default function BitbucketImportRepositoryForm(props: BitbucketImportRepo
projectRepositories = {},
searchResults,
searching,
- selectedRepository
+ selectedRepository,
} = props;
if (projects.length === 0) {
@@ -65,11 +65,12 @@ export default function BitbucketImportRepositoryForm(props: BitbucketImportRepo
<Link
to={{
pathname: '/projects/create',
- search: queryToSearch({ mode: CreateProjectModes.BitbucketServer, resetPat: 1 })
- }}>
+ search: queryToSearch({ mode: CreateProjectModes.BitbucketServer, resetPat: 1 }),
+ }}
+ >
{translate('onboarding.create_project.update_your_token')}
</Link>
- )
+ ),
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectAccordion.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectAccordion.tsx
index 707f4d6415d..ebf4240cb8c 100644
--- a/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectAccordion.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectAccordion.tsx
@@ -49,7 +49,7 @@ export default function BitbucketProjectAccordion(props: BitbucketProjectAccordi
project,
repositories,
selectedRepository,
- showingAllRepositories
+ showingAllRepositories,
} = props;
const repositoryCount = repositories.length;
@@ -61,7 +61,7 @@ export default function BitbucketProjectAccordion(props: BitbucketProjectAccordi
className={classNames('big-spacer-bottom', {
open,
'not-clickable': !props.onClick,
- 'no-hover': !props.onClick
+ 'no-hover': !props.onClick,
})}
onClick={
props.onClick
@@ -71,7 +71,8 @@ export default function BitbucketProjectAccordion(props: BitbucketProjectAccordi
}
}
open={open}
- title={<h3>{title}</h3>}>
+ title={<h3>{title}</h3>}
+ >
{open && (
<>
<div className="display-flex-wrap">
@@ -87,22 +88,24 @@ export default function BitbucketProjectAccordion(props: BitbucketProjectAccordi
pathname: '/projects/create',
search: queryToSearch({
mode: CreateProjectModes.BitbucketServer,
- resetPat: 1
- })
- }}>
+ resetPat: 1,
+ }),
+ }}
+ >
{translate('onboarding.create_project.update_your_token')}
</Link>
- )
+ ),
}}
/>
</Alert>
)}
- {repositories.map(repo =>
+ {repositories.map((repo) =>
repo.sqProjectKey ? (
<div
className="display-flex-start spacer-right spacer-bottom create-project-import-bbs-repo"
- key={repo.id}>
+ key={repo.id}
+ >
<CheckIcon className="spacer-right" fill={colors.green} size={14} />
<div className="overflow-hidden">
<div className="little-spacer-bottom text-ellipsis">
@@ -119,12 +122,13 @@ export default function BitbucketProjectAccordion(props: BitbucketProjectAccordi
className={classNames(
'display-flex-start spacer-right spacer-bottom create-project-import-bbs-repo overflow-hidden',
{
- disabled: disableRepositories
+ disabled: disableRepositories,
}
)}
key={repo.id}
onCheck={() => props.onSelectRepository(repo)}
- value={String(repo.id)}>
+ value={String(repo.id)}
+ >
<strong className="text-ellipsis" title={repo.name}>
{repo.name}
</strong>
diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectCreate.tsx
index 5c56e0683c5..97b08aeed0d 100644
--- a/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectCreate.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectCreate.tsx
@@ -22,13 +22,13 @@ import {
getBitbucketServerProjects,
getBitbucketServerRepositories,
importBitbucketServerProject,
- searchForBitbucketServerRepositories
+ searchForBitbucketServerRepositories,
} from '../../../api/alm-integrations';
import { Location, Router } from '../../../components/hoc/withRouter';
import {
BitbucketProject,
BitbucketProjectRepositories,
- BitbucketRepository
+ BitbucketRepository,
} from '../../../types/alm-integration';
import { AlmSettingsInstance } from '../../../types/alm-settings';
import BitbucketCreateProjectRenderer from './BitbucketProjectCreateRenderer';
@@ -67,7 +67,7 @@ export default class BitbucketProjectCreate extends React.PureComponent<Props, S
importing: false,
loading: false,
searching: false,
- showPersonalAccessTokenForm: true
+ showPersonalAccessTokenForm: true,
};
}
@@ -105,7 +105,7 @@ export default class BitbucketProjectCreate extends React.PureComponent<Props, S
this.setState({
projects,
projectRepositories,
- loading: false
+ loading: false,
});
}
}
@@ -131,7 +131,7 @@ export default class BitbucketProjectCreate extends React.PureComponent<Props, S
}
return Promise.all(
- projects.map(p => {
+ projects.map((p) => {
return getBitbucketServerRepositories(bitbucketSetting.key, p.name).then(
({ isLastPage, repositories }) => {
// Because the WS uses the project name rather than its key to find
@@ -139,7 +139,7 @@ export default class BitbucketProjectCreate extends React.PureComponent<Props, S
// example, p.name = "A1" would find repositories for projects "A1",
// "A10", "A11", etc. This is a limitation of BBS. To make sure we
// don't display incorrect information, filter on the project key.
- const filteredRepositories = repositories.filter(r => r.projectKey === p.key);
+ const filteredRepositories = repositories.filter((r) => r.projectKey === p.key);
// And because of the above, the "isLastPage" cannot be relied upon
// either. This one is impossible to get 100% for now. We can only
@@ -155,12 +155,12 @@ export default class BitbucketProjectCreate extends React.PureComponent<Props, S
return {
repositories: filteredRepositories,
isLastPage: realIsLastPage,
- projectKey: p.key
+ projectKey: p.key,
};
}
);
})
- ).then(results => {
+ ).then((results) => {
return results.reduce(
(acc: BitbucketProjectRepositories, { isLastPage, projectKey, repositories }) => {
return { ...acc, [projectKey]: { allShown: isLastPage, repositories } };
@@ -249,7 +249,7 @@ export default class BitbucketProjectCreate extends React.PureComponent<Props, S
searching,
searchResults,
selectedRepository,
- showPersonalAccessTokenForm
+ showPersonalAccessTokenForm,
} = this.state;
return (
diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectCreateRenderer.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectCreateRenderer.tsx
index 141e33e02e5..4c001740ea6 100644
--- a/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectCreateRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketProjectCreateRenderer.tsx
@@ -25,7 +25,7 @@ import { getBaseUrl } from '../../../helpers/system';
import {
BitbucketProject,
BitbucketProjectRepositories,
- BitbucketRepository
+ BitbucketRepository,
} from '../../../types/alm-integration';
import { AlmKeys, AlmSettingsInstance } from '../../../types/alm-settings';
import BitbucketImportRepositoryForm from './BitbucketImportRepositoryForm';
@@ -63,7 +63,7 @@ export default function BitbucketProjectCreateRenderer(props: BitbucketProjectCr
searching,
searchResults,
showPersonalAccessTokenForm,
- resetPat
+ resetPat,
} = props;
return (
@@ -76,7 +76,8 @@ export default function BitbucketProjectCreateRenderer(props: BitbucketProjectCr
<Button
className="button-large button-primary"
disabled={!selectedRepository || importing}
- onClick={props.onImportRepository}>
+ onClick={props.onImportRepository}
+ >
{translate('onboarding.create_project.import_selected_repo')}
</Button>
</div>
diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketRepositories.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketRepositories.tsx
index ed686200500..47749f7c548 100644
--- a/server/sonar-web/src/main/js/apps/create/project/BitbucketRepositories.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketRepositories.tsx
@@ -24,7 +24,7 @@ import { translate } from '../../../helpers/l10n';
import {
BitbucketProject,
BitbucketProjectRepositories,
- BitbucketRepository
+ BitbucketRepository,
} from '../../../types/alm-integration';
import BitbucketProjectAccordion from './BitbucketProjectAccordion';
@@ -56,12 +56,13 @@ export default function BitbucketRepositories(props: BitbucketRepositoriesProps)
<div className="overflow-hidden spacer-bottom">
<ButtonLink
className="pull-right"
- onClick={() => setOpenProjectKeys(allAreExpanded ? [] : projects.map(p => p.key))}>
+ onClick={() => setOpenProjectKeys(allAreExpanded ? [] : projects.map((p) => p.key))}
+ >
{allAreExpanded ? translate('collapse_all') : translate('expand_all')}
</ButtonLink>
</div>
- {projects.map(project => {
+ {projects.map((project) => {
const isOpen = openProjectKeys.includes(project.key);
const { allShown, repositories = [] } = projectRepositories[project.key] || {};
diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketSearchResults.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketSearchResults.tsx
index 8edf6d88a90..53f321b3534 100644
--- a/server/sonar-web/src/main/js/apps/create/project/BitbucketSearchResults.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketSearchResults.tsx
@@ -39,7 +39,7 @@ export default function BitbucketSearchResults(props: BitbucketSearchResultsProp
projects,
searching,
searchResults = [],
- selectedRepository
+ selectedRepository,
} = props;
if (searchResults.length === 0 && !searching) {
@@ -50,10 +50,12 @@ export default function BitbucketSearchResults(props: BitbucketSearchResultsProp
);
}
- const filteredProjects = projects.filter(p => searchResults.some(r => r.projectKey === p.key));
- const filteredProjectKeys = filteredProjects.map(p => p.key);
+ const filteredProjects = projects.filter((p) =>
+ searchResults.some((r) => r.projectKey === p.key)
+ );
+ const filteredProjectKeys = filteredProjects.map((p) => p.key);
const filteredSearchResults = searchResults.filter(
- r => !filteredProjectKeys.includes(r.projectKey)
+ (r) => !filteredProjectKeys.includes(r.projectKey)
);
return (
@@ -70,8 +72,8 @@ export default function BitbucketSearchResults(props: BitbucketSearchResultsProp
/>
)}
- {filteredProjects.map(project => {
- const repositories = searchResults.filter(r => r.projectKey === project.key);
+ {filteredProjects.map((project) => {
+ const repositories = searchResults.filter((r) => r.projectKey === project.key);
return (
<BitbucketProjectAccordion
diff --git a/server/sonar-web/src/main/js/apps/create/project/CreateProjectModeSelection.tsx b/server/sonar-web/src/main/js/apps/create/project/CreateProjectModeSelection.tsx
index f3f9631952c..7e4c9c0c007 100644
--- a/server/sonar-web/src/main/js/apps/create/project/CreateProjectModeSelection.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/CreateProjectModeSelection.tsx
@@ -51,7 +51,7 @@ function renderAlmOption(
const {
almCounts,
appState: { canAdmin },
- loadingBindings
+ loadingBindings,
} = props;
const hasBitbucketCloudConf = almCounts[AlmKeys.BitbucketCloud] > 0;
@@ -100,7 +100,8 @@ function renderAlmOption(
)}
disabled={disabled}
onClick={onClick}
- type="button">
+ type="button"
+ >
<img
alt="" // Should be ignored by screen readers
height={DEFAULT_ICON_SIZE}
@@ -130,7 +131,7 @@ function renderAlmOption(
export function CreateProjectModeSelection(props: CreateProjectModeSelectionProps) {
const {
appState: { canAdmin },
- almCounts
+ almCounts,
} = props;
const almTotalCount = Object.values(almCounts).reduce((prev, cur) => prev + cur);
@@ -159,7 +160,8 @@ export function CreateProjectModeSelection(props: CreateProjectModeSelectionProp
<button
className="button button-huge display-flex-column create-project-mode-type-manual"
onClick={() => props.onSelectMode(CreateProjectModes.Manual)}
- type="button">
+ type="button"
+ >
<ChevronsIcon size={DEFAULT_ICON_SIZE} />
<div className="medium big-spacer-top">
{translate('onboarding.create_project.select_method.manual')}
diff --git a/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx b/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx
index 7ae78c00b10..abbd5af9d05 100644
--- a/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx
@@ -22,7 +22,7 @@ import { Helmet } from 'react-helmet-async';
import { getAlmSettings } from '../../../api/alm-settings';
import withAppStateContext from '../../../app/components/app-state/withAppStateContext';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget';
import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
@@ -63,7 +63,7 @@ const PROJECT_MODE_FOR_ALM_KEY = {
[AlmKeys.BitbucketCloud]: CreateProjectModes.BitbucketCloud,
[AlmKeys.BitbucketServer]: CreateProjectModes.BitbucketServer,
[AlmKeys.GitHub]: CreateProjectModes.GitHub,
- [AlmKeys.GitLab]: CreateProjectModes.GitLab
+ [AlmKeys.GitLab]: CreateProjectModes.GitLab,
};
export class CreateProjectPage extends React.PureComponent<Props, State> {
@@ -74,7 +74,7 @@ export class CreateProjectPage extends React.PureComponent<Props, State> {
bitbucketCloudSettings: [],
githubSettings: [],
gitlabSettings: [],
- loading: true
+ loading: true,
};
componentDidMount() {
@@ -89,15 +89,15 @@ export class CreateProjectPage extends React.PureComponent<Props, State> {
fetchAlmBindings = () => {
this.setState({ loading: true });
return getAlmSettings()
- .then(almSettings => {
+ .then((almSettings) => {
if (this.mounted) {
this.setState({
- azureSettings: almSettings.filter(s => s.alm === AlmKeys.Azure),
- bitbucketSettings: almSettings.filter(s => s.alm === AlmKeys.BitbucketServer),
- bitbucketCloudSettings: almSettings.filter(s => s.alm === AlmKeys.BitbucketCloud),
- githubSettings: almSettings.filter(s => s.alm === AlmKeys.GitHub),
- gitlabSettings: almSettings.filter(s => s.alm === AlmKeys.GitLab),
- loading: false
+ azureSettings: almSettings.filter((s) => s.alm === AlmKeys.Azure),
+ bitbucketSettings: almSettings.filter((s) => s.alm === AlmKeys.BitbucketServer),
+ bitbucketCloudSettings: almSettings.filter((s) => s.alm === AlmKeys.BitbucketCloud),
+ githubSettings: almSettings.filter((s) => s.alm === AlmKeys.GitHub),
+ gitlabSettings: almSettings.filter((s) => s.alm === AlmKeys.GitLab),
+ loading: false,
});
}
})
@@ -112,7 +112,7 @@ export class CreateProjectPage extends React.PureComponent<Props, State> {
const { router, location } = this.props;
router.push({
pathname: location.pathname,
- query: { mode }
+ query: { mode },
});
};
@@ -150,7 +150,7 @@ export class CreateProjectPage extends React.PureComponent<Props, State> {
const {
appState: { canAdmin },
location,
- router
+ router,
} = this.props;
const {
azureSettings,
@@ -158,7 +158,7 @@ export class CreateProjectPage extends React.PureComponent<Props, State> {
bitbucketCloudSettings,
githubSettings,
gitlabSettings,
- loading
+ loading,
} = this.state;
const branchSupportEnabled = this.props.hasFeature(Feature.BranchSupport);
@@ -237,7 +237,7 @@ export class CreateProjectPage extends React.PureComponent<Props, State> {
[AlmKeys.BitbucketServer]: bitbucketSettings.length,
[AlmKeys.BitbucketCloud]: bitbucketCloudSettings.length,
[AlmKeys.GitHub]: githubSettings.length,
- [AlmKeys.GitLab]: gitlabSettings.length
+ [AlmKeys.GitLab]: gitlabSettings.length,
};
return (
<CreateProjectModeSelection
diff --git a/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreate.tsx
index 2871ac8eda8..bb009226dc3 100644
--- a/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreate.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreate.tsx
@@ -23,7 +23,7 @@ import {
getGithubClientId,
getGithubOrganizations,
getGithubRepositories,
- importGithubRepository
+ importGithubRepository,
} from '../../../api/alm-integrations';
import { Location, Router } from '../../../components/hoc/withRouter';
import { getHostUrl } from '../../../helpers/urls';
@@ -72,7 +72,7 @@ export default class GitHubProjectCreate extends React.Component<Props, State> {
repositories: [],
repositoryPaging: { pageSize: REPOSITORY_PAGE_SIZE, total: 0, pageIndex: 1 },
searchQuery: '',
- settings: props.settings[0]
+ settings: props.settings[0],
};
this.triggerSearch = debounce(this.triggerSearch, 250);
@@ -136,7 +136,7 @@ export default class GitHubProjectCreate extends React.Component<Props, State> {
const queryParams = [
{ param: 'client_id', value: clientId },
- { param: 'redirect_uri', value: `${getHostUrl()}/projects/create?mode=${AlmKeys.GitHub}` }
+ { param: 'redirect_uri', value: `${getHostUrl()}/projects/create?mode=${AlmKeys.GitHub}` },
]
.map(({ param, value }) => `${param}=${value}`)
.join('&');
@@ -181,14 +181,14 @@ export default class GitHubProjectCreate extends React.Component<Props, State> {
organization: organizationKey,
pageSize: REPOSITORY_PAGE_SIZE,
page,
- query
+ query,
});
if (this.mounted) {
this.setState(({ repositories }) => ({
loadingRepositories: false,
repositoryPaging: data.paging,
- repositories: page === 1 ? data.repositories : [...repositories, ...data.repositories]
+ repositories: page === 1 ? data.repositories : [...repositories, ...data.repositories],
}));
}
} catch (_) {
@@ -196,7 +196,7 @@ export default class GitHubProjectCreate extends React.Component<Props, State> {
this.setState({
loadingRepositories: false,
repositoryPaging: { pageIndex: 1, pageSize: REPOSITORY_PAGE_SIZE, total: 0 },
- repositories: []
+ repositories: [],
});
}
}
@@ -214,14 +214,14 @@ export default class GitHubProjectCreate extends React.Component<Props, State> {
this.setState(({ organizations }) => ({
searchQuery: '',
selectedRepository: undefined,
- selectedOrganization: organizations.find(o => o.key === key)
+ selectedOrganization: organizations.find((o) => o.key === key),
}));
this.fetchRepositories({ organizationKey: key });
};
handleSelectRepository = (key: string) => {
this.setState(({ repositories }) => ({
- selectedRepository: repositories?.find(r => r.key === key)
+ selectedRepository: repositories?.find((r) => r.key === key),
}));
};
@@ -237,7 +237,7 @@ export default class GitHubProjectCreate extends React.Component<Props, State> {
this.fetchRepositories({
organizationKey: selectedOrganization.key,
page: repositoryPaging.pageIndex + 1,
- query: searchQuery
+ query: searchQuery,
});
}
};
@@ -276,7 +276,7 @@ export default class GitHubProjectCreate extends React.Component<Props, State> {
repositories,
searchQuery,
selectedOrganization,
- selectedRepository
+ selectedRepository,
} = this.state;
return (
diff --git a/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx b/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx
index 85503415407..1d10ee93751 100644
--- a/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/GitHubProjectCreateRenderer.tsx
@@ -73,7 +73,7 @@ function renderRepositoryList(props: GitHubProjectCreateRendererProps) {
repositoryPaging,
searchQuery,
selectedOrganization,
- selectedRepository
+ selectedRepository,
} = props;
const isChecked = (repository: GithubRepository) =>
@@ -103,21 +103,23 @@ function renderRepositoryList(props: GitHubProjectCreateRendererProps) {
</DeferredSpinner>
</div>
) : (
- repositories.map(r => (
+ repositories.map((r) => (
<Radio
className="spacer-top spacer-bottom padded create-project-github-repository"
key={r.key}
checked={isChecked(r)}
disabled={isDisabled(r)}
value={r.key}
- onCheck={props.onSelectRepository}>
+ onCheck={props.onSelectRepository}
+ >
<div className="big overflow-hidden max-width-100" title={r.name}>
<div className="text-ellipsis">
{r.sqProjectKey ? (
<div className="display-flex-center max-width-100">
<Link
className="display-flex-center max-width-60"
- to={getProjectUrl(r.sqProjectKey)}>
+ to={getProjectUrl(r.sqProjectKey)}
+ >
<QualifierIcon
className="spacer-right"
qualifier={ComponentQualifier.Project}
@@ -138,10 +140,11 @@ function renderRepositoryList(props: GitHubProjectCreateRendererProps) {
{r.url && (
<a
className="notice small display-flex-center little-spacer-top"
- onClick={e => e.stopPropagation()}
+ onClick={(e) => e.stopPropagation()}
target="_blank"
href={r.url}
- rel="noopener noreferrer">
+ rel="noopener noreferrer"
+ >
{translate('onboarding.create_project.see_on_github')}
</a>
)}
@@ -172,7 +175,7 @@ export default function GitHubProjectCreateRenderer(props: GitHubProjectCreateRe
loadingOrganizations,
organizations,
selectedOrganization,
- selectedRepository
+ selectedRepository,
} = props;
if (loadingBindings) {
@@ -189,7 +192,8 @@ export default function GitHubProjectCreateRenderer(props: GitHubProjectCreateRe
<Button
className="button-large button-primary"
disabled={!selectedRepository || importing}
- onClick={props.onImportRepository}>
+ onClick={props.onImportRepository}
+ >
{translate('onboarding.create_project.import_selected_repo')}
</Button>
</div>
@@ -226,7 +230,7 @@ export default function GitHubProjectCreateRenderer(props: GitHubProjectCreateRe
<Link to="/admin/settings?category=almintegration">
{translate('onboarding.create_project.github.warning.message_admin.link')}
</Link>
- )
+ ),
}}
/>
) : (
@@ -260,7 +264,7 @@ export default function GitHubProjectCreateRenderer(props: GitHubProjectCreateRe
'onboarding.create_project.github.warning.message_admin.link'
)}
</Link>
- )
+ ),
}}
/>
) : (
diff --git a/server/sonar-web/src/main/js/apps/create/project/GitlabProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/GitlabProjectCreate.tsx
index f1dab9ad7be..b51ade4a0e9 100644
--- a/server/sonar-web/src/main/js/apps/create/project/GitlabProjectCreate.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/GitlabProjectCreate.tsx
@@ -63,7 +63,7 @@ export default class GitlabProjectCreate extends React.PureComponent<Props, Stat
showPersonalAccessTokenForm: true,
searching: false,
searchQuery: '',
- settings: props.settings.length === 1 ? props.settings[0] : undefined
+ settings: props.settings.length === 1 ? props.settings[0] : undefined,
};
}
@@ -96,11 +96,11 @@ export default class GitlabProjectCreate extends React.PureComponent<Props, Stat
this.setState({
loading: false,
projects,
- projectsPaging
+ projectsPaging,
});
} else {
this.setState({
- loading: false
+ loading: false,
});
}
}
@@ -125,7 +125,7 @@ export default class GitlabProjectCreate extends React.PureComponent<Props, Stat
almSetting: settings.key,
page: pageIndex,
pageSize: GITLAB_PROJECTS_PAGESIZE,
- query
+ query,
});
} catch (_) {
return this.handleError();
@@ -142,7 +142,7 @@ export default class GitlabProjectCreate extends React.PureComponent<Props, Stat
try {
return await importGitlabProject({
almSetting: settings.key,
- gitlabProjectId
+ gitlabProjectId,
});
} catch (_) {
return this.handleError();
@@ -168,7 +168,7 @@ export default class GitlabProjectCreate extends React.PureComponent<Props, Stat
const {
projectsPaging: { pageIndex },
- searchQuery
+ searchQuery,
} = this.state;
const result = await this.fetchProjects(pageIndex + 1, searchQuery);
@@ -177,7 +177,7 @@ export default class GitlabProjectCreate extends React.PureComponent<Props, Stat
this.setState(({ projects = [], projectsPaging }) => ({
loadingMore: false,
projects: result ? [...projects, ...result.projects] : projects,
- projectsPaging: result ? result.projectsPaging : projectsPaging
+ projectsPaging: result ? result.projectsPaging : projectsPaging,
}));
}
};
@@ -191,7 +191,7 @@ export default class GitlabProjectCreate extends React.PureComponent<Props, Stat
this.setState(({ projects, projectsPaging }) => ({
searching: false,
projects: result ? result.projects : projects,
- projectsPaging: result ? result.projectsPaging : projectsPaging
+ projectsPaging: result ? result.projectsPaging : projectsPaging,
}));
}
};
@@ -220,7 +220,7 @@ export default class GitlabProjectCreate extends React.PureComponent<Props, Stat
searching,
searchQuery,
settings,
- showPersonalAccessTokenForm
+ showPersonalAccessTokenForm,
} = this.state;
return (
diff --git a/server/sonar-web/src/main/js/apps/create/project/GitlabProjectCreateRenderer.tsx b/server/sonar-web/src/main/js/apps/create/project/GitlabProjectCreateRenderer.tsx
index 0b1106bc023..8dc36218a5a 100644
--- a/server/sonar-web/src/main/js/apps/create/project/GitlabProjectCreateRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/GitlabProjectCreateRenderer.tsx
@@ -58,7 +58,7 @@ export default function GitlabProjectCreateRenderer(props: GitlabProjectCreateRe
searching,
searchQuery,
settings,
- showPersonalAccessTokenForm
+ showPersonalAccessTokenForm,
} = props;
return (
diff --git a/server/sonar-web/src/main/js/apps/create/project/GitlabProjectSelectionForm.tsx b/server/sonar-web/src/main/js/apps/create/project/GitlabProjectSelectionForm.tsx
index 10719853aa5..b5636072f3d 100644
--- a/server/sonar-web/src/main/js/apps/create/project/GitlabProjectSelectionForm.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/GitlabProjectSelectionForm.tsx
@@ -54,7 +54,7 @@ export default function GitlabProjectSelectionForm(props: GitlabProjectSelection
projects = [],
projectsPaging,
searching,
- searchQuery
+ searchQuery,
} = props;
if (projects.length === 0 && searchQuery.length === 0 && !searching) {
@@ -68,11 +68,12 @@ export default function GitlabProjectSelectionForm(props: GitlabProjectSelection
<Link
to={{
pathname: '/projects/create',
- search: queryToSearch({ mode: CreateProjectModes.GitLab, resetPat: 1 })
- }}>
+ search: queryToSearch({ mode: CreateProjectModes.GitLab, resetPat: 1 }),
+ }}
+ >
{translate('onboarding.create_project.update_your_token')}
</Link>
- )
+ ),
}}
/>
</Alert>
@@ -96,7 +97,7 @@ export default function GitlabProjectSelectionForm(props: GitlabProjectSelection
) : (
<table className="data zebra zebra-hover">
<tbody>
- {projects.map(project => (
+ {projects.map((project) => (
<tr key={project.id}>
<td>
<Tooltip overlay={project.slug}>
@@ -125,7 +126,8 @@ export default function GitlabProjectSelectionForm(props: GitlabProjectSelection
<Link
className="display-inline-flex-center big-spacer-right"
to={project.url}
- target="_blank">
+ target="_blank"
+ >
{translate('onboarding.create_project.gitlab.link')}
</Link>
</td>
@@ -140,7 +142,8 @@ export default function GitlabProjectSelectionForm(props: GitlabProjectSelection
<td className="text-right">
<Button
disabled={!!importingGitlabProjectId}
- onClick={() => props.onImport(project.id)}>
+ onClick={() => props.onImport(project.id)}
+ >
{translate('onboarding.create_project.set_up')}
{importingGitlabProjectId === project.id && (
<DeferredSpinner className="spacer-left" />
diff --git a/server/sonar-web/src/main/js/apps/create/project/ManualProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/ManualProjectCreate.tsx
index 480c410f267..9a4cc49363e 100644
--- a/server/sonar-web/src/main/js/apps/create/project/ManualProjectCreate.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/ManualProjectCreate.tsx
@@ -72,7 +72,7 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
projectNameTouched: false,
mainBranchName: 'main',
mainBranchNameTouched: false,
- validatingProjectKey: false
+ validatingProjectKey: false,
};
this.checkFreeKey = debounce(this.checkFreeKey, 250);
}
@@ -98,13 +98,13 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
this.setState({ validatingProjectKey: true });
return doesComponentExists({ component: key })
- .then(alreadyExist => {
+ .then((alreadyExist) => {
if (this.mounted && key === this.state.projectKey) {
this.setState({
projectKeyError: alreadyExist
? translate('onboarding.create_project.project_key.taken')
: undefined,
- validatingProjectKey: false
+ validatingProjectKey: false,
});
}
})
@@ -134,7 +134,7 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
createProject({
project: projectKey,
name: (projectName || projectKey).trim(),
- mainBranch: mainBranchName
+ mainBranch: mainBranchName,
}).then(
({ project }) => this.props.onProjectCreate(project.key),
() => {
@@ -152,7 +152,7 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
this.setState({
projectKey,
projectKeyError,
- projectKeyTouched: fromUI
+ projectKeyTouched: fromUI,
});
if (projectKeyError === undefined) {
@@ -165,7 +165,7 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
{
projectName,
projectNameError: this.validateName(projectName),
- projectNameTouched: fromUI
+ projectNameTouched: fromUI,
},
() => {
if (!this.state.projectKeyTouched) {
@@ -182,7 +182,7 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
this.setState({
mainBranchName,
mainBranchNameError: this.validateMainBranchName(mainBranchName),
- mainBranchNameTouched: fromUI
+ mainBranchNameTouched: fromUI,
});
};
@@ -219,7 +219,7 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
mainBranchName,
mainBranchNameError,
mainBranchNameTouched,
- submitting
+ submitting,
} = this.state;
const { branchesEnabled } = this.props;
@@ -246,16 +246,17 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
isInvalid={projectNameIsInvalid}
isValid={projectNameIsValid}
label={translate('onboarding.create_project.display_name')}
- required={true}>
+ required={true}
+ >
<input
className={classNames('input-super-large', {
'is-invalid': projectNameIsInvalid,
- 'is-valid': projectNameIsValid
+ 'is-valid': projectNameIsValid,
})}
id="project-name"
maxLength={PROJECT_NAME_MAX_LEN}
minLength={1}
- onChange={e => this.handleProjectNameChange(e.currentTarget.value, true)}
+ onChange={(e) => this.handleProjectNameChange(e.currentTarget.value, true)}
type="text"
value={projectName}
autoFocus={true}
@@ -264,7 +265,7 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
<ProjectKeyInput
error={projectKeyError}
label={translate('onboarding.create_project.project_key')}
- onProjectKeyChange={e => this.handleProjectKeyChange(e.currentTarget.value, true)}
+ onProjectKeyChange={(e) => this.handleProjectKeyChange(e.currentTarget.value, true)}
projectKey={projectKey}
touched={touched}
validating={validatingProjectKey}
@@ -283,7 +284,7 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
<DocLink to="/project-administration/project-existence">
{translate('learn_more')}
</DocLink>
- )
+ ),
}}
/>
}
@@ -292,15 +293,16 @@ export default class ManualProjectCreate extends React.PureComponent<Props, Stat
isInvalid={mainBranchNameIsInvalid}
isValid={mainBranchNameIsValid}
label={translate('onboarding.create_project.main_branch_name')}
- required={true}>
+ required={true}
+ >
<input
id="main-branch-name"
className={classNames('input-super-large', {
'is-invalid': mainBranchNameIsInvalid,
- 'is-valid': mainBranchNameIsValid
+ 'is-valid': mainBranchNameIsValid,
})}
minLength={1}
- onChange={e => this.handleBranchNameChange(e.currentTarget.value, true)}
+ onChange={(e) => this.handleBranchNameChange(e.currentTarget.value, true)}
type="text"
value={mainBranchName}
/>
diff --git a/server/sonar-web/src/main/js/apps/create/project/PersonalAccessTokenForm.tsx b/server/sonar-web/src/main/js/apps/create/project/PersonalAccessTokenForm.tsx
index 8845249264e..3462224c37d 100644
--- a/server/sonar-web/src/main/js/apps/create/project/PersonalAccessTokenForm.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/PersonalAccessTokenForm.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import {
checkPersonalAccessTokenIsValid,
- setAlmPersonalAccessToken
+ setAlmPersonalAccessToken,
} from '../../../api/alm-integrations';
import { SubmitButton } from '../../../components/controls/buttons';
import ValidationInput from '../../../components/controls/ValidationInput';
@@ -71,14 +71,14 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
touched: false,
password: '',
submitting: false,
- validationFailed: false
+ validationFailed: false,
};
}
async componentDidMount() {
const {
almSetting: { key },
- resetPat
+ resetPat,
} = this.props;
this.mounted = true;
@@ -95,13 +95,13 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
// This is the initial message when no token was provided
if (error === `personal access token for '${key}' is missing`) {
this.setState({
- checkingPat: false
+ checkingPat: false,
});
} else {
this.setState({
checkingPat: false,
validationFailed: true,
- validationErrorMessage: error
+ validationErrorMessage: error,
});
}
}
@@ -115,21 +115,21 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
handleUsernameChange = (event: React.ChangeEvent<HTMLInputElement>) => {
this.setState({
touched: true,
- username: event.target.value
+ username: event.target.value,
});
};
handlePasswordChange = (event: React.ChangeEvent<HTMLInputElement>) => {
this.setState({
touched: true,
- password: event.target.value
+ password: event.target.value,
});
};
handleSubmit = async (e: React.SyntheticEvent<HTMLFormElement>) => {
const { password, username } = this.state;
const {
- almSetting: { key }
+ almSetting: { key },
} = this.props;
e.preventDefault();
@@ -152,7 +152,7 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
password: '',
submitting: false,
username: '',
- validationFailed: false
+ validationFailed: false,
});
this.props.onPersonalAccessTokenCreated();
} else if (this.mounted) {
@@ -160,7 +160,7 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
submitting: false,
touched: false,
validationFailed: true,
- validationErrorMessage: error
+ validationErrorMessage: error,
});
}
}
@@ -168,7 +168,7 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
renderHelpBox(suffixTranslationKey: string) {
const {
- almSetting: { alm, url }
+ almSetting: { alm, url },
} = this.props;
return (
@@ -194,7 +194,8 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
<a
href="https://bitbucket.org/account/settings/"
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate(
'onboarding.create_project.pat_help.instructions_username.bitbucketcloud.link'
)}
@@ -222,7 +223,7 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
<strong>
{translate('onboarding.create_project.pat_help.bitbucket.instructions.button')}
</strong>
- )
+ ),
}}
/>
) : (
@@ -232,7 +233,7 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
`onboarding.create_project.pat_help${suffixTranslationKey}.instructions`
)}
values={{
- alm: translate('onboarding.alm', alm)
+ alm: translate('onboarding.alm', alm),
}}
/>
)}
@@ -271,7 +272,7 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
<strong>
{translate('onboarding.create_project.pat_help.read_permission')}
</strong>
- )
+ ),
}}
/>
</li>
@@ -288,7 +289,7 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
<strong>
{translate('onboarding.create_project.pat_help.read_permission')}
</strong>
- )
+ ),
}}
/>
</li>
@@ -308,7 +309,7 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
render() {
const {
- almSetting: { alm }
+ almSetting: { alm },
} = this.props;
const {
checkingPat,
@@ -317,7 +318,7 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
password,
username,
validationFailed,
- validationErrorMessage
+ validationErrorMessage,
} = this.state;
if (checkingPat) {
@@ -348,11 +349,12 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
isInvalid={false}
isValid={false}
label={translate('onboarding.create_project.enter_username')}
- required={true}>
+ required={true}
+ >
<input
autoFocus={true}
className={classNames('input-super-large', {
- 'is-invalid': isInvalid
+ 'is-invalid': isInvalid,
})}
id="username"
minLength={1}
@@ -370,11 +372,12 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
isInvalid={false}
isValid={false}
label={translate(`onboarding.create_project.enter_pat${suffixTranslationKey}`)}
- required={true}>
+ required={true}
+ >
<input
autoFocus={alm !== AlmKeys.BitbucketCloud}
className={classNames('input-super-large', {
- 'is-invalid': isInvalid
+ 'is-invalid': isInvalid,
})}
id="personal_access_token"
minLength={1}
@@ -389,7 +392,8 @@ export default class PersonalAccessTokenForm extends React.PureComponent<Props,
id="personal_access_token_submit"
isInvalid={isInvalid}
isValid={false}
- label={null}>
+ label={null}
+ >
<SubmitButton disabled={submitButtonDiabled}>{translate('save')}</SubmitButton>
<DeferredSpinner className="spacer-left" loading={submitting} />
</ValidationInput>
diff --git a/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx b/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx
index 296f7638bcc..05f292c5d32 100644
--- a/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/WrongBindingCountAlert.tsx
@@ -46,7 +46,7 @@ export default function WrongBindingCountAlert(props: WrongBindingCountAlertProp
<Link to={getGlobalSettingsUrl(ALM_INTEGRATION_CATEGORY)}>
{translate('settings.page')}
</Link>
- )
+ ),
}}
/>
) : (
@@ -54,7 +54,7 @@ export default function WrongBindingCountAlert(props: WrongBindingCountAlertProp
defaultMessage={translate('onboarding.create_project.wrong_binding_count')}
id="onboarding.create_project.wrong_binding_count"
values={{
- alm: translate('onboarding.alm', alm)
+ alm: translate('onboarding.alm', alm),
}}
/>
)}
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/AzurePersonalAccessTokenForm-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/AzurePersonalAccessTokenForm-test.tsx
index 25e9a7c721c..fd3ac131e87 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/AzurePersonalAccessTokenForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/AzurePersonalAccessTokenForm-test.tsx
@@ -24,13 +24,13 @@ import { mockAlmSettingsInstance } from '../../../../helpers/mocks/alm-settings'
import { change, submit } from '../../../../helpers/testUtils';
import { AlmKeys } from '../../../../types/alm-settings';
import AzurePersonalAccessTokenForm, {
- AzurePersonalAccessTokenFormProps
+ AzurePersonalAccessTokenFormProps,
} from '../AzurePersonalAccessTokenForm';
jest.mock('react', () => {
return {
...jest.requireActual('react'),
- useEffect: jest.fn()
+ useEffect: jest.fn(),
};
});
@@ -58,7 +58,7 @@ it('should correctly handle form interactions', () => {
// If validation fails, we toggle the submitting flag and call useEffect()
// to set the `touched` flag to false again. Trigger a re-render, and mock
// useEffect(). This should de-activate the submit button again.
- (React.useEffect as jest.Mock).mockImplementationOnce(f => f());
+ (React.useEffect as jest.Mock).mockImplementationOnce((f) => f());
wrapper.setProps({ submitting: false });
expect(wrapper.find(SubmitButton).prop('disabled')).toBe(true);
});
@@ -68,7 +68,7 @@ function shallowRender(props: Partial<AzurePersonalAccessTokenFormProps> = {}) {
<AzurePersonalAccessTokenForm
almSetting={mockAlmSettingsInstance({
alm: AlmKeys.Azure,
- url: 'http://www.example.com'
+ url: 'http://www.example.com',
})}
onPersonalAccessTokenCreate={jest.fn()}
validationFailed={false}
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectAccordion-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectAccordion-test.tsx
index f020eca9852..5c8f5d507ec 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectAccordion-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectAccordion-test.tsx
@@ -32,8 +32,8 @@ it('should render correctly', () => {
shallowRender({
repositories: [
mockAzureRepository(),
- mockAzureRepository({ sqProjectKey: 'sq-key', sqProjectName: 'SQ Name' })
- ]
+ mockAzureRepository({ sqProjectKey: 'sq-key', sqProjectName: 'SQ Name' }),
+ ],
})
).toMatchSnapshot('with repositories');
expect(shallowRender({ importing: true, repositories: [mockAzureRepository()] })).toMatchSnapshot(
@@ -46,10 +46,10 @@ it('should render correctly', () => {
mockAzureRepository({
name: 'This is a repo with class',
sqProjectKey: 'sq-key',
- sqProjectName: 'SQ Name'
- })
+ sqProjectName: 'SQ Name',
+ }),
],
- searchQuery: 'repo'
+ searchQuery: 'repo',
})
).toMatchSnapshot('search results');
});
@@ -60,28 +60,15 @@ it('should open when clicked', () => {
const wrapper = shallowRender({
onOpen,
repositories: [mockAzureRepository()],
- startsOpen: false
+ startsOpen: false,
});
- expect(
- wrapper
- .find(BoxedGroupAccordion)
- .children()
- .exists()
- ).toBe(false);
+ expect(wrapper.find(BoxedGroupAccordion).children().exists()).toBe(false);
- wrapper
- .find(BoxedGroupAccordion)
- .props()
- .onClick();
+ wrapper.find(BoxedGroupAccordion).props().onClick();
expect(onOpen).toHaveBeenCalled();
- expect(
- wrapper
- .find(BoxedGroupAccordion)
- .children()
- .exists()
- ).toBe(true);
+ expect(wrapper.find(BoxedGroupAccordion).children().exists()).toBe(true);
});
it('should close when clicked', () => {
@@ -89,29 +76,16 @@ it('should close when clicked', () => {
const wrapper = shallowRender({
onOpen,
- repositories: [mockAzureRepository()]
+ repositories: [mockAzureRepository()],
});
- expect(
- wrapper
- .find(BoxedGroupAccordion)
- .children()
- .exists()
- ).toBe(true);
+ expect(wrapper.find(BoxedGroupAccordion).children().exists()).toBe(true);
- wrapper
- .find(BoxedGroupAccordion)
- .props()
- .onClick();
+ wrapper.find(BoxedGroupAccordion).props().onClick();
expect(onOpen).not.toHaveBeenCalled();
- expect(
- wrapper
- .find(BoxedGroupAccordion)
- .children()
- .exists()
- ).toBe(false);
+ expect(wrapper.find(BoxedGroupAccordion).children().exists()).toBe(false);
});
it('should trigger selection when repo is clicked', () => {
@@ -119,10 +93,7 @@ it('should trigger selection when repo is clicked', () => {
const repo = mockAzureRepository();
const wrapper = shallowRender({ onSelectRepository, repositories: [repo] });
- wrapper
- .find(Radio)
- .props()
- .onCheck(mockEvent());
+ wrapper.find(Radio).props().onCheck(mockEvent());
expect(onSelectRepository).toHaveBeenCalledWith(repo);
});
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectCreate-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectCreate-test.tsx
index 32d096c993e..f2a80b0cf13 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectCreate-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectCreate-test.tsx
@@ -25,7 +25,7 @@ import {
getAzureRepositories,
importAzureRepository,
searchAzureRepositories,
- setAlmPersonalAccessToken
+ setAlmPersonalAccessToken,
} from '../../../../api/alm-integrations';
import { mockAzureProject, mockAzureRepository } from '../../../../helpers/mocks/alm-integrations';
import { mockAlmSettingsInstance } from '../../../../helpers/mocks/alm-settings';
@@ -41,7 +41,7 @@ jest.mock('../../../../api/alm-integrations', () => {
getAzureProjects: jest.fn().mockResolvedValue({ projects: [] }),
getAzureRepositories: jest.fn().mockResolvedValue({ repositories: [] }),
searchAzureRepositories: jest.fn().mockResolvedValue({ repositories: [] }),
- importAzureRepository: jest.fn().mockResolvedValue({ project: { key: 'baz' } })
+ importAzureRepository: jest.fn().mockResolvedValue({ project: { key: 'baz' } }),
};
});
@@ -98,7 +98,7 @@ it('should correctly fetch projects and repositories on mount', async () => {
const project = mockAzureProject();
(getAzureProjects as jest.Mock).mockResolvedValueOnce({ projects: [project] });
(getAzureRepositories as jest.Mock).mockResolvedValueOnce({
- repositories: [mockAzureRepository()]
+ repositories: [mockAzureRepository()],
});
const wrapper = shallowRender();
@@ -111,7 +111,7 @@ it('should correctly fetch projects and repositories on mount', async () => {
it('should handle opening a project', async () => {
const projects = [
mockAzureProject(),
- mockAzureProject({ name: 'project2', description: 'Project to open' })
+ mockAzureProject({ name: 'project2', description: 'Project to open' }),
];
const firstProjectRepos = [mockAzureRepository()];
@@ -120,10 +120,10 @@ it('should handle opening a project', async () => {
(getAzureProjects as jest.Mock).mockResolvedValueOnce({ projects });
(getAzureRepositories as jest.Mock)
.mockResolvedValueOnce({
- repositories: firstProjectRepos
+ repositories: firstProjectRepos,
})
.mockResolvedValueOnce({
- repositories: secondProjectRepos
+ repositories: secondProjectRepos,
});
const wrapper = shallowRender();
@@ -136,7 +136,7 @@ it('should handle opening a project', async () => {
expect(wrapper.state().repositories).toEqual({
[projects[0].name]: firstProjectRepos,
- [projects[1].name]: secondProjectRepos
+ [projects[1].name]: secondProjectRepos,
});
});
@@ -147,7 +147,7 @@ it('should handle searching for repositories', async () => {
const query = 'repo';
const repositories = [mockAzureRepository({ projectName: 'p2' })];
(searchAzureRepositories as jest.Mock).mockResolvedValueOnce({
- repositories
+ repositories,
});
wrapper.instance().handleSearchRepositories(query);
expect(wrapper.state().searching).toBe(true);
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectCreateRenderer-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectCreateRenderer-test.tsx
index 1941f05b24f..265a1890e03 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectCreateRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectCreateRenderer-test.tsx
@@ -23,7 +23,7 @@ import { mockAzureProject, mockAzureRepository } from '../../../../helpers/mocks
import { mockAlmSettingsInstance } from '../../../../helpers/mocks/alm-settings';
import { AlmKeys } from '../../../../types/alm-settings';
import AzureProjectCreateRenderer, {
- AzureProjectCreateRendererProps
+ AzureProjectCreateRendererProps,
} from '../AzureProjectCreateRenderer';
it('should render correctly', () => {
@@ -34,13 +34,13 @@ it('should render correctly', () => {
expect(
shallowRender({
settings: mockAlmSettingsInstance({ alm: AlmKeys.Azure }),
- showPersonalAccessTokenForm: true
+ showPersonalAccessTokenForm: true,
})
).toMatchSnapshot('setting missing url, admin');
expect(
shallowRender({
canAdmin: false,
- settings: mockAlmSettingsInstance({ alm: AlmKeys.Azure })
+ settings: mockAlmSettingsInstance({ alm: AlmKeys.Azure }),
})
).toMatchSnapshot('setting missing url, not admin');
});
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectsList-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectsList-test.tsx
index 60196abb5de..74a374d780c 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectsList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/AzureProjectsList-test.tsx
@@ -33,7 +33,7 @@ it('should render search results correctly', () => {
const projects = [
mockAzureProject({ name: 'p1', description: 'p1' }),
mockAzureProject({ name: 'p2', description: 'p2' }),
- mockAzureProject({ name: 'p3', description: 'p3' })
+ mockAzureProject({ name: 'p3', description: 'p3' }),
];
const searchResults = [mockAzureRepository({ projectName: 'p2' })];
expect(shallowRender({ searchResults, projects })).toMatchSnapshot('default');
@@ -43,9 +43,9 @@ it('should render search results correctly', () => {
searchResults: [
mockAzureRepository({ projectName: 'p2' }),
mockAzureRepository({ name: 'Unknown repository 1', projectName: 'u1' }),
- mockAzureRepository({ name: 'Unknown repository 2', projectName: 'u2' })
+ mockAzureRepository({ name: 'Unknown repository 2', projectName: 'u2' }),
],
- projects
+ projects,
})
).toMatchSnapshot('search results belonging to unknown projects');
});
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudProjectCreate-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudProjectCreate-test.tsx
index 761f1e3abcd..7d2263cc0b4 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudProjectCreate-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudProjectCreate-test.tsx
@@ -21,14 +21,14 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
importBitbucketCloudRepository,
- searchForBitbucketCloudRepositories
+ searchForBitbucketCloudRepositories,
} from '../../../../api/alm-integrations';
import { mockBitbucketCloudRepository } from '../../../../helpers/mocks/alm-integrations';
import { mockBitbucketCloudAlmSettingsInstance } from '../../../../helpers/mocks/alm-settings';
import { mockLocation, mockRouter } from '../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../helpers/testUtils';
import BitbucketCloudProjectCreate, {
- BITBUCKET_CLOUD_PROJECTS_PAGESIZE
+ BITBUCKET_CLOUD_PROJECTS_PAGESIZE,
} from '../BitbucketCloudProjectCreate';
jest.mock('../../../../api/alm-integrations', () => {
@@ -41,7 +41,7 @@ jest.mock('../../../../api/alm-integrations', () => {
.fn()
.mockResolvedValue({ isLastPage: true, repositories: [] }),
checkPersonalAccessTokenIsValid: jest.fn().mockResolvedValue({ status: true }),
- setAlmPersonalAccessToken: jest.fn().mockResolvedValue(null)
+ setAlmPersonalAccessToken: jest.fn().mockResolvedValue(null),
};
});
@@ -69,7 +69,7 @@ it('Should handle error correctly', async () => {
wrapper.setState({
showPersonalAccessTokenForm: false,
repositories: [mockBitbucketCloudRepository()],
- projectsPaging: { pageIndex: 2, pageSize: BITBUCKET_CLOUD_PROJECTS_PAGESIZE }
+ projectsPaging: { pageIndex: 2, pageSize: BITBUCKET_CLOUD_PROJECTS_PAGESIZE },
});
await wrapper.instance().handlePersonalAccessTokenCreated();
expect(wrapper.state().repositories).toHaveLength(0);
@@ -83,8 +83,8 @@ it('Should load repository', async () => {
isLastPage: true,
repositories: [
mockBitbucketCloudRepository(),
- mockBitbucketCloudRepository({ sqProjectKey: 'sq-key' })
- ]
+ mockBitbucketCloudRepository({ sqProjectKey: 'sq-key' }),
+ ],
});
const wrapper = shallowRender();
@@ -97,8 +97,8 @@ it('Should load more repository', async () => {
isLastPage: true,
repositories: [
mockBitbucketCloudRepository(),
- mockBitbucketCloudRepository({ sqProjectKey: 'sq-key' })
- ]
+ mockBitbucketCloudRepository({ sqProjectKey: 'sq-key' }),
+ ],
});
const wrapper = shallowRender();
@@ -114,8 +114,8 @@ it('Should handle search repository', async () => {
isLastPage: true,
repositories: [
mockBitbucketCloudRepository(),
- mockBitbucketCloudRepository({ sqProjectKey: 'sq-key' })
- ]
+ mockBitbucketCloudRepository({ sqProjectKey: 'sq-key' }),
+ ],
});
const wrapper = shallowRender();
@@ -123,7 +123,7 @@ it('Should handle search repository', async () => {
isLastPage: false,
showPersonalAccessTokenForm: false,
projectsPaging: { pageIndex: 2, pageSize: BITBUCKET_CLOUD_PROJECTS_PAGESIZE },
- repositories: [mockBitbucketCloudRepository()]
+ repositories: [mockBitbucketCloudRepository()],
});
wrapper.instance().handleSearch('test');
await waitAndUpdate(wrapper);
@@ -144,7 +144,7 @@ it('Should import repository', async () => {
isLastPage: false,
showPersonalAccessTokenForm: false,
projectsPaging: { pageIndex: 1, pageSize: BITBUCKET_CLOUD_PROJECTS_PAGESIZE },
- repositories: [mockBitbucketCloudRepository({ slug: 'slug-test' })]
+ repositories: [mockBitbucketCloudRepository({ slug: 'slug-test' })],
});
await wrapper.instance().handleImport('slug-test');
expect(importBitbucketCloudRepository).toHaveBeenCalledWith('key', 'slug-test');
@@ -159,7 +159,7 @@ it('Should behave correctly when import fail', async () => {
isLastPage: false,
showPersonalAccessTokenForm: false,
projectsPaging: { pageIndex: 1, pageSize: BITBUCKET_CLOUD_PROJECTS_PAGESIZE },
- repositories: [mockBitbucketCloudRepository({ slug: 'slug-test' })]
+ repositories: [mockBitbucketCloudRepository({ slug: 'slug-test' })],
});
await wrapper.instance().handleImport('slug-test');
expect(importBitbucketCloudRepository).toHaveBeenCalledWith('key', 'slug-test');
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudProjectCreateRender-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudProjectCreateRender-test.tsx
index e14832364b7..951aa97fbd1 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudProjectCreateRender-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudProjectCreateRender-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import { mockBitbucketCloudAlmSettingsInstance } from '../../../../helpers/mocks/alm-settings';
import BitbucketCloudProjectCreateRenderer, {
- BitbucketCloudProjectCreateRendererProps
+ BitbucketCloudProjectCreateRendererProps,
} from '../BitbucketCloudProjectCreateRender';
it('Should render correctly', () => {
@@ -30,7 +30,7 @@ it('Should render correctly', () => {
expect(shallowRender({ loading: true })).toMatchSnapshot('Loading...');
expect(
shallowRender({
- showPersonalAccessTokenForm: true
+ showPersonalAccessTokenForm: true,
})
).toMatchSnapshot('Need App password');
});
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudSearchForm-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudSearchForm-test.tsx
index 0d1cff1f72b..253442d7b0a 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudSearchForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketCloudSearchForm-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import { mockBitbucketCloudRepository } from '../../../../helpers/mocks/alm-integrations';
import BitbucketCloudSearchForm, {
- BitbucketCloudSearchFormProps
+ BitbucketCloudSearchFormProps,
} from '../BitbucketCloudSearchForm';
it('Should render correctly', () => {
@@ -30,29 +30,29 @@ it('Should render correctly', () => {
shallowRender({
repositories: [
mockBitbucketCloudRepository(),
- mockBitbucketCloudRepository({ sqProjectKey: 'sq-key' })
+ mockBitbucketCloudRepository({ sqProjectKey: 'sq-key' }),
],
- isLastPage: false
+ isLastPage: false,
})
).toMatchSnapshot('Show more');
expect(
shallowRender({
repositories: [mockBitbucketCloudRepository()],
- isLastPage: true
+ isLastPage: true,
})
).toMatchSnapshot('Show no more');
expect(
shallowRender({
repositories: [mockBitbucketCloudRepository()],
isLastPage: false,
- loadingMore: true
+ loadingMore: true,
})
).toMatchSnapshot('Loading more');
expect(
shallowRender({
repositories: [],
isLastPage: false,
- searching: true
+ searching: true,
})
).toMatchSnapshot('Searching');
expect(
@@ -60,9 +60,9 @@ it('Should render correctly', () => {
importingSlug: 'import-slug',
repositories: [
mockBitbucketCloudRepository({ slug: 'import-slug' }),
- mockBitbucketCloudRepository({ sqProjectKey: 'sq-key' })
+ mockBitbucketCloudRepository({ sqProjectKey: 'sq-key' }),
],
- isLastPage: false
+ isLastPage: false,
})
).toMatchSnapshot('Importing');
});
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketImportRepositoryForm-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketImportRepositoryForm-test.tsx
index b8d015b06eb..ecf054c6f33 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketImportRepositoryForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketImportRepositoryForm-test.tsx
@@ -22,11 +22,11 @@ import * as React from 'react';
import SearchBox from '../../../../components/controls/SearchBox';
import {
mockBitbucketProject,
- mockBitbucketRepository
+ mockBitbucketRepository,
} from '../../../../helpers/mocks/alm-integrations';
import { change } from '../../../../helpers/testUtils';
import BitbucketImportRepositoryForm, {
- BitbucketImportRepositoryFormProps
+ BitbucketImportRepositoryFormProps,
} from '../BitbucketImportRepositoryForm';
it('should render correctly', () => {
@@ -56,13 +56,13 @@ function shallowRender(props: Partial<BitbucketImportRepositoryFormProps> = {})
allShown: true,
repositories: [
mockBitbucketRepository(),
- mockBitbucketRepository({ id: 2, slug: 'bar', name: 'Bar', sqProjectKey: 'bar' })
- ]
- }
+ mockBitbucketRepository({ id: 2, slug: 'bar', name: 'Bar', sqProjectKey: 'bar' }),
+ ],
+ },
}}
projects={[
mockBitbucketProject(),
- mockBitbucketProject({ id: 2, key: 'project2', name: 'Project 2' })
+ mockBitbucketProject({ id: 2, key: 'project2', name: 'Project 2' }),
]}
searching={false}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectAccordion-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectAccordion-test.tsx
index dc6edfc6c38..1a238bad84a 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectAccordion-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectAccordion-test.tsx
@@ -22,10 +22,10 @@ import * as React from 'react';
import Radio from '../../../../components/controls/Radio';
import {
mockBitbucketProject,
- mockBitbucketRepository
+ mockBitbucketRepository,
} from '../../../../helpers/mocks/alm-integrations';
import BitbucketProjectAccordion, {
- BitbucketProjectAccordionProps
+ BitbucketProjectAccordionProps,
} from '../BitbucketProjectAccordion';
it('should render correctly', () => {
@@ -46,14 +46,10 @@ it('should correctly handle selecting repos', () => {
const repo = mockBitbucketRepository();
const wrapper = shallowRender({
onSelectRepository,
- repositories: [repo]
+ repositories: [repo],
});
- wrapper
- .find(Radio)
- .at(0)
- .props()
- .onCheck('');
+ wrapper.find(Radio).at(0).props().onCheck('');
expect(onSelectRepository).toHaveBeenCalledWith(repo);
});
@@ -67,7 +63,7 @@ function shallowRender(props: Partial<BitbucketProjectAccordionProps> = {}) {
project={mockBitbucketProject()}
repositories={[
mockBitbucketRepository(),
- mockBitbucketRepository({ id: 2, slug: 'bar', name: 'Bar', sqProjectKey: 'bar' })
+ mockBitbucketRepository({ id: 2, slug: 'bar', name: 'Bar', sqProjectKey: 'bar' }),
]}
showingAllRepositories={true}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectCreate-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectCreate-test.tsx
index 30bf627a0c5..c4d108190ca 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectCreate-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectCreate-test.tsx
@@ -23,11 +23,11 @@ import {
getBitbucketServerProjects,
getBitbucketServerRepositories,
importBitbucketServerProject,
- searchForBitbucketServerRepositories
+ searchForBitbucketServerRepositories,
} from '../../../../api/alm-integrations';
import {
mockBitbucketProject,
- mockBitbucketRepository
+ mockBitbucketRepository,
} from '../../../../helpers/mocks/alm-integrations';
import { mockAlmSettingsInstance } from '../../../../helpers/mocks/alm-settings';
import { mockLocation, mockRouter } from '../../../../helpers/testMocks';
@@ -43,22 +43,22 @@ jest.mock('../../../../api/alm-integrations', () => {
getBitbucketServerProjects: jest.fn().mockResolvedValue({
projects: [
mockBitbucketProject({ key: 'project1', name: 'Project 1' }),
- mockBitbucketProject({ id: 2, key: 'project2' })
- ]
+ mockBitbucketProject({ id: 2, key: 'project2' }),
+ ],
}),
getBitbucketServerRepositories: jest.fn().mockResolvedValue({
repositories: [
mockBitbucketRepository({ projectKey: 'project1' }),
- mockBitbucketRepository({ id: 2, projectKey: 'project1', slug: 'project__repo2' })
- ]
+ mockBitbucketRepository({ id: 2, projectKey: 'project1', slug: 'project__repo2' }),
+ ],
}),
importBitbucketServerProject: jest.fn().mockResolvedValue({ project: { key: 'baz' } }),
searchForBitbucketServerRepositories: jest.fn().mockResolvedValue({
repositories: [
mockBitbucketRepository(),
- mockBitbucketRepository({ id: 2, slug: 'project__repo2' })
- ]
- })
+ mockBitbucketRepository({ id: 2, slug: 'project__repo2' }),
+ ],
+ }),
};
});
@@ -90,9 +90,9 @@ it('should correctly fetch projects and repos', async () => {
project1: expect.objectContaining({
repositories: expect.arrayContaining([
expect.objectContaining({ id: 1 }),
- expect.objectContaining({ id: 2 })
- ])
- })
+ expect.objectContaining({ id: 2 }),
+ ]),
+ }),
})
);
expect(wrapper.state().projectRepositories).toBeDefined();
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectCreateRenderer-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectCreateRenderer-test.tsx
index ffa7fd5b388..d771028e1df 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectCreateRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketProjectCreateRenderer-test.tsx
@@ -21,12 +21,12 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
mockBitbucketProject,
- mockBitbucketRepository
+ mockBitbucketRepository,
} from '../../../../helpers/mocks/alm-integrations';
import { mockAlmSettingsInstance } from '../../../../helpers/mocks/alm-settings';
import { AlmKeys } from '../../../../types/alm-settings';
import BitbucketProjectCreateRenderer, {
- BitbucketProjectCreateRendererProps
+ BitbucketProjectCreateRendererProps,
} from '../BitbucketProjectCreateRenderer';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketRepositories-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketRepositories-test.tsx
index 661f69254ae..137468f862b 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketRepositories-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketRepositories-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
mockBitbucketProject,
- mockBitbucketRepository
+ mockBitbucketRepository,
} from '../../../../helpers/mocks/alm-integrations';
import { click } from '../../../../helpers/testUtils';
import BitbucketProjectAccordion from '../BitbucketProjectAccordion';
@@ -51,13 +51,13 @@ function shallowRender(props: Partial<BitbucketRepositoriesProps> = {}) {
allShown: true,
repositories: [
mockBitbucketRepository(),
- mockBitbucketRepository({ id: 2, slug: 'bar', name: 'Bar', sqProjectKey: 'bar' })
- ]
- }
+ mockBitbucketRepository({ id: 2, slug: 'bar', name: 'Bar', sqProjectKey: 'bar' }),
+ ],
+ },
}}
projects={[
mockBitbucketProject(),
- mockBitbucketProject({ id: 2, key: 'project2', name: 'Project 2' })
+ mockBitbucketProject({ id: 2, key: 'project2', name: 'Project 2' }),
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketSearchResults-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketSearchResults-test.tsx
index 56fb57bc2ce..2bb40e32c2c 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketSearchResults-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/BitbucketSearchResults-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
mockBitbucketProject,
- mockBitbucketRepository
+ mockBitbucketRepository,
} from '../../../../helpers/mocks/alm-integrations';
import BitbucketSearchResults, { BitbucketSearchResultsProps } from '../BitbucketSearchResults';
@@ -33,7 +33,10 @@ it('should render correctly', () => {
expect(shallowRender({ searchResults: undefined })).toMatchSnapshot('no results');
expect(
shallowRender({
- searchResults: [mockBitbucketRepository(), mockBitbucketRepository({ projectKey: 'unknown' })]
+ searchResults: [
+ mockBitbucketRepository(),
+ mockBitbucketRepository({ projectKey: 'unknown' }),
+ ],
})
).toMatchSnapshot('unknown project in search results');
});
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectModeSelection-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectModeSelection-test.tsx
index 3dbf2b4487c..47ddaad401e 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectModeSelection-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectModeSelection-test.tsx
@@ -24,7 +24,7 @@ import { click } from '../../../../helpers/testUtils';
import { AlmKeys } from '../../../../types/alm-settings';
import {
CreateProjectModeSelection,
- CreateProjectModeSelectionProps
+ CreateProjectModeSelectionProps,
} from '../CreateProjectModeSelection';
import { CreateProjectModes } from '../types';
@@ -54,7 +54,7 @@ it('should render correctly', () => {
[AlmKeys.BitbucketCloud]: 0,
[AlmKeys.BitbucketServer]: 0,
[AlmKeys.GitHub]: 0,
- [AlmKeys.GitLab]: 0
+ [AlmKeys.GitLab]: 0,
}
)
).toMatchSnapshot('no alm conf yet, admin');
@@ -140,7 +140,7 @@ function shallowRender(
[AlmKeys.BitbucketServer]: 1,
[AlmKeys.GitHub]: 1,
[AlmKeys.GitLab]: 1,
- ...almCountOverrides
+ ...almCountOverrides,
};
return shallow<CreateProjectModeSelectionProps>(
<CreateProjectModeSelection
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx
index 4098221e47a..146f6bb91de 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectPage-test.tsx
@@ -31,7 +31,7 @@ import { CreateProjectModes } from '../types';
jest.mock('../../../../api/alm-settings', () => {
const { AlmKeys } = jest.requireActual('../../../../types/alm-settings');
return {
- getAlmSettings: jest.fn().mockResolvedValue([{ alm: AlmKeys.BitbucketServer, key: 'foo' }])
+ getAlmSettings: jest.fn().mockResolvedValue([{ alm: AlmKeys.BitbucketServer, key: 'foo' }]),
};
});
@@ -48,11 +48,11 @@ it.each([
[CreateProjectModes.BitbucketServer],
[CreateProjectModes.BitbucketCloud],
[CreateProjectModes.GitHub],
- [CreateProjectModes.GitLab]
+ [CreateProjectModes.GitLab],
])('should render correctly for %s mode', (mode: CreateProjectModes) => {
expect(
shallowRender({
- location: mockLocation({ query: { mode } })
+ location: mockLocation({ query: { mode } }),
})
).toMatchSnapshot();
});
@@ -60,26 +60,17 @@ it.each([
it('should render alm configuration creation correctly', () => {
const wrapper = shallowRender();
- wrapper
- .find(CreateProjectModeSelection)
- .props()
- .onConfigMode(AlmKeys.Azure);
+ wrapper.find(CreateProjectModeSelection).props().onConfigMode(AlmKeys.Azure);
expect(wrapper).toMatchSnapshot();
});
it('should cancel alm configuration creation properly', () => {
const wrapper = shallowRender();
- wrapper
- .find(CreateProjectModeSelection)
- .props()
- .onConfigMode(AlmKeys.Azure);
+ wrapper.find(CreateProjectModeSelection).props().onConfigMode(AlmKeys.Azure);
expect(wrapper.state().creatingAlmDefinition).toBe(AlmKeys.Azure);
- wrapper
- .find(AlmBindingDefinitionForm)
- .props()
- .onCancel();
+ wrapper.find(AlmBindingDefinitionForm).props().onCancel();
expect(wrapper.state().creatingAlmDefinition).toBeUndefined();
});
@@ -87,16 +78,10 @@ it('should submit alm configuration creation properly', async () => {
const push = jest.fn();
const wrapper = shallowRender({ router: mockRouter({ push }) });
- wrapper
- .find(CreateProjectModeSelection)
- .props()
- .onConfigMode(AlmKeys.Azure);
+ wrapper.find(CreateProjectModeSelection).props().onConfigMode(AlmKeys.Azure);
expect(wrapper.state().creatingAlmDefinition).toBe(AlmKeys.Azure);
- wrapper
- .find(AlmBindingDefinitionForm)
- .props()
- .afterSubmit({ key: 'test-key' });
+ wrapper.find(AlmBindingDefinitionForm).props().afterSubmit({ key: 'test-key' });
await waitAndUpdate(wrapper);
expect(wrapper.state().creatingAlmDefinition).toBeUndefined();
expect(getAlmSettings).toHaveBeenCalled();
@@ -107,17 +92,11 @@ it('should submit alm configuration creation properly for BBC', async () => {
const push = jest.fn();
const wrapper = shallowRender({ router: mockRouter({ push }) });
- wrapper
- .find(CreateProjectModeSelection)
- .props()
- .onConfigMode(AlmKeys.BitbucketServer);
+ wrapper.find(CreateProjectModeSelection).props().onConfigMode(AlmKeys.BitbucketServer);
expect(wrapper.state().creatingAlmDefinition).toBe(AlmKeys.BitbucketServer);
(getAlmSettings as jest.Mock).mockResolvedValueOnce([{ alm: AlmKeys.BitbucketCloud }]);
- wrapper
- .find(AlmBindingDefinitionForm)
- .props()
- .afterSubmit({ key: 'test-key' });
+ wrapper.find(AlmBindingDefinitionForm).props().afterSubmit({ key: 'test-key' });
await waitAndUpdate(wrapper);
expect(wrapper.state().creatingAlmDefinition).toBeUndefined();
expect(getAlmSettings).toHaveBeenCalled();
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHubProjectCreate-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHubProjectCreate-test.tsx
index 58732686b45..f17a178b463 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHubProjectCreate-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHubProjectCreate-test.tsx
@@ -23,7 +23,7 @@ import {
getGithubClientId,
getGithubOrganizations,
getGithubRepositories,
- importGithubRepository
+ importGithubRepository,
} from '../../../../api/alm-integrations';
import { mockGitHubRepository } from '../../../../helpers/mocks/alm-integrations';
import { mockAlmSettingsInstance } from '../../../../helpers/mocks/alm-settings';
@@ -35,7 +35,7 @@ jest.mock('../../../../api/alm-integrations', () => ({
getGithubClientId: jest.fn().mockResolvedValue({ clientId: 'client-id-124' }),
getGithubOrganizations: jest.fn().mockResolvedValue({ organizations: [] }),
getGithubRepositories: jest.fn().mockResolvedValue({ repositories: [], paging: {} }),
- importGithubRepository: jest.fn().mockResolvedValue({ project: {} })
+ importGithubRepository: jest.fn().mockResolvedValue({ project: {} }),
}));
const originalLocation = window.location;
@@ -43,18 +43,18 @@ const originalLocation = window.location;
beforeAll(() => {
const location = {
...window.location,
- replace: jest.fn()
+ replace: jest.fn(),
};
Object.defineProperty(window, 'location', {
writable: true,
- value: location
+ value: location,
});
});
afterAll(() => {
Object.defineProperty(window, 'location', {
writable: true,
- value: originalLocation
+ value: originalLocation,
});
});
@@ -78,7 +78,7 @@ it('should redirect when no code', async () => {
it('should redirect when no code - github.com', async () => {
const wrapper = shallowRender({
- settings: [mockAlmSettingsInstance({ key: 'a', url: 'api.github.com' })]
+ settings: [mockAlmSettingsInstance({ key: 'a', url: 'api.github.com' })],
});
await waitAndUpdate(wrapper);
@@ -100,13 +100,13 @@ it('should not redirect when invalid clientId', async () => {
it('should fetch organizations when code', async () => {
const organizations = [
{ key: '1', name: 'org1' },
- { key: '2', name: 'org2' }
+ { key: '2', name: 'org2' },
];
(getGithubOrganizations as jest.Mock).mockResolvedValueOnce({ organizations });
const replace = jest.fn();
const wrapper = shallowRender({
location: mockLocation({ query: { code: '123456' } }),
- router: mockRouter({ replace })
+ router: mockRouter({ replace }),
});
await waitAndUpdate(wrapper);
@@ -118,13 +118,13 @@ it('should fetch organizations when code', async () => {
it('should handle org selection', async () => {
const organizations = [
{ key: '1', name: 'org1' },
- { key: '2', name: 'org2' }
+ { key: '2', name: 'org2' },
];
(getGithubOrganizations as jest.Mock).mockResolvedValueOnce({ organizations });
const repositories = [mockGitHubRepository()];
(getGithubRepositories as jest.Mock).mockResolvedValueOnce({
repositories,
- paging: { total: 1, pageIndex: 1 }
+ paging: { total: 1, pageIndex: 1 },
});
const wrapper = shallowRender({ location: mockLocation({ query: { code: '123456' } }) });
await waitAndUpdate(wrapper);
@@ -145,13 +145,13 @@ it('should load more', async () => {
const repositories = [
mockGitHubRepository({ key: 'r1' }),
mockGitHubRepository({ key: 'r2' }),
- mockGitHubRepository({ key: 'r3' })
+ mockGitHubRepository({ key: 'r3' }),
];
(getGithubRepositories as jest.Mock).mockResolvedValueOnce({ repositories });
wrapper.setState({
repositories: startRepos,
- selectedOrganization: { key: 'o1', name: 'org' }
+ selectedOrganization: { key: 'o1', name: 'org' },
});
wrapper.instance().handleLoadMore();
@@ -169,13 +169,13 @@ it('should handle search', async () => {
const repositories = [
mockGitHubRepository({ key: 'r1' }),
mockGitHubRepository({ key: 'r2' }),
- mockGitHubRepository({ key: 'r3' })
+ mockGitHubRepository({ key: 'r3' }),
];
(getGithubRepositories as jest.Mock).mockResolvedValueOnce({ repositories });
wrapper.setState({
repositories: startRepos,
- selectedOrganization: { key: 'o1', name: 'org' }
+ selectedOrganization: { key: 'o1', name: 'org' },
});
wrapper.instance().handleSearch(query);
@@ -187,7 +187,7 @@ it('should handle search', async () => {
organization: 'o1',
page: 1,
pageSize: 30,
- query: 'query'
+ query: 'query',
});
expect(wrapper.state().repositories).toEqual(repositories);
});
@@ -218,7 +218,7 @@ it('should handle importing', async () => {
const selectedRepository = mockGitHubRepository();
wrapper.setState({
selectedOrganization,
- selectedRepository
+ selectedRepository,
});
wrapper.instance().handleImportRepository();
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHubProjectCreateRenderer-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHubProjectCreateRenderer-test.tsx
index 7de9d843efb..05c57f0b2aa 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHubProjectCreateRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHubProjectCreateRenderer-test.tsx
@@ -25,7 +25,7 @@ import Select from '../../../../components/controls/Select';
import { mockGitHubRepository } from '../../../../helpers/mocks/alm-integrations';
import { GithubOrganization } from '../../../../types/alm-integration';
import GitHubProjectCreateRenderer, {
- GitHubProjectCreateRendererProps
+ GitHubProjectCreateRendererProps,
} from '../GitHubProjectCreateRenderer';
it('should render correctly', () => {
@@ -36,21 +36,21 @@ it('should render correctly', () => {
const organizations: GithubOrganization[] = [
{ key: 'o1', name: 'org1' },
- { key: 'o2', name: 'org2' }
+ { key: 'o2', name: 'org2' },
];
expect(shallowRender({ organizations })).toMatchSnapshot('organizations');
expect(
shallowRender({
organizations,
- selectedOrganization: organizations[1]
+ selectedOrganization: organizations[1],
})
).toMatchSnapshot('no repositories');
const repositories = [
mockGitHubRepository({ id: '1', key: 'repo1' }),
mockGitHubRepository({ id: '2', key: 'repo2', sqProjectKey: 'repo2' }),
- mockGitHubRepository({ id: '3', key: 'repo3' })
+ mockGitHubRepository({ id: '3', key: 'repo3' }),
];
expect(
@@ -58,7 +58,7 @@ it('should render correctly', () => {
organizations,
selectedOrganization: organizations[1],
repositories,
- selectedRepository: repositories[2]
+ selectedRepository: repositories[2],
})
).toMatchSnapshot('repositories');
});
@@ -76,7 +76,7 @@ describe('callback', () => {
onSearch,
organizations: [org],
selectedOrganization: org,
- repositories: [mockGitHubRepository()]
+ repositories: [mockGitHubRepository()],
});
beforeEach(() => {
@@ -91,19 +91,13 @@ describe('callback', () => {
it('should be called when searchbox is changed', () => {
const value = 'search query';
- wrapper
- .find(SearchBox)
- .props()
- .onChange(value);
+ wrapper.find(SearchBox).props().onChange(value);
expect(onSearch).toHaveBeenCalledWith(value);
});
it('should be called when repo is selected', () => {
const value = 'repo1';
- wrapper
- .find(Radio)
- .props()
- .onCheck(value);
+ wrapper.find(Radio).props().onCheck(value);
expect(onSelectRepository).toHaveBeenCalledWith(value);
});
});
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectCreate-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectCreate-test.tsx
index 579810d0965..4504a6e0912 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectCreate-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectCreate-test.tsx
@@ -29,7 +29,7 @@ import GitlabProjectCreate from '../GitlabProjectCreate';
jest.mock('../../../../api/alm-integrations', () => ({
getGitlabProjects: jest.fn().mockRejectedValue('error'),
- importGitlabProject: jest.fn().mockRejectedValue('error')
+ importGitlabProject: jest.fn().mockRejectedValue('error'),
}));
beforeEach(jest.clearAllMocks);
@@ -47,7 +47,7 @@ it('should fetch more projects and preserve search', async () => {
mockGitlabProject({ id: '3' }),
mockGitlabProject({ id: '4' }),
mockGitlabProject({ id: '5' }),
- mockGitlabProject({ id: '6' })
+ mockGitlabProject({ id: '6' }),
];
(getGitlabProjects as jest.Mock)
.mockResolvedValueOnce({
@@ -55,16 +55,16 @@ it('should fetch more projects and preserve search', async () => {
projectsPaging: {
pageIndex: 1,
pageSize: 4,
- total: 6
- }
+ total: 6,
+ },
})
.mockResolvedValueOnce({
projects: projects.slice(5),
projectsPaging: {
pageIndex: 2,
pageSize: 4,
- total: 6
- }
+ total: 6,
+ },
});
const wrapper = shallowRender();
@@ -89,7 +89,7 @@ it('should search for projects', async () => {
mockGitlabProject({ id: '3' }),
mockGitlabProject({ id: '4' }),
mockGitlabProject({ id: '5' }),
- mockGitlabProject({ id: '6' })
+ mockGitlabProject({ id: '6' }),
];
(getGitlabProjects as jest.Mock)
.mockResolvedValueOnce({
@@ -97,16 +97,16 @@ it('should search for projects', async () => {
projectsPaging: {
pageIndex: 1,
pageSize: 6,
- total: 6
- }
+ total: 6,
+ },
})
.mockResolvedValueOnce({
projects: projects.slice(3, 5),
projectsPaging: {
pageIndex: 1,
pageSize: 6,
- total: 2
- }
+ total: 2,
+ },
});
const query = 'query';
@@ -130,13 +130,13 @@ it('should import', async () => {
projectsPaging: {
pageIndex: 1,
pageSize: 6,
- total: 2
- }
+ total: 2,
+ },
});
const createdProjectkey = 'imported_project_key';
(importGitlabProject as jest.Mock).mockResolvedValueOnce({
- project: { key: createdProjectkey }
+ project: { key: createdProjectkey },
});
const onProjectCreate = jest.fn();
@@ -183,8 +183,8 @@ it('should handle errors when importing a project', async () => {
projectsPaging: {
pageIndex: 1,
pageSize: 10,
- total: 1
- }
+ total: 1,
+ },
});
const wrapper = shallowRender();
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectCreateRenderer-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectCreateRenderer-test.tsx
index f0186a3a980..dd0773a03bf 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectCreateRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectCreateRenderer-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { mockAlmSettingsInstance } from '../../../../helpers/mocks/alm-settings';
import { AlmKeys } from '../../../../types/alm-settings';
import GitlabProjectCreateRenderer, {
- GitlabProjectCreateRendererProps
+ GitlabProjectCreateRendererProps,
} from '../GitlabProjectCreateRenderer';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectSelectionForm-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectSelectionForm-test.tsx
index a32c6712ef2..b464e947bc0 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectSelectionForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitlabProjectSelectionForm-test.tsx
@@ -24,7 +24,7 @@ import ListFooter from '../../../../components/controls/ListFooter';
import SearchBox from '../../../../components/controls/SearchBox';
import { mockGitlabProject } from '../../../../helpers/mocks/alm-integrations';
import GitlabProjectSelectionForm, {
- GitlabProjectSelectionFormProps
+ GitlabProjectSelectionFormProps,
} from '../GitlabProjectSelectionForm';
it('should render correctly', () => {
@@ -50,28 +50,19 @@ describe('appropriate callback', () => {
const wrapper = shallowRender({ onImport, onLoadMore, onSearch });
it('should be called when clicking to import', () => {
- wrapper
- .find(Button)
- .first()
- .simulate('click');
+ wrapper.find(Button).first().simulate('click');
expect(onImport).toHaveBeenCalled();
});
it('should be assigned to the list footer', () => {
- const { loadMore } = wrapper
- .find(ListFooter)
- .first()
- .props();
+ const { loadMore } = wrapper.find(ListFooter).first().props();
expect(loadMore).toBe(onLoadMore);
});
it('should be assigned to the search box', () => {
- const { onChange } = wrapper
- .find(SearchBox)
- .first()
- .props();
+ const { onChange } = wrapper.find(SearchBox).first().props();
expect(onChange).toBe(onSearch);
});
@@ -83,8 +74,8 @@ function shallowRender(props: Partial<GitlabProjectSelectionFormProps> = {}) {
mockGitlabProject({
id: '2',
sqProjectKey: 'already-imported',
- sqProjectName: 'Already Imported'
- })
+ sqProjectName: 'Already Imported',
+ }),
];
return shallow<GitlabProjectSelectionFormProps>(
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/ManualProjectCreate-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/ManualProjectCreate-test.tsx
index de813558a76..7e3efa67ba9 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/ManualProjectCreate-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/ManualProjectCreate-test.tsx
@@ -28,11 +28,11 @@ jest.mock('../../../../api/components', () => ({
createProject: jest.fn().mockResolvedValue({ project: { key: 'bar', name: 'Bar' } }),
doesComponentExists: jest
.fn()
- .mockImplementation(({ component }) => Promise.resolve(component === 'exists'))
+ .mockImplementation(({ component }) => Promise.resolve(component === 'exists')),
}));
jest.mock('../../../../api/settings', () => ({
- getValue: jest.fn().mockResolvedValue({ value: 'main' })
+ getValue: jest.fn().mockResolvedValue({ value: 'main' }),
}));
beforeEach(() => {
@@ -53,7 +53,7 @@ it('should validate form input', async () => {
// All input valid
await user.click(
await screen.findByRole('textbox', {
- name: 'onboarding.create_project.display_name field_required'
+ name: 'onboarding.create_project.display_name field_required',
})
);
await user.keyboard('test');
@@ -65,7 +65,7 @@ it('should validate form input', async () => {
// Sanitize the key
await user.click(
await screen.findByRole('textbox', {
- name: 'onboarding.create_project.display_name field_required'
+ name: 'onboarding.create_project.display_name field_required',
})
);
await user.keyboard('{Control>}a{/Control}This is not a key%^$');
@@ -76,7 +76,7 @@ it('should validate form input', async () => {
// Clear name
await user.clear(
screen.getByRole('textbox', {
- name: 'onboarding.create_project.display_name field_required'
+ name: 'onboarding.create_project.display_name field_required',
})
);
expect(
@@ -90,7 +90,7 @@ it('should validate form input', async () => {
// Only key
await user.click(
await screen.findByRole('textbox', {
- name: 'onboarding.create_project.project_key field_required'
+ name: 'onboarding.create_project.project_key field_required',
})
);
await user.keyboard('awsome-key');
@@ -105,7 +105,7 @@ it('should validate form input', async () => {
// Invalid key
await user.click(
await screen.findByRole('textbox', {
- name: 'onboarding.create_project.project_key field_required'
+ name: 'onboarding.create_project.project_key field_required',
})
);
await user.keyboard('{Control>}a{/Control}123');
@@ -124,7 +124,7 @@ it('should validate form input', async () => {
// Invalid main branch name
await user.clear(
screen.getByRole('textbox', {
- name: 'onboarding.create_project.main_branch_name field_required'
+ name: 'onboarding.create_project.main_branch_name field_required',
})
);
expect(
@@ -140,7 +140,7 @@ it('should submit form input', async () => {
// All input valid
await user.click(
await screen.findByRole('textbox', {
- name: 'onboarding.create_project.display_name field_required'
+ name: 'onboarding.create_project.display_name field_required',
})
);
await user.keyboard('test');
@@ -148,7 +148,7 @@ it('should submit form input', async () => {
expect(createProject).toHaveBeenCalledWith({
name: 'test',
project: 'test',
- mainBranch: 'main'
+ mainBranch: 'main',
});
expect(onProjectCreate).toHaveBeenCalled();
});
@@ -162,7 +162,7 @@ it('should handle create failure', async () => {
// All input valid
await user.click(
await screen.findByRole('textbox', {
- name: 'onboarding.create_project.display_name field_required'
+ name: 'onboarding.create_project.display_name field_required',
})
);
await user.keyboard('test');
@@ -180,7 +180,7 @@ it('should handle component exists failure', async () => {
// All input valid
await user.click(
await screen.findByRole('textbox', {
- name: 'onboarding.create_project.display_name field_required'
+ name: 'onboarding.create_project.display_name field_required',
})
);
await user.keyboard('test');
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/PersonalAccessTokenForm-test.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/PersonalAccessTokenForm-test.tsx
index e3760fef073..51f82e784c5 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/PersonalAccessTokenForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/PersonalAccessTokenForm-test.tsx
@@ -21,12 +21,12 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
checkPersonalAccessTokenIsValid,
- setAlmPersonalAccessToken
+ setAlmPersonalAccessToken,
} from '../../../../api/alm-integrations';
import { SubmitButton } from '../../../../components/controls/buttons';
import {
mockAlmSettingsInstance,
- mockBitbucketCloudAlmSettingsInstance
+ mockBitbucketCloudAlmSettingsInstance,
} from '../../../../helpers/mocks/alm-settings';
import { change, submit, waitAndUpdate } from '../../../../helpers/testUtils';
import { AlmKeys } from '../../../../types/alm-settings';
@@ -34,7 +34,7 @@ import PersonalAccessTokenForm from '../PersonalAccessTokenForm';
jest.mock('../../../../api/alm-integrations', () => ({
checkPersonalAccessTokenIsValid: jest.fn().mockResolvedValue({ status: true }),
- setAlmPersonalAccessToken: jest.fn().mockResolvedValue({})
+ setAlmPersonalAccessToken: jest.fn().mockResolvedValue({}),
}));
it('should render correctly', async () => {
@@ -52,7 +52,7 @@ it('should render correctly', async () => {
(checkPersonalAccessTokenIsValid as jest.Mock).mockResolvedValueOnce({ status: false });
wrapper = shallowRender({
- almSetting: mockAlmSettingsInstance({ alm: AlmKeys.GitLab, url: 'https://gitlab.com/api/v4' })
+ almSetting: mockAlmSettingsInstance({ alm: AlmKeys.GitLab, url: 'https://gitlab.com/api/v4' }),
});
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot('gitlab');
@@ -61,8 +61,8 @@ it('should render correctly', async () => {
wrapper = shallowRender({
almSetting: mockAlmSettingsInstance({
alm: AlmKeys.GitLab,
- url: 'https://gitlabapi.unexpectedurl.org'
- })
+ url: 'https://gitlabapi.unexpectedurl.org',
+ }),
});
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot('gitlab with non-standard api path');
@@ -90,7 +90,7 @@ it('should correctly handle form for bitbucket interactions', async () => {
const onPersonalAccessTokenCreated = jest.fn();
const wrapper = shallowRender({
almSetting: mockBitbucketCloudAlmSettingsInstance(),
- onPersonalAccessTokenCreated
+ onPersonalAccessTokenCreated,
});
await waitAndUpdate(wrapper);
@@ -113,7 +113,7 @@ it('should correctly handle form for bitbucket interactions', async () => {
it('should show error when issue', async () => {
(checkPersonalAccessTokenIsValid as jest.Mock).mockRejectedValueOnce({});
const wrapper = shallowRender({
- almSetting: mockBitbucketCloudAlmSettingsInstance()
+ almSetting: mockBitbucketCloudAlmSettingsInstance(),
});
await waitAndUpdate(wrapper);
@@ -134,7 +134,7 @@ function shallowRender(props: Partial<PersonalAccessTokenForm['props']> = {}) {
<PersonalAccessTokenForm
almSetting={mockAlmSettingsInstance({
alm: AlmKeys.BitbucketServer,
- url: 'http://www.example.com'
+ url: 'http://www.example.com',
})}
onPersonalAccessTokenCreated={jest.fn()}
resetPat={false}
diff --git a/server/sonar-web/src/main/js/apps/create/project/types.ts b/server/sonar-web/src/main/js/apps/create/project/types.ts
index 4c26ec0e348..5543eaa8f69 100644
--- a/server/sonar-web/src/main/js/apps/create/project/types.ts
+++ b/server/sonar-web/src/main/js/apps/create/project/types.ts
@@ -23,5 +23,5 @@ export enum CreateProjectModes {
BitbucketServer = 'bitbucket',
BitbucketCloud = 'bitbucketcloud',
GitHub = 'github',
- GitLab = 'gitlab'
+ GitLab = 'gitlab',
}
diff --git a/server/sonar-web/src/main/js/apps/groups/components/App.tsx b/server/sonar-web/src/main/js/apps/groups/components/App.tsx
index ac751d235a8..af2478db6c2 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/App.tsx
@@ -57,7 +57,7 @@ export default class App extends React.PureComponent<{}, State> {
this.setState({ loading: true });
return searchUsersGroups({
q: this.state.query,
- ...data
+ ...data,
});
};
@@ -83,13 +83,13 @@ export default class App extends React.PureComponent<{}, State> {
if (currentPaging && currentPaging.total > currentPaging.pageIndex * currentPaging.pageSize) {
try {
const { groups, paging } = await this.makeFetchGroupsRequest({
- p: currentPaging.pageIndex + 1
+ p: currentPaging.pageIndex + 1,
});
if (this.mounted) {
this.setState(({ groups: existingGroups = [] }) => ({
groups: [...existingGroups, ...groups],
loading: false,
- paging
+ paging,
}));
}
} catch {
@@ -166,7 +166,7 @@ export default class App extends React.PureComponent<{}, State> {
description,
id: editedGroup.id,
// pass `name` only if it has changed, otherwise the WS fails
- ...omitNil({ name: name !== editedGroup.name ? name : undefined })
+ ...omitNil({ name: name !== editedGroup.name ? name : undefined }),
};
await updateGroup(data);
@@ -174,9 +174,9 @@ export default class App extends React.PureComponent<{}, State> {
if (this.mounted) {
this.setState(({ groups = [] }: State) => ({
editedGroup: undefined,
- groups: groups.map(group =>
+ groups: groups.map((group) =>
group.name === editedGroup.name ? { ...group, ...data } : group
- )
+ ),
}));
}
};
diff --git a/server/sonar-web/src/main/js/apps/groups/components/EditMembers.tsx b/server/sonar-web/src/main/js/apps/groups/components/EditMembers.tsx
index f67bbe2feb5..124af00a589 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/EditMembers.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/EditMembers.tsx
@@ -64,7 +64,8 @@ export default class EditMembers extends React.PureComponent<Props, State> {
aria-label={translate('groups.users.edit')}
className="button-small"
onClick={this.handleMembersClick}
- title={translate('groups.users.edit')}>
+ title={translate('groups.users.edit')}
+ >
<BulletListIcon />
</ButtonIcon>
{this.state.modal && (
diff --git a/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx b/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx
index b947ad325df..1cdbe4b051d 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/EditMembersModal.tsx
@@ -24,7 +24,7 @@ import { ResetButtonLink } from '../../../components/controls/buttons';
import Modal from '../../../components/controls/Modal';
import SelectList, {
SelectListFilter,
- SelectListSearchParams
+ SelectListSearchParams,
} from '../../../components/controls/SelectList';
import { translate } from '../../../helpers/l10n';
import { Group, UserSelected } from '../../../types/types';
@@ -51,7 +51,7 @@ export default class EditMembersModal extends React.PureComponent<Props, State>
this.state = {
needToReload: false,
users: [],
- selectedUsers: []
+ selectedUsers: [],
};
}
@@ -69,14 +69,16 @@ export default class EditMembersModal extends React.PureComponent<Props, State>
p: searchParams.page,
ps: searchParams.pageSize,
q: searchParams.query !== '' ? searchParams.query : undefined,
- selected: searchParams.filter
- }).then(data => {
+ selected: searchParams.filter,
+ }).then((data) => {
if (this.mounted) {
- this.setState(prevState => {
+ this.setState((prevState) => {
const more = searchParams.page != null && searchParams.page > 1;
const users = more ? [...prevState.users, ...data.users] : data.users;
- const newSelectedUsers = data.users.filter(user => user.selected).map(user => user.login);
+ const newSelectedUsers = data.users
+ .filter((user) => user.selected)
+ .map((user) => user.login);
const selectedUsers = more
? [...prevState.selectedUsers, ...newSelectedUsers]
: newSelectedUsers;
@@ -87,7 +89,7 @@ export default class EditMembersModal extends React.PureComponent<Props, State>
loading: false,
users,
usersTotalCount: data.total,
- selectedUsers
+ selectedUsers,
};
});
}
@@ -96,12 +98,12 @@ export default class EditMembersModal extends React.PureComponent<Props, State>
handleSelect = (login: string) =>
addUserToGroup({
name: this.props.group.name,
- login
+ login,
}).then(() => {
if (this.mounted) {
this.setState((state: State) => ({
needToReload: true,
- selectedUsers: [...state.selectedUsers, login]
+ selectedUsers: [...state.selectedUsers, login],
}));
}
});
@@ -109,12 +111,12 @@ export default class EditMembersModal extends React.PureComponent<Props, State>
handleUnselect = (login: string) =>
removeUserFromGroup({
name: this.props.group.name,
- login
+ login,
}).then(() => {
if (this.mounted) {
this.setState((state: State) => ({
needToReload: true,
- selectedUsers: without(state.selectedUsers, login)
+ selectedUsers: without(state.selectedUsers, login),
}));
}
});
@@ -146,7 +148,7 @@ export default class EditMembersModal extends React.PureComponent<Props, State>
<div className="modal-body modal-container">
<SelectList
- elements={this.state.users.map(user => user.login)}
+ elements={this.state.users.map((user) => user.login)}
elementsTotalCount={this.state.usersTotalCount}
needToReload={
this.state.needToReload &&
diff --git a/server/sonar-web/src/main/js/apps/groups/components/Form.tsx b/server/sonar-web/src/main/js/apps/groups/components/Form.tsx
index 4e35588f895..4f1fc0a539d 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/Form.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/Form.tsx
@@ -44,7 +44,7 @@ export default class Form extends React.PureComponent<Props, State> {
super(props);
this.state = {
description: (props.group && props.group.description) || '',
- name: (props.group && props.group.name) || ''
+ name: (props.group && props.group.name) || '',
};
}
@@ -68,7 +68,8 @@ export default class Form extends React.PureComponent<Props, State> {
header={this.props.header}
onClose={this.props.onClose}
onSubmit={this.handleSubmit}
- size="small">
+ size="small"
+ >
{({ onCloseClick, onFormSubmit, submitting }) => (
<form onSubmit={onFormSubmit}>
<header className="modal-head">
diff --git a/server/sonar-web/src/main/js/apps/groups/components/List.tsx b/server/sonar-web/src/main/js/apps/groups/components/List.tsx
index b985a18e98f..a07ca958903 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/List.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/List.tsx
@@ -60,7 +60,7 @@ export default function List(props: Props) {
</tr>
)}
- {sortBy(props.groups, group => group.name.toLowerCase()).map(group => (
+ {sortBy(props.groups, (group) => group.name.toLowerCase()).map((group) => (
<ListItem
group={group}
key={group.name}
diff --git a/server/sonar-web/src/main/js/apps/groups/components/ListItem.tsx b/server/sonar-web/src/main/js/apps/groups/components/ListItem.tsx
index 0b7309f4729..4c24f5dd8a0 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/ListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/ListItem.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import ActionsDropdown, {
ActionsDropdownDivider,
- ActionsDropdownItem
+ ActionsDropdownItem,
} from '../../../components/controls/ActionsDropdown';
import { translate } from '../../../helpers/l10n';
import { Group } from '../../../types/types';
@@ -62,7 +62,8 @@ export default function ListItem(props: ListItemProps) {
<ActionsDropdownItem
className="js-group-delete"
destructive={true}
- onClick={() => props.onDelete(group)}>
+ onClick={() => props.onDelete(group)}
+ >
{translate('delete')}
</ActionsDropdownItem>
</ActionsDropdown>
diff --git a/server/sonar-web/src/main/js/apps/groups/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/groups/components/__tests__/App-test.tsx
index 31fe6ef3cf1..7e5d25d83f5 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/__tests__/App-test.tsx
@@ -23,7 +23,7 @@ import {
createGroup,
deleteGroup,
searchUsersGroups,
- updateGroup
+ updateGroup,
} from '../../../../api/user_groups';
import { mockGroup } from '../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../helpers/testUtils';
@@ -35,7 +35,7 @@ jest.mock('../../../../api/user_groups', () => ({
description: 'Desc foo',
id: 3,
membersCount: 0,
- name: 'Foo'
+ name: 'Foo',
}),
deleteGroup: jest.fn().mockResolvedValue({}),
searchUsersGroups: jest.fn().mockResolvedValue({
@@ -46,18 +46,18 @@ jest.mock('../../../../api/user_groups', () => ({
description: 'Owners of organization foo',
id: 1,
membersCount: 1,
- name: 'Owners'
+ name: 'Owners',
},
{
default: true,
description: 'Members of organization foo',
id: 2,
membersCount: 2,
- name: 'Members'
- }
- ]
+ name: 'Members',
+ },
+ ],
}),
- updateGroup: jest.fn().mockResolvedValue({})
+ updateGroup: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
@@ -112,7 +112,7 @@ it('should correctly handle edition', async () => {
description: 'foo',
id: 1,
membersCount: 1,
- name: 'bar'
+ name: 'bar',
});
});
diff --git a/server/sonar-web/src/main/js/apps/groups/components/__tests__/EditMembersModal-test.tsx b/server/sonar-web/src/main/js/apps/groups/components/__tests__/EditMembersModal-test.tsx
index 0cd013f7572..5c60f04477c 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/__tests__/EditMembersModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/__tests__/EditMembersModal-test.tsx
@@ -33,12 +33,12 @@ jest.mock('../../../../api/user_groups', () => ({
{
login: 'foo',
name: 'bar',
- selected: true
- }
- ]
+ selected: true,
+ },
+ ],
}),
addUserToGroup: jest.fn().mockResolvedValue({}),
- removeUserFromGroup: jest.fn().mockResolvedValue({})
+ removeUserFromGroup: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
@@ -47,15 +47,12 @@ beforeEach(() => {
it('should render modal properly', async () => {
const wrapper = shallowRender();
- wrapper
- .find(SelectList)
- .props()
- .onSearch({
- query: '',
- filter: SelectListFilter.Selected,
- page: 1,
- pageSize: 100
- });
+ wrapper.find(SelectList).props().onSearch({
+ query: '',
+ filter: SelectListFilter.Selected,
+ page: 1,
+ pageSize: 100,
+ });
await waitAndUpdate(wrapper);
expect(wrapper.state().needToReload).toBe(false);
@@ -70,7 +67,7 @@ it('should render modal properly', async () => {
p: 1,
ps: 100,
q: undefined,
- selected: SelectListFilter.Selected
+ selected: SelectListFilter.Selected,
})
);
@@ -86,7 +83,7 @@ it('should handle selection properly', async () => {
expect(addUserToGroup).toHaveBeenCalledWith(
expect.objectContaining({
name: group.name,
- login: 'toto'
+ login: 'toto',
})
);
expect(wrapper.state().needToReload).toBe(true);
@@ -100,7 +97,7 @@ it('should handle deselection properly', async () => {
expect(removeUserFromGroup).toHaveBeenCalledWith(
expect.objectContaining({
name: group.name,
- login: 'tata'
+ login: 'tata',
})
);
expect(wrapper.state().needToReload).toBe(true);
diff --git a/server/sonar-web/src/main/js/apps/groups/components/__tests__/List-test.tsx b/server/sonar-web/src/main/js/apps/groups/components/__tests__/List-test.tsx
index c5e8c25de54..50c9720a1c0 100644
--- a/server/sonar-web/src/main/js/apps/groups/components/__tests__/List-test.tsx
+++ b/server/sonar-web/src/main/js/apps/groups/components/__tests__/List-test.tsx
@@ -26,18 +26,14 @@ it('should render', () => {
});
it('should not render "Anyone"', () => {
- expect(
- shallowRender(false)
- .find('.js-anyone')
- .exists()
- ).toBe(false);
+ expect(shallowRender(false).find('.js-anyone').exists()).toBe(false);
});
function shallowRender(showAnyone = true) {
const groups = [
{ id: 1, name: 'sonar-users', description: '', membersCount: 55, default: true },
{ id: 2, name: 'foo', description: 'foobar', membersCount: 0, default: false },
- { id: 3, name: 'bar', description: 'barbar', membersCount: 1, default: false }
+ { id: 3, name: 'bar', description: 'barbar', membersCount: 1, default: false },
];
return shallow(
<List
diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx
index 0eb6484eac5..e53b3ce3f0f 100644
--- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx
@@ -65,7 +65,7 @@ it('should be able to bulk change', async () => {
expect(
issueBoxFixThat.getByRole('button', {
- name: 'issue.type.type_x_click_to_change.issue.type.CODE_SMELL'
+ name: 'issue.type.type_x_click_to_change.issue.type.CODE_SMELL',
})
).toBeInTheDocument();
@@ -78,13 +78,13 @@ it('should be able to bulk change', async () => {
expect(screen.getByRole('button', { name: 'apply' })).toBeDisabled();
await selectEvent.select(screen.getByRole('textbox', { name: 'issue.set_type' }), [
- 'issue.type.BUG'
+ 'issue.type.BUG',
]);
await user.click(screen.getByRole('button', { name: 'apply' }));
expect(
issueBoxFixThat.getByRole('button', {
- name: 'issue.type.type_x_click_to_change.issue.type.BUG'
+ name: 'issue.type.type_x_click_to_change.issue.type.BUG',
})
).toBeInTheDocument();
});
@@ -239,7 +239,7 @@ it('should open issue and navigate', async () => {
expect(screen.getByRole('region', { name: 'Issue on file' })).toBeInTheDocument();
expect(
screen.getByRole('row', {
- name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;'
+ name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;',
})
).toBeInTheDocument();
});
@@ -282,12 +282,12 @@ it('should be able to perform action on issues', async () => {
// changing issue type
expect(
screen.getByRole('button', {
- name: `issue.type.type_x_click_to_change.issue.type.CODE_SMELL`
+ name: `issue.type.type_x_click_to_change.issue.type.CODE_SMELL`,
})
).toBeInTheDocument();
await user.click(
screen.getByRole('button', {
- name: `issue.type.type_x_click_to_change.issue.type.CODE_SMELL`
+ name: `issue.type.type_x_click_to_change.issue.type.CODE_SMELL`,
})
);
expect(screen.getByText('issue.type.BUG')).toBeInTheDocument();
@@ -296,7 +296,7 @@ it('should be able to perform action on issues', async () => {
await user.click(screen.getByText('issue.type.VULNERABILITY'));
expect(
screen.getByRole('button', {
- name: `issue.type.type_x_click_to_change.issue.type.VULNERABILITY`
+ name: `issue.type.type_x_click_to_change.issue.type.VULNERABILITY`,
})
).toBeInTheDocument();
@@ -305,7 +305,7 @@ it('should be able to perform action on issues', async () => {
await user.click(
screen.getByRole('button', {
- name: `issue.severity.severity_x_click_to_change.severity.MAJOR`
+ name: `issue.severity.severity_x_click_to_change.severity.MAJOR`,
})
);
expect(screen.getByText('severity.MINOR')).toBeInTheDocument();
@@ -313,7 +313,7 @@ it('should be able to perform action on issues', async () => {
await user.click(screen.getByText('severity.MINOR'));
expect(
screen.getByRole('button', {
- name: `issue.severity.severity_x_click_to_change.severity.MINOR`
+ name: `issue.severity.severity_x_click_to_change.severity.MINOR`,
})
).toBeInTheDocument();
@@ -327,7 +327,7 @@ it('should be able to perform action on issues', async () => {
await user.click(screen.getByText('issue.transition.confirm'));
expect(
screen.getByRole('button', {
- name: `issue.transition.status_x_click_to_change.issue.status.CONFIRMED`
+ name: `issue.transition.status_x_click_to_change.issue.status.CONFIRMED`,
})
).toBeInTheDocument();
@@ -343,13 +343,13 @@ it('should be able to perform action on issues', async () => {
// assigning issue to a different user
expect(
screen.getByRole('button', {
- name: `issue.assign.unassigned_click_to_assign`
+ name: `issue.assign.unassigned_click_to_assign`,
})
).toBeInTheDocument();
await user.click(
screen.getByRole('button', {
- name: `issue.assign.unassigned_click_to_assign`
+ name: `issue.assign.unassigned_click_to_assign`,
})
);
expect(screen.getByRole('searchbox', { name: 'search_verb' })).toBeInTheDocument();
@@ -363,13 +363,13 @@ it('should be able to perform action on issues', async () => {
// adding comment to the issue
expect(
screen.getByRole('button', {
- name: `issue.comment.add_comment`
+ name: `issue.comment.add_comment`,
})
).toBeInTheDocument();
await user.click(
screen.getByRole('button', {
- name: `issue.comment.add_comment`
+ name: `issue.comment.add_comment`,
})
);
expect(screen.getByText('issue.comment.submit')).toBeInTheDocument();
@@ -438,29 +438,29 @@ it('should not allow performing actions when user does not have permission', asy
expect(
screen.queryByRole('button', {
- name: `issue.assign.unassigned_click_to_assign`
+ name: `issue.assign.unassigned_click_to_assign`,
})
).not.toBeInTheDocument();
expect(
screen.queryByRole('button', {
- name: `issue.type.type_x_click_to_change.issue.type.CODE_SMELL`
+ name: `issue.type.type_x_click_to_change.issue.type.CODE_SMELL`,
})
).not.toBeInTheDocument();
await user.click(
screen.getByRole('button', {
- name: `issue.comment.add_comment`
+ name: `issue.comment.add_comment`,
})
);
expect(screen.queryByRole('button', { name: 'issue.comment.submit' })).not.toBeInTheDocument();
expect(
screen.queryByRole('button', {
- name: `issue.transition.status_x_click_to_change.issue.status.OPEN`
+ name: `issue.transition.status_x_click_to_change.issue.status.OPEN`,
})
).not.toBeInTheDocument();
expect(
screen.queryByRole('button', {
- name: `issue.severity.severity_x_click_to_change.severity.MAJOR`
+ name: `issue.severity.severity_x_click_to_change.severity.MAJOR`,
})
).not.toBeInTheDocument();
});
@@ -535,14 +535,14 @@ it('should show code tabs when any secondary location is selected', async () =>
);
expect(
screen.queryByRole('row', {
- name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;'
+ name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;',
})
).not.toBeInTheDocument();
await user.click(screen.getByRole('button', { name: '1 location 1' }));
expect(
screen.getByRole('row', {
- name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;'
+ name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;',
})
).toBeInTheDocument();
@@ -552,14 +552,14 @@ it('should show code tabs when any secondary location is selected', async () =>
);
expect(
screen.queryByRole('row', {
- name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;'
+ name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;',
})
).not.toBeInTheDocument();
await user.click(screen.getByRole('button', { name: '1 location 1' }));
expect(
screen.getByRole('row', {
- name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;'
+ name: '2 source_viewer.tooltip.covered import java.util. ArrayList ;',
})
).toBeInTheDocument();
});
@@ -574,7 +574,7 @@ it('should show issue tags if applicable', async () => {
expect(
screen.getByRole('heading', {
- name: 'Issue with tags sonar-lint-icon issue.resolution.badge.DEPRECATED'
+ name: 'Issue with tags sonar-lint-icon issue.resolution.badge.DEPRECATED',
})
).toBeInTheDocument();
});
diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/actions-test.ts b/server/sonar-web/src/main/js/apps/issues/__tests__/actions-test.ts
index 1a5b23ef3f2..aade2bdba87 100644
--- a/server/sonar-web/src/main/js/apps/issues/__tests__/actions-test.ts
+++ b/server/sonar-web/src/main/js/apps/issues/__tests__/actions-test.ts
@@ -26,7 +26,7 @@ describe('selectFlow', () => {
expect(selectFlow(5)()).toEqual({
locationsNavigator: true,
selectedFlowIndex: 5,
- selectedLocationIndex: undefined
+ selectedLocationIndex: undefined,
});
});
});
@@ -38,13 +38,13 @@ describe('enableLocationsNavigator', () => {
).toEqual(
expect.objectContaining({
locationsNavigator: true,
- selectedFlowIndex: 20
+ selectedFlowIndex: 20,
})
);
expect(enableLocationsNavigator({ openIssue: mockIssue(true) } as State)).toEqual(
expect.objectContaining({
locationsNavigator: true,
- selectedFlowIndex: 0
+ selectedFlowIndex: 0,
})
);
expect(
@@ -52,7 +52,7 @@ describe('enableLocationsNavigator', () => {
).toEqual(
expect.objectContaining({
locationsNavigator: true,
- selectedFlowIndex: undefined
+ selectedFlowIndex: undefined,
})
);
});
@@ -61,7 +61,7 @@ describe('enableLocationsNavigator', () => {
expect(enableLocationsNavigator({ openIssue: mockIssue(true) } as State)).toEqual(
expect.objectContaining({
locationsNavigator: true,
- selectedLocationIndex: undefined
+ selectedLocationIndex: undefined,
})
);
@@ -70,7 +70,7 @@ describe('enableLocationsNavigator', () => {
).toEqual(
expect.objectContaining({
locationsNavigator: true,
- selectedLocationIndex: 0
+ selectedLocationIndex: 0,
})
);
@@ -79,7 +79,7 @@ describe('enableLocationsNavigator', () => {
).toEqual(
expect.objectContaining({
locationsNavigator: true,
- selectedLocationIndex: 20
+ selectedLocationIndex: 20,
})
);
});
@@ -88,7 +88,7 @@ describe('enableLocationsNavigator', () => {
expect(enableLocationsNavigator({ openIssue: mockIssue() } as State)).toBeNull();
expect(
enableLocationsNavigator({
- openIssue: mockIssue(true, { flows: [], secondaryLocations: [] })
+ openIssue: mockIssue(true, { flows: [], secondaryLocations: [] }),
} as State)
).toBeNull();
});
diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts
index 3b2c8a7c5dc..74db752161e 100644
--- a/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts
@@ -22,11 +22,11 @@ import {
serializeQuery,
shouldOpenSonarSourceSecurityFacet,
shouldOpenStandardsChildFacet,
- shouldOpenStandardsFacet
+ shouldOpenStandardsFacet,
} from '../utils';
jest.mock('../../../helpers/scrolling', () => ({
- scrollToElement: jest.fn()
+ scrollToElement: jest.fn(),
}));
beforeEach(() => {
@@ -67,7 +67,7 @@ describe('serialize/deserialize', () => {
sonarsourceSecurity: ['a', 'b'],
statuses: ['a', 'b'],
tags: ['a', 'b'],
- types: ['a', 'b']
+ types: ['a', 'b'],
})
).toStrictEqual({
assignees: 'a,b',
@@ -98,7 +98,7 @@ describe('serialize/deserialize', () => {
sonarsourceSecurity: 'a,b',
statuses: 'a,b',
tags: 'a,b',
- types: 'a,b'
+ types: 'a,b',
});
});
});
diff --git a/server/sonar-web/src/main/js/apps/issues/actions.ts b/server/sonar-web/src/main/js/apps/issues/actions.ts
index 86077870ebe..6132db4d2e3 100644
--- a/server/sonar-web/src/main/js/apps/issues/actions.ts
+++ b/server/sonar-web/src/main/js/apps/issues/actions.ts
@@ -31,7 +31,7 @@ export function enableLocationsNavigator(state: State) {
selectedFlowIndex,
// Also reset index = -1 to 0, we don't want to start on the issue when enabling the location navigator
selectedLocationIndex:
- selectedLocationIndex && selectedLocationIndex < 0 ? 0 : selectedLocationIndex
+ selectedLocationIndex && selectedLocationIndex < 0 ? 0 : selectedLocationIndex,
};
}
return null;
@@ -55,7 +55,7 @@ export function selectNextLocation(
}
return {
selectedLocationIndex: index !== undefined && index < lastLocationIdx ? index + 1 : index,
- locationsNavigator: true
+ locationsNavigator: true,
};
}
return null;
@@ -71,7 +71,7 @@ export function selectPreviousLocation(state: State) {
}
return {
selectedLocationIndex: index !== undefined && index > 0 ? index - 1 : index,
- locationsNavigator: true
+ locationsNavigator: true,
};
}
return null;
@@ -82,7 +82,7 @@ export function selectFlow(nextIndex?: number) {
return {
locationsNavigator: true,
selectedFlowIndex: nextIndex,
- selectedLocationIndex: undefined
+ selectedLocationIndex: undefined,
};
};
}
@@ -99,7 +99,7 @@ export function selectNextFlow(state: State) {
return {
selectedFlowIndex: selectedFlowIndex + 1,
selectedLocationIndex: 0,
- locationsNavigator: true
+ locationsNavigator: true,
};
} else if (
openIssue &&
@@ -117,7 +117,7 @@ export function selectPreviousFlow(state: State) {
return {
selectedFlowIndex: selectedFlowIndex - 1,
selectedLocationIndex: 0,
- locationsNavigator: true
+ locationsNavigator: true,
};
}
return null;
diff --git a/server/sonar-web/src/main/js/apps/issues/components/AssigneeSelect.tsx b/server/sonar-web/src/main/js/apps/issues/components/AssigneeSelect.tsx
index 780fd24494a..cdb7fb3c7d0 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/AssigneeSelect.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/AssigneeSelect.tsx
@@ -58,17 +58,17 @@ export default class AssigneeSelect extends React.Component<AssigneeSelectProps>
if (isLoggedIn(currentUser)) {
const canBeAssignedToMe =
- issues.filter(issue => issue.assignee !== currentUser.login).length > 0;
+ issues.filter((issue) => issue.assignee !== currentUser.login).length > 0;
if (canBeAssignedToMe) {
options.push({
avatar: currentUser.avatar,
label: currentUser.name,
- value: currentUser.login
+ value: currentUser.login,
});
}
}
- const canBeUnassigned = issues.filter(issue => issue.assignee).length > 0;
+ const canBeUnassigned = issues.filter((issue) => issue.assignee).length > 0;
if (canBeUnassigned) {
options.push({ label: translate('unassigned'), value: '' });
}
@@ -84,13 +84,13 @@ export default class AssigneeSelect extends React.Component<AssigneeSelectProps>
searchAssignees(query)
.then(({ results }) =>
- results.map(r => {
+ results.map((r) => {
const userInfo = r.name || r.login;
return {
avatar: r.avatar,
label: isUserActive(r) ? userInfo : translateWithParameters('user.x_deleted', userInfo),
- value: r.login
+ value: r.login,
};
})
)
@@ -125,7 +125,7 @@ export default class AssigneeSelect extends React.Component<AssigneeSelectProps>
inputId={inputId}
components={{
Option: this.renderAssigneeOption,
- SingleValue: this.renderSingleAssignee
+ SingleValue: this.renderSingleAssignee,
}}
isClearable={true}
defaultOptions={this.getDefaultAssignee()}
diff --git a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx
index b40ad4a4043..e1c814765b0 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx
@@ -31,7 +31,7 @@ import Radio from '../../../components/controls/Radio';
import Select, {
BasicSelectOption,
CreatableSelect,
- SearchSelect
+ SearchSelect,
} from '../../../components/controls/Select';
import Tooltip from '../../../components/controls/Tooltip';
import IssueTypeIcon from '../../../components/icons/IssueTypeIcon';
@@ -85,7 +85,7 @@ enum InputField {
assignee = 'assignee',
removeTags = 'removeTags',
severity = 'severity',
- type = 'type'
+ type = 'type',
}
export const MAX_PAGE_SIZE = 500;
@@ -111,10 +111,10 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
}
this.setState({
- initialTags: tags.map(tag => ({ label: tag, value: tag })),
+ initialTags: tags.map((tag) => ({ label: tag, value: tag })),
issues,
loading: false,
- paging
+ paging,
});
}
},
@@ -136,16 +136,15 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
handleTagsSearch = (query: string, resolve: (option: TagOption[]) => void) => {
searchIssueTags({ q: query })
- .then(tags => tags.map(tag => ({ label: tag, value: tag })))
+ .then((tags) => tags.map((tag) => ({ label: tag, value: tag })))
.then(resolve)
.catch(() => resolve([]));
};
- handleTagsSelect = (field: InputField.addTags | InputField.removeTags) => (
- options: TagOption[]
- ) => {
- this.setState<keyof FormFields>({ [field]: options });
- };
+ handleTagsSelect =
+ (field: InputField.addTags | InputField.removeTags) => (options: TagOption[]) => {
+ this.setState<keyof FormFields>({ [field]: options });
+ };
handleFieldCheck = (field: keyof FormFields) => (checked: boolean) => {
if (!checked) {
@@ -176,19 +175,19 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
const query = pickBy(
{
- add_tags: this.state.addTags && this.state.addTags.map(t => t.value).join(),
+ add_tags: this.state.addTags && this.state.addTags.map((t) => t.value).join(),
assign: this.state.assignee ? this.state.assignee.value : null,
comment: this.state.comment,
do_transition: this.state.transition,
- remove_tags: this.state.removeTags && this.state.removeTags.map(t => t.value).join(),
+ remove_tags: this.state.removeTags && this.state.removeTags.map((t) => t.value).join(),
sendNotifications: this.state.notifications,
set_severity: this.state.severity,
- set_type: this.state.type
+ set_type: this.state.type,
},
- x => x !== undefined
+ (x) => x !== undefined
);
- const issueKeys = this.state.issues.map(issue => issue.key);
+ const issueKeys = this.state.issues.map((issue) => issue.key);
this.setState({ submitting: true });
bulkChangeIssues(issueKeys, query).then(
@@ -196,7 +195,7 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
this.setState({ submitting: false });
this.props.onDone();
},
- error => {
+ (error) => {
this.setState({ submitting: false });
throwGlobalError(error);
}
@@ -205,9 +204,9 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
getAvailableTransitions(issues: Issue[]) {
const transitions: Dict<number> = {};
- issues.forEach(issue => {
+ issues.forEach((issue) => {
if (issue.transitions) {
- issue.transitions.forEach(t => {
+ issue.transitions.forEach((t) => {
if (transitions[t] !== undefined) {
transitions[t]++;
} else {
@@ -216,9 +215,9 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
});
}
});
- return sortBy(Object.keys(transitions)).map(transition => ({
+ return sortBy(Object.keys(transitions)).map((transition) => ({
transition,
- count: transitions[transition]
+ count: transitions[transition],
}));
}
@@ -305,9 +304,9 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
}
const types: IssueType[] = ['BUG', 'VULNERABILITY', 'CODE_SMELL'];
- const options: BasicSelectOption[] = types.map(type => ({
+ const options: BasicSelectOption[] = types.map((type) => ({
label: translate('issue.type', type),
- value: type
+ value: type,
}));
const typeRenderer = (option: BasicSelectOption) => (
@@ -329,7 +328,7 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
),
SingleValue: (props: SingleValueProps<BasicSelectOption>) => (
<components.SingleValue {...props}>{typeRenderer(props.data)}</components.SingleValue>
- )
+ ),
}}
onChange={this.handleSelectFieldChange('type')}
options={options}
@@ -348,9 +347,9 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
}
const severities = ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO'];
- const options: BasicSelectOption[] = severities.map(severity => ({
+ const options: BasicSelectOption[] = severities.map((severity) => ({
label: translate('severity', severity),
- value: severity
+ value: severity,
}));
const input = (
@@ -370,7 +369,7 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
<components.SingleValue {...props}>
{<SeverityHelper className="display-flex-center" severity={props.data.value} />}
</components.SingleValue>
- )
+ ),
}}
options={options}
/>
@@ -398,7 +397,7 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
defaultOptions: this.state.initialTags,
isMulti: true,
onChange: this.handleTagsSelect(field),
- loadOptions: this.handleTagsSearch
+ loadOptions: this.handleTagsSearch,
};
const input = allowCreate ? (
@@ -421,14 +420,16 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
<div className="modal-field">
<fieldset>
<legend>{translate('issue.transition')}</legend>
- {transitions.map(transition => (
+ {transitions.map((transition) => (
<span
className="bulk-change-radio-button display-flex-center display-flex-space-between"
- key={transition.transition}>
+ key={transition.transition}
+ >
<Radio
checked={this.state.transition === transition.transition}
onCheck={this.handleRadioTransitionChange}
- value={transition.transition}>
+ value={transition.transition}
+ >
{translate('issue.transition', transition.transition)}
</Radio>
{this.renderAffected(transition.count)}
@@ -472,7 +473,8 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
className="display-inline-block spacer-top"
id="send-notifications"
onCheck={this.handleFieldCheck('notifications')}
- right={true}>
+ right={true}
+ >
<strong className="little-spacer-right">{translate('issue.send_notifications')}</strong>
</Checkbox>
);
@@ -518,7 +520,8 @@ export default class BulkChangeModal extends React.PureComponent<Props, State> {
<Tooltip overlay={!canSubmit ? translate('issue_bulk_change.no_change_selected') : null}>
<SubmitButton
disabled={!canSubmit || submitting || issues.length === 0}
- id="bulk-change-submit">
+ id="bulk-change-submit"
+ >
{translate('apply')}
</SubmitButton>
</Tooltip>
diff --git a/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx b/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx
index 12391f0f991..09b792dd4a0 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx
@@ -37,7 +37,7 @@ export default function ComponentBreadcrumbs({
component,
issue,
selectedFlowIndex,
- selectedLocationIndex
+ selectedLocationIndex,
}: Props) {
const displayProject =
!component ||
@@ -49,7 +49,7 @@ export default function ComponentBreadcrumbs({
const selectedLocation = getSelectedLocation(issue, selectedFlowIndex, selectedLocationIndex);
const componentName = selectedLocation ? selectedLocation.componentName : issue.componentLongName;
- const projectName = [issue.projectName, issue.branch].filter(s => !!s).join(' - ');
+ const projectName = [issue.projectName, issue.branch].filter((s) => !!s).join(' - ');
return (
<div
@@ -57,7 +57,8 @@ export default function ComponentBreadcrumbs({
'issues.on_file_x',
`${displayProject ? issue.projectName + ', ' : ''}${componentName}`
)}
- className="component-name text-ellipsis">
+ className="component-name text-ellipsis"
+ >
<QualifierIcon className="spacer-right" qualifier={issue.componentQualifier} />
{displayProject && (
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 c2573472526..243ac925d1d 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
@@ -120,14 +120,14 @@ export default class IssueHeader extends React.PureComponent<Props, State> {
const {
issue,
ruleDetails: { key, name },
- branchLike
+ branchLike,
} = this.props;
const { issuePopupName } = this.state;
const issueUrl = getComponentIssuesUrl(issue.project, {
...getBranchLikeQuery(branchLike),
issues: issue.key,
open: issue.key,
- types: issue.type === 'SECURITY_HOTSPOT' ? issue.type : undefined
+ types: issue.type === 'SECURITY_HOTSPOT' ? issue.type : undefined,
});
const ruleStatus = issue.ruleStatus as RuleStatus | undefined;
const { quickFixAvailable } = issue;
@@ -148,7 +148,8 @@ export default class IssueHeader extends React.PureComponent<Props, State> {
className="js-issue-permalink link-no-underline"
target="_blank"
title={translate('permalink')}
- to={issueUrl}>
+ to={issueUrl}
+ >
{translate('issue.action.permalink')}
<LinkIcon />
</Link>
diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx
index 4c9aee53cec..ec9ef204ef6 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx
@@ -49,7 +49,7 @@ import {
fillBranchLike,
getBranchLikeQuery,
isPullRequest,
- isSameBranchLike
+ isSameBranchLike,
} from '../../../helpers/branch-like';
import handleRequiredAuthentication from '../../../helpers/handleRequiredAuthentication';
import { parseIssueFromResponse } from '../../../helpers/issues';
@@ -60,7 +60,7 @@ import {
addSideBarClass,
addWhitePageClass,
removeSideBarClass,
- removeWhitePageClass
+ removeWhitePageClass,
} from '../../../helpers/pages';
import { serializeDate } from '../../../helpers/query';
import { BranchLike } from '../../../types/branch-like';
@@ -70,7 +70,7 @@ import {
FetchIssuesPromise,
ReferencedComponent,
ReferencedLanguage,
- ReferencedRule
+ ReferencedRule,
} from '../../../types/issues';
import { SecurityStandard } from '../../../types/security';
import { Component, Dict, Issue, Paging, RawQuery, RuleDetails } from '../../../types/types';
@@ -93,7 +93,7 @@ import {
shouldOpenSonarSourceSecurityFacet,
shouldOpenStandardsChildFacet,
shouldOpenStandardsFacet,
- STANDARDS
+ STANDARDS,
} from '../utils';
import BulkChangeModal, { MAX_PAGE_SIZE } from './BulkChangeModal';
import IssueHeader from './IssueHeader';
@@ -176,7 +176,7 @@ export class App extends React.PureComponent<Props, State> {
severities: true,
sonarsourceSecurity: shouldOpenSonarSourceSecurityFacet({}, query),
standards: shouldOpenStandardsFacet({}, query),
- types: true
+ types: true,
},
query,
referencedComponentsById: {},
@@ -184,20 +184,20 @@ export class App extends React.PureComponent<Props, State> {
referencedLanguages: {},
referencedRules: {},
referencedUsers: {},
- selected: getOpen(props.location.query)
+ selected: getOpen(props.location.query),
};
this.refreshBranchStatus = debounce(this.refreshBranchStatus, BRANCH_STATUS_REFRESH_INTERVAL);
}
static getDerivedStateFromProps(props: Props, state: State) {
const {
- location: { query }
+ location: { query },
} = props;
return {
myIssues: areMyIssuesSelected(query),
query: parseQuery(query),
- openIssue: getOpenIssue(props, state.issues)
+ openIssue: getOpenIssue(props, state.issues),
};
}
@@ -233,7 +233,7 @@ export class App extends React.PureComponent<Props, State> {
locationsNavigator: true,
selected: openIssue.key,
selectedFlowIndex: 0,
- selectedLocationIndex: undefined
+ selectedLocationIndex: undefined,
});
}
if (this.state.openIssue && this.state.openIssue.key !== prevState.openIssue?.key) {
@@ -322,7 +322,7 @@ export class App extends React.PureComponent<Props, State> {
getSelectedIndex() {
const { issues = [], selected } = this.state;
- const index = issues.findIndex(issue => issue.key === selected);
+ const index = issues.findIndex((issue) => issue.key === selected);
return index !== -1 ? index : undefined;
}
@@ -336,7 +336,7 @@ export class App extends React.PureComponent<Props, State> {
this.setState({
selected: issues[selectedIndex + 1].key,
selectedFlowIndex: undefined,
- selectedLocationIndex: undefined
+ selectedLocationIndex: undefined,
});
}
}
@@ -349,7 +349,7 @@ export class App extends React.PureComponent<Props, State> {
}
this.setState({ loadingRule: true });
const openRuleDetails = await getRuleDetails({ key: openIssue.rule })
- .then(response => response.rule)
+ .then((response) => response.rule)
.catch(() => undefined);
if (this.mounted) {
this.setState({ loadingRule: false, openRuleDetails });
@@ -366,7 +366,7 @@ export class App extends React.PureComponent<Props, State> {
this.setState({
selected: issues[selectedIndex - 1].key,
selectedFlowIndex: undefined,
- selectedLocationIndex: undefined
+ selectedLocationIndex: undefined,
});
}
}
@@ -380,15 +380,15 @@ export class App extends React.PureComponent<Props, State> {
...getBranchLikeQuery(this.props.branchLike),
id: this.props.component && this.props.component.key,
myIssues: this.state.myIssues ? 'true' : undefined,
- open: issueKey
- }
+ open: issueKey,
+ },
};
if (this.state.openIssue) {
if (path.query.open && path.query.open === this.state.openIssue.key) {
this.setState({
locationsNavigator: false,
selectedFlowIndex: undefined,
- selectedLocationIndex: undefined
+ selectedLocationIndex: undefined,
});
} else {
this.props.router.replace(path);
@@ -407,8 +407,8 @@ export class App extends React.PureComponent<Props, State> {
...getBranchLikeQuery(this.props.branchLike),
id: this.props.component && this.props.component.key,
myIssues: this.state.myIssues ? 'true' : undefined,
- open: undefined
- }
+ open: undefined,
+ },
});
}
};
@@ -426,9 +426,9 @@ export class App extends React.PureComponent<Props, State> {
return searchIssues({
...query,
additionalFields: '_all',
- timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
- }).then(response => {
- const parsedIssues = response.issues.map(issue =>
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
+ }).then((response) => {
+ const parsedIssues = response.issues.map((issue) =>
parseIssueFromResponse(issue, response.components, response.users, response.rules)
);
return { ...response, issues: parsedIssues } as FetchIssuesPromise;
@@ -441,7 +441,7 @@ export class App extends React.PureComponent<Props, State> {
const facets = requestFacets
? Object.keys(openFacets)
- .filter(facet => facet !== STANDARDS && openFacets[facet])
+ .filter((facet) => facet !== STANDARDS && openFacets[facet])
.join(',')
: undefined;
@@ -452,7 +452,7 @@ export class App extends React.PureComponent<Props, State> {
...serializeQuery(query),
ps: '100',
facets,
- ...additional
+ ...additional,
};
if (query.createdAfter !== undefined && this.createdAfterIncludesTime()) {
@@ -485,7 +485,7 @@ export class App extends React.PureComponent<Props, State> {
) {
return true;
}
- return pageIssues.some(issue => issue.key === openIssueKey);
+ return pageIssues.some((issue) => issue.key === openIssueKey);
});
} else {
fetchPromise = this.fetchIssues({}, true);
@@ -499,7 +499,7 @@ export class App extends React.PureComponent<Props, State> {
if (issues.length > 0) {
selected = openIssue ? openIssue.key : issues[0].key;
}
- this.setState(state => ({
+ this.setState((state) => ({
cannotShowOpenIssue: Boolean(openIssueKey && !openIssue),
effortTotal,
facets: { ...state.facets, ...parseFacets(facets) },
@@ -515,7 +515,7 @@ export class App extends React.PureComponent<Props, State> {
referencedUsers: keyBy(other.users, 'login'),
selected,
selectedFlowIndex: 0,
- selectedLocationIndex: undefined
+ selectedLocationIndex: undefined,
}));
}
return issues;
@@ -560,12 +560,12 @@ export class App extends React.PureComponent<Props, State> {
this.setState({ checkAll: false, loadingMore: true });
return this.fetchIssuesPage(p).then(
- response => {
+ (response) => {
if (this.mounted) {
- this.setState(state => ({
+ this.setState((state) => ({
loadingMore: false,
issues: [...state.issues, ...response.issues],
- paging: response.paging
+ paging: response.paging,
}));
}
},
@@ -581,23 +581,23 @@ export class App extends React.PureComponent<Props, State> {
return this.fetchIssues({ ps: 1, facets: facet }, false).then(
({ facets, ...other }) => {
if (this.mounted) {
- this.setState(state => ({
+ this.setState((state) => ({
facets: { ...state.facets, ...parseFacets(facets) },
loadingFacets: omit(state.loadingFacets, facet),
referencedComponentsById: {
...state.referencedComponentsById,
- ...keyBy(other.components, 'uuid')
+ ...keyBy(other.components, 'uuid'),
},
referencedComponentsByKey: {
...state.referencedComponentsByKey,
- ...keyBy(other.components, 'key')
+ ...keyBy(other.components, 'key'),
},
referencedLanguages: {
...state.referencedLanguages,
- ...keyBy(other.languages, 'key')
+ ...keyBy(other.languages, 'key'),
},
referencedRules: { ...state.referencedRules, ...keyBy(other.rules, 'key') },
- referencedUsers: { ...state.referencedUsers, ...keyBy(other.users, 'login') }
+ referencedUsers: { ...state.referencedUsers, ...keyBy(other.users, 'login') },
}));
}
},
@@ -614,7 +614,7 @@ export class App extends React.PureComponent<Props, State> {
getCheckedIssues = () => {
const issues = this.state.checked
- .map(checked => this.state.issues.find(issue => issue.key === checked))
+ .map((checked) => this.state.issues.find((issue) => issue.key === checked))
.filter((issue): issue is Issue => issue !== undefined);
const paging = { pageIndex: 1, pageSize: issues.length, total: issues.length };
return Promise.resolve({ issues, paging });
@@ -642,15 +642,15 @@ export class App extends React.PureComponent<Props, State> {
...serializeQuery({ ...this.state.query, ...changes }),
...getBranchLikeQuery(this.props.branchLike),
id: this.props.component && this.props.component.key,
- myIssues: this.state.myIssues ? 'true' : undefined
- }
+ myIssues: this.state.myIssues ? 'true' : undefined,
+ },
});
this.setState(({ openFacets }) => ({
openFacets: {
...openFacets,
sonarsourceSecurity: shouldOpenSonarSourceSecurityFacet(openFacets, changes),
- standards: shouldOpenStandardsFacet(openFacets, changes)
- }
+ standards: shouldOpenStandardsFacet(openFacets, changes),
+ },
}));
};
@@ -665,8 +665,8 @@ export class App extends React.PureComponent<Props, State> {
...serializeQuery({ ...this.state.query, assigned: true, assignees: [] }),
...getBranchLikeQuery(this.props.branchLike),
id: this.props.component && this.props.component.key,
- myIssues: myIssues ? 'true' : undefined
- }
+ myIssues: myIssues ? 'true' : undefined,
+ },
});
};
@@ -680,7 +680,7 @@ export class App extends React.PureComponent<Props, State> {
facets: property,
s: 'FILE_LINE',
...serializeQuery({ ...query, ...changes }),
- ps: 1
+ ps: 1,
};
if (myIssues) {
@@ -691,17 +691,17 @@ export class App extends React.PureComponent<Props, State> {
};
closeFacet = (property: string) => {
- this.setState(state => ({
- openFacets: { ...state.openFacets, [property]: false }
+ this.setState((state) => ({
+ openFacets: { ...state.openFacets, [property]: false },
}));
};
handleFacetToggle = (property: string) => {
- this.setState(state => {
+ this.setState((state) => {
const willOpenProperty = !state.openFacets[property];
const newState = {
loadingFacets: state.loadingFacets,
- openFacets: { ...state.openFacets, [property]: willOpenProperty }
+ openFacets: { ...state.openFacets, [property]: willOpenProperty },
};
// Try to open sonarsource security "subfacet" by default if the standard facet is open
@@ -731,8 +731,8 @@ export class App extends React.PureComponent<Props, State> {
...DEFAULT_QUERY,
...getBranchLikeQuery(this.props.branchLike),
id: this.props.component && this.props.component.key,
- myIssues: this.state.myIssues ? 'true' : undefined
- }
+ myIssues: this.state.myIssues ? 'true' : undefined,
+ },
});
};
@@ -752,18 +752,18 @@ export class App extends React.PureComponent<Props, State> {
};
handleIssueCheck = (issue: string) => {
- this.setState(state => ({
+ this.setState((state) => ({
checkAll: false,
checked: state.checked.includes(issue)
? without(state.checked, issue)
- : [...state.checked, issue]
+ : [...state.checked, issue],
}));
};
handleIssueChange = (issue: Issue) => {
this.refreshBranchStatus();
- this.setState(state => ({
- issues: state.issues.map(candidate => (candidate.key === issue.key ? issue : candidate))
+ this.setState((state) => ({
+ issues: state.issues.map((candidate) => (candidate.key === issue.key ? issue : candidate)),
}));
};
@@ -812,9 +812,9 @@ export class App extends React.PureComponent<Props, State> {
handleCheckAll = (checked: boolean) => {
if (checked) {
- this.setState(state => ({
+ this.setState((state) => ({
checkAll: true,
- checked: state.issues.map(issue => issue.key)
+ checked: state.issues.map((issue) => issue.key),
}));
} else {
this.setState({ checkAll: false, checked: [] });
@@ -867,7 +867,8 @@ export class App extends React.PureComponent<Props, State> {
innerRef={this.bulkButtonRef}
disabled={checked.length === 0}
id="issues-bulk-change"
- onClick={this.handleOpenBulkChange}>
+ onClick={this.handleOpenBulkChange}
+ >
{this.getButtonLabel(checked, checkAll, paging)}
</Button>
@@ -895,7 +896,7 @@ export class App extends React.PureComponent<Props, State> {
<ButtonToggle
options={[
{ value: true, label: translate('issues.my_issues') },
- { value: false, label: translate('all') }
+ { value: false, label: translate('all') },
]}
value={this.state.myIssues}
onCheck={this.handleMyIssuesChange}
@@ -965,7 +966,8 @@ export class App extends React.PureComponent<Props, State> {
<section
aria-label={openIssue ? translate('list_of_issues') : translate('filters')}
className="layout-page-side"
- style={{ top }}>
+ style={{ top }}
+ >
<div className="layout-page-side-inner">
<A11ySkipTarget
anchor="issues_sidebar"
@@ -977,7 +979,8 @@ export class App extends React.PureComponent<Props, State> {
{!canBrowseAllChildProjects && isPortfolioLike(qualifier) && (
<Alert
className="big-spacer-top big-spacer-right big-spacer-left it__portfolio_warning"
- variant="warning">
+ variant="warning"
+ >
<AlertContent>
{translate('issues.not_all_issue_show')}
<HelpTooltip
@@ -1054,7 +1057,7 @@ export class App extends React.PureComponent<Props, State> {
renderHeader({
openIssue,
paging,
- selectedIndex
+ selectedIndex,
}: {
openIssue: Issue | undefined;
paging: Paging | undefined;
@@ -1090,7 +1093,7 @@ export class App extends React.PureComponent<Props, State> {
loading,
openIssue,
paging,
- loadingRule
+ loadingRule,
} = this.state;
return (
<div className="layout-page-main-inner">
@@ -1156,7 +1159,8 @@ export class App extends React.PureComponent<Props, State> {
return (
<div
className={classNames('layout-page issues', { 'project-level': component !== undefined })}
- id="issues-page">
+ id="issues-page"
+ >
<Suggestions suggestions="issues" />
<Helmet defer={false} title={openIssue ? openIssue.message : translate('issues.page')} />
diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesList.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssuesList.tsx
index fad89e4aae1..4afb18fe2ab 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/IssuesList.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesList.tsx
@@ -43,7 +43,7 @@ interface State {
export default class IssuesList extends React.PureComponent<Props, State> {
state: State = {
- prerender: true
+ prerender: true,
};
componentDidMount() {
diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx
index 8e0999fd403..282dde3441e 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx
@@ -72,12 +72,12 @@ export default class IssuesSourceViewer extends React.PureComponent<IssuesSource
this.selectedSecondaryLocationRef.scrollIntoView({
behavior: 'smooth',
block: 'center',
- inline: 'nearest'
+ inline: 'nearest',
});
} else if (this.primaryLocationRef) {
this.primaryLocationRef.scrollIntoView({
block: 'center',
- inline: 'nearest'
+ inline: 'nearest',
});
}
}
@@ -89,7 +89,7 @@ export default class IssuesSourceViewer extends React.PureComponent<IssuesSource
selectedLocationIndex,
locationsNavigator,
branchLike,
- issues
+ issues,
} = this.props;
const locations = getLocations(openIssue, selectedFlowIndex).map((loc, index) => {
@@ -112,8 +112,9 @@ export default class IssuesSourceViewer extends React.PureComponent<IssuesSource
<IssueSourceViewerScrollContext.Provider
value={{
registerPrimaryLocationRef: this.registerPrimaryLocationRef,
- registerSelectedSecondaryLocationRef: this.registerSelectedSecondaryLocationRef
- }}>
+ registerSelectedSecondaryLocationRef: this.registerSelectedSecondaryLocationRef,
+ }}
+ >
<CrossComponentSourceViewer
branchLike={branchLike}
highlightedLocationMessage={highlightedLocationMessage}
diff --git a/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx b/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx
index 6b8a3155d61..eeeef764f99 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx
@@ -110,7 +110,7 @@ export default class ListItem extends React.PureComponent<Props> {
previousIssue.branch !== issue.branch;
return (
- <li className="issues-workspace-list-item" ref={node => (this.nodeRef = node)}>
+ <li className="issues-workspace-list-item" ref={(node) => (this.nodeRef = node)}>
{displayComponent && (
<div className="issues-workspace-list-component note">
<ComponentBreadcrumbs component={component} issue={this.props.issue} />
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/AssigneeSelect-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/AssigneeSelect-test.tsx
index 95e7b6473f3..1ae09b00ad2 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/AssigneeSelect-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/AssigneeSelect-test.tsx
@@ -27,7 +27,7 @@ import { searchAssignees } from '../../utils';
import AssigneeSelect, {
AssigneeOption,
AssigneeSelectProps,
- MIN_QUERY_LENGTH
+ MIN_QUERY_LENGTH,
} from '../AssigneeSelect';
jest.mock('../../utils', () => ({
@@ -37,21 +37,21 @@ jest.mock('../../utils', () => ({
active: true,
avatar: '##avatar1',
login: 'toto@toto',
- name: 'toto'
+ name: 'toto',
},
{
active: false,
avatar: '##avatar2',
login: 'tata@tata',
- name: 'tata'
+ name: 'tata',
},
{
active: true,
avatar: '##avatar3',
- login: 'titi@titi'
- }
- ]
- })
+ login: 'titi@titi',
+ },
+ ],
+ }),
}));
it('should render correctly', () => {
@@ -75,7 +75,7 @@ it('should render options correctly', () => {
wrapper.instance().renderAssignee({
avatar: '##avatar1',
value: 'toto@toto',
- label: 'toto'
+ label: 'toto',
})
)
.find(Avatar)
@@ -86,7 +86,7 @@ it('should render options correctly', () => {
shallow(
wrapper.instance().renderAssignee({
value: 'toto@toto',
- label: 'toto'
+ label: 'toto',
})
)
.find(Avatar)
@@ -122,18 +122,18 @@ it('should handle assignee search', async () => {
{
avatar: '##avatar1',
value: 'toto@toto',
- label: 'toto'
+ label: 'toto',
},
{
avatar: '##avatar2',
value: 'tata@tata',
- label: 'user.x_deleted.tata'
+ label: 'user.x_deleted.tata',
},
{
avatar: '##avatar3',
value: 'titi@titi',
- label: 'user.x_deleted.titi@titi'
- }
+ label: 'user.x_deleted.titi@titi',
+ },
]);
});
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/BulkChangeModal-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/BulkChangeModal-test.tsx
index fdaed62701b..5f9de47d13f 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/BulkChangeModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/BulkChangeModal-test.tsx
@@ -30,7 +30,7 @@ import { Issue } from '../../../../types/types';
import BulkChangeModal, { MAX_PAGE_SIZE } from '../BulkChangeModal';
jest.mock('../../../../api/issues', () => ({
- searchIssueTags: jest.fn().mockResolvedValue([undefined, []])
+ searchIssueTags: jest.fn().mockResolvedValue([undefined, []]),
}));
it('should display error message when no issues available', async () => {
@@ -59,7 +59,7 @@ it('should display warning when too many issues are passed', async () => {
it('should properly handle the search for tags', async () => {
const wrapper = getWrapper([]);
- await new Promise(resolve => {
+ await new Promise((resolve) => {
wrapper.instance().handleTagsSearch('query', resolve);
});
expect(searchIssueTags).toHaveBeenCalled();
@@ -67,7 +67,7 @@ it('should properly handle the search for tags', async () => {
it.each([
['type', 'set_type'],
- ['severity', 'set_severity']
+ ['severity', 'set_severity'],
])('should render select for %s', async (_field, action) => {
const wrapper = getWrapper([mockIssue(false, { actions: [action] })]);
await waitAndUpdate(wrapper);
@@ -90,17 +90,14 @@ it('should disable the submit button unless some change is configured', async ()
const wrapper = getWrapper([mockIssue(false, { actions: ['set_severity', 'comment'] })]);
await waitAndUpdate(wrapper);
- return new Promise<void>(resolve => {
+ return new Promise<void>((resolve) => {
expect(wrapper.find(SubmitButton).props().disabled).toBe(true);
// Setting a comment is not sufficient; some other change must occur.
change(wrapper.find('#comment'), 'Some comment');
expect(wrapper.find(SubmitButton).props().disabled).toBe(true);
- wrapper
- .find<ReactSelectProps>(Select)
- .at(0)
- .simulate('change', { value: 'foo' });
+ wrapper.find<ReactSelectProps>(Select).at(0).simulate('change', { value: 'foo' });
expect(wrapper.find(SubmitButton).props().disabled).toBe(false);
resolve();
@@ -118,8 +115,8 @@ const getWrapper = (issues: Issue[]) => {
paging: {
pageIndex: issues.length,
pageSize: issues.length,
- total: issues.length
- }
+ total: issues.length,
+ },
})
}
onClose={() => {}}
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/ComponentBreadcrumbs-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/ComponentBreadcrumbs-test.tsx
index f037f698591..77805805d04 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/ComponentBreadcrumbs-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/ComponentBreadcrumbs-test.tsx
@@ -30,7 +30,7 @@ const baseIssue = mockIssue(false, {
componentQualifier: ComponentQualifier.File,
project: 'proj',
projectName: 'proj-name',
- branch: 'test-branch'
+ branch: 'test-branch',
});
it('renders', () => {
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesApp-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesApp-test.tsx
index d080b03bb50..256797c4bf4 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesApp-test.tsx
@@ -29,7 +29,7 @@ import {
addSideBarClass,
addWhitePageClass,
removeSideBarClass,
- removeWhitePageClass
+ removeWhitePageClass,
} from '../../../../helpers/pages';
import {
mockCurrentUser,
@@ -37,7 +37,7 @@ import {
mockLocation,
mockLoggedInUser,
mockRawIssue,
- mockRouter
+ mockRouter,
} from '../../../../helpers/testMocks';
import { keydown, mockEvent, waitAndUpdate } from '../../../../helpers/testUtils';
import { ComponentQualifier } from '../../../../types/component';
@@ -49,7 +49,7 @@ import {
selectNextFlow,
selectNextLocation,
selectPreviousFlow,
- selectPreviousLocation
+ selectPreviousLocation,
} from '../../actions';
import BulkChangeModal from '../BulkChangeModal';
import { App } from '../IssuesApp';
@@ -58,39 +58,39 @@ jest.mock('../../../../helpers/pages', () => ({
addSideBarClass: jest.fn(),
addWhitePageClass: jest.fn(),
removeSideBarClass: jest.fn(),
- removeWhitePageClass: jest.fn()
+ removeWhitePageClass: jest.fn(),
}));
jest.mock('../../../../helpers/handleRequiredAuthentication', () => jest.fn());
jest.mock('../../../../api/issues', () => ({
- searchIssues: jest.fn().mockResolvedValue({ facets: [], issues: [] })
+ searchIssues: jest.fn().mockResolvedValue({ facets: [], issues: [] }),
}));
jest.mock('../../../../api/rules', () => ({
- getRuleDetails: jest.fn()
+ getRuleDetails: jest.fn(),
}));
jest.mock('../../../../api/users', () => ({
getCurrentUser: jest.fn().mockResolvedValue({
dismissedNotices: {
- something: false
- }
+ something: false,
+ },
}),
- dismissNotification: jest.fn()
+ dismissNotification: jest.fn(),
}));
const RAW_ISSUES = [
mockRawIssue(false, { key: 'foo' }),
mockRawIssue(false, { key: 'bar' }),
mockRawIssue(true, { key: 'third' }),
- mockRawIssue(false, { key: 'fourth' })
+ mockRawIssue(false, { key: 'fourth' }),
];
const ISSUES = [
mockIssue(false, { key: 'foo' }),
mockIssue(false, { key: 'bar' }),
mockIssue(true, { key: 'third' }),
- mockIssue(false, { key: 'fourth' })
+ mockIssue(false, { key: 'fourth' }),
];
const FACETS = [{ property: 'severities', values: [{ val: 'MINOR', count: 4 }] }];
const PAGING = { pageIndex: 1, pageSize: 100, total: 4 };
@@ -106,7 +106,7 @@ beforeEach(() => {
languages: [],
paging: PAGING,
rules: [],
- users: []
+ users: [],
});
(getRuleDetails as jest.Mock).mockResolvedValue({ rule: { test: 'test' } });
@@ -120,8 +120,8 @@ it('should show warnning when not all projects are accessible', () => {
const wrapper = shallowRender({
component: mockComponent({
canBrowseAllChildProjects: false,
- qualifier: ComponentQualifier.Portfolio
- })
+ qualifier: ComponentQualifier.Portfolio,
+ }),
});
const rootNode = shallow(wrapper.instance().renderSide(undefined));
expect(rootNode).toMatchSnapshot();
@@ -148,8 +148,8 @@ it('should handle my issue change properly', () => {
query: {
id: 'foo',
author: [],
- myIssues: 'true'
- }
+ myIssues: 'true',
+ },
});
});
@@ -162,7 +162,7 @@ it('should load search result count correcly', async () => {
it('should not render for anonymous user', () => {
shallowRender({
currentUser: mockCurrentUser({ isLoggedIn: false }),
- location: mockLocation({ query: { myIssues: true.toString() } })
+ location: mockLocation({ query: { myIssues: true.toString() } }),
});
expect(handleRequiredAuthentication).toHaveBeenCalled();
});
@@ -176,14 +176,14 @@ it('should handle reset properly', () => {
query: {
id: 'foo',
myIssues: undefined,
- resolved: 'false'
- }
+ resolved: 'false',
+ },
});
});
it('should open standard facets for vulnerabilities and hotspots', () => {
const wrapper = shallowRender({
- location: mockLocation({ pathname: '/issues', query: { types: 'VULNERABILITY' } })
+ location: mockLocation({ pathname: '/issues', query: { types: 'VULNERABILITY' } }),
});
const instance = wrapper.instance();
const fetchFacet = jest.spyOn(instance, 'fetchFacet');
@@ -266,17 +266,14 @@ it('should be able to bulk change specific issues', async () => {
instance.handleOpenBulkChange();
wrapper.update();
expect(wrapper.find(BulkChangeModal).exists()).toBe(true);
- const { issues } = await wrapper
- .find(BulkChangeModal)
- .props()
- .fetchIssues({});
+ const { issues } = await wrapper.find(BulkChangeModal).props().fetchIssues({});
expect(issues).toHaveLength(2);
});
it('should display the right facets open', () => {
expect(
shallowRender({
- location: mockLocation({ query: { types: 'BUGS' } })
+ location: mockLocation({ query: { types: 'BUGS' } }),
}).state('openFacets')
).toEqual({
owaspTop10: false,
@@ -285,11 +282,11 @@ it('should display the right facets open', () => {
severities: true,
standards: false,
sonarsourceSecurity: false,
- types: true
+ types: true,
});
expect(
shallowRender({
- location: mockLocation({ query: { owaspTop10: 'a1' } })
+ location: mockLocation({ query: { owaspTop10: 'a1' } }),
}).state('openFacets')
).toEqual({
owaspTop10: true,
@@ -298,7 +295,7 @@ it('should display the right facets open', () => {
severities: true,
standards: true,
sonarsourceSecurity: false,
- types: true
+ types: true,
});
});
@@ -310,14 +307,14 @@ it('should correctly handle filter changes', () => {
expect(instance.state.openFacets).toEqual({
types: true,
sonarsourceSecurity: true,
- standards: true
+ standards: true,
});
expect(push).toHaveBeenCalled();
instance.handleFilterChange({ types: ['BUGS'] });
expect(instance.state.openFacets).toEqual({
types: true,
sonarsourceSecurity: true,
- standards: true
+ standards: true,
});
});
@@ -329,8 +326,8 @@ it('should fetch issues until defined', async () => {
const wrapper = shallowRender({
location: mockLocation({
- query: { open: '0' }
- })
+ query: { open: '0' },
+ }),
});
const instance = wrapper.instance();
await waitAndUpdate(wrapper);
@@ -444,7 +441,7 @@ it('should handle createAfter query param with time', async () => {
(searchIssues as jest.Mock).mockImplementation(mockSearchIssuesResponse());
const wrapper = shallowRender({
- location: mockLocation({ query: { createdAfter: '2020-10-21' } })
+ location: mockLocation({ query: { createdAfter: '2020-10-21' } }),
});
expect(wrapper.instance().createdAfterIncludesTime()).toBe(false);
await waitAndUpdate(wrapper);
@@ -473,8 +470,8 @@ function mockSearchIssuesResponse(keyCount = 0, lineCount = 1) {
startLine: lineCount++,
endLine: lineCount,
startOffset: 0,
- endOffset: 15
- }
+ endOffset: 15,
+ },
}),
mockRawIssue(false, {
key: `${keyCount}`,
@@ -482,14 +479,14 @@ function mockSearchIssuesResponse(keyCount = 0, lineCount = 1) {
startLine: lineCount++,
endLine: lineCount,
startOffset: 0,
- endOffset: 15
- }
- })
+ endOffset: 15,
+ },
+ }),
],
languages: [],
paging: { pageIndex: p, pageSize: 2, total: 6 },
rules: [],
- users: []
+ users: [],
});
}
@@ -500,7 +497,7 @@ function shallowRender(props: Partial<App['props']> = {}) {
breadcrumbs: [],
key: 'foo',
name: 'bar',
- qualifier: 'Doe'
+ qualifier: 'Doe',
}}
currentUser={mockLoggedInUser()}
fetchBranchStatus={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesSourceViewer-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesSourceViewer-test.tsx
index 2a29aa7ea46..20532c78913 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesSourceViewer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesSourceViewer-test.tsx
@@ -28,15 +28,15 @@ it('should render SourceViewer correctly', () => {
expect(
shallowRender({
issues: [mockIssue(true)],
- openIssue: mockIssue(true, { flows: [[mockFlowLocation()]] })
+ openIssue: mockIssue(true, { flows: [[mockFlowLocation()]] }),
})
).toMatchSnapshot('single secondary location');
expect(
shallowRender({
issues: [mockIssue(true)],
openIssue: mockIssue(true, {
- flows: [[mockFlowLocation(), mockFlowLocation(), mockFlowLocation()]]
- })
+ flows: [[mockFlowLocation(), mockFlowLocation(), mockFlowLocation()]],
+ }),
})
).toMatchSnapshot('all secondary locations on same line');
});
@@ -54,12 +54,12 @@ it('should render CrossComponentSourceViewer correctly', () => {
startLine: 10,
startOffset: 1,
endLine: 12,
- endOffset: 2
- }
- })
- ]
- ]
- })
+ endOffset: 2,
+ },
+ }),
+ ],
+ ],
+ }),
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx
index 936aa79e414..59504f3543b 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx
@@ -74,12 +74,14 @@ export default class ConciseIssueBox extends React.PureComponent<Props> {
return (
<div
className={classNames('concise-issue-box', 'clearfix', { selected })}
- onClick={selected ? undefined : this.handleClick}>
+ onClick={selected ? undefined : this.handleClick}
+ >
<ButtonPlain
className="concise-issue-box-message"
aria-current={selected}
- innerRef={node => (this.messageElement = node)}
- onClick={this.handleClick}>
+ innerRef={(node) => (this.messageElement = node)}
+ onClick={this.handleClick}
+ >
{issue.message}
</ButtonPlain>
<div className="concise-issue-box-attributes">
@@ -88,7 +90,7 @@ export default class ConciseIssueBox extends React.PureComponent<Props> {
<span className="concise-issue-box-flow-indicator muted">
{translateWithParameters(
'issue.x_data_flows',
- issue.flowsWithType.filter(f => f.type === FlowType.DATA).length
+ issue.flowsWithType.filter((f) => f.type === FlowType.DATA).length
)}
</span>
) : (
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationBadge.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationBadge.tsx
index 679f5bdc0ce..972cf36a90c 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationBadge.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocationBadge.tsx
@@ -40,7 +40,8 @@ export default function ConciseIssueLocationBadge(props: Props) {
? 'issue.this_flow_involves_x_code_locations'
: 'issue.this_issue_involves_x_code_locations',
formatMeasure(count, 'INT')
- )}>
+ )}
+ >
<LocationIndex onClick={props.onClick} selected={selected}>
{'+'}
{count}
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.tsx
index 43c509cea5a..899a4637f11 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueLocations.tsx
@@ -45,7 +45,8 @@ export default class ConciseIssueLocations extends React.PureComponent<Props, St
return (
<Button
className="concise-issue-expand location-index link-no-underline"
- onClick={this.handleExpandClick}>
+ onClick={this.handleExpandClick}
+ >
...
</Button>
);
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx
index 206217baf01..cf56fa0b1d7 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx
@@ -42,7 +42,7 @@ const issue: Issue = {
severity: '',
status: '',
transitions: [],
- type: 'BUG'
+ type: 'BUG',
};
it('should render', () => {
diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssueLocations-test.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssueLocations-test.tsx
index 4c5df99760b..ee7eda2c9df 100644
--- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssueLocations-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssueLocations-test.tsx
@@ -28,7 +28,7 @@ const loc = { component: '', msg: '', textRange };
it('should render secondary locations', () => {
const issue = {
flows: [],
- secondaryLocations: [loc, loc, loc]
+ secondaryLocations: [loc, loc, loc],
};
expect(
shallow(
@@ -40,7 +40,7 @@ it('should render secondary locations', () => {
it('should render one flow', () => {
const issue = {
flows: [[loc, loc, loc]],
- secondaryLocations: []
+ secondaryLocations: [],
};
expect(
shallow(
@@ -54,9 +54,9 @@ it('should render several flows', () => {
flows: [
[loc, loc, loc],
[loc, loc],
- [loc, loc, loc]
+ [loc, loc, loc],
],
- secondaryLocations: []
+ secondaryLocations: [],
};
expect(
shallow(
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
index 9be1aa102cc..1209fa02ba1 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx
@@ -35,7 +35,7 @@ import {
Snippet,
SnippetGroup,
SourceLine,
- SourceViewerFile
+ SourceViewerFile,
} from '../../../types/types';
import { IssueSourceViewerScrollContext } from '../components/IssueSourceViewerScrollContext';
import IssueSourceViewerHeader from './IssueSourceViewerHeader';
@@ -46,7 +46,7 @@ import {
EXPAND_BY_LINES,
getPrimaryLocation,
linesForSnippets,
- MERGE_DISTANCE
+ MERGE_DISTANCE,
} from './utils';
interface Props {
@@ -86,7 +86,7 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
additionalLines: {},
highlightedSymbols: [],
loading: false,
- snippets: []
+ snippets: [],
};
}
@@ -108,7 +108,7 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
locations:
snippetGroup.locations.length === 0
? [getPrimaryLocation(issue)]
- : [getPrimaryLocation(issue), ...snippetGroup.locations]
+ : [getPrimaryLocation(issue), ...snippetGroup.locations],
});
this.setState({ snippets });
@@ -118,7 +118,7 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
const { branchLike, snippetGroup } = this.props;
const { key } = snippetGroup.component;
const { snippets } = this.state;
- const snippet = snippets.find(s => s.index === snippetIndex);
+ const snippet = snippets.find((s) => s.index === snippetIndex);
if (!snippet) {
return Promise.reject();
}
@@ -128,36 +128,36 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
direction === 'up'
? {
from: Math.max(1, snippet.start - extension),
- to: snippet.start - 1
+ to: snippet.start - 1,
}
: {
from: snippet.end + 1,
- to: snippet.end + extension
+ to: snippet.end + extension,
};
return getSources({
key,
...range,
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
})
- .then(lines =>
+ .then((lines) =>
lines.reduce((lineMap: Dict<SourceLine>, line) => {
line.coverageStatus = getCoverageStatus(line);
lineMap[line.line] = line;
return lineMap;
}, {})
)
- .then(newLinesMapped => {
+ .then((newLinesMapped) => {
const newSnippets = expandSnippet({
direction,
snippetIndex,
- snippets
+ snippets,
});
this.setState(({ additionalLines }) => {
const combinedLines = { ...additionalLines, ...newLinesMapped };
return {
additionalLines: combinedLines,
- snippets: newSnippets.filter(s => !s.toDelete)
+ snippets: newSnippets.filter((s) => !s.toDelete),
};
});
});
@@ -170,14 +170,14 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
this.setState({ loading: true });
getSources({ key, ...getBranchLikeQuery(branchLike) }).then(
- lines => {
+ (lines) => {
if (this.mounted) {
this.setState(({ additionalLines }) => {
const combinedLines = { ...additionalLines, ...lines };
return {
additionalLines: combinedLines,
loading: false,
- snippets: [{ start: 0, end: lines[lines.length - 1].line, index: -1 }]
+ snippets: [{ start: 0, end: lines[lines.length - 1].line, index: -1 }],
};
});
}
@@ -193,7 +193,7 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
handleSymbolClick = (clickedSymbols: string[]) => {
this.setState(({ highlightedSymbols }) => {
const newHighlightedSymbols = clickedSymbols.filter(
- symb => !highlightedSymbols.includes(symb)
+ (symb) => !highlightedSymbols.includes(symb)
);
return { highlightedSymbols: newHighlightedSymbols };
});
@@ -222,11 +222,11 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
return (
issuesForLine.length > 0 && (
<div>
- {issuesForLine.map(issueToDisplay => {
+ {issuesForLine.map((issueToDisplay) => {
const isSelectedIssue = issueToDisplay.key === issue.key;
return (
<IssueSourceViewerScrollContext.Consumer key={issueToDisplay.key}>
- {ctx => (
+ {(ctx) => (
<IssueMessageBox
selected={!!(isSelectedIssue && issueLocations.length > 0)}
issue={issueToDisplay}
@@ -243,13 +243,8 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
};
render() {
- const {
- branchLike,
- isLastOccurenceOfPrimaryComponent,
- issue,
- lastSnippetGroup,
- snippetGroup
- } = this.props;
+ const { branchLike, isLastOccurenceOfPrimaryComponent, issue, lastSnippetGroup, snippetGroup } =
+ this.props;
const { additionalLines, loading, snippets } = this.state;
const locations =
issue.component === snippetGroup.component.key && issue.textRange !== undefined
@@ -264,7 +259,7 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
const snippetLines = linesForSnippets(snippets, {
...snippetGroup.sources,
- ...additionalLines
+ ...additionalLines,
});
const isFlow = issue.secondaryLocations.length === 0;
@@ -282,7 +277,7 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
{issue.component === snippetGroup.component.key && issue.textRange === undefined && (
<IssueSourceViewerScrollContext.Consumer>
- {ctx => (
+ {(ctx) => (
<IssueMessageBox
selected={true}
issue={issue}
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx
index 739e1eb92f9..395342ee5ef 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewer.tsx
@@ -25,11 +25,11 @@ import DuplicationPopup from '../../../components/SourceViewer/components/Duplic
import {
filterDuplicationBlocksByLine,
getDuplicationBlocksForIndex,
- isDuplicationBlockInRemovedComponent
+ isDuplicationBlockInRemovedComponent,
} from '../../../components/SourceViewer/helpers/duplications';
import {
duplicationsByLine as getDuplicationsByLine,
- issuesByComponentAndLine
+ issuesByComponentAndLine,
} from '../../../components/SourceViewer/helpers/indexing';
import { SourceViewerContext } from '../../../components/SourceViewer/SourceViewerContext';
import { Alert } from '../../../components/ui/Alert';
@@ -48,7 +48,7 @@ import {
FlowLocation,
Issue,
SnippetsByComponent,
- SourceViewerFile
+ SourceViewerFile,
} from '../../../types/types';
import ComponentSourceSnippetGroupViewer from './ComponentSourceSnippetGroupViewer';
import { groupLocationsByComponent } from './utils';
@@ -79,7 +79,7 @@ export default class CrossComponentSourceViewer extends React.PureComponent<Prop
components: {},
duplicationsByLine: {},
loading: true,
- notAccessible: false
+ notAccessible: false,
};
componentDidMount() {
@@ -100,14 +100,14 @@ export default class CrossComponentSourceViewer extends React.PureComponent<Prop
fetchDuplications = (component: string) => {
getDuplications({
key: component,
- ...getBranchLikeQuery(this.props.branchLike)
+ ...getBranchLikeQuery(this.props.branchLike),
}).then(
- r => {
+ (r) => {
if (this.mounted) {
this.setState({
duplicatedFiles: r.files,
duplications: r.duplications,
- duplicationsByLine: getDuplicationsByLine(r.duplications)
+ duplicationsByLine: getDuplicationsByLine(r.duplications),
});
}
},
@@ -126,7 +126,7 @@ export default class CrossComponentSourceViewer extends React.PureComponent<Prop
if (components[issue.component] === undefined) {
const issueComponent = await getComponentForSourceViewer({
component: issue.component,
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
});
components[issue.component] = { component: issueComponent, sources: [] };
if (isFile(issueComponent.q)) {
@@ -134,15 +134,15 @@ export default class CrossComponentSourceViewer extends React.PureComponent<Prop
key: issueComponent.key,
...getBranchLikeQuery(branchLike),
from: 1,
- to: 10
- }).then(lines => keyBy(lines, 'line'));
+ to: 10,
+ }).then((lines) => keyBy(lines, 'line'));
components[issue.component].sources = sources;
}
}
if (this.mounted) {
this.setState({
components,
- loading: false
+ loading: false,
});
}
} catch (response) {
@@ -220,7 +220,8 @@ export default class CrossComponentSourceViewer extends React.PureComponent<Prop
<SourceViewerContext.Provider
// eslint-disable-next-line react/no-array-index-key
key={`${issue.key}-${this.props.selectedFlowIndex || 0}-${i}`}
- value={{ branchLike: this.props.branchLike, file: snippetGroup.component }}>
+ value={{ branchLike: this.props.branchLike, file: snippetGroup.component }}
+ >
<ComponentSourceSnippetGroupViewer
branchLike={this.props.branchLike}
duplications={duplications}
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx
index c8875ca4beb..b8457c447b2 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx
@@ -52,7 +52,7 @@ export default function IssueSourceViewerHeader(props: Props) {
linkToProject = true,
loading,
onExpand,
- sourceViewerFile
+ sourceViewerFile,
} = props;
const { measures, path, project, projectName, q } = sourceViewerFile;
@@ -68,14 +68,16 @@ export default function IssueSourceViewerHeader(props: Props) {
<div
className="issue-source-viewer-header display-flex-row display-flex-space-between"
role="separator"
- aria-label={sourceViewerFile.path}>
+ aria-label={sourceViewerFile.path}
+ >
<div className="display-flex-center flex-1">
{displayProjectName && (
<div className="spacer-right">
{linkToProject ? (
<a
className="link-no-underline"
- href={getPathUrlAsString(getBranchLikeUrl(project, branchLike))}>
+ href={getPathUrlAsString(getBranchLikeUrl(project, branchLike))}
+ >
{projectNameLabel}
</a>
) : (
@@ -105,14 +107,16 @@ export default function IssueSourceViewerHeader(props: Props) {
{!isProjectRoot && measures.issues !== undefined && (
<div
className={classNames('flex-0 big-spacer-left', {
- 'little-spacer-right': !expandable || loading
- })}>
+ 'little-spacer-right': !expandable || loading,
+ })}
+ >
<Link
to={getComponentIssuesUrl(project, {
...getBranchLikeQuery(branchLike),
files: path,
- resolved: 'false'
- })}>
+ resolved: 'false',
+ })}
+ >
{translate('source_viewer.view_all_issues')}
</Link>
</div>
@@ -124,7 +128,8 @@ export default function IssueSourceViewerHeader(props: Props) {
<ButtonIcon
aria-label={translate('source_viewer.expand_all_lines')}
className="js-actions"
- onClick={onExpand}>
+ onClick={onExpand}
+ >
<ExpandSnippetIcon />
</ButtonIcon>
</div>
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx
index 1e21f308b1a..f49cd3d8d99 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx
@@ -25,7 +25,7 @@ import { symbolsByLine } from '../../../components/SourceViewer/helpers/indexing
import { getSecondaryIssueLocationsForLine } from '../../../components/SourceViewer/helpers/issueLocations';
import {
optimizeHighlightedSymbols,
- optimizeLocationMessage
+ optimizeLocationMessage,
} from '../../../components/SourceViewer/helpers/lines';
import { translate } from '../../../helpers/l10n';
import {
@@ -35,7 +35,7 @@ import {
Issue,
LinearIssueLocation,
SourceLine,
- SourceViewerFile
+ SourceViewerFile,
} from '../../../types/types';
import './SnippetViewer.css';
import { LINES_BELOW_ISSUE } from './utils';
@@ -74,7 +74,7 @@ export default class SnippetViewer extends React.PureComponent<Props> {
line,
snippet,
symbols,
- verticalBuffer
+ verticalBuffer,
}: {
displayDuplications: boolean;
displaySCM?: boolean;
@@ -128,21 +128,16 @@ export default class SnippetViewer extends React.PureComponent<Props> {
previousLine={index > 0 ? snippet[index - 1] : undefined}
renderDuplicationPopup={this.props.renderDuplicationPopup}
secondaryIssueLocations={secondaryIssueLocations}
- verticalBuffer={verticalBuffer}>
+ verticalBuffer={verticalBuffer}
+ >
{this.props.renderAdditionalChildInLine && this.props.renderAdditionalChildInLine(line)}
</Line>
);
}
render() {
- const {
- component,
- displaySCM,
- issue,
- lastSnippetOfLastGroup,
- locationsByLine,
- snippet
- } = this.props;
+ const { component, displaySCM, issue, lastSnippetOfLastGroup, locationsByLine, snippet } =
+ this.props;
const lastLine =
component.measures && component.measures.lines && parseInt(component.measures.lines, 10);
@@ -157,7 +152,7 @@ export default class SnippetViewer extends React.PureComponent<Props> {
: 0;
const displayDuplications =
- Boolean(this.props.loadDuplications) && snippet.some(s => !!s.duplicated);
+ Boolean(this.props.loadDuplications) && snippet.some((s) => !!s.duplicated);
return (
<div className="source-viewer-code snippet">
@@ -167,7 +162,8 @@ export default class SnippetViewer extends React.PureComponent<Props> {
<button
aria-label={translate('source_viewer.expand_above')}
onClick={this.expandBlock('up')}
- type="button">
+ type="button"
+ >
<ExpandSnippetIcon />
</button>
</div>
@@ -175,8 +171,9 @@ export default class SnippetViewer extends React.PureComponent<Props> {
<table
className={classNames('source-table', {
'expand-up': snippet[0].line > 1,
- 'expand-down': !lastLine || snippet[snippet.length - 1].line < lastLine
- })}>
+ 'expand-down': !lastLine || snippet[snippet.length - 1].line < lastLine,
+ })}
+ >
<tbody>
{snippet.map((line, index) =>
this.renderLine({
@@ -187,7 +184,7 @@ export default class SnippetViewer extends React.PureComponent<Props> {
line,
snippet,
symbols: symbols[line.line],
- verticalBuffer: index === snippet.length - 1 ? verticalBuffer : 0
+ verticalBuffer: index === snippet.length - 1 ? verticalBuffer : 0,
})
)}
</tbody>
@@ -197,7 +194,8 @@ export default class SnippetViewer extends React.PureComponent<Props> {
<button
aria-label={translate('source_viewer.expand_below')}
onClick={this.expandBlock('down')}
- type="button">
+ type="button"
+ >
<ExpandSnippetIcon />
</button>
</div>
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/ComponentSourceSnippetGroupViewer-test.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/ComponentSourceSnippetGroupViewer-test.tsx
index ca406031813..9a4cf4441bb 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/ComponentSourceSnippetGroupViewer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/ComponentSourceSnippetGroupViewer-test.tsx
@@ -26,7 +26,7 @@ import { mockBranch, mockMainBranch } from '../../../../helpers/mocks/branch-lik
import {
mockSnippetsByComponent,
mockSourceLine,
- mockSourceViewerFile
+ mockSourceViewerFile,
} from '../../../../helpers/mocks/sources';
import { mockFlowLocation, mockIssue } from '../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../helpers/testUtils';
@@ -35,7 +35,7 @@ import ComponentSourceSnippetGroupViewer from '../ComponentSourceSnippetGroupVie
import SnippetViewer from '../SnippetViewer';
jest.mock('../../../../api/components', () => ({
- getSources: jest.fn().mockResolvedValue([])
+ getSources: jest.fn().mockResolvedValue([]),
}));
beforeEach(() => {
@@ -51,25 +51,25 @@ it('should render correctly with secondary locations', () => {
const issue = mockIssue(true, {
component: 'project:main.js',
flows: [],
- textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 10 }
+ textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 10 },
});
const snippetGroup: SnippetGroup = {
locations: [
mockFlowLocation({
component: issue.component,
- textRange: { startLine: 34, endLine: 34, startOffset: 0, endOffset: 0 }
+ textRange: { startLine: 34, endLine: 34, startOffset: 0, endOffset: 0 },
}),
mockFlowLocation({
component: issue.component,
- textRange: { startLine: 74, endLine: 74, startOffset: 0, endOffset: 0 }
- })
+ textRange: { startLine: 74, endLine: 74, startOffset: 0, endOffset: 0 },
+ }),
],
...mockSnippetsByComponent('main.js', 'project', [
...range(2, 17),
...range(29, 39),
- ...range(69, 79)
- ])
+ ...range(69, 79),
+ ]),
};
const wrapper = shallowRender({ issue, snippetGroup });
expect(wrapper.state('snippets')).toHaveLength(3);
@@ -83,25 +83,25 @@ it('should render correctly with flows', () => {
const issue = mockIssue(true, {
component: 'project:main.js',
secondaryLocations: [],
- textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 10 }
+ textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 10 },
});
const snippetGroup: SnippetGroup = {
locations: [
mockFlowLocation({
component: issue.component,
- textRange: { startLine: 34, endLine: 34, startOffset: 0, endOffset: 0 }
+ textRange: { startLine: 34, endLine: 34, startOffset: 0, endOffset: 0 },
}),
mockFlowLocation({
component: issue.component,
- textRange: { startLine: 74, endLine: 74, startOffset: 0, endOffset: 0 }
- })
+ textRange: { startLine: 74, endLine: 74, startOffset: 0, endOffset: 0 },
+ }),
],
...mockSnippetsByComponent('main.js', 'project', [
...range(2, 17),
...range(29, 39),
- ...range(69, 79)
- ])
+ ...range(69, 79),
+ ]),
};
const wrapper = shallowRender({ issue, snippetGroup });
expect(wrapper.state('snippets')).toHaveLength(3);
@@ -110,18 +110,13 @@ it('should render correctly with flows', () => {
expect(wrapper.state('snippets')[2]).toEqual({ index: 2, start: 69, end: 79 });
// Check that locationsByLine is defined when isLastOccurenceOfPrimaryComponent
- expect(
- wrapper
- .find(SnippetViewer)
- .at(0)
- .props().locationsByLine
- ).not.toEqual({});
+ expect(wrapper.find(SnippetViewer).at(0).props().locationsByLine).not.toEqual({});
// If not, it should be an empty object:
const snippets = shallowRender({
isLastOccurenceOfPrimaryComponent: false,
issue,
- snippetGroup
+ snippetGroup,
}).find(SnippetViewer);
expect(snippets.at(0).props().locationsByLine).toEqual({});
@@ -133,7 +128,7 @@ it('should render file-level issue correctly', () => {
const issue = mockIssue(true, {
component: 'project:main.js',
flows: [],
- textRange: undefined
+ textRange: undefined,
});
const wrapper = shallowRender({
@@ -142,20 +137,14 @@ it('should render file-level issue correctly', () => {
locations: [
mockFlowLocation({
component: issue.component,
- textRange: { startLine: 34, endLine: 34, startOffset: 0, endOffset: 0 }
- })
+ textRange: { startLine: 34, endLine: 34, startOffset: 0, endOffset: 0 },
+ }),
],
- ...mockSnippetsByComponent('main.js', 'project', range(29, 39))
- }
+ ...mockSnippetsByComponent('main.js', 'project', range(29, 39)),
+ },
});
- expect(
- wrapper
- .find('ContextConsumer')
- .dive()
- .find(IssueMessageBox)
- .exists()
- ).toBe(true);
+ expect(wrapper.find('ContextConsumer').dive().find(IssueMessageBox).exists()).toBe(true);
});
it('should expand block', async () => {
@@ -163,20 +152,20 @@ it('should expand block', async () => {
Object.values(mockSnippetsByComponent('a', 'project', range(6, 59)).sources)
);
const issue = mockIssue(true, {
- textRange: { startLine: 74, endLine: 74, startOffset: 5, endOffset: 10 }
+ textRange: { startLine: 74, endLine: 74, startOffset: 5, endOffset: 10 },
});
const snippetGroup: SnippetGroup = {
locations: [
mockFlowLocation({
component: 'a',
- textRange: { startLine: 74, endLine: 74, startOffset: 0, endOffset: 0 }
+ textRange: { startLine: 74, endLine: 74, startOffset: 0, endOffset: 0 },
}),
mockFlowLocation({
component: 'a',
- textRange: { startLine: 107, endLine: 107, startOffset: 0, endOffset: 0 }
- })
+ textRange: { startLine: 107, endLine: 107, startOffset: 0, endOffset: 0 },
+ }),
],
- ...mockSnippetsByComponent('a', 'project', [...range(69, 83), ...range(102, 112)])
+ ...mockSnippetsByComponent('a', 'project', [...range(69, 83), ...range(102, 112)]),
};
const wrapper = shallowRender({ issue, snippetGroup });
@@ -198,14 +187,14 @@ it('should expand full component', async () => {
locations: [
mockFlowLocation({
component: 'a',
- textRange: { startLine: 3, endLine: 3, startOffset: 0, endOffset: 0 }
+ textRange: { startLine: 3, endLine: 3, startOffset: 0, endOffset: 0 },
}),
mockFlowLocation({
component: 'a',
- textRange: { startLine: 12, endLine: 12, startOffset: 0, endOffset: 0 }
- })
+ textRange: { startLine: 12, endLine: 12, startOffset: 0, endOffset: 0 },
+ }),
],
- ...mockSnippetsByComponent('a', 'project', [1, 2, 3, 4, 5, 10, 11, 12, 13, 14])
+ ...mockSnippetsByComponent('a', 'project', [1, 2, 3, 4, 5, 10, 11, 12, 13, 14]),
};
const wrapper = shallowRender({ snippetGroup });
@@ -227,12 +216,12 @@ it('should get the right branch when expanding', async () => {
);
const snippetGroup: SnippetGroup = {
locations: [mockFlowLocation()],
- ...mockSnippetsByComponent('a', 'project', [1, 2, 3, 4, 5, 6, 7])
+ ...mockSnippetsByComponent('a', 'project', [1, 2, 3, 4, 5, 6, 7]),
};
const wrapper = shallowRender({
branchLike: mockBranch({ name: 'asdf' }),
- snippetGroup
+ snippetGroup,
});
wrapper.instance().expandBlock(0, 'down');
@@ -255,14 +244,18 @@ it('should correctly handle lines actions', () => {
locations: [
mockFlowLocation({
component: 'my-project:foo/bar.ts',
- textRange: { startLine: 34, endLine: 34, startOffset: 0, endOffset: 0 }
+ textRange: { startLine: 34, endLine: 34, startOffset: 0, endOffset: 0 },
}),
mockFlowLocation({
component: 'my-project:foo/bar.ts',
- textRange: { startLine: 54, endLine: 54, startOffset: 0, endOffset: 0 }
- })
+ textRange: { startLine: 54, endLine: 54, startOffset: 0, endOffset: 0 },
+ }),
],
- ...mockSnippetsByComponent('foo/bar.ts', 'my-project', [32, 33, 34, 35, 36, 52, 53, 54, 55, 56])
+ ...mockSnippetsByComponent(
+ 'foo/bar.ts',
+ 'my-project',
+ [32, 33, 34, 35, 36, 52, 53, 54, 55, 56]
+ ),
};
const loadDuplications = jest.fn();
const renderDuplicationPopup = jest.fn();
@@ -270,20 +263,14 @@ it('should correctly handle lines actions', () => {
const wrapper = shallowRender({
loadDuplications,
renderDuplicationPopup,
- snippetGroup
+ snippetGroup,
});
const line = mockSourceLine();
- wrapper
- .find('SnippetViewer')
- .first()
- .prop<Function>('loadDuplications')(line);
+ wrapper.find('SnippetViewer').first().prop<Function>('loadDuplications')(line);
expect(loadDuplications).toHaveBeenCalledWith('my-project:foo/bar.ts', line);
- wrapper
- .find('SnippetViewer')
- .first()
- .prop<Function>('renderDuplicationPopup')(1, 13);
+ wrapper.find('SnippetViewer').first().prop<Function>('renderDuplicationPopup')(1, 13);
expect(renderDuplicationPopup).toHaveBeenCalledWith(
mockSourceViewerFile('foo/bar.ts', 'my-project'),
1,
@@ -295,7 +282,7 @@ function shallowRender(props: Partial<ComponentSourceSnippetGroupViewer['props']
const snippetGroup: SnippetGroup = {
component: mockSourceViewerFile(),
locations: [],
- sources: []
+ sources: [],
};
return shallow<ComponentSourceSnippetGroupViewer>(
<ComponentSourceSnippetGroupViewer
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/CrossComponentSourceViewer-test.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/CrossComponentSourceViewer-test.tsx
index d0f0fba1570..711cf415e54 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/CrossComponentSourceViewer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/CrossComponentSourceViewer-test.tsx
@@ -24,7 +24,7 @@ import { getIssueFlowSnippets } from '../../../../api/issues';
import {
mockSnippetsByComponent,
mockSourceLine,
- mockSourceViewerFile
+ mockSourceViewerFile,
} from '../../../../helpers/mocks/sources';
import { mockFlowLocation, mockIssue } from '../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../helpers/testUtils';
@@ -34,13 +34,13 @@ import CrossComponentSourceViewer from '../CrossComponentSourceViewer';
jest.mock('../../../../api/issues', () => {
const { mockSnippetsByComponent } = jest.requireActual('../../../../helpers/mocks/sources');
return {
- getIssueFlowSnippets: jest.fn().mockResolvedValue({ 'main.js': mockSnippetsByComponent() })
+ getIssueFlowSnippets: jest.fn().mockResolvedValue({ 'main.js': mockSnippetsByComponent() }),
};
});
jest.mock('../../../../api/components', () => ({
getDuplications: jest.fn().mockResolvedValue({}),
- getComponentForSourceViewer: jest.fn().mockResolvedValue({})
+ getComponentForSourceViewer: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
@@ -92,10 +92,7 @@ it('should handle duplication popup', async () => {
const wrapper = shallowRender();
await waitAndUpdate(wrapper);
- wrapper
- .find(ComponentSourceSnippetGroupViewer)
- .props()
- .loadDuplications('foo', mockSourceLine());
+ wrapper.find(ComponentSourceSnippetGroupViewer).props().loadDuplications('foo', mockSourceLine());
await waitAndUpdate(wrapper);
expect(getDuplications).toHaveBeenCalledWith({ key: 'foo' });
@@ -119,7 +116,7 @@ function shallowRender(props: Partial<CrossComponentSourceViewer['props']> = {})
issue={mockIssue(true, {
key: '1',
component: 'project:main.js',
- textRange: { startLine: 1, endLine: 2, startOffset: 0, endOffset: 15 }
+ textRange: { startLine: 1, endLine: 2, startOffset: 0, endOffset: 15 },
})}
issues={[]}
locations={[mockFlowLocation({ component: 'project:main.js' })]}
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx
index 06655111a37..d67b331f0b7 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/IssueSourceViewerHeader-test.tsx
@@ -31,8 +31,8 @@ it('should render correctly', () => {
expect(
shallowRender({
sourceViewerFile: mockSourceViewerFile('foo/bar.ts', 'my-project', {
- q: ComponentQualifier.Project
- })
+ q: ComponentQualifier.Project,
+ }),
})
).toMatchSnapshot('project root');
});
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/SnippetViewer-test.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/SnippetViewer-test.tsx
index 88b099b2ce7..d1fffc77c55 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/SnippetViewer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/SnippetViewer-test.tsx
@@ -25,7 +25,7 @@ import { mockIssue } from '../../../../helpers/testMocks';
import SnippetViewer from '../SnippetViewer';
jest.mock('../../../../helpers/scrolling', () => ({
- scrollHorizontally: jest.fn()
+ scrollHorizontally: jest.fn(),
}));
beforeEach(() => {
@@ -33,19 +33,19 @@ beforeEach(() => {
});
it('should render correctly', () => {
- const snippet = range(5, 8).map(line => mockSourceLine({ line }));
+ const snippet = range(5, 8).map((line) => mockSourceLine({ line }));
const wrapper = shallowRender({
- snippet
+ snippet,
});
expect(wrapper).toMatchSnapshot();
});
it('should render correctly with no SCM', () => {
- const snippet = range(5, 8).map(line => mockSourceLine({ line }));
+ const snippet = range(5, 8).map((line) => mockSourceLine({ line }));
const wrapper = shallowRender({
displaySCM: false,
- snippet
+ snippet,
});
expect(wrapper).toMatchSnapshot();
@@ -65,16 +65,16 @@ it('should render additional child in line', () => {
line: sourceline,
snippet: [sourceline],
symbols: [],
- verticalBuffer: 5
+ verticalBuffer: 5,
});
expect(renderAdditionalChildInLine).toHaveBeenCalledWith(sourceline);
});
it('should render correctly when at the top of the file', () => {
- const snippet = range(1, 8).map(line => mockSourceLine({ line }));
+ const snippet = range(1, 8).map((line) => mockSourceLine({ line }));
const wrapper = shallowRender({
- snippet
+ snippet,
});
expect(wrapper).toMatchSnapshot();
@@ -82,35 +82,29 @@ it('should render correctly when at the top of the file', () => {
it('should render correctly when at the bottom of the file', () => {
const component = mockSourceViewerFile('foo/bar.ts', 'my-project', { measures: { lines: '14' } });
- const snippet = range(10, 14).map(line => mockSourceLine({ line }));
+ const snippet = range(10, 14).map((line) => mockSourceLine({ line }));
const wrapper = shallowRender({
component,
- snippet
+ snippet,
});
expect(wrapper).toMatchSnapshot();
});
it('should correctly handle expansion', () => {
- const snippet = range(5, 8).map(line => mockSourceLine({ line }));
+ const snippet = range(5, 8).map((line) => mockSourceLine({ line }));
const expandBlock = jest.fn(() => Promise.resolve());
const wrapper = shallowRender({
expandBlock,
index: 2,
- snippet
+ snippet,
});
- wrapper
- .find('.expand-block-above button')
- .first()
- .simulate('click');
+ wrapper.find('.expand-block-above button').first().simulate('click');
expect(expandBlock).toHaveBeenCalledWith(2, 'up');
- wrapper
- .find('.expand-block-below button')
- .first()
- .simulate('click');
+ wrapper.find('.expand-block-below button').first().simulate('click');
expect(expandBlock).toHaveBeenCalledWith(2, 'down');
});
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/utils-test.ts
index bc9896d68a6..b16926cefa0 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/__tests__/utils-test.ts
@@ -31,28 +31,21 @@ describe('groupLocationsByComponent', () => {
mockIssue(),
[
mockFlowLocation({
- textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 }
+ textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 },
}),
mockFlowLocation({
- textRange: { startLine: 16, startOffset: 2, endLine: 16, endOffset: 3 }
+ textRange: { startLine: 16, startOffset: 2, endLine: 16, endOffset: 3 },
}),
mockFlowLocation({
- textRange: { startLine: 24, startOffset: 1, endLine: 24, endOffset: 2 }
- })
+ textRange: { startLine: 24, startOffset: 1, endLine: 24, endOffset: 2 },
+ }),
],
{
- 'main.js': mockSnippetsByComponent('main.js', 'project', [
- 14,
- 15,
- 16,
- 17,
- 18,
- 22,
- 23,
- 24,
- 25,
- 26
- ])
+ 'main.js': mockSnippetsByComponent(
+ 'main.js',
+ 'project',
+ [14, 15, 16, 17, 18, 22, 23, 24, 25, 26]
+ ),
}
);
@@ -65,20 +58,20 @@ describe('groupLocationsByComponent', () => {
[
mockFlowLocation({
component: 'A.js',
- textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 }
+ textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 },
}),
mockFlowLocation({
component: 'B.js',
- textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 }
+ textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 },
}),
mockFlowLocation({
component: 'A.js',
- textRange: { startLine: 15, startOffset: 2, endLine: 15, endOffset: 3 }
- })
+ textRange: { startLine: 15, startOffset: 2, endLine: 15, endOffset: 3 },
+ }),
],
{
'A.js': mockSnippetsByComponent('A.js', 'project', [13, 14, 15, 16, 17, 18]),
- 'B.js': mockSnippetsByComponent('B.js', 'project', [14, 15, 16, 17, 18])
+ 'B.js': mockSnippetsByComponent('B.js', 'project', [14, 15, 16, 17, 18]),
}
);
@@ -96,16 +89,16 @@ describe('createSnippets', () => {
it('should merge snippets correctly', () => {
const locations = [
mockFlowLocation({
- textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 }
+ textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 },
}),
mockFlowLocation({
- textRange: { startLine: 19, startOffset: 2, endLine: 19, endOffset: 3 }
- })
+ textRange: { startLine: 19, startOffset: 2, endLine: 19, endOffset: 3 },
+ }),
];
const results = createSnippets({
component: '',
locations,
- issue: mockIssue(false, locations[1])
+ issue: mockIssue(false, locations[1]),
});
expect(results).toHaveLength(1);
@@ -115,19 +108,19 @@ describe('createSnippets', () => {
it('should merge snippets correctly, even when not in sequence', () => {
const locations = [
mockFlowLocation({
- textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 }
+ textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 },
}),
mockFlowLocation({
- textRange: { startLine: 47, startOffset: 2, endLine: 47, endOffset: 3 }
+ textRange: { startLine: 47, startOffset: 2, endLine: 47, endOffset: 3 },
}),
mockFlowLocation({
- textRange: { startLine: 14, startOffset: 2, endLine: 14, endOffset: 3 }
- })
+ textRange: { startLine: 14, startOffset: 2, endLine: 14, endOffset: 3 },
+ }),
];
const results = createSnippets({
component: '',
locations,
- issue: mockIssue(false, locations[2])
+ issue: mockIssue(false, locations[2]),
});
expect(results).toHaveLength(2);
@@ -138,22 +131,22 @@ describe('createSnippets', () => {
it('should merge three snippets together', () => {
const locations = [
mockFlowLocation({
- textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 }
+ textRange: { startLine: 16, startOffset: 10, endLine: 16, endOffset: 14 },
}),
mockFlowLocation({
- textRange: { startLine: 47, startOffset: 2, endLine: 47, endOffset: 3 }
+ textRange: { startLine: 47, startOffset: 2, endLine: 47, endOffset: 3 },
}),
mockFlowLocation({
- textRange: { startLine: 23, startOffset: 2, endLine: 23, endOffset: 3 }
+ textRange: { startLine: 23, startOffset: 2, endLine: 23, endOffset: 3 },
}),
mockFlowLocation({
- textRange: { startLine: 18, startOffset: 2, endLine: 18, endOffset: 3 }
- })
+ textRange: { startLine: 18, startOffset: 2, endLine: 18, endOffset: 3 },
+ }),
];
const results = createSnippets({
component: '',
locations,
- issue: mockIssue(false, locations[0])
+ issue: mockIssue(false, locations[0]),
});
expect(results).toHaveLength(2);
@@ -164,20 +157,20 @@ describe('createSnippets', () => {
it("should prepend the issue's main location if necessary", () => {
const locations = [
mockFlowLocation({
- textRange: { startLine: 85, startOffset: 2, endLine: 85, endOffset: 3 }
+ textRange: { startLine: 85, startOffset: 2, endLine: 85, endOffset: 3 },
}),
mockFlowLocation({
- textRange: { startLine: 42, startOffset: 2, endLine: 42, endOffset: 3 }
- })
+ textRange: { startLine: 42, startOffset: 2, endLine: 42, endOffset: 3 },
+ }),
];
const issue = mockIssue(false, {
secondaryLocations: [mockFlowLocation()],
- textRange: { startLine: 12, endLine: 12, startOffset: 0, endOffset: 0 }
+ textRange: { startLine: 12, endLine: 12, startOffset: 0, endOffset: 0 },
});
const results = createSnippets({
component: issue.component,
locations,
- issue
+ issue,
});
expect(results).toHaveLength(3);
@@ -189,17 +182,17 @@ describe('createSnippets', () => {
it('should ignore location with no textrange', () => {
const locations = [
mockFlowLocation({
- textRange: { startLine: 85, startOffset: 2, endLine: 85, endOffset: 3 }
- })
+ textRange: { startLine: 85, startOffset: 2, endLine: 85, endOffset: 3 },
+ }),
];
const issue = mockIssue(false, {
secondaryLocations: [mockFlowLocation()],
- textRange: undefined
+ textRange: undefined,
});
const results = createSnippets({
component: issue.component,
locations,
- issue
+ issue,
});
expect(results).toHaveLength(1);
@@ -230,7 +223,7 @@ describe('expandSnippet', () => {
const snippets = [
{ index: 1, start: 4, end: 14 },
{ index: 2, start: 82, end: 92 },
- { index: 3, start: 37, end: 47 }
+ { index: 3, start: 37, end: 47 },
];
const result = expandSnippet({ direction: 'down', snippetIndex: 1, snippets });
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/utils.ts b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/utils.ts
index 7476c471fb1..408d1cb010a 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/utils.ts
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/utils.ts
@@ -26,7 +26,7 @@ import {
Snippet,
SnippetGroup,
SnippetsByComponent,
- SourceLine
+ SourceLine,
} from '../../../types/types';
const LINES_ABOVE = 5;
@@ -44,9 +44,9 @@ function unknownComponent(key: string): SnippetsByComponent {
project: '',
projectName: '',
q: ComponentQualifier.File,
- uuid: ''
+ uuid: '',
},
- sources: []
+ sources: [],
};
}
@@ -61,8 +61,8 @@ export function getPrimaryLocation(issue: Issue): FlowLocation {
endLine: 0,
endOffset: 0,
startLine: 0,
- startOffset: 0
- }
+ startOffset: 0,
+ },
};
}
@@ -98,7 +98,7 @@ export function createSnippets(params: {
let firstCollision: { start: number; end: number } | undefined;
// Remove ranges that collide into the first collision
- snippets = snippets.filter(snippet => {
+ snippets = snippets.filter((snippet) => {
if (collision([snippet.start, snippet.end], [startIndex, endIndex])) {
let keep = false;
// Check if we've already collided
@@ -120,7 +120,7 @@ export function createSnippets(params: {
snippets.push({
start: startIndex,
end: endIndex,
- index
+ index,
});
}
@@ -136,7 +136,7 @@ export function createSnippets(params: {
export function linesForSnippets(snippets: Snippet[], componentLines: LineMap) {
return snippets
- .map(snippet => {
+ .map((snippet) => {
const lines = [];
for (let i = snippet.start; i <= snippet.end; i++) {
if (componentLines[i]) {
@@ -145,7 +145,7 @@ export function linesForSnippets(snippets: Snippet[], componentLines: LineMap) {
}
return lines;
})
- .filter(snippet => snippet.length > 0);
+ .filter((snippet) => snippet.length > 0);
}
export function groupLocationsByComponent(
@@ -160,7 +160,7 @@ export function groupLocationsByComponent(
const addGroup = (componentKey: string) => {
currentGroup = {
...(components[componentKey] || unknownComponent(componentKey)),
- locations: []
+ locations: [],
};
groups.push(currentGroup);
currentComponent = componentKey;
@@ -168,7 +168,7 @@ export function groupLocationsByComponent(
if (
issue.secondaryLocations.length > 0 &&
- locations.every(loc => loc.component !== issue.component)
+ locations.every((loc) => loc.component !== issue.component)
) {
addGroup(issue.component);
}
@@ -191,13 +191,13 @@ export function groupLocationsByComponent(
export function expandSnippet({
direction,
snippetIndex,
- snippets
+ snippets,
}: {
direction: ExpandDirection;
snippetIndex: number;
snippets: Snippet[];
}) {
- const snippetToExpand = snippets.find(s => s.index === snippetIndex);
+ const snippetToExpand = snippets.find((s) => s.index === snippetIndex);
if (!snippetToExpand) {
throw new Error(`Snippet ${snippetIndex} not found`);
}
@@ -208,7 +208,7 @@ export function expandSnippet({
);
snippetToExpand.end += direction === 'down' ? EXPAND_BY_LINES : 0;
- return snippets.map(snippet => {
+ return snippets.map((snippet) => {
if (snippet.index === snippetIndex) {
return snippetToExpand;
}
diff --git a/server/sonar-web/src/main/js/apps/issues/routes.tsx b/server/sonar-web/src/main/js/apps/issues/routes.tsx
index 61354aba355..f32d22bc7cf 100644
--- a/server/sonar-web/src/main/js/apps/issues/routes.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/routes.tsx
@@ -46,9 +46,9 @@ function IssuesNavigate() {
id: searchParams.get('id'),
branch: searchParams.get('branch'),
pullRequest: searchParams.get('pullRequest'),
- assignedToMe: 'false'
+ assignedToMe: 'false',
})
- ).toString()
+ ).toString(),
},
{ replace: true }
);
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/AssigneeFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/AssigneeFacet.tsx
index 9412a6395f7..db95de826ad 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/AssigneeFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/AssigneeFacet.tsx
@@ -59,7 +59,7 @@ export default class AssigneeFacet extends React.PureComponent<Props> {
} else {
this.props.onChange({
assigned: true,
- assignees: assignees.includes(itemValue) && assignees.length < 2 ? [] : [itemValue]
+ assignees: assignees.includes(itemValue) && assignees.length < 2 ? [] : [itemValue],
});
}
};
@@ -83,7 +83,7 @@ export default class AssigneeFacet extends React.PureComponent<Props> {
loadSearchResultCount = (assignees: UserBase[]) => {
return this.props.loadSearchResultCount('assignees', {
assigned: undefined,
- assignees: assignees.map(assignee => assignee.login)
+ assignees: assignees.map((assignee) => assignee.login),
});
};
@@ -92,9 +92,9 @@ export default class AssigneeFacet extends React.PureComponent<Props> {
return sortBy(
Object.keys(stats),
// put "not assigned" first
- key => (key === '' ? 0 : 1),
+ (key) => (key === '' ? 0 : 1),
// the sort by number
- key => -stats[key]
+ (key) => -stats[key]
);
};
@@ -147,8 +147,8 @@ export default class AssigneeFacet extends React.PureComponent<Props> {
facetHeader={translate('issues.facet.assignees')}
fetching={this.props.fetching}
getFacetItemText={this.getAssigneeName}
- getSearchResultKey={user => user.login}
- getSearchResultText={user => user.name || user.login}
+ getSearchResultKey={(user) => user.login}
+ getSearchResultText={(user) => user.name || user.login}
// put "not assigned" item first
getSortedItems={this.getSortedItems}
loadSearchResultCount={this.loadSearchResultCount}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.tsx
index dfea386d98f..bd83518fb45 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/AuthorFacet.tsx
@@ -53,8 +53,8 @@ export default class AuthorFacet extends React.PureComponent<Props> {
return searchIssueAuthors({
project,
ps: SEARCH_SIZE, // maximum
- q: query
- }).then(authors => ({ maxResults: authors.length === SEARCH_SIZE, results: authors }));
+ q: query,
+ }).then((authors) => ({ maxResults: authors.length === SEARCH_SIZE, results: authors }));
};
loadSearchResultCount = (author: string[]) => {
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx
index 0287f037fad..8c2ccb89ac0 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/CreationDateFacet.tsx
@@ -29,7 +29,7 @@ import FacetItem from '../../../components/facet/FacetItem';
import { longFormatterOption } from '../../../components/intl/DateFormatter';
import DateFromNow from '../../../components/intl/DateFromNow';
import DateTimeFormatter, {
- formatterOption as dateTimeFormatterOption
+ formatterOption as dateTimeFormatterOption,
} from '../../../components/intl/DateTimeFormatter';
import { parseDate } from '../../../helpers/dates';
import { translate, translateWithParameters } from '../../../helpers/l10n';
@@ -56,7 +56,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon
property = 'createdAt';
static defaultProps = {
- open: true
+ open: true,
};
hasValue = () =>
@@ -81,13 +81,13 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon
createdBefore: undefined,
createdInLast: undefined,
inNewCodePeriod: undefined,
- ...changes
+ ...changes,
});
};
handleBarClick = ({
createdAfter,
- createdBefore
+ createdBefore,
}: {
createdAfter: Date;
createdBefore?: Date;
@@ -102,13 +102,8 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon
handlePeriodClick = (period: string) => this.resetTo({ createdInLast: period });
getValues() {
- const {
- createdAfter,
- createdAfterIncludesTime,
- createdAt,
- createdBefore,
- createdInLast
- } = this.props;
+ const { createdAfter, createdAfterIncludesTime, createdAt, createdBefore, createdInLast } =
+ this.props;
const { formatDate } = this.props.intl;
const values = [];
if (createdAfter) {
@@ -146,7 +141,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon
const periods = Object.keys(stats);
- if (periods.length < 2 || periods.every(period => !stats[period])) {
+ if (periods.length < 2 || periods.every((period) => !stats[period])) {
return null;
}
@@ -185,15 +180,15 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon
tooltip,
description,
x: index,
- y: stats[start]
+ y: stats[start],
};
});
const barsWidth = Math.floor(250 / data.length);
const width = barsWidth * data.length - 1 + 10;
- const maxValue = max(data.map(d => d.y));
- const xValues = data.map(d => (d.y === maxValue ? formatMeasure(maxValue, 'SHORT_INT') : ''));
+ const maxValue = max(data.map((d) => d.y));
+ const xValues = data.map((d) => (d.y === maxValue ? formatMeasure(maxValue, 'SHORT_INT') : ''));
return (
<BarChart
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/DirectoryFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/DirectoryFacet.tsx
index 5403f36a9f6..18c247db86c 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/DirectoryFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/DirectoryFacet.tsx
@@ -65,16 +65,16 @@ export default class DirectoryFacet extends React.PureComponent<Props> {
...getBranchLikeQuery(branchLike),
q: query,
p: page,
- ps: 30
+ ps: 30,
}).then(({ components, paging }) => ({
paging,
- results: components.filter(dir => dir.path !== undefined)
+ results: components.filter((dir) => dir.path !== undefined),
}));
};
loadSearchResultCount = (directories: TreeComponentWithPath[]) => {
return this.props.loadSearchResultCount('directories', {
- directories: directories.map(directory => directory.path)
+ directories: directories.map((directory) => directory.path),
});
};
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.tsx
index f2d2f2f4cee..5a102ccf9d6 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/FileFacet.tsx
@@ -67,20 +67,20 @@ export default class FileFacet extends React.PureComponent<Props> {
...getBranchLikeQuery(branchLike),
q: query,
p: page,
- ps: 30
+ ps: 30,
}).then(({ components, paging }) => ({
paging,
- results: components.filter(file => file.path !== undefined)
+ results: components.filter((file) => file.path !== undefined),
}));
};
loadSearchResultCount = (files: TreeComponentWithPath[]) => {
return this.props.loadSearchResultCount('files', {
files: files
- .map(file => {
+ .map((file) => {
return file.path;
})
- .filter(isDefined)
+ .filter(isDefined),
});
};
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/LanguageFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/LanguageFacet.tsx
index c10a038f8b7..f3eef01d016 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/LanguageFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/LanguageFacet.tsx
@@ -49,7 +49,7 @@ class LanguageFacet extends React.PureComponent<Props> {
handleSearch = (query: string) => {
const options = this.getAllPossibleOptions();
- const results = options.filter(language =>
+ const results = options.filter((language) =>
language.name.toLowerCase().includes(query.toLowerCase())
);
const paging = { pageIndex: 1, pageSize: results.length, total: results.length };
@@ -63,14 +63,14 @@ class LanguageFacet extends React.PureComponent<Props> {
// for such language we don't know their display name, so let's just use their key
// and make sure we reference each language only once
return uniqBy(
- [...Object.values(languages), ...Object.keys(stats).map(key => ({ key, name: key }))],
- language => language.key
+ [...Object.values(languages), ...Object.keys(stats).map((key) => ({ key, name: key }))],
+ (language) => language.key
);
};
loadSearchResultCount = (languages: Language[]) => {
return this.props.loadSearchResultCount('languages', {
- languages: languages.map(language => language.key)
+ languages: languages.map((language) => language.key),
});
};
@@ -84,8 +84,8 @@ class LanguageFacet extends React.PureComponent<Props> {
facetHeader={translate('issues.facet.languages')}
fetching={this.props.fetching}
getFacetItemText={this.getLanguageName}
- getSearchResultKey={language => language.key}
- getSearchResultText={language => language.name}
+ getSearchResultKey={(language) => language.key}
+ getSearchResultText={(language) => language.name}
loadSearchResultCount={this.loadSearchResultCount}
minSearchLength={1}
onChange={this.props.onChange}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/PeriodFilter.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/PeriodFilter.tsx
index c75cd9a2b6d..27370ecf119 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/PeriodFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/PeriodFilter.tsx
@@ -33,7 +33,7 @@ export interface PeriodFilterProps {
}
enum Period {
- NewCode = 'inNewCodePeriod'
+ NewCode = 'inNewCodePeriod',
}
const PROPERTY = 'period';
@@ -49,7 +49,7 @@ export default function PeriodFilter(props: PeriodFilterProps) {
createdAt: undefined,
createdBefore: undefined,
createdInLast: undefined,
- [Period.NewCode]: !newCodeSelected
+ [Period.NewCode]: !newCodeSelected,
});
}, [newCodeSelected, onChange]);
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.tsx
index d96d452a39f..744f7207ec5 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.tsx
@@ -58,7 +58,7 @@ export default class ProjectFacet extends React.PureComponent<Props> {
[
ComponentQualifier.Portfolio,
ComponentQualifier.SubPortfolio,
- ComponentQualifier.Application
+ ComponentQualifier.Application,
].includes(component.qualifier as ComponentQualifier)
) {
return getTree({
@@ -66,26 +66,26 @@ export default class ProjectFacet extends React.PureComponent<Props> {
p: page,
ps: 30,
q: query,
- qualifiers: ComponentQualifier.Project
+ qualifiers: ComponentQualifier.Project,
}).then(({ components, paging }) => ({
paging,
- results: components.map(component => ({
+ results: components.map((component) => ({
key: component.refKey || component.key,
- name: component.name
- }))
+ name: component.name,
+ })),
}));
}
return searchProjects({
p: page,
ps: 30,
- filter: query ? `query = "${query}"` : ''
+ filter: query ? `query = "${query}"` : '',
}).then(({ components, paging }) => ({
paging,
- results: components.map(component => ({
+ results: components.map((component) => ({
key: component.key,
- name: component.name
- }))
+ name: component.name,
+ })),
}));
};
@@ -96,7 +96,7 @@ export default class ProjectFacet extends React.PureComponent<Props> {
loadSearchResultCount = (projects: SearchedProject[]) => {
return this.props.loadSearchResultCount('projects', {
- projects: projects.map(project => project.key)
+ projects: projects.map((project) => project.key),
});
};
@@ -122,8 +122,8 @@ export default class ProjectFacet extends React.PureComponent<Props> {
facetHeader={translate('issues.facet.projects')}
fetching={this.props.fetching}
getFacetItemText={this.getProjectName}
- getSearchResultKey={project => project.key}
- getSearchResultText={project => project.name}
+ getSearchResultKey={(project) => project.key}
+ getSearchResultText={(project) => project.name}
loadSearchResultCount={this.loadSearchResultCount}
onChange={this.props.onChange}
onSearch={this.handleSearch}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/ResolutionFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/ResolutionFacet.tsx
index 1a54f9b3eee..f35af217a23 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/ResolutionFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/ResolutionFacet.tsx
@@ -44,7 +44,7 @@ export default class ResolutionFacet extends React.PureComponent<Props> {
property = 'resolutions';
static defaultProps = {
- open: true
+ open: true,
};
handleItemClick = (itemValue: string, multiple: boolean) => {
@@ -63,7 +63,7 @@ export default class ResolutionFacet extends React.PureComponent<Props> {
this.props.onChange({
resolved: true,
[this.property]:
- resolutions.includes(itemValue) && resolutions.length < 2 ? [] : [itemValue]
+ resolutions.includes(itemValue) && resolutions.length < 2 ? [] : [itemValue],
});
}
};
@@ -109,7 +109,7 @@ export default class ResolutionFacet extends React.PureComponent<Props> {
render() {
const { resolutions, stats = {} } = this.props;
- const values = resolutions.map(resolution => this.getFacetItemName(resolution));
+ const values = resolutions.map((resolution) => this.getFacetItemName(resolution));
return (
<FacetBox property={this.property}>
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.tsx
index fb6d1177191..5d0f35ebacb 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/RuleFacet.tsx
@@ -49,15 +49,15 @@ export default class RuleFacet extends React.PureComponent<Props> {
p: page,
ps: 30,
s: 'name',
- include_external: true
- }).then(response => ({
+ include_external: true,
+ }).then((response) => ({
paging: { pageIndex: response.p, pageSize: response.ps, total: response.total },
- results: response.rules
+ results: response.rules,
}));
};
loadSearchResultCount = (rules: Rule[]) => {
- return this.props.loadSearchResultCount('rules', { rules: rules.map(rule => rule.key) });
+ return this.props.loadSearchResultCount('rules', { rules: rules.map((rule) => rule.key) });
};
getRuleName = (ruleKey: string) => {
@@ -81,8 +81,8 @@ export default class RuleFacet extends React.PureComponent<Props> {
facetHeader={translate('issues.facet.rules')}
fetching={this.props.fetching}
getFacetItemText={this.getRuleName}
- getSearchResultKey={rule => rule.key}
- getSearchResultText={rule => rule.name}
+ getSearchResultKey={(rule) => rule.key}
+ getSearchResultText={(rule) => rule.name}
loadSearchResultCount={this.loadSearchResultCount}
onChange={this.props.onChange}
onSearch={this.handleSearch}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/ScopeFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/ScopeFacet.tsx
index f831854f467..508a2141f22 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/ScopeFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/ScopeFacet.tsx
@@ -41,7 +41,7 @@ export interface ScopeFacetProps {
export default function ScopeFacet(props: ScopeFacetProps) {
const { fetching, open, scopes = [], stats = {} } = props;
- const values = scopes.map(scope => translate('issue.scope', scope));
+ const values = scopes.map((scope) => translate('issue.scope', scope));
return (
<FacetBox property="scopes">
@@ -78,11 +78,11 @@ export default function ScopeFacet(props: ScopeFacetProps) {
onClick={(itemValue: string, multiple: boolean) => {
if (multiple) {
props.onChange({
- scopes: active ? without(scopes, itemValue) : [...scopes, itemValue]
+ scopes: active ? without(scopes, itemValue) : [...scopes, itemValue],
});
} else {
props.onChange({
- scopes: active && scopes.length === 1 ? [] : [itemValue]
+ scopes: active && scopes.length === 1 ? [] : [itemValue],
});
}
}}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx
index 360ead170ca..f574fe09c9f 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx
@@ -44,7 +44,7 @@ export default class SeverityFacet extends React.PureComponent<Props> {
property = 'severities';
static defaultProps = {
- open: true
+ open: true,
};
handleItemClick = (itemValue: string, multiple: boolean) => {
@@ -56,7 +56,7 @@ export default class SeverityFacet extends React.PureComponent<Props> {
this.props.onChange({ [this.property]: newValue });
} else {
this.props.onChange({
- [this.property]: severities.includes(itemValue) && severities.length < 2 ? [] : [itemValue]
+ [this.property]: severities.includes(itemValue) && severities.length < 2 ? [] : [itemValue],
});
}
};
@@ -94,7 +94,7 @@ export default class SeverityFacet extends React.PureComponent<Props> {
render() {
const { severities, stats = {} } = this.props;
- const values = severities.map(severity => translate('severity', severity));
+ const values = severities.map((severity) => translate('severity', severity));
return (
<FacetBox property={this.property}>
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
index 2496a4dcf9b..83a792aa168 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
@@ -26,13 +26,13 @@ import {
ComponentQualifier,
isApplication,
isPortfolioLike,
- isView
+ isView,
} from '../../../types/component';
import {
Facet,
ReferencedComponent,
ReferencedLanguage,
- ReferencedRule
+ ReferencedRule,
} from '../../../types/issues';
import { GlobalSettingKeys } from '../../../types/settings';
import { Component, Dict } from '../../../types/types';
@@ -88,7 +88,7 @@ export class Sidebar extends React.PureComponent<Props> {
loadSearchResultCount: this.props.loadSearchResultCount,
onChange: this.props.onFilterChange,
onToggle: this.props.onFacetToggle,
- query
+ query,
};
return (
<>
@@ -122,7 +122,7 @@ export class Sidebar extends React.PureComponent<Props> {
facets,
openFacets,
query,
- branchLike
+ branchLike,
} = this.props;
const disableDeveloperAggregatedInfo =
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/StandardFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/StandardFacet.tsx
index 02b892f6bb0..030d27486f5 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/StandardFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/StandardFacet.tsx
@@ -37,7 +37,7 @@ import {
renderOwaspTop102021Category,
renderOwaspTop10Category,
renderSansTop25Category,
- renderSonarSourceSecurityCategory
+ renderSonarSourceSecurityCategory,
} from '../../../helpers/security-standard';
import { Facet } from '../../../types/issues';
import { SecurityStandard, Standards } from '../../../types/security';
@@ -99,8 +99,8 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
sonarsourceSecurity: {},
'pciDss-3.2': {},
'pciDss-4.0': {},
- 'owaspAsvs-4.0': {}
- }
+ 'owaspAsvs-4.0': {},
+ },
};
componentDidMount() {
@@ -139,7 +139,7 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
sonarsourceSecurity,
'pciDss-3.2': pciDss3_2,
'pciDss-4.0': pciDss4_0,
- 'owaspAsvs-4.0': owaspAsvs4_0
+ 'owaspAsvs-4.0': owaspAsvs4_0,
}: Standards) => {
if (this.mounted) {
this.setState({
@@ -151,8 +151,8 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
sonarsourceSecurity,
'pciDss-3.2': pciDss3_2,
'pciDss-4.0': pciDss4_0,
- 'owaspAsvs-4.0': owaspAsvs4_0
- }
+ 'owaspAsvs-4.0': owaspAsvs4_0,
+ },
});
}
},
@@ -162,19 +162,19 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
getValues = () => {
return [
- ...this.props.sonarsourceSecurity.map(item =>
+ ...this.props.sonarsourceSecurity.map((item) =>
renderSonarSourceSecurityCategory(this.state.standards, item, true)
),
- ...this.props.owaspTop10.map(item =>
+ ...this.props.owaspTop10.map((item) =>
renderOwaspTop10Category(this.state.standards, item, true)
),
- ...this.props['owaspTop10-2021'].map(item =>
+ ...this.props['owaspTop10-2021'].map((item) =>
renderOwaspTop102021Category(this.state.standards, item, true)
),
- ...this.props.sansTop25.map(item =>
+ ...this.props.sansTop25.map((item) =>
renderSansTop25Category(this.state.standards, item, true)
),
- ...this.props.cwe.map(item => renderCWECategory(this.state.standards, item))
+ ...this.props.cwe.map((item) => renderCWECategory(this.state.standards, item)),
];
};
@@ -205,7 +205,7 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
'owaspTop10-2021': [],
sansTop25: [],
cwe: [],
- sonarsourceSecurity: []
+ sonarsourceSecurity: [],
});
};
@@ -218,7 +218,7 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
this.props.onChange({ [prop]: newValue });
} else {
this.props.onChange({
- [prop]: items.includes(itemValue) && items.length < 2 ? [] : [itemValue]
+ [prop]: items.includes(itemValue) && items.length < 2 ? [] : [itemValue],
});
}
};
@@ -241,11 +241,9 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
handleCWESearch = (query: string) => {
return Promise.resolve({
- results: Object.keys(this.state.standards.cwe).filter(cwe =>
- renderCWECategory(this.state.standards, cwe)
- .toLowerCase()
- .includes(query.toLowerCase())
- )
+ results: Object.keys(this.state.standards.cwe).filter((cwe) =>
+ renderCWECategory(this.state.standards, cwe).toLowerCase().includes(query.toLowerCase())
+ ),
});
};
@@ -267,7 +265,7 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
if (!stats) {
return null;
}
- const categories = sortBy(Object.keys(stats), key => -stats[key]);
+ const categories = sortBy(Object.keys(stats), (key) => -stats[key]);
return this.renderFacetItemsList(stats, values, categories, renderName, renderName, onClick);
};
@@ -294,7 +292,7 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
return (
<FacetItemsList>
- {categories.map(category => (
+ {categories.map((category) => (
<FacetItem
active={values.includes(category)}
key={category}
@@ -352,8 +350,8 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
const sortedItems = sortBy(
Object.keys(stats),
- key => -stats[key],
- key => renderSonarSourceSecurityCategory(this.state.standards, key)
+ (key) => -stats[key],
+ (key) => renderSonarSourceSecurityCategory(this.state.standards, key)
);
const limitedList = this.state.showFullSonarSourceList
@@ -363,13 +361,13 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
// make sure all selected items are displayed
const selectedBelowLimit = this.state.showFullSonarSourceList
? []
- : sortedItems.slice(INITIAL_FACET_COUNT).filter(item => values.includes(item));
+ : sortedItems.slice(INITIAL_FACET_COUNT).filter((item) => values.includes(item));
const allItemShown = limitedList.length + selectedBelowLimit.length === sortedItems.length;
return (
<>
<FacetItemsList>
- {limitedList.map(item => (
+ {limitedList.map((item) => (
<FacetItem
active={values.includes(item)}
key={item}
@@ -385,7 +383,7 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
<>
{!allItemShown && <div className="note spacer-bottom text-center">⋯</div>}
<FacetItemsList>
- {selectedBelowLimit.map(item => (
+ {selectedBelowLimit.map((item) => (
<FacetItem
active={true}
key={item}
@@ -440,7 +438,7 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
name={translate('issues.facet.sonarsourceSecurity')}
onClick={this.handleSonarSourceSecurityHeaderClick}
open={this.props.sonarsourceSecurityOpen}
- values={this.props.sonarsourceSecurity.map(item =>
+ values={this.props.sonarsourceSecurity.map((item) =>
renderSonarSourceSecurityCategory(this.state.standards, item)
)}
/>
@@ -457,7 +455,7 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
name={translate('issues.facet.owaspTop10_2021')}
onClick={this.handleOwaspTop102021HeaderClick}
open={this.props['owaspTop10-2021Open']}
- values={this.props['owaspTop10-2021'].map(item =>
+ values={this.props['owaspTop10-2021'].map((item) =>
renderOwaspTop102021Category(this.state.standards, item)
)}
/>
@@ -474,7 +472,7 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
name={translate('issues.facet.owaspTop10')}
onClick={this.handleOwaspTop10HeaderClick}
open={this.props.owaspTop10Open}
- values={this.props.owaspTop10.map(item =>
+ values={this.props.owaspTop10.map((item) =>
renderOwaspTop10Category(this.state.standards, item)
)}
/>
@@ -491,7 +489,7 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
name={translate('issues.facet.sansTop25')}
onClick={this.handleSansTop25HeaderClick}
open={this.props.sansTop25Open}
- values={this.props.sansTop25.map(item =>
+ values={this.props.sansTop25.map((item) =>
renderSansTop25Category(this.state.standards, item)
)}
/>
@@ -506,9 +504,9 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
className="is-inner"
facetHeader={translate('issues.facet.cwe')}
fetching={this.props.fetchingCwe}
- getFacetItemText={item => renderCWECategory(this.state.standards, item)}
- getSearchResultKey={item => item}
- getSearchResultText={item => renderCWECategory(this.state.standards, item)}
+ getFacetItemText={(item) => renderCWECategory(this.state.standards, item)}
+ getSearchResultKey={(item) => item}
+ getSearchResultText={(item) => renderCWECategory(this.state.standards, item)}
loadSearchResultCount={this.loadCWESearchResultCount}
onChange={this.props.onChange}
onSearch={this.handleCWESearch}
@@ -516,7 +514,7 @@ export default class StandardFacet extends React.PureComponent<Props, State> {
open={this.props.cweOpen}
property={SecurityStandard.CWE}
query={omit(this.props.query, 'cwe')}
- renderFacetItem={item => renderCWECategory(this.state.standards, item)}
+ renderFacetItem={(item) => renderCWECategory(this.state.standards, item)}
renderSearchResult={(item, query) =>
highlightTerm(renderCWECategory(this.state.standards, item), query)
}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.tsx
index c2b91369b1c..d47bc17b8b2 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/StatusFacet.tsx
@@ -54,7 +54,7 @@ export default class StatusFacet extends React.PureComponent<Props> {
this.props.onChange({ [this.property]: newValue });
} else {
this.props.onChange({
- [this.property]: statuses.includes(itemValue) && statuses.length < 2 ? [] : [itemValue]
+ [this.property]: statuses.includes(itemValue) && statuses.length < 2 ? [] : [itemValue],
});
}
};
@@ -92,7 +92,7 @@ export default class StatusFacet extends React.PureComponent<Props> {
render() {
const { statuses, stats = {} } = this.props;
- const values = statuses.map(status => translate('issue.status', status));
+ const values = statuses.map((status) => translate('issue.status', status));
return (
<FacetBox property={this.property}>
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx
index 66c6f296e5e..0767102a7cb 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/TagFacet.tsx
@@ -53,8 +53,8 @@ export default class TagFacet extends React.PureComponent<Props> {
project,
branch,
ps: SEARCH_SIZE,
- q: query
- }).then(tags => ({ maxResults: tags.length === SEARCH_SIZE, results: tags }));
+ q: query,
+ }).then((tags) => ({ maxResults: tags.length === SEARCH_SIZE, results: tags }));
};
getTagName = (tag: string) => {
@@ -87,8 +87,8 @@ export default class TagFacet extends React.PureComponent<Props> {
facetHeader={translate('issues.facet.tags')}
fetching={this.props.fetching}
getFacetItemText={this.getTagName}
- getSearchResultKey={tag => tag}
- getSearchResultText={tag => tag}
+ getSearchResultKey={(tag) => tag}
+ getSearchResultText={(tag) => tag}
loadSearchResultCount={this.loadSearchResultCount}
onChange={this.props.onChange}
onSearch={this.handleSearch}
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 9b04c49c307..f2095d0a684 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
@@ -43,7 +43,7 @@ export default class TypeFacet extends React.PureComponent<Props> {
property = 'types';
static defaultProps = {
- open: true
+ open: true,
};
handleItemClick = (itemValue: string, multiple: boolean) => {
@@ -55,7 +55,7 @@ export default class TypeFacet extends React.PureComponent<Props> {
this.props.onChange({ [this.property]: newValue });
} else {
this.props.onChange({
- [this.property]: types.includes(itemValue) && types.length < 2 ? [] : [itemValue]
+ [this.property]: types.includes(itemValue) && types.length < 2 ? [] : [itemValue],
});
}
};
@@ -100,7 +100,7 @@ export default class TypeFacet extends React.PureComponent<Props> {
render() {
const { types, stats = {} } = this.props;
- const values = types.map(type => translate('issue.type', type));
+ const values = types.map((type) => translate('issue.type', type));
return (
<FacetBox property={this.property}>
@@ -116,7 +116,7 @@ export default class TypeFacet extends React.PureComponent<Props> {
{this.props.open && (
<>
<FacetItemsList>
- {ISSUE_TYPES.filter(t => t !== 'SECURITY_HOTSPOT').map(this.renderItem)}
+ {ISSUE_TYPES.filter((t) => t !== 'SECURITY_HOTSPOT').map(this.renderItem)}
</FacetItemsList>
<MultipleSelectionHint options={Object.keys(stats).length} values={types.length} />
</>
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AssigneeFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AssigneeFacet-test.tsx
index a9841ccf695..94e18c28d34 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AssigneeFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/AssigneeFacet-test.tsx
@@ -27,11 +27,7 @@ it('should render', () => {
});
it('should select unassigned', () => {
- expect(
- shallowRender({ assigned: false })
- .find('ListStyleFacet')
- .prop('values')
- ).toEqual(['']);
+ expect(shallowRender({ assigned: false }).find('ListStyleFacet').prop('values')).toEqual(['']);
});
it('should call onChange', () => {
@@ -54,8 +50,8 @@ describe('test behavior', () => {
assignees: ['foo', 'baz'],
referencedUsers: {
foo: { active: false, login: 'foo' },
- baz: { active: true, login: 'baz', name: 'Name Baz' }
- }
+ baz: { active: true, login: 'baz', name: 'Name Baz' },
+ },
}).instance();
it('should correctly render assignee name', () => {
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/CreationDateFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/CreationDateFacet-test.tsx
index b7dc314c058..064cbfae9d0 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/CreationDateFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/CreationDateFacet-test.tsx
@@ -31,13 +31,13 @@ it('should render correctly', () => {
expect(
shallowRender({
createdAfter: new Date('2019.04.29T13:33:00Z'),
- createdAfterIncludesTime: true
+ createdAfterIncludesTime: true,
})
).toMatchSnapshot('created after');
expect(
shallowRender({
createdAfter: new Date('2019.04.29T13:33:00Z'),
- createdAfterIncludesTime: true
+ createdAfterIncludesTime: true,
})
).toMatchSnapshot('created after timestamp');
expect(shallowRender({ component: mockComponent() })).toMatchSnapshot('project');
@@ -49,7 +49,7 @@ it('should render correctly', () => {
it.each([
['week', '1w'],
['month', '1m'],
- ['year', '1y']
+ ['year', '1y'],
])('should render correctly for createdInLast %s', (_, createdInLast) => {
expect(shallowRender({ component: mockComponent(), createdInLast })).toMatchSnapshot();
});
@@ -67,7 +67,7 @@ function shallowRender(props?: Partial<CreationDateFacet['props']>) {
inNewCodePeriod={false}
intl={
{
- formatDate: (date: string) => 'formatted.' + date
+ formatDate: (date: string) => 'formatted.' + date,
} as IntlShape
}
onChange={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/DirectoryFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/DirectoryFacet-test.tsx
index 3ed3dbd5223..86158f1a518 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/DirectoryFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/DirectoryFacet-test.tsx
@@ -28,7 +28,7 @@ import { Query } from '../../utils';
import DirectoryFacet from '../DirectoryFacet';
jest.mock('../../../../api/components', () => ({
- getDirectories: jest.fn().mockResolvedValue({ components: [] })
+ getDirectories: jest.fn().mockResolvedValue({ components: [] }),
}));
beforeEach(() => jest.clearAllMocks());
@@ -51,17 +51,14 @@ it('should properly search for directory', () => {
const query = 'foo';
- wrapper
- .find(ListStyleFacet)
- .props()
- .onSearch(query);
+ wrapper.find(ListStyleFacet).props().onSearch(query);
expect(getDirectories).toHaveBeenCalledWith({
branch: branch.name,
component: component.key,
q: query,
ps: 30,
- p: undefined
+ p: undefined,
});
});
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx
index 6e77daa6f4c..0a8d45e2eb4 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/FileFacet-test.tsx
@@ -28,7 +28,7 @@ import { Query } from '../../utils';
import FileFacet from '../FileFacet';
jest.mock('../../../../api/components', () => ({
- getFiles: jest.fn().mockResolvedValue({ components: [] })
+ getFiles: jest.fn().mockResolvedValue({ components: [] }),
}));
beforeEach(() => jest.clearAllMocks());
@@ -53,17 +53,14 @@ it('should properly search for file', () => {
const query = 'foo';
- wrapper
- .find(ListStyleFacet)
- .props()
- .onSearch(query);
+ wrapper.find(ListStyleFacet).props().onSearch(query);
expect(getFiles).toHaveBeenCalledWith({
branch: branch.name,
component: component.key,
q: query,
ps: 30,
- p: undefined
+ p: undefined,
});
});
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/PeriodFilter-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/PeriodFilter-test.tsx
index 346fcea74b9..06ebef3c213 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/PeriodFilter-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/PeriodFilter-test.tsx
@@ -36,7 +36,7 @@ it('should filter when clicked', async () => {
createdAt: undefined,
createdBefore: undefined,
createdInLast: undefined,
- inNewCodePeriod: true
+ inNewCodePeriod: true,
});
});
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ProjectFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ProjectFacet-test.tsx
index 45ce1c7f9a1..b702cd21da3 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ProjectFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ProjectFacet-test.tsx
@@ -32,8 +32,8 @@ jest.mock('../../../../api/components', () => ({
searchProjects: jest.fn().mockResolvedValue({
components: [],
facets: [],
- paging: {}
- })
+ paging: {},
+ }),
}));
beforeEach(() => jest.clearAllMocks());
@@ -47,7 +47,7 @@ it('should callback to load search results', () => {
const wrapper = shallowRender({ loadSearchResultCount });
wrapper.instance().loadSearchResultCount([
{ key: '1', name: 'first' },
- { key: '2', name: 'seecond' }
+ { key: '2', name: 'seecond' },
]);
expect(loadSearchResultCount).toHaveBeenCalledWith('projects', { projects: ['1', '2'] });
@@ -65,7 +65,7 @@ it('should handle search for projects globally', async () => {
it('should handle search for projects in portfolio', async () => {
const wrapper = shallowRender({
- component: mockComponent({ qualifier: ComponentQualifier.Portfolio })
+ component: mockComponent({ qualifier: ComponentQualifier.Portfolio }),
});
const query = 'my project';
@@ -78,9 +78,9 @@ it('should handle search for projects in portfolio', async () => {
describe("ListStyleFacet's renderers", () => {
const components: ReferencedComponent[] = [
{ key: 'projectKey', name: 'First Project Name', uuid: '141324' },
- { key: 'projectKey2', name: 'Second Project Name', uuid: '643878' }
+ { key: 'projectKey2', name: 'Second Project Name', uuid: '643878' },
];
- const referencedComponents = keyBy(components, c => c.key);
+ const referencedComponents = keyBy(components, (c) => c.key);
const wrapper = shallowRender({ referencedComponents });
const instance = wrapper.instance();
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/RuleFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/RuleFacet-test.tsx
index 75a3c8ac9c1..43d5230f53f 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/RuleFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/RuleFacet-test.tsx
@@ -26,7 +26,7 @@ import { Query } from '../../utils';
import RuleFacet from '../RuleFacet';
jest.mock('../../../../api/rules', () => ({
- searchRules: jest.fn().mockResolvedValue({})
+ searchRules: jest.fn().mockResolvedValue({}),
}));
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ScopeFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ScopeFacet-test.tsx
index abc273c3101..505ab8d4007 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ScopeFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/ScopeFacet-test.tsx
@@ -59,7 +59,7 @@ it('should correctly handle facet item clicks', () => {
clickFacetItem(wrapper, IssueScope.Test, true);
clickFacetItem(wrapper, IssueScope.Main, true);
expect(onChange).toHaveBeenLastCalledWith({
- scopes: expect.arrayContaining([IssueScope.Main, IssueScope.Test])
+ scopes: expect.arrayContaining([IssueScope.Main, IssueScope.Test]),
});
clickFacetItem(wrapper, IssueScope.Test, true);
@@ -73,7 +73,7 @@ function clickFacetItem(
) {
return wrapper
.find(FacetItem)
- .filterWhere(f => f.key() === scope)
+ .filterWhere((f) => f.key() === scope)
.props()
.onClick(scope, multiple);
}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-test.tsx
index bdfb4b033bd..51e24764183 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/Sidebar-test.tsx
@@ -38,8 +38,8 @@ it('should render facets for project', () => {
it.each([
[ComponentQualifier.Application],
[ComponentQualifier.Portfolio],
- [ComponentQualifier.SubPortfolio]
-])('should render facets for %p', qualifier => {
+ [ComponentQualifier.SubPortfolio],
+])('should render facets for %p', (qualifier) => {
expect(renderSidebar({ component: mockComponent({ qualifier }) })).toMatchSnapshot();
});
@@ -51,8 +51,8 @@ it('should not render developer nominative facets when asked not to', () => {
expect(
renderSidebar({
appState: mockAppState({
- settings: { [GlobalSettingKeys.DeveloperAggregatedInfoDisabled]: 'true' }
- })
+ settings: { [GlobalSettingKeys.DeveloperAggregatedInfoDisabled]: 'true' },
+ }),
})
).toMatchSnapshot();
});
@@ -63,7 +63,7 @@ const renderSidebar = (props?: Partial<Sidebar['props']>) => {
shallow<Sidebar>(
<Sidebar
appState={mockAppState({
- settings: { [GlobalSettingKeys.DeveloperAggregatedInfoDisabled]: 'false' }
+ settings: { [GlobalSettingKeys.DeveloperAggregatedInfoDisabled]: 'false' },
})}
component={undefined}
createdAfterIncludesTime={false}
@@ -87,9 +87,9 @@ const renderSidebar = (props?: Partial<Sidebar['props']>) => {
);
function mapChildren(wrapper: ShallowWrapper) {
- return wrapper.children().map(node => {
+ return wrapper.children().map((node) => {
if (typeof node.type() === 'symbol') {
- return node.children().map(n => n.name());
+ return node.children().map((n) => n.name());
}
return node.name();
});
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StandardFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StandardFacet-test.tsx
index fa4b3eaf027..936691f2b3b 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StandardFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StandardFacet-test.tsx
@@ -30,42 +30,42 @@ jest.mock('../../../../helpers/security-standard', () => ({
getStandards: jest.fn().mockResolvedValue({
owaspTop10: {
a1: {
- title: 'Injection'
+ title: 'Injection',
},
a2: {
- title: 'Broken Authentication'
- }
+ title: 'Broken Authentication',
+ },
},
'owaspTop10-2021': {
a1: {
- title: 'Injection'
+ title: 'Injection',
},
a2: {
- title: 'Broken Authentication'
- }
+ title: 'Broken Authentication',
+ },
},
sansTop25: {
'insecure-interaction': {
- title: 'Insecure Interaction Between Components'
- }
+ title: 'Insecure Interaction Between Components',
+ },
},
cwe: {
unknown: {
- title: 'No CWE associated'
+ title: 'No CWE associated',
},
'1004': {
- title: "Sensitive Cookie Without 'HttpOnly' Flag"
- }
+ title: "Sensitive Cookie Without 'HttpOnly' Flag",
+ },
},
sonarsourceSecurity: {
'sql-injection': {
- title: 'SQL Injection'
+ title: 'SQL Injection',
},
'command-injection': {
- title: 'Command Injection'
- }
- }
- })
+ title: 'Command Injection',
+ },
+ },
+ }),
}));
it('should render closed', () => {
@@ -90,7 +90,7 @@ it('should clear standards facet', () => {
'owaspTop10-2021': [],
sansTop25: [],
sonarsourceSecurity: [],
- standards: []
+ standards: [],
});
});
@@ -109,7 +109,7 @@ it('should render sub-facets', () => {
sansTop25Stats: { foo: 12, 'risky-resource': 10 },
sonarsourceSecurity: ['sql-injection'],
sonarsourceSecurityOpen: true,
- sonarsourceSecurityStats: { 'sql-injection': 12 }
+ sonarsourceSecurityStats: { 'sql-injection': 12 },
})
).toMatchSnapshot();
expect(getStandards).toHaveBeenCalled();
@@ -145,8 +145,8 @@ it('should show sonarsource facet more button', () => {
'encrypt-data': 3,
traceability: 3,
permission: 3,
- others: 3
- }
+ others: 3,
+ },
});
expect(wrapper.find(ListStyleFacetFooter).exists()).toBe(true);
@@ -179,7 +179,7 @@ it('should select items', () => {
sansTop25Stats: { foo: 12, 'risky-resource': 10 },
sonarsourceSecurity: ['command-injection'],
sonarsourceSecurityOpen: true,
- sonarsourceSecurityStats: { 'sql-injection': 10 }
+ sonarsourceSecurityStats: { 'sql-injection': 10 },
});
selectAndCheck('owaspTop10', 'a1');
@@ -214,7 +214,7 @@ it('should display correct selection', () => {
'owaspTop10-2021': ['a1', 'a2'],
sansTop25: ['risky-resource', 'foo'],
cwe: ['42', '1111', 'unknown'],
- sonarsourceSecurity: ['sql-injection', 'others']
+ sonarsourceSecurity: ['sql-injection', 'others'],
});
checkValues('standards', [
'SONAR SQL Injection',
@@ -227,7 +227,7 @@ it('should display correct selection', () => {
'SANS foo',
'CWE-42 - cwe-42 title',
'CWE-1111',
- 'Unknown CWE'
+ 'Unknown CWE',
]);
checkValues('owaspTop10', ['A1 - a1 title', 'A3']);
checkValues('owaspTop10-2021', ['A1 - a1 title', 'A2']);
@@ -236,10 +236,7 @@ it('should display correct selection', () => {
function checkValues(property: string, values: string[]) {
expect(
- wrapper
- .find(`FacetBox[property="${property}"]`)
- .children('FacetHeader')
- .prop('values')
+ wrapper.find(`FacetBox[property="${property}"]`).children('FacetHeader').prop('values')
).toEqual(values);
}
});
@@ -283,9 +280,9 @@ function shallowRender(props: Partial<StandardFacet['props']> = {}) {
cwe: { 42: { title: 'cwe-42 title' }, unknown: { title: 'Unknown CWE' } },
sonarsourceSecurity: {
'sql-injection': { title: 'SQL Injection' },
- others: { title: 'Others' }
- }
- }
+ others: { title: 'Others' },
+ },
+ },
});
return wrapper;
}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StatusFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StatusFacet-test.tsx
index 666f381a72c..452e68cba2c 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StatusFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/StatusFacet-test.tsx
@@ -48,10 +48,10 @@ it('should select a status', () => {
clickAndCheck('CLOSED');
function clickAndCheck(status: string, multiple = false, expected = [status]) {
- wrapper
- .find(`FacetItemsList`)
- .find(`FacetItem[value="${status}"]`)
- .prop<Function>('onClick')(status, multiple);
+ wrapper.find(`FacetItemsList`).find(`FacetItem[value="${status}"]`).prop<Function>('onClick')(
+ status,
+ multiple
+ );
expect(onChange).toHaveBeenLastCalledWith({ statuses: expected });
wrapper.setProps({ statuses: expected });
}
@@ -69,7 +69,7 @@ function shallowRender(props: Partial<StatusFacet['props']> = {}) {
CONFIRMED: 8,
REOPENED: 0,
RESOLVED: 0,
- CLOSED: 8
+ CLOSED: 8,
}}
statuses={[]}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/TypeFacet-test.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/TypeFacet-test.tsx
index 3a778362f68..131449e62c2 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/TypeFacet-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/__tests__/TypeFacet-test.tsx
@@ -47,10 +47,10 @@ it('should select a type', () => {
clickAndCheck('VULNERABILITY', true, ['CODE_SMELL', 'VULNERABILITY']);
function clickAndCheck(type: string, multiple = false, expected = [type]) {
- wrapper
- .find(`FacetItemsList`)
- .find(`FacetItem[value="${type}"]`)
- .prop<Function>('onClick')(type, multiple);
+ wrapper.find(`FacetItemsList`).find(`FacetItem[value="${type}"]`).prop<Function>('onClick')(
+ type,
+ multiple
+ );
expect(onChange).toHaveBeenLastCalledWith({ types: expected });
wrapper.setProps({ types: expected });
}
diff --git a/server/sonar-web/src/main/js/apps/issues/utils.ts b/server/sonar-web/src/main/js/apps/issues/utils.ts
index cd77fa72956..cc6ab93aa9e 100644
--- a/server/sonar-web/src/main/js/apps/issues/utils.ts
+++ b/server/sonar-web/src/main/js/apps/issues/utils.ts
@@ -29,7 +29,7 @@ import {
queriesEqual,
serializeDateShort,
serializeString,
- serializeStringArray
+ serializeStringArray,
} from '../../helpers/query';
import { get, save } from '../../helpers/storage';
import { isDefined } from '../../helpers/types';
@@ -112,7 +112,7 @@ export function parseQuery(query: RawQuery): Query {
sort: parseAsSort(query.s),
statuses: parseAsArray(query.statuses, parseAsString),
tags: parseAsArray(query.tags, parseAsString),
- types: parseAsArray(query.types, parseAsString)
+ types: parseAsArray(query.types, parseAsString),
};
}
@@ -122,7 +122,7 @@ export function getOpen(query: RawQuery): string | undefined {
export function getOpenIssue(props: { location: { query: RawQuery } }, issues: Issue[]) {
const open = getOpen(props.location.query);
- return open ? issues.find(issue => issue.key === open) : undefined;
+ return open ? issues.find((issue) => issue.key === open) : undefined;
}
export const areMyIssuesSelected = (query: RawQuery) => query.myIssues === 'true';
@@ -159,7 +159,7 @@ export function serializeQuery(query: Query): RawQuery {
sonarsourceSecurity: serializeStringArray(query.sonarsourceSecurity),
statuses: serializeStringArray(query.statuses),
tags: serializeStringArray(query.tags),
- types: serializeStringArray(query.types)
+ types: serializeStringArray(query.types),
};
return cleanQuery(filter);
@@ -174,9 +174,9 @@ export function parseFacets(facets: RawFacet[]): Dict<Facet> {
}
const result: Dict<Facet> = {};
- facets.forEach(facet => {
+ facets.forEach((facet) => {
const values: Facet = {};
- facet.values.forEach(value => {
+ facet.values.forEach((value) => {
values[value.val] = value.count;
});
result[facet.property] = values;
@@ -194,7 +194,7 @@ export const searchAssignees = (
): Promise<{ paging: Paging; results: UserBase[] }> => {
return searchUsers({ p: page, q: query }).then(({ paging, users }) => ({
paging,
- results: users
+ results: users,
}));
};
@@ -212,7 +212,7 @@ export function getLocations(
{
flows,
secondaryLocations,
- flowsWithType
+ flowsWithType,
}: Pick<Issue, 'flows' | 'secondaryLocations' | 'flowsWithType'>,
selectedFlowIndex: number | undefined
) {
@@ -244,7 +244,7 @@ export function allLocationsEmpty(
issue: Pick<Issue, 'flows' | 'secondaryLocations' | 'flowsWithType'>,
selectedFlowIndex: number | undefined
) {
- return getLocations(issue, selectedFlowIndex).every(location => !location.msg);
+ return getLocations(issue, selectedFlowIndex).every((location) => !location.msg);
}
export function shouldOpenStandardsFacet(
@@ -296,7 +296,7 @@ function isOneStandardChildFacetOpen(openFacets: Dict<boolean>, query: Partial<Q
SecurityStandard.OWASP_TOP10,
SecurityStandard.SANS_TOP25,
SecurityStandard.CWE,
- SecurityStandard.SONARSOURCE
+ SecurityStandard.SONARSOURCE,
].some(
(
standardType:
diff --git a/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx b/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx
index 4655bb62b1c..01cbe30b150 100644
--- a/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/maintenance/components/App.tsx
@@ -73,7 +73,7 @@ export default class App extends React.PureComponent<Props, State> {
message: undefined,
startedAt: undefined,
state: undefined,
- status: 'OFFLINE'
+ status: 'OFFLINE',
});
}
});
@@ -141,9 +141,10 @@ export default class App extends React.PureComponent<Props, State> {
<div className="page-wrapper-simple" id="bd">
<div
className={classNames('page-simple', {
- 'panel-warning': state === 'MIGRATION_REQUIRED'
+ 'panel-warning': state === 'MIGRATION_REQUIRED',
})}
- id="nonav">
+ id="nonav"
+ >
{status === 'OFFLINE' && (
<>
<h1 className="maintenance-title text-danger">
@@ -212,10 +213,11 @@ export default class App extends React.PureComponent<Props, State> {
link: (
<Link
to="https://www.sonarlint.org/?referrer=sonarqube-maintenance"
- target="_blank">
+ target="_blank"
+ >
{translate('maintenance.sonarqube_is_under_maintenance_link.1')}
</Link>
- )
+ ),
}}
/>
</p>
@@ -227,10 +229,11 @@ export default class App extends React.PureComponent<Props, State> {
link: (
<Link
to="https://redirect.sonarsource.com/doc/upgrading.html"
- target="_blank">
+ target="_blank"
+ >
{translate('maintenance.sonarqube_is_under_maintenance_link.2')}
</Link>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx
index bd74666d3c9..ba1cc32d9c7 100644
--- a/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx
@@ -28,12 +28,12 @@ import App from '../App';
jest.mock('../../../../api/system', () => ({
getMigrationStatus: jest.fn().mockResolvedValue(null),
getSystemStatus: jest.fn().mockResolvedValue(null),
- migrateDatabase: jest.fn().mockResolvedValue(null)
+ migrateDatabase: jest.fn().mockResolvedValue(null),
}));
jest.mock('../../../../helpers/system', () => ({
...jest.requireActual('../../../../helpers/system'),
- getBaseUrl: jest.fn().mockReturnValue('/context')
+ getBaseUrl: jest.fn().mockReturnValue('/context'),
}));
const originalLocation = window.location;
@@ -44,11 +44,11 @@ beforeAll(() => {
const location = {
...window.location,
- replace
+ replace,
};
Object.defineProperty(window, 'location', {
writable: true,
- value: location
+ value: location,
});
});
@@ -58,7 +58,7 @@ afterAll(() => {
Object.defineProperty(window, 'location', {
writable: true,
- value: originalLocation
+ value: originalLocation,
});
});
@@ -70,23 +70,23 @@ describe('Maintenance', () => {
'OFFLINE',
'maintenance.is_offline',
'maintenance.sonarqube_is_offline.text',
- { name: 'maintenance.try_again', href: '/context/' }
+ { name: 'maintenance.try_again', href: '/context/' },
],
[
'UP',
'maintenance.is_up',
'maintenance.all_systems_opetational',
- { name: 'layout.home', href: '/' }
+ { name: 'layout.home', href: '/' },
],
['STARTING', 'maintenance.is_starting'],
[
'DOWN',
'maintenance.is_down',
'maintenance.sonarqube_is_down.text',
- { name: 'maintenance.try_again', href: '/context/' }
+ { name: 'maintenance.try_again', href: '/context/' },
],
['DB_MIGRATION_NEEDED', 'maintenance.is_under_maintenance'],
- ['DB_MIGRATION_RUNNING', 'maintenance.is_under_maintenance']
+ ['DB_MIGRATION_RUNNING', 'maintenance.is_under_maintenance'],
])(
'should handle "%p" status correctly',
async (status, heading, body = undefined, linkInfo = undefined) => {
@@ -155,7 +155,7 @@ describe('Setup', () => {
'NO_MIGRATION',
'maintenance.database_is_up_to_date',
undefined,
- { name: 'layout.home', href: '/' }
+ { name: 'layout.home', href: '/' },
],
[
'MIGRATION_REQUIRED',
@@ -163,28 +163,28 @@ describe('Setup', () => {
[
'maintenance.upgrade_database.1',
'maintenance.upgrade_database.2',
- 'maintenance.upgrade_database.3'
- ]
+ 'maintenance.upgrade_database.3',
+ ],
],
[
'NOT_SUPPORTED',
'maintenance.migration_not_supported',
- ['maintenance.migration_not_supported.text']
+ ['maintenance.migration_not_supported.text'],
],
[
'MIGRATION_RUNNING',
'maintenance.database_migration',
undefined,
undefined,
- { message: 'MESSAGE', startedAt: '2022-12-01' }
+ { message: 'MESSAGE', startedAt: '2022-12-01' },
],
[
'MIGRATION_SUCCEEDED',
'maintenance.database_is_up_to_date',
undefined,
- { name: 'layout.home', href: '/' }
+ { name: 'layout.home', href: '/' },
],
- ['MIGRATION_FAILED', 'maintenance.upgrade_failed', ['maintenance.upgrade_failed.text']]
+ ['MIGRATION_FAILED', 'maintenance.upgrade_failed', ['maintenance.upgrade_failed.text']],
])(
'should handle "%p" state correctly',
async (state, heading, bodyText: string[] = [], linkInfo = undefined, payload = undefined) => {
@@ -195,7 +195,7 @@ describe('Setup', () => {
expect(title).toBeInTheDocument();
// eslint-disable-next-line jest/no-conditional-in-test
if (bodyText.length) {
- bodyText.forEach(text => {
+ bodyText.forEach((text) => {
// eslint-disable-next-line jest/no-conditional-expect
expect(screen.getByText(text)).toBeInTheDocument();
});
@@ -222,7 +222,7 @@ describe('Setup', () => {
(migrateDatabase as jest.Mock).mockResolvedValueOnce({
message: 'MESSAGE',
startedAt: '2022-12-01',
- state: 'MIGRATION_RUNNING'
+ state: 'MIGRATION_RUNNING',
});
(getMigrationStatus as jest.Mock)
.mockResolvedValueOnce({ state: 'MIGRATION_REQUIRED' })
diff --git a/server/sonar-web/src/main/js/apps/marketplace/App.tsx b/server/sonar-web/src/main/js/apps/marketplace/App.tsx
index ece024efdae..05222ad8fa4 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/App.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/App.tsx
@@ -25,7 +25,7 @@ import {
getAvailablePlugins,
getInstalledPlugins,
getInstalledPluginsWithUpdates,
- getPluginUpdates
+ getPluginUpdates,
} from '../../api/plugins';
import { getValue, setSimpleSettingValue } from '../../api/settings';
import DocLink from '../../components/common/DocLink';
@@ -97,7 +97,7 @@ export class App extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
loadingPlugins: false,
- plugins: sortBy(plugins, 'name')
+ plugins: sortBy(plugins, 'name'),
});
}
}, this.stopLoadingPlugins);
@@ -123,7 +123,7 @@ export class App extends React.PureComponent<Props, State> {
acknowledgeRisk = async () => {
await setSimpleSettingValue({
key: SettingsKey.PluginRiskConsent,
- value: RiskConsent.Accepted
+ value: RiskConsent.Accepted,
});
await this.fetchRiskConsent();
@@ -175,7 +175,7 @@ export class App extends React.PureComponent<Props, State> {
<DocLink to="/instance-administration/marketplace/">
{translate('marketplace.page.plugins.description2.link')}
</DocLink>
- )
+ ),
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx b/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx
index f4c18553a1e..102937e6b14 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/EditionBoxes.tsx
@@ -47,7 +47,7 @@ export default class EditionBoxes extends React.PureComponent<Props, State> {
fetchData = () => {
getMarketplaceNavigation().then(
- formData => {
+ (formData) => {
if (this.mounted) {
this.setState({ ...formData });
}
@@ -67,7 +67,7 @@ export default class EditionBoxes extends React.PureComponent<Props, State> {
return (
<div className="spacer-bottom marketplace-editions">
- {visibleEditions.map(edition => (
+ {visibleEditions.map((edition) => (
<EditionBox
currentEdition={currentEdition}
edition={edition}
diff --git a/server/sonar-web/src/main/js/apps/marketplace/MarketplaceAppContainer.tsx b/server/sonar-web/src/main/js/apps/marketplace/MarketplaceAppContainer.tsx
index 3c39c05c05c..78d72cd912e 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/MarketplaceAppContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/MarketplaceAppContainer.tsx
@@ -38,7 +38,7 @@ export function MarketplaceAppContainer(props: MarketplaceAppContainerProps) {
location,
updateCenterActive: appState.settings[GlobalSettingKeys.UpdatecenterActivated] === 'true',
currentEdition: appState.edition as EditionKey,
- standaloneMode: appState.standalone
+ standaloneMode: appState.standalone,
};
return (
diff --git a/server/sonar-web/src/main/js/apps/marketplace/PluginsList.tsx b/server/sonar-web/src/main/js/apps/marketplace/PluginsList.tsx
index 7d0597bf855..8d222e841f8 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/PluginsList.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/PluginsList.tsx
@@ -36,13 +36,13 @@ export interface PluginsListProps {
function getPluginStatus(plugin: Plugin, pending: PluginsListProps['pending']): string | undefined {
const { installing, updating, removing } = pending;
- if (installing.find(p => p.key === plugin.key)) {
+ if (installing.find((p) => p.key === plugin.key)) {
return 'installing';
}
- if (updating.find(p => p.key === plugin.key)) {
+ if (updating.find((p) => p.key === plugin.key)) {
return 'updating';
}
- if (removing.find(p => p.key === plugin.key)) {
+ if (removing.find((p) => p.key === plugin.key)) {
return 'removing';
}
return undefined;
@@ -54,7 +54,7 @@ export default function PluginsList(props: PluginsListProps) {
return (
<div className="boxed-group boxed-group-inner" id="marketplace-plugins">
<ul>
- {sortBy(plugins, ({ name }) => name).map(plugin => (
+ {sortBy(plugins, ({ name }) => name).map((plugin) => (
<li className="panel panel-vertical" key={plugin.key}>
<table className="marketplace-plugin-table">
<tbody>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/Search.tsx b/server/sonar-web/src/main/js/apps/marketplace/Search.tsx
index 8adefc03bb3..03f1bcbbedc 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/Search.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/Search.tsx
@@ -45,8 +45,8 @@ export default class Search extends React.PureComponent<Props> {
disabled: !updateCenterActive,
label: translate('marketplace.updates_only'),
tooltip: !updateCenterActive ? translate('marketplace.not_activated') : undefined,
- value: 'updates'
- }
+ value: 'updates',
+ },
];
return (
<div className="big-spacer-bottom" id="marketplace-search">
diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/__tests__/App-test.tsx
index 98ad7ffbc8f..d014d2682f5 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/App-test.tsx
@@ -23,7 +23,7 @@ import {
getAvailablePlugins,
getInstalledPlugins,
getInstalledPluginsWithUpdates,
- getPluginUpdates
+ getPluginUpdates,
} from '../../../api/plugins';
import { getValue, setSimpleSettingValue } from '../../../api/settings';
import { mockLocation, mockRouter } from '../../../helpers/testMocks';
@@ -40,13 +40,13 @@ jest.mock('../../../api/plugins', () => {
getAvailablePlugins: jest.fn().mockResolvedValue({ plugins: [plugin] }),
getInstalledPlugins: jest.fn().mockResolvedValue([]),
getInstalledPluginsWithUpdates: jest.fn().mockResolvedValue([]),
- getPluginUpdates: jest.fn().mockResolvedValue([])
+ getPluginUpdates: jest.fn().mockResolvedValue([]),
};
});
jest.mock('../../../api/settings', () => ({
getValue: jest.fn().mockResolvedValue({}),
- setSimpleSettingValue: jest.fn().mockResolvedValue(true)
+ setSimpleSettingValue: jest.fn().mockResolvedValue(true),
}));
beforeEach(jest.clearAllMocks);
@@ -108,7 +108,7 @@ function shallowRender(props: Partial<App['props']> = {}) {
pendingPlugins={{
installing: [],
updating: [],
- removing: []
+ removing: [],
}}
router={mockRouter()}
updateCenterActive={false}
diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/EditionBoxes-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/__tests__/EditionBoxes-test.tsx
index b1568cb8b73..086c3ee7585 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/EditionBoxes-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/EditionBoxes-test.tsx
@@ -23,7 +23,7 @@ import { EditionKey } from '../../../types/editions';
import EditionBoxes from '../EditionBoxes';
jest.mock('../../../api/navigation', () => ({
- getMarketplaceNavigation: jest.fn().mockResolvedValue({})
+ getMarketplaceNavigation: jest.fn().mockResolvedValue({}),
}));
it('should display the available edition boxes correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceAppContainer-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceAppContainer-test.tsx
index 476b4035805..9c52889f4fe 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceAppContainer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceAppContainer-test.tsx
@@ -30,9 +30,9 @@ it('should render correctly', () => {
shallowRender({
appState: mockAppState({
settings: {
- [GlobalSettingKeys.UpdatecenterActivated]: 'true'
- }
- })
+ [GlobalSettingKeys.UpdatecenterActivated]: 'true',
+ },
+ }),
}).dive()
).toMatchSnapshot('update center active');
});
diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/PluginUpdates-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/__tests__/PluginUpdates-test.tsx
index 72ca53357bd..b3bf2861b2e 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/PluginUpdates-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/PluginUpdates-test.tsx
@@ -29,19 +29,19 @@ it('should render correctly', () => {
{
requires: [],
status: '',
- release: { date: '2012-02-10', version: '1.3' }
+ release: { date: '2012-02-10', version: '1.3' },
},
{
requires: [],
status: '',
- release: { date: '2012-02-01', version: '1.1' }
+ release: { date: '2012-02-01', version: '1.1' },
},
{
requires: [],
status: '',
- release: { date: '2012-02-02', version: '1.2' }
- }
- ]
+ release: { date: '2012-02-02', version: '1.2' },
+ },
+ ],
})
).toMatchSnapshot('with status');
});
diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/PluginsList-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/__tests__/PluginsList-test.tsx
index c141bcb3924..40b6dc22e7f 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/PluginsList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/PluginsList-test.tsx
@@ -29,8 +29,8 @@ it('should render correctly', () => {
pending: {
installing: [mockPendingPlugin({ key: 'sonar-foo' })],
updating: [mockPendingPlugin({ key: 'sonar-bar' })],
- removing: [mockPendingPlugin({ key: 'sonar-baz' })]
- }
+ removing: [mockPendingPlugin({ key: 'sonar-baz' })],
+ },
})
).toMatchSnapshot('with status');
});
@@ -41,7 +41,7 @@ function shallowRender(props: Partial<PluginsListProps> = {}) {
plugins={[
mockAvailablePlugin({ key: 'sonar-foo' }),
mockAvailablePlugin({ key: 'sonar-bar', name: 'Sonar Bar' }),
- mockAvailablePlugin({ key: 'sonar-baz', name: 'Sonar Baz' })
+ mockAvailablePlugin({ key: 'sonar-baz', name: 'Sonar Baz' }),
]}
pending={{ installing: [], updating: [], removing: [] }}
readOnly={false}
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx
index 20f2890ec2e..b5331db3d42 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx
@@ -140,7 +140,8 @@ export default function EditionBox({ edition, ncloc, serverId, currentEdition }:
<div className="marketplace-edition-action spacer-top">
<Link
to={getEditionUrl(edition, { ncloc, serverId, sourceEdition: currentEdition })}
- target="_blank">
+ target="_blank"
+ >
{translate('marketplace.request_free_trial')}
</Link>
</div>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx
index 4336f3090f4..407a8fb4585 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx
@@ -44,7 +44,7 @@ export default function LicensePromptModal({ onClose }: Props) {
<Link onClick={onClose} to="/admin/extension/license/app">
{translate('license.prompt.link')}
</Link>
- )
+ ),
}}
/>
</div>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx
index 19f4ce99a1b..c823e63aac5 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx
@@ -127,7 +127,8 @@ export default class PluginActions extends React.PureComponent<Props, State> {
checked={this.state.acceptTerms}
className="js-terms"
id={'plugin-terms-' + plugin.key}
- onCheck={this.handleTermsCheck}>
+ onCheck={this.handleTermsCheck}
+ >
<label className="little-spacer-left" htmlFor={'plugin-terms-' + plugin.key}>
{translate('marketplace.i_accept_the')}
</label>
@@ -136,7 +137,8 @@ export default class PluginActions extends React.PureComponent<Props, State> {
className="js-plugin-terms nowrap little-spacer-left"
href={plugin.termsAndConditionsUrl}
target="_blank"
- rel="noopener noreferrer">
+ rel="noopener noreferrer"
+ >
{translate('marketplace.terms_and_conditions')}
</a>
</p>
@@ -157,7 +159,8 @@ export default class PluginActions extends React.PureComponent<Props, State> {
<Button
className="js-uninstall button-red little-spacer-left"
disabled={loading}
- onClick={this.handleUninstall}>
+ onClick={this.handleUninstall}
+ >
{translate('marketplace.uninstall')}
</Button>
</Tooltip>
@@ -170,7 +173,8 @@ export default class PluginActions extends React.PureComponent<Props, State> {
disabled={
loading || (plugin.termsAndConditionsUrl != null && !this.state.acceptTerms)
}
- onClick={this.handleInstall}>
+ onClick={this.handleInstall}
+ >
{translate('marketplace.install')}
</Button>
</Tooltip>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx
index 27819e8f4cc..27ffbb7e4da 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx
@@ -57,7 +57,7 @@ export default function PluginAvailable(props: PluginAvailableProps) {
'marketplace.installing_this_plugin_will_also_install_x',
plugin.update.requires
.filter(({ key }) => !installedPluginKeys.includes(key))
- .map(requiredPlugin => requiredPlugin.name)
+ .map((requiredPlugin) => requiredPlugin.name)
.join(', ')
)}
</strong>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLog.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLog.tsx
index 814d8d69d48..804a55f2fa7 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLog.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLog.tsx
@@ -34,17 +34,15 @@ export default function PluginChangeLog({ release, update }: Props) {
<h6>{translate('changelog')}</h6>
<ul className="js-plugin-changelog-list">
{update.previousUpdates &&
- sortBy(
- update.previousUpdates,
- prevUpdate => prevUpdate.release?.date
- ).map(previousUpdate =>
- previousUpdate.release ? (
- <PluginChangeLogItem
- key={previousUpdate.release.version}
- release={previousUpdate.release}
- update={previousUpdate}
- />
- ) : null
+ sortBy(update.previousUpdates, (prevUpdate) => prevUpdate.release?.date).map(
+ (previousUpdate) =>
+ previousUpdate.release ? (
+ <PluginChangeLogItem
+ key={previousUpdate.release.version}
+ release={previousUpdate.release}
+ update={previousUpdate}
+ />
+ ) : null
)}
<PluginChangeLogItem release={release} update={update} />
</ul>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogButton.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogButton.tsx
index 3367ec62b2a..2fd503c4b1f 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogButton.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogButton.tsx
@@ -33,7 +33,8 @@ export default function PluginChangeLogButton({ release, update }: Props) {
return (
<Dropdown
className="display-inline-block little-spacer-left"
- overlay={<PluginChangeLog release={release} update={update} />}>
+ overlay={<PluginChangeLog release={release} update={update} />}
+ >
<ButtonLink className="js-changelog">
<EllipsisIcon />
</ButtonLink>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx
index 691f92fec35..cbcbba43481 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx
@@ -51,7 +51,8 @@ export default function PluginChangeLogItem({ release, update }: Props) {
className="js-plugin-changelog-link"
href={release.changeLogUrl}
target="_blank"
- rel="noopener noreferrer">
+ rel="noopener noreferrer"
+ >
{translate('marketplace.release_notes')}
</a>
)}
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginLicense.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginLicense.tsx
index 5340bdbc0a9..6565f46b30c 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginLicense.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginLicense.tsx
@@ -37,7 +37,7 @@ export default function PluginLicense({ license }: Props) {
defaultMessage={translate('marketplace.licensed_under_x')}
id="marketplace.licensed_under_x"
values={{
- license: <span className="js-plugin-license">{license}</span>
+ license: <span className="js-plugin-license">{license}</span>,
}}
/>
</li>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginOrganization.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginOrganization.tsx
index c0c5218ba93..e255849869a 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginOrganization.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginOrganization.tsx
@@ -41,12 +41,13 @@ export default function PluginOrganization({ plugin }: PluginOrganizationProps)
className="js-plugin-organization"
href={plugin.organizationUrl}
target="_blank"
- rel="noopener noreferrer">
+ rel="noopener noreferrer"
+ >
{plugin.organizationName}
</a>
) : (
<span className="js-plugin-organization">{plugin.organizationName}</span>
- )
+ ),
}}
/>
</li>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginRiskConsentBox.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginRiskConsentBox.tsx
index 84c2d0ed2b7..3e216de3b38 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginRiskConsentBox.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginRiskConsentBox.tsx
@@ -46,7 +46,8 @@ export default function PluginRiskConsentBox(props: PluginRiskConsentBoxProps) {
)}
<Button
className="display-block big-spacer-top button-primary"
- onClick={props.acknowledgeRisk}>
+ onClick={props.acknowledgeRisk}
+ >
{translate('marketplace.risk_consent.action')}
</Button>
</div>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateButton.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateButton.tsx
index cd1be181feb..1178b6140ad 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateButton.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateButton.tsx
@@ -44,7 +44,8 @@ export default class PluginUpdateButton extends React.PureComponent<Props> {
<Button
className="js-update little-spacer-bottom"
disabled={disabled}
- onClick={this.handleClick}>
+ onClick={this.handleClick}
+ >
{translateWithParameters('marketplace.update_to_x', update.release.version)}
</Button>
</Tooltip>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx
index 1e17f7acbba..bc6b447a649 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx
@@ -45,7 +45,7 @@ export default class PluginUpdateItem extends React.PureComponent<Props, State>
if (show !== undefined) {
this.setState({ changelogOpen: show });
} else {
- this.setState(state => ({ changelogOpen: !state.changelogOpen }));
+ this.setState((state) => ({ changelogOpen: !state.changelogOpen }));
}
};
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdates.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdates.tsx
index af2cea1f297..5499adf3f41 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdates.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdates.tsx
@@ -34,7 +34,7 @@ export default function PluginUpdates({ updates }: PluginUpdatesProps) {
<li className="spacer-top">
<strong>{translate('marketplace.updates')}:</strong>
<ul className="little-spacer-top">
- {updates.map(update =>
+ {updates.map((update) =>
update.release ? (
<PluginUpdateItem
key={update.release.version}
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUrls.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUrls.tsx
index 922a1996168..f4259c081d2 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUrls.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUrls.tsx
@@ -38,7 +38,8 @@ export default function PluginUrls({ plugin }: Props) {
className="js-plugin-homepage"
href={plugin.homepageUrl}
target="_blank"
- rel="noopener noreferrer">
+ rel="noopener noreferrer"
+ >
{translate('marketplace.homepage')}
</a>
</li>
@@ -49,7 +50,8 @@ export default function PluginUrls({ plugin }: Props) {
className="js-plugin-issues"
href={plugin.issueTrackerUrl}
target="_blank"
- rel="noopener noreferrer">
+ rel="noopener noreferrer"
+ >
{translate('marketplace.issue_tracker')}
</a>
</li>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginActions-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginActions-test.tsx
index 05b9d9a539e..95089f66d93 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginActions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginActions-test.tsx
@@ -32,7 +32,7 @@ const installedPlugin: InstalledPlugin = {
termsAndConditionsUrl: 'https://url',
updatedAt: 1,
updates: [{ status: 'COMPATIBLE', requires: [] }],
- version: '7.7'
+ version: '7.7',
};
const availablePlugin: AvailablePlugin = {
@@ -40,7 +40,7 @@ const availablePlugin: AvailablePlugin = {
name: 'Foo',
release: { version: '7.7', date: 'date' },
termsAndConditionsUrl: 'https://url',
- update: { status: 'COMPATIBLE', requires: [] }
+ update: { status: 'COMPATIBLE', requires: [] },
};
it('should render installed plugin correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginAvailable-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginAvailable-test.tsx
index 4fb87c22329..bf39c4a88fb 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginAvailable-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginAvailable-test.tsx
@@ -23,7 +23,7 @@ import {
mockAvailablePlugin,
mockInstalledPlugin,
mockPlugin,
- mockUpdate
+ mockUpdate,
} from '../../../../helpers/mocks/plugins';
import PluginAvailable, { PluginAvailableProps } from '../PluginAvailable';
@@ -33,8 +33,8 @@ it('should render correctly', () => {
expect(
shallowRender({
plugin: mockAvailablePlugin({
- update: mockUpdate({ requires: [mockPlugin()] })
- })
+ update: mockUpdate({ requires: [mockPlugin()] }),
+ }),
})
).toMatchSnapshot('has requirements');
const installed = mockInstalledPlugin({ key: 'sonar-bar', name: 'Sonar Bar' });
@@ -43,9 +43,9 @@ it('should render correctly', () => {
installedPlugins: [installed],
plugin: mockAvailablePlugin({
update: mockUpdate({
- requires: [mockPlugin(), installed]
- })
- })
+ requires: [mockPlugin(), installed],
+ }),
+ }),
})
).toMatchSnapshot('has requirements, some of them already met');
});
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginChangeLog-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginChangeLog-test.tsx
index 1770f2aa660..766930df360 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginChangeLog-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginChangeLog-test.tsx
@@ -33,7 +33,7 @@ function shallowRender(props: Partial<Props> = {}) {
version: '0.11',
date: '2018-11-05',
description: 'Change version description',
- changeLogUrl: 'https://my.change.log/url'
+ changeLogUrl: 'https://my.change.log/url',
}}
update={{
previousUpdates: [
@@ -42,24 +42,24 @@ function shallowRender(props: Partial<Props> = {}) {
version: '0.11',
date: '2018-06-08',
description: 'Change version description',
- changeLogUrl: 'https://my.change.log/url'
+ changeLogUrl: 'https://my.change.log/url',
},
requires: [],
- status: 'COMPATIBLE'
+ status: 'COMPATIBLE',
},
{
release: {
version: '0.10',
date: '2018-06-05',
description: 'Change version description',
- changeLogUrl: 'https://my.change.log/url'
+ changeLogUrl: 'https://my.change.log/url',
},
requires: [],
- status: 'COMPATIBLE'
- }
+ status: 'COMPATIBLE',
+ },
],
requires: [{ key: 'java', name: 'SonarJava', description: 'Code Analyzer for Java' }],
- status: 'COMPATIBLE'
+ status: 'COMPATIBLE',
}}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginDescription-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginDescription-test.tsx
index eaaba29a480..9bcb5a0dfd1 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginDescription-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginDescription-test.tsx
@@ -38,7 +38,7 @@ function getWrapper(props = {}) {
key: 'foo',
name: 'Foo',
description: 'foo description',
- category: 'foocategory'
+ category: 'foocategory',
}}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginOrganization-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginOrganization-test.tsx
index c7fc5619e7a..c3c5770b638 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginOrganization-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginOrganization-test.tsx
@@ -28,7 +28,7 @@ it('should render correctly', () => {
it('should render correctly with no organization name', () => {
const wrapper = shallowRender({
- plugin: { key: 'test', name: 'test', organizationName: undefined }
+ plugin: { key: 'test', name: 'test', organizationName: undefined },
});
expect(wrapper.type()).toBeNull();
});
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginUrls-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginUrls-test.tsx
index 77c361636d3..ed936a92ffd 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginUrls-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/PluginUrls-test.tsx
@@ -42,7 +42,7 @@ function getWrapper(plugin = {}) {
description: 'foo description',
homepageUrl: 'homepageurl',
issueTrackerUrl: 'issuetrackerurl',
- ...plugin
+ ...plugin,
}}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/marketplace/utils.ts b/server/sonar-web/src/main/js/apps/marketplace/utils.ts
index 0e4ed921d4d..12b844f03ff 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/utils.ts
+++ b/server/sonar-web/src/main/js/apps/marketplace/utils.ts
@@ -30,11 +30,11 @@ export interface Query {
const EXCLUDED_PLUGINS = ['license'];
export function filterPlugins(plugins: Plugin[], search?: string): Plugin[] {
if (!search) {
- return plugins.filter(plugin => !EXCLUDED_PLUGINS.includes(plugin.key));
+ return plugins.filter((plugin) => !EXCLUDED_PLUGINS.includes(plugin.key));
}
const s = search.toLowerCase();
- return plugins.filter(plugin => {
+ return plugins.filter((plugin) => {
return (
!EXCLUDED_PLUGINS.includes(plugin.key) &&
(plugin.name.toLowerCase().includes(s) ||
@@ -48,7 +48,7 @@ export const DEFAULT_FILTER = 'all';
export const parseQuery = memoize(
(urlQuery: RawQuery): Query => ({
filter: parseAsString(urlQuery['filter']) || DEFAULT_FILTER,
- search: parseAsString(urlQuery['search'])
+ search: parseAsString(urlQuery['search']),
})
);
@@ -56,6 +56,6 @@ export const serializeQuery = memoize(
(query: Query): RawQuery =>
cleanQuery({
filter: query.filter === DEFAULT_FILTER ? undefined : serializeString(query.filter),
- search: query.search ? serializeString(query.search) : undefined
+ search: query.search ? serializeString(query.search) : undefined,
})
);
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx
index 8fb7721b7d6..3ef1ddcc51c 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx
@@ -24,7 +24,7 @@ import {
DEFAULT_GRAPH,
generateSeries,
getDisplayedHistoryMetrics,
- splitSeriesInGraphs
+ splitSeriesInGraphs,
} from '../../../components/activity-graph/utils';
import ActivityLink from '../../../components/common/ActivityLink';
import DeferredSpinner from '../../../components/ui/DeferredSpinner';
@@ -35,7 +35,7 @@ import { BranchLike } from '../../../types/branch-like';
import {
Analysis as AnalysisType,
GraphType,
- MeasureHistory
+ MeasureHistory,
} from '../../../types/project-activity';
import { Component, Metric } from '../../../types/types';
import Analysis from './Analysis';
@@ -65,7 +65,7 @@ export function ActivityPanel(props: ActivityPanelProps) {
leakPeriodDate,
loading,
measuresHistory,
- metrics
+ metrics,
} = props;
const displayedMetrics = getDisplayedHistoryMetrics(graph, []);
@@ -85,7 +85,7 @@ export function ActivityPanel(props: ActivityPanelProps) {
startDate.getTime() > leakPeriodDate.getTime() ? startDate : leakPeriodDate;
}
- const filteredAnalyses = analyses.filter(a => a.events.length > 0).slice(0, MAX_ANALYSES_NB);
+ const filteredAnalyses = analyses.filter((a) => a.events.length > 0).slice(0, MAX_ANALYSES_NB);
return (
<div className="overview-panel big-spacer-top" data-test="overview__activity-panel">
@@ -100,7 +100,7 @@ export function ActivityPanel(props: ActivityPanelProps) {
analyses={[]}
ariaLabel={translateWithParameters(
'overview.activity.graph_shows_data_for_x',
- displayedMetrics.map(metricKey => localizeMetric(metricKey)).join(', ')
+ displayedMetrics.map((metricKey) => localizeMetric(metricKey)).join(', ')
)}
canShowDataAsTable={false}
graph={graph}
@@ -121,12 +121,13 @@ export function ActivityPanel(props: ActivityPanelProps) {
<div data-test="overview__activity-analyses">
<DeferredSpinner
className="spacer-top spacer-left"
- loading={analyses.length === 0 && loading}>
+ loading={analyses.length === 0 && loading}
+ >
{analyses.length === 0 ? (
<p className="spacer-top spacer-left note">{translate('no_results')}</p>
) : (
<ul className="spacer-top spacer-left">
- {filteredAnalyses.map(analysis => (
+ {filteredAnalyses.map((analysis) => (
<Analysis
analysis={analysis}
key={analysis.key}
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx b/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx
index 6a8f47d9001..c5f866871a1 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx
@@ -34,7 +34,7 @@ export function Analysis({ analysis, ...props }: AnalysisProps) {
const sortedEvents = sortBy(
analysis.events,
// versions first
- event => (event.category === 'VERSION' ? 0 : 1),
+ (event) => (event.category === 'VERSION' ? 0 : 1),
// then the rest sorted by category
'category'
);
@@ -55,7 +55,7 @@ export function Analysis({ analysis, ...props }: AnalysisProps) {
{sortedEvents.length > 0 ? (
<div className="overview-activity-events">
- {sortedEvents.map(event => (
+ {sortedEvents.map((event) => (
<Event event={event} key={event.key} />
))}
</div>
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/ApplicationLeakPeriodInfo.tsx b/server/sonar-web/src/main/js/apps/overview/branches/ApplicationLeakPeriodInfo.tsx
index 27c8821aea3..24826848cfc 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/ApplicationLeakPeriodInfo.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/ApplicationLeakPeriodInfo.tsx
@@ -31,7 +31,7 @@ export function ApplicationLeakPeriodInfo({ leakPeriod }: ApplicationLeakPeriodI
return (
<div className="note spacer-top display-inline-flex-center">
<DateFromNow date={leakPeriod.date}>
- {fromNow => translateWithParameters('overview.started_x', fromNow)}
+ {(fromNow) => translateWithParameters('overview.started_x', fromNow)}
</DateFromNow>
<HelpTooltip
className="little-spacer-left"
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx
index cafc0f47fc1..d603c816fb3 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverview.tsx
@@ -27,19 +27,19 @@ import { getAllTimeMachineData } from '../../../api/time-machine';
import {
getActivityGraph,
getHistoryMetrics,
- saveActivityGraph
+ saveActivityGraph,
} from '../../../components/activity-graph/utils';
import {
getBranchLikeDisplayName,
getBranchLikeQuery,
isMainBranch,
- isSameBranchLike
+ isSameBranchLike,
} from '../../../helpers/branch-like';
import { parseDate, toNotSoISOString } from '../../../helpers/dates';
import { enhanceConditionWithMeasure, enhanceMeasuresWithMetrics } from '../../../helpers/measures';
import {
extractStatusConditionsFromApplicationStatusChildProject,
- extractStatusConditionsFromProjectStatus
+ extractStatusConditionsFromProjectStatus,
} from '../../../helpers/qualityGates';
import { isDefined } from '../../../helpers/types';
import { ProjectAlmBindingResponse } from '../../../types/alm-settings';
@@ -127,12 +127,13 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
// data for the application as a whole.
const appStatus = await getApplicationQualityGate({
application: component.key,
- ...getBranchLikeQuery(branch)
+ ...getBranchLikeQuery(branch),
});
- const { measures: appMeasures, metrics, period } = await this.loadMeasuresAndMeta(
- component.key,
- branch
- );
+ const {
+ measures: appMeasures,
+ metrics,
+ period,
+ } = await this.loadMeasuresAndMeta(component.key, branch);
const appBranchName =
(branch && !isMainBranch(branch) && getBranchLikeDisplayName(branch)) || undefined;
@@ -141,13 +142,13 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
// We also need to load the application leak periods separately.
getApplicationLeak(component.key, appBranchName).then(
- leaks => {
+ (leaks) => {
if (this.mounted && leaks && leaks.length) {
- const sortedLeaks = sortBy(leaks, leak => {
+ const sortedLeaks = sortBy(leaks, (leak) => {
return new Date(leak.date);
});
this.setState({
- appLeak: sortedLeaks[0]
+ appLeak: sortedLeaks[0],
});
}
},
@@ -163,8 +164,8 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
// them at the parent application level will not get all the necessary
// information, unfortunately, as they are aggregated.
Promise.all(
- appStatus.projects.map(project => {
- const projectDetails = appDetails.projects.find(p => p.key === project.key);
+ appStatus.projects.map((project) => {
+ const projectDetails = appDetails.projects.find((p) => p.key === project.key);
const projectBranchLike = projectDetails
? { isMain: projectDetails.isMain, name: projectDetails.branch, excludedFromPurge: false }
: undefined;
@@ -174,15 +175,15 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
projectBranchLike,
// Only load metrics that apply to failing QG conditions; we don't
// need the others anyway.
- project.conditions.filter(c => c.status !== 'OK').map(c => c.metric)
+ project.conditions.filter((c) => c.status !== 'OK').map((c) => c.metric)
).then(({ measures }) => ({
measures,
project,
- projectBranchLike
+ projectBranchLike,
}));
})
).then(
- results => {
+ (results) => {
if (this.mounted) {
const qgStatuses = results.map(({ measures = [], project, projectBranchLike }) => {
const { key, name, status } = project;
@@ -194,7 +195,7 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
key,
name,
status,
- branchLike: projectBranchLike
+ branchLike: projectBranchLike,
};
});
@@ -203,7 +204,7 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
measures: appMeasures,
metrics,
period,
- qgStatuses
+ qgStatuses,
});
}
},
@@ -218,20 +219,20 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
loadProjectStatus = async () => {
const {
branch,
- component: { key, name }
+ component: { key, name },
} = this.props;
this.setState({ loadingStatus: true });
const projectStatus = await getQualityGateProjectStatus({
projectKey: key,
- ...getBranchLikeQuery(branch)
+ ...getBranchLikeQuery(branch),
});
// Get failing condition metric keys. We need measures for them as well to
// render them.
const metricKeys =
projectStatus.conditions !== undefined
- ? uniq([...METRICS, ...projectStatus.conditions.map(c => c.metricKey)])
+ ? uniq([...METRICS, ...projectStatus.conditions.map((c) => c.metricKey)])
: METRICS;
this.loadMeasuresAndMeta(key, branch, metricKeys).then(
@@ -247,7 +248,7 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
key,
name,
status,
- branchLike: branch
+ branchLike: branch,
};
this.setState({
@@ -255,7 +256,7 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
measures,
metrics,
period,
- qgStatuses: [qgStatus]
+ qgStatuses: [qgStatus],
});
} else if (this.mounted) {
this.setState({ loadingStatus: false, qgStatuses: undefined });
@@ -282,7 +283,7 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
return {
measures: enhanceMeasuresWithMetrics(measures || [], metrics || []),
metrics,
- period
+ period,
};
});
};
@@ -307,18 +308,18 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
...getBranchLikeQuery(branch),
from: FROM_DATE,
component: component.key,
- metrics: metrics.join()
+ metrics: metrics.join(),
}).then(
({ measures }) => {
if (this.mounted) {
this.setState({
- measuresHistory: measures.map(measure => ({
+ measuresHistory: measures.map((measure) => ({
metric: measure.metric,
- history: measure.history.map(analysis => ({
+ history: measure.history.map((analysis) => ({
date: parseDate(analysis.date),
- value: analysis.value
- }))
- }))
+ value: analysis.value,
+ })),
+ })),
});
}
},
@@ -332,7 +333,7 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
return getProjectActivity({
...getBranchLikeQuery(branch),
project: this.getTopLevelComponent(),
- from: FROM_DATE
+ from: FROM_DATE,
}).then(
({ analyses }) => {
if (this.mounted) {
@@ -341,7 +342,7 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
analyses.length > 0
? analyses[0].detectedCI !== undefined && analyses[0].detectedCI !== NO_CI_DETECTED
: undefined,
- analyses
+ analyses,
});
}
},
@@ -352,10 +353,10 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
getFailedConditions = (conditions: QualityGateStatusCondition[], measures: MeasureEnhanced[]) => {
return (
conditions
- .filter(c => c.level !== 'OK')
+ .filter((c) => c.level !== 'OK')
// Enhance them with Metric information, which will be needed
// to render the conditions properly.
- .map(c => enhanceConditionWithMeasure(c, measures))
+ .map((c) => enhanceConditionWithMeasure(c, measures))
// The enhancement will return undefined if it cannot find the
// appropriate measure. Make sure we filter them out.
.filter(isDefined)
@@ -367,11 +368,13 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
let current = component.breadcrumbs.length - 1;
while (
current > 0 &&
- !([
- ComponentQualifier.Project,
- ComponentQualifier.Portfolio,
- ComponentQualifier.Application
- ] as string[]).includes(component.breadcrumbs[current].qualifier)
+ !(
+ [
+ ComponentQualifier.Project,
+ ComponentQualifier.Portfolio,
+ ComponentQualifier.Application,
+ ] as string[]
+ ).includes(component.breadcrumbs[current].qualifier)
) {
current--;
}
@@ -381,7 +384,7 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
doneLoadingHistory = () => {
if (this.mounted) {
this.setState({
- loadingHistory: false
+ loadingHistory: false,
});
}
};
@@ -407,13 +410,13 @@ export default class BranchOverview extends React.PureComponent<Props, State> {
measuresHistory,
metrics,
period,
- qgStatuses
+ qgStatuses,
} = this.state;
const projectIsEmpty =
loadingStatus === false &&
(measures === undefined ||
- measures.find(measure =>
+ measures.find((measure) =>
([MetricKey.lines, MetricKey.new_lines] as string[]).includes(measure.metric.key)
) === undefined);
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx
index 969790a0bfb..324c7879b90 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx
@@ -71,7 +71,7 @@ export function BranchOverviewRenderer(props: BranchOverviewRendererProps) {
period,
projectBinding,
projectIsEmpty,
- qgStatuses
+ qgStatuses,
} = props;
const leakPeriod = component.qualifier === ComponentQualifier.Application ? appLeak : period;
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/DebtValue.tsx b/server/sonar-web/src/main/js/apps/overview/branches/DebtValue.tsx
index e9219dfb5f7..c1028a58585 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/DebtValue.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/DebtValue.tsx
@@ -62,7 +62,8 @@ export function DebtValue(props: DebtValueProps) {
branchLike={branchLike}
className="overview-measures-value text-light"
component={component.key}
- metric={metricKey}>
+ metric={metricKey}
+ >
{formattedValue}
</DrilldownLink>
)}
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/DrilldownMeasureValue.tsx b/server/sonar-web/src/main/js/apps/overview/branches/DrilldownMeasureValue.tsx
index 87846f3f6c9..299730855c7 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/DrilldownMeasureValue.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/DrilldownMeasureValue.tsx
@@ -51,7 +51,8 @@ export function DrilldownMeasureValue(props: DrilldownMeasureValueProps) {
branchLike={branchLike}
className="overview-measures-value text-light"
component={component.key}
- metric={metric}>
+ metric={metric}
+ >
{formatMeasure(measure.value, 'SHORT_INT')}
</DrilldownLink>
</span>
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/Event.tsx b/server/sonar-web/src/main/js/apps/overview/branches/Event.tsx
index b10845593df..cd0103a767f 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/Event.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/Event.tsx
@@ -34,7 +34,8 @@ export function Event({ event }: Props) {
return (
<span
className="overview-analysis-event analysis-version text-ellipsis max-width-80"
- title={`${translate('version')} ${event.name}`}>
+ title={`${translate('version')} ${event.name}`}
+ >
{event.name}
</span>
);
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx b/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx
index cde368eb107..cbe175cb33a 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx
@@ -39,13 +39,8 @@ export interface FirstAnalysisNextStepsNotifProps {
}
export function FirstAnalysisNextStepsNotif(props: FirstAnalysisNextStepsNotifProps) {
- const {
- component,
- currentUser,
- branchesEnabled,
- detectedCIOnLastAnalysis,
- projectBinding
- } = props;
+ const { component, currentUser, branchesEnabled, detectedCIOnLastAnalysis, projectBinding } =
+ props;
if (!isLoggedIn(currentUser) || component.qualifier !== ComponentQualifier.Project) {
return null;
@@ -67,8 +62,9 @@ export function FirstAnalysisNextStepsNotif(props: FirstAnalysisNextStepsNotifPr
<Link
to={{
pathname: '/tutorials',
- search: queryToSearch({ id: component.key })
- }}>
+ search: queryToSearch({ id: component.key }),
+ }}
+ >
{translate('overview.project.next_steps.links.set_up_ci')}
</Link>
);
@@ -78,9 +74,10 @@ export function FirstAnalysisNextStepsNotif(props: FirstAnalysisNextStepsNotifPr
pathname: '/project/settings',
search: queryToSearch({
id: component.key,
- category: PULL_REQUEST_DECORATION_BINDING_CATEGORY
- })
- }}>
+ category: PULL_REQUEST_DECORATION_BINDING_CATEGORY,
+ }),
+ }}
+ >
{translate('overview.project.next_steps.links.project_settings')}
</Link>
);
@@ -92,7 +89,7 @@ export function FirstAnalysisNextStepsNotif(props: FirstAnalysisNextStepsNotifPr
defaultMessage={translate('overview.project.next_steps.set_up_ci')}
id="overview.project.next_steps.set_up_ci"
values={{
- link: tutorialsLink
+ link: tutorialsLink,
}}
/>
)}
@@ -103,7 +100,7 @@ export function FirstAnalysisNextStepsNotif(props: FirstAnalysisNextStepsNotifPr
defaultMessage={translate('overview.project.next_steps.set_up_pr_deco.admin')}
id="overview.project.next_steps.set_up_pr_deco.admin"
values={{
- link_project_settings: projectSettingsLink
+ link_project_settings: projectSettingsLink,
}}
/>
) : (
@@ -117,7 +114,7 @@ export function FirstAnalysisNextStepsNotif(props: FirstAnalysisNextStepsNotifPr
id="overview.project.next_steps.set_up_pr_deco_and_ci.admin"
values={{
link_ci: tutorialsLink,
- link_project_settings: projectSettingsLink
+ link_project_settings: projectSettingsLink,
}}
/>
) : (
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanel.tsx
index e3be38745b2..5819bf69b2e 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanel.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanel.tsx
@@ -51,13 +51,13 @@ export interface MeasuresPanelProps {
export enum MeasuresPanelTabs {
New = 'new',
- Overall = 'overall'
+ Overall = 'overall',
}
export function MeasuresPanel(props: MeasuresPanelProps) {
const { appLeak, branch, component, loading, measures = [], period, location } = props;
- const hasDiffMeasures = measures.some(m => isDiffMetric(m.metric.key));
+ const hasDiffMeasures = measures.some((m) => isDiffMetric(m.metric.key));
const isApp = component.qualifier === ComponentQualifier.Application;
const leakPeriod = isApp ? appLeak : period;
const query = parseQuery(location.query);
@@ -88,7 +88,7 @@ export function MeasuresPanel(props: MeasuresPanelProps) {
<span className="text-bold">{translate('overview.new_code')}</span>
{leakPeriod && <LeakPeriodInfo leakPeriod={leakPeriod} />}
</div>
- )
+ ),
},
{
key: MeasuresPanelTabs.Overall,
@@ -98,8 +98,8 @@ export function MeasuresPanel(props: MeasuresPanelProps) {
{translate('overview.overall_code')}
</span>
</div>
- )
- }
+ ),
+ },
];
return (
@@ -115,13 +115,14 @@ export function MeasuresPanel(props: MeasuresPanelProps) {
</div>
) : (
<>
- <BoxedTabs onSelect={key => selectTab(key)} selected={tab} tabs={tabs} />
+ <BoxedTabs onSelect={(key) => selectTab(key)} selected={tab} tabs={tabs} />
<div
className="overview-panel-content flex-1 bordered"
role="tabpanel"
id={getTabPanelId(tab)}
- aria-labelledby={getTabId(tab)}>
+ aria-labelledby={getTabId(tab)}
+ >
{!hasDiffMeasures && isNewCodeTab ? (
<MeasuresPanelNoNewCode branch={branch} component={component} period={period} />
) : (
@@ -130,7 +131,7 @@ export function MeasuresPanel(props: MeasuresPanelProps) {
IssueType.Bug,
IssueType.Vulnerability,
IssueType.SecurityHotspot,
- IssueType.CodeSmell
+ IssueType.CodeSmell,
].map((type: IssueType) => (
<MeasuresPanelIssueMeasureRow
branchLike={branch}
@@ -147,7 +148,8 @@ export function MeasuresPanel(props: MeasuresPanelProps) {
findMeasure(measures, MetricKey.new_coverage)) && (
<div
className="overview-panel-huge-padded flex-1 bordered-right display-flex-center"
- data-test="overview__measures-coverage">
+ data-test="overview__measures-coverage"
+ >
<MeasurementLabel
branchLike={branch}
centered={isNewCodeTab}
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx
index e62fe9e6475..249beb351e7 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelIssueMeasureRow.tsx
@@ -44,7 +44,8 @@ export default function MeasuresPanelIssueMeasureRow(props: MeasuresPanelIssueMe
return (
<div
className="display-flex-row overview-measures-row"
- data-test={`overview__measures-${type.toString().toLowerCase()}`}>
+ data-test={`overview__measures-${type.toString().toLowerCase()}`}
+ >
{type === IssueType.CodeSmell ? (
<>
<div className="overview-panel-big-padded flex-1 small display-flex-center big-spacer-left">
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx
index 15cdb87860c..5378e8fdd97 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/MeasuresPanelNoNewCode.tsx
@@ -79,11 +79,12 @@ export default function MeasuresPanelNoNewCode(props: MeasuresPanelNoNewCodeProp
<Link
to={{
pathname: '/project/baseline',
- search: queryToSearch({ id: component.key, ...getBranchLikeQuery(branch) })
- }}>
+ search: queryToSearch({ id: component.key, ...getBranchLikeQuery(branch) }),
+ }}
+ >
{translate('settings.new_code_period.category')}
</Link>
- )
+ ),
}}
/>
</p>
@@ -96,7 +97,7 @@ export default function MeasuresPanelNoNewCode(props: MeasuresPanelNoNewCodeProp
values={{
learn_more_link: (
<DocLink to="/user-guide/clean-as-you-code/">{translate('learn_more')}</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/NoCodeWarning.tsx b/server/sonar-web/src/main/js/apps/overview/branches/NoCodeWarning.tsx
index de302036cf1..a0bfd6f8085 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/NoCodeWarning.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/NoCodeWarning.tsx
@@ -52,7 +52,7 @@ export function NoCodeWarning({ branchLike, component, measures }: Props) {
if (isApp) {
if (
measures === undefined ||
- measures.find(measure => measure.metric.key === MetricKey.projects) === undefined
+ measures.find((measure) => measure.metric.key === MetricKey.projects) === undefined
) {
title = translate('portfolio.app.empty');
} else {
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx b/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx
index eccfce5a45a..c5c462a9530 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/ProjectLeakPeriodInfo.tsx
@@ -33,7 +33,7 @@ export interface ProjectLeakPeriodInfoProps extends WrappedComponentProps {
export function ProjectLeakPeriodInfo(props: ProjectLeakPeriodInfoProps) {
const {
intl: { formatDate, formatTime },
- leakPeriod
+ leakPeriod,
} = props;
const leakPeriodLabel = getPeriodLabel(
@@ -67,7 +67,7 @@ export function ProjectLeakPeriodInfo(props: ProjectLeakPeriodInfoProps) {
{leakPeriodLabel}
</div>
<DateFromNow date={leakPeriodDate}>
- {fromNow => (
+ {(fromNow) => (
<div className="note little-spacer-top">
{translateWithParameters(
leakPeriod.mode === 'previous_analysis'
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx
index 800bbee2f37..47c8d400aec 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanel.tsx
@@ -42,7 +42,7 @@ export function QualityGatePanel(props: QualityGatePanelProps) {
return null;
}
- const overallLevel = qgStatuses.map(s => s.status).includes('ERROR') ? 'ERROR' : 'OK';
+ const overallLevel = qgStatuses.map((s) => s.status).includes('ERROR') ? 'ERROR' : 'OK';
const success = overallLevel === 'OK';
const overallFailedConditionsCount = qgStatuses.reduce(
@@ -53,7 +53,7 @@ export function QualityGatePanel(props: QualityGatePanelProps) {
const showIgnoredConditionWarning =
component.qualifier === 'TRK' &&
qgStatuses !== undefined &&
- qgStatuses.some(p => Boolean(p.ignoredConditions));
+ qgStatuses.some((p) => Boolean(p.ignoredConditions));
return (
<div className="overview-panel" data-test="overview__quality-gate-panel">
@@ -92,8 +92,9 @@ export function QualityGatePanel(props: QualityGatePanelProps) {
<div
className={classNames('overview-quality-gate-badge-large', {
failed: !success,
- success
- })}>
+ success,
+ })}
+ >
<h3 className="big-spacer-bottom huge">{translate('metric.level', overallLevel)}</h3>
<span className="small">
@@ -108,7 +109,7 @@ export function QualityGatePanel(props: QualityGatePanelProps) {
{overallFailedConditionsCount > 0 && (
<div data-test="overview__quality-gate-conditions">
- {qgStatuses.map(qgStatus => (
+ {qgStatuses.map((qgStatus) => (
<QualityGatePanelSection
component={component}
key={qgStatus.key}
@@ -121,7 +122,7 @@ export function QualityGatePanel(props: QualityGatePanelProps) {
)}
</div>
<SonarLintPromotion
- qgConditions={flatMap(qgStatuses, qgStatus => qgStatus.failedConditions)}
+ qgConditions={flatMap(qgStatuses, (qgStatus) => qgStatus.failedConditions)}
/>
</div>
);
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanelSection.tsx b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanelSection.tsx
index efd1fdaae20..0fc0748abb6 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanelSection.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/QualityGatePanelSection.tsx
@@ -34,8 +34,8 @@ export interface QualityGatePanelSectionProps {
export function QualityGatePanelSection(props: QualityGatePanelSectionProps) {
const { component, qgStatus } = props;
- const newCodeFailedConditions = qgStatus.failedConditions.filter(c => isDiffMetric(c.metric));
- const overallFailedConditions = qgStatus.failedConditions.filter(c => !isDiffMetric(c.metric));
+ const newCodeFailedConditions = qgStatus.failedConditions.filter((c) => isDiffMetric(c.metric));
+ const overallFailedConditions = qgStatus.failedConditions.filter((c) => !isDiffMetric(c.metric));
if (newCodeFailedConditions.length === 0 && overallFailedConditions.length === 0) {
return null;
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-test.tsx
index 93f43fa5705..3488e272750 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-test.tsx
@@ -36,7 +36,7 @@ it('should render correctly', () => {
it('should correctly pass the leak period start date', () => {
// Leak period start is more recent than the oldest historic measure.
let { leakPeriodDate } = shallowRender({
- leakPeriodDate: parseDate('2017-08-27T16:33:50+0200')
+ leakPeriodDate: parseDate('2017-08-27T16:33:50+0200'),
})
.find(GraphsHistory)
.props();
@@ -59,9 +59,9 @@ function shallowRender(props: Partial<ActivityPanelProps> = {}) {
component={mockComponent()}
graph={GraphType.issues}
loading={false}
- measuresHistory={[mockMeasure()].map(m => ({
+ measuresHistory={[mockMeasure()].map((m) => ({
...m,
- history: [{ date: parseDate('2016-10-27T16:33:50+0200'), value: '20' }]
+ history: [{ date: parseDate('2016-10-27T16:33:50+0200'), value: '20' }],
}))}
metrics={[mockMetric({ key: 'bugs' })]}
onGraphChange={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Analysis-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Analysis-test.tsx
index d5d1e9fd151..482240bed3d 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Analysis-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Analysis-test.tsx
@@ -34,8 +34,8 @@ function shallowRender(props: Partial<AnalysisProps> = {}) {
analysis={mockAnalysis({
events: [
{ key: '1', category: 'OTHER', name: 'test' },
- { key: '2', category: 'VERSION', name: '6.5-SNAPSHOT' }
- ]
+ { key: '2', category: 'VERSION', name: '6.5-SNAPSHOT' },
+ ],
})}
qualifier={ComponentQualifier.Project}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ApplicationLeakPeriodInfo-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ApplicationLeakPeriodInfo-test.tsx
index 58e6d7988c9..b6044a3bfd0 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ApplicationLeakPeriodInfo-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ApplicationLeakPeriodInfo-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { mockApplicationPeriod } from '../../../../helpers/mocks/application';
import {
ApplicationLeakPeriodInfo,
- ApplicationLeakPeriodInfoProps
+ ApplicationLeakPeriodInfoProps,
} from '../ApplicationLeakPeriodInfo';
jest.mock('../../../../components/intl/DateFromNow');
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx
index fba029f57fa..a97bb9ea6cb 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-test.tsx
@@ -24,7 +24,7 @@ import { getMeasuresWithPeriodAndMetrics } from '../../../../api/measures';
import { getProjectActivity } from '../../../../api/projectActivity';
import {
getApplicationQualityGate,
- getQualityGateProjectStatus
+ getQualityGateProjectStatus,
} from '../../../../api/quality-gates';
import { getAllTimeMachineData } from '../../../../api/time-machine';
import { getActivityGraph, saveActivityGraph } from '../../../../components/activity-graph/utils';
@@ -41,8 +41,8 @@ import BranchOverview, { BRANCH_OVERVIEW_ACTIVITY_GRAPH, NO_CI_DETECTED } from '
import BranchOverviewRenderer from '../BranchOverviewRenderer';
jest.mock('../../../../helpers/dates', () => ({
- parseDate: jest.fn(date => `PARSED:${date}`),
- toNotSoISOString: jest.fn(date => date)
+ parseDate: jest.fn((date) => `PARSED:${date}`),
+ toNotSoISOString: jest.fn((date) => date),
}));
jest.mock('../../../../api/measures', () => {
@@ -51,7 +51,7 @@ jest.mock('../../../../api/measures', () => {
getMeasuresWithPeriodAndMetrics: jest.fn((_, metricKeys: string[]) => {
const metrics: Metric[] = [];
const measures: Measure[] = [];
- metricKeys.forEach(key => {
+ metricKeys.forEach((key) => {
if (key === 'unknown_metric') {
return;
}
@@ -68,18 +68,18 @@ jest.mock('../../../../api/measures', () => {
measures.push(
mockMeasure({
metric: key,
- ...(isDiffMetric(key) ? { leak: '1' } : { period: undefined })
+ ...(isDiffMetric(key) ? { leak: '1' } : { period: undefined }),
})
);
});
return Promise.resolve({
component: {
measures,
- name: 'foo'
+ name: 'foo',
},
- metrics
+ metrics,
});
- })
+ }),
};
});
@@ -99,7 +99,7 @@ jest.mock('../../../../api/quality-gates', () => {
errorThreshold: '1.0',
metricKey: MetricKey.new_bugs,
periodIndex: 1,
- status: 'ERROR'
+ status: 'ERROR',
},
{
actualValue: '5',
@@ -107,7 +107,7 @@ jest.mock('../../../../api/quality-gates', () => {
errorThreshold: '2.0',
metricKey: MetricKey.bugs,
periodIndex: 0,
- status: 'ERROR'
+ status: 'ERROR',
},
{
actualValue: '2',
@@ -115,12 +115,12 @@ jest.mock('../../../../api/quality-gates', () => {
errorThreshold: '1.0',
metricKey: 'unknown_metric',
periodIndex: 0,
- status: 'ERROR'
- }
- ]
+ status: 'ERROR',
+ },
+ ],
})
),
- getApplicationQualityGate: jest.fn().mockResolvedValue(mockQualityGateApplicationStatus())
+ getApplicationQualityGate: jest.fn().mockResolvedValue(mockQualityGateApplicationStatus()),
};
});
@@ -134,12 +134,12 @@ jest.mock('../../../../api/time-machine', () => {
{ metric: MetricKey.sqale_index, history: [{ date: '2019-01-01', value: '1.0' }] },
{
metric: MetricKey.duplicated_lines_density,
- history: [{ date: '2019-01-02', value: '1.0' }]
+ history: [{ date: '2019-01-02', value: '1.0' }],
},
{ metric: MetricKey.ncloc, history: [{ date: '2019-01-03', value: '10000' }] },
- { metric: MetricKey.coverage, history: [{ date: '2019-01-04', value: '95.5' }] }
- ]
- })
+ { metric: MetricKey.coverage, history: [{ date: '2019-01-04', value: '95.5' }] },
+ ],
+ }),
};
});
@@ -152,9 +152,9 @@ jest.mock('../../../../api/projectActivity', () => {
mockAnalysis(),
mockAnalysis(),
mockAnalysis(),
- mockAnalysis()
- ]
- })
+ mockAnalysis(),
+ ],
+ }),
};
});
@@ -167,18 +167,18 @@ jest.mock('../../../../api/application', () => ({
{
branch: 'foo',
key: 'KEY-P1',
- name: 'P1'
- }
+ name: 'P1',
+ },
],
- visibility: 'Private'
+ visibility: 'Private',
}),
getApplicationLeak: jest.fn().mockResolvedValue([
{
date: '2017-01-05',
project: 'foo',
- projectName: 'Foo'
- }
- ])
+ projectName: 'Foo',
+ },
+ ]),
}));
jest.mock('../../../../components/activity-graph/utils', () => {
@@ -187,7 +187,7 @@ jest.mock('../../../../components/activity-graph/utils', () => {
return {
getActivityGraph: jest.fn(() => ({ graph: GraphType.coverage })),
saveActivityGraph: jest.fn(),
- getHistoryMetrics: jest.fn(() => [MetricKey.lines_to_cover, MetricKey.uncovered_lines])
+ getHistoryMetrics: jest.fn(() => [MetricKey.lines_to_cover, MetricKey.uncovered_lines]),
};
});
@@ -215,7 +215,7 @@ describe('project overview', () => {
expect.objectContaining({
name: 'Foo',
key: 'foo',
- status: 'ERROR'
+ status: 'ERROR',
})
);
@@ -226,16 +226,16 @@ describe('project overview', () => {
level: 'ERROR',
metric: MetricKey.new_bugs,
measure: expect.objectContaining({
- metric: expect.objectContaining({ key: MetricKey.new_bugs })
- })
+ metric: expect.objectContaining({ key: MetricKey.new_bugs }),
+ }),
});
expect(failedConditions[1]).toMatchObject({
actual: '5',
level: 'ERROR',
metric: MetricKey.bugs,
measure: expect.objectContaining({
- metric: expect.objectContaining({ key: MetricKey.bugs })
- })
+ metric: expect.objectContaining({ key: MetricKey.bugs }),
+ }),
});
});
@@ -251,7 +251,7 @@ describe('project overview', () => {
describe('application overview', () => {
const component = mockComponent({
breadcrumbs: [mockComponent({ key: 'foo', qualifier: ComponentQualifier.Application })],
- qualifier: ComponentQualifier.Application
+ qualifier: ComponentQualifier.Application,
});
it('should render correctly', async () => {
@@ -283,7 +283,7 @@ describe('application overview', () => {
expect.objectContaining({
name: 'Foo',
key: 'foo',
- status: 'ERROR'
+ status: 'ERROR',
})
);
@@ -294,23 +294,23 @@ describe('application overview', () => {
level: 'ERROR',
metric: MetricKey.coverage,
measure: expect.objectContaining({
- metric: expect.objectContaining({ key: MetricKey.coverage })
- })
+ metric: expect.objectContaining({ key: MetricKey.coverage }),
+ }),
});
expect(failedConditions1[1]).toMatchObject({
actual: '5',
level: 'ERROR',
metric: MetricKey.new_bugs,
measure: expect.objectContaining({
- metric: expect.objectContaining({ key: MetricKey.new_bugs })
- })
+ metric: expect.objectContaining({ key: MetricKey.new_bugs }),
+ }),
});
expect(qgStatus1).toEqual(
expect.objectContaining({
name: 'Foo',
key: 'foo',
- status: 'ERROR'
+ status: 'ERROR',
})
);
@@ -321,8 +321,8 @@ describe('application overview', () => {
level: 'ERROR',
metric: MetricKey.new_bugs,
measure: expect.objectContaining({
- metric: expect.objectContaining({ key: MetricKey.new_bugs })
- })
+ metric: expect.objectContaining({ key: MetricKey.new_bugs }),
+ }),
});
});
@@ -347,7 +347,7 @@ it("should correctly load a component's history", async () => {
expect(measuresHistory![0]).toEqual(
expect.objectContaining({
metric: MetricKey.bugs,
- history: [{ date: 'PARSED:2019-01-05', value: '2.0' }]
+ history: [{ date: 'PARSED:2019-01-05', value: '2.0' }],
})
);
});
@@ -356,7 +356,7 @@ it.each([
['no analysis', [], undefined],
['1 analysis, no CI data', [mockAnalysis()], false],
['1 analysis, no CI detected', [mockAnalysis({ detectedCI: NO_CI_DETECTED })], false],
- ['1 analysis, CI detected', [mockAnalysis({ detectedCI: 'Cirrus CI' })], true]
+ ['1 analysis, CI detected', [mockAnalysis({ detectedCI: 'Cirrus CI' })], true],
])(
"should correctly flag a project that wasn't analyzed using a CI (%s)",
async (_, analyses, expected) => {
@@ -389,7 +389,7 @@ function shallowRender(props: Partial<BranchOverview['props']> = {}) {
component={mockComponent({
breadcrumbs: [mockComponent({ key: 'foo' })],
key: 'foo',
- name: 'Foo'
+ name: 'Foo',
})}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DebtValue-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DebtValue-test.tsx
index df5a657faee..fe0f25d23e3 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DebtValue-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/DebtValue-test.tsx
@@ -38,7 +38,7 @@ function shallowRender(props: Partial<DebtValueProps> = {}) {
component={mockComponent()}
measures={[
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.sqale_index }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_technical_debt }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_technical_debt }) }),
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Event-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Event-test.tsx
index 9426d128179..5eaccc938bc 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Event-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/Event-test.tsx
@@ -42,8 +42,8 @@ it('should render rich quality gate event', () => {
qualityGate: {
failing: [{ branch: 'master', key: 'foo', name: 'Foo' }],
status: 'ERROR',
- stillFailing: true
- }
+ stillFailing: true,
+ },
};
expect(shallow(<Event event={event} />)).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx
index 0f4ba3d37ba..16547a5448f 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx
@@ -25,14 +25,14 @@ import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks
import { ComponentQualifier } from '../../../../types/component';
import {
FirstAnalysisNextStepsNotif,
- FirstAnalysisNextStepsNotifProps
+ FirstAnalysisNextStepsNotifProps,
} from '../FirstAnalysisNextStepsNotif';
it('should render correctly', () => {
expect(shallowRender({ currentUser: mockCurrentUser() }).type()).toBeNull();
expect(
shallowRender({
- component: mockComponent({ qualifier: ComponentQualifier.Application })
+ component: mockComponent({ qualifier: ComponentQualifier.Application }),
}).type()
).toBeNull();
expect(shallowRender({ detectedCIOnLastAnalysis: false })).toMatchSnapshot(
@@ -40,26 +40,26 @@ it('should render correctly', () => {
);
expect(
shallowRender({
- projectBinding: undefined
+ projectBinding: undefined,
})
).toMatchSnapshot('show prompt to configure PR decoration, regular user');
expect(
shallowRender({
component: mockComponent({ configuration: { showSettings: true } }),
- projectBinding: undefined
+ projectBinding: undefined,
})
).toMatchSnapshot('show prompt to configure PR decoration, project admin');
expect(
shallowRender({
projectBinding: undefined,
- detectedCIOnLastAnalysis: false
+ detectedCIOnLastAnalysis: false,
})
).toMatchSnapshot('show prompt to configure PR decoration + CI, regular user');
expect(
shallowRender({
component: mockComponent({ configuration: { showSettings: true } }),
projectBinding: undefined,
- detectedCIOnLastAnalysis: false
+ detectedCIOnLastAnalysis: false,
})
).toMatchSnapshot('show prompt to configure PR decoration + CI, project admin');
});
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx
index 2564e650feb..7667546f36e 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanel-test.tsx
@@ -26,7 +26,7 @@ import {
mockLocation,
mockMeasureEnhanced,
mockMetric,
- mockPeriod
+ mockPeriod,
} from '../../../../helpers/testMocks';
import { ComponentQualifier } from '../../../../types/component';
import { MetricKey } from '../../../../types/metrics';
@@ -35,7 +35,7 @@ import { MeasuresPanel, MeasuresPanelProps, MeasuresPanelTabs } from '../Measure
jest.mock('react', () => {
return {
...jest.requireActual('react'),
- useEffect: jest.fn().mockImplementation(f => f())
+ useEffect: jest.fn().mockImplementation((f) => f()),
};
});
@@ -48,7 +48,7 @@ it('should render correctly for projects', () => {
it('should render correctly for applications', () => {
const wrapper = shallowRender({
- component: mockComponent({ qualifier: ComponentQualifier.Application })
+ component: mockComponent({ qualifier: ComponentQualifier.Application }),
});
expect(wrapper).toMatchSnapshot('default');
wrapper.find(BoxedTabs).prop<Function>('onSelect')(MeasuresPanelTabs.Overall);
@@ -59,8 +59,8 @@ it('should render correctly if there is no new code measures', () => {
const wrapper = shallowRender({
measures: [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) })
- ]
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }),
+ ],
});
wrapper.find(BoxedTabs).prop<Function>('onSelect')(MeasuresPanelTabs.New);
expect(wrapper).toMatchSnapshot();
@@ -71,9 +71,9 @@ it('should render correctly if branch is misconfigured', () => {
branch: mockBranch({ name: 'own-reference' }),
measures: [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }),
],
- period: mockPeriod({ date: undefined, mode: 'REFERENCE_BRANCH', parameter: 'own-reference' })
+ period: mockPeriod({ date: undefined, mode: 'REFERENCE_BRANCH', parameter: 'own-reference' }),
});
wrapper.find(BoxedTabs).prop<Function>('onSelect')(MeasuresPanelTabs.New);
expect(wrapper).toMatchSnapshot('hide settings');
@@ -87,8 +87,8 @@ it('should render correctly if there is no coverage', () => {
shallowRender({
measures: [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_bugs }) })
- ]
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_bugs }) }),
+ ],
})
).toMatchSnapshot();
});
@@ -100,7 +100,7 @@ it('should render correctly if the data is still loading', () => {
it('should render correctly when code scope is overall code', () => {
expect(
shallowRender({
- location: mockLocation({ pathname: '/dashboard', query: { code_scope: 'overall' } })
+ location: mockLocation({ pathname: '/dashboard', query: { code_scope: 'overall' } }),
})
).toMatchSnapshot();
});
@@ -108,7 +108,7 @@ it('should render correctly when code scope is overall code', () => {
it('should render correctly when code scope is new code', () => {
expect(
shallowRender({
- location: mockLocation({ pathname: '/dashboard', query: { code_scope: 'new' } })
+ location: mockLocation({ pathname: '/dashboard', query: { code_scope: 'new' } }),
})
).toMatchSnapshot();
});
@@ -122,7 +122,7 @@ function shallowRender(props: Partial<MeasuresPanelProps> = {}) {
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) }),
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_coverage }) }),
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_bugs }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_bugs }) }),
]}
location={mockLocation()}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelIssueMeasureRow-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelIssueMeasureRow-test.tsx
index 7282bf3f609..415490d8c67 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelIssueMeasureRow-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelIssueMeasureRow-test.tsx
@@ -26,7 +26,7 @@ import { ComponentQualifier } from '../../../../types/component';
import { IssueType } from '../../../../types/issues';
import { MetricKey } from '../../../../types/metrics';
import MeasuresPanelIssueMeasureRow, {
- MeasuresPanelIssueMeasureRowProps
+ MeasuresPanelIssueMeasureRowProps,
} from '../MeasuresPanelIssueMeasureRow';
it('should render correctly for projects', () => {
@@ -54,7 +54,7 @@ function shallowRender(props: Partial<MeasuresPanelIssueMeasureRowProps> = {}) {
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) }),
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_coverage }) }),
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_bugs }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_bugs }) }),
]}
type={IssueType.Bug}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx
index 49def02a09b..d629829c66d 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/MeasuresPanelNoNewCode-test.tsx
@@ -85,12 +85,12 @@ it('should render the default message', () => {
).toMatchInlineSnapshot(defaultMessage);
expect(
shallowRender({
- period: mockPeriod({ date: undefined, mode: 'REFERENCE_BRANCH', parameter: 'master' })
+ period: mockPeriod({ date: undefined, mode: 'REFERENCE_BRANCH', parameter: 'master' }),
})
).toMatchSnapshot();
expect(
shallowRender({
- period: mockPeriod({ date: undefined, mode: 'REFERENCE_BRANCH', parameter: 'notsame' })
+ period: mockPeriod({ date: undefined, mode: 'REFERENCE_BRANCH', parameter: 'notsame' }),
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/NoCodeWarning-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/NoCodeWarning-test.tsx
index 28303220ee6..c8f70fe9802 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/NoCodeWarning-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/NoCodeWarning-test.tsx
@@ -51,7 +51,7 @@ it('should correctly if the project is empty', () => {
it('should render correctly if the application is empty or has no lines of code', () => {
const wrapper = shallowRender({
component: mockComponent({ qualifier: ComponentQualifier.Application }),
- measures: [mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.projects }) })]
+ measures: [mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.projects }) })],
});
expect(wrapper.children().text()).toBe('portfolio.app.no_lines_of_code');
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx
index f21aa5f15c9..40a6a7d8f67 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ProjectLeakPeriodInfo-test.tsx
@@ -72,7 +72,7 @@ function shallowRender(period: Partial<Period> = {}) {
intl={
{
formatDate: (date: string) => 'formatted.' + date,
- formatTime: (date: string) => 'formattedTime.' + date
+ formatTime: (date: string) => 'formattedTime.' + date,
} as IntlShape
}
leakPeriod={mockPeriod({ ...period })}
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanel-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanel-test.tsx
index f75329ee6e3..3e4aa3e3279 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanel-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanel-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { mockComponent } from '../../../../helpers/mocks/component';
import {
mockQualityGateStatus,
- mockQualityGateStatusConditionEnhanced
+ mockQualityGateStatusConditionEnhanced,
} from '../../../../helpers/mocks/quality-gates';
import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks';
import { ComponentQualifier } from '../../../../types/component';
@@ -36,7 +36,7 @@ it('should render correctly for projects', () => {
).toMatchSnapshot();
const wrapper = shallowRender({
- qgStatuses: [mockQualityGateStatus({ ignoredConditions: true })]
+ qgStatuses: [mockQualityGateStatus({ ignoredConditions: true })],
});
expect(wrapper).toMatchSnapshot();
});
@@ -52,13 +52,13 @@ it('should render correctly for applications', () => {
mockQualityGateStatusConditionEnhanced(),
mockQualityGateStatusConditionEnhanced({
measure: mockMeasureEnhanced({
- metric: mockMetric({ key: MetricKey.new_code_smells })
+ metric: mockMetric({ key: MetricKey.new_code_smells }),
}),
- metric: MetricKey.new_code_smells
- })
- ]
- })
- ]
+ metric: MetricKey.new_code_smells,
+ }),
+ ],
+ }),
+ ],
})
).toMatchSnapshot();
@@ -68,9 +68,9 @@ it('should render correctly for applications', () => {
mockQualityGateStatus(),
mockQualityGateStatus({
status: 'OK',
- failedConditions: []
- })
- ]
+ failedConditions: [],
+ }),
+ ],
});
expect(wrapper).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx
index f07859b5589..087885af540 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx
@@ -23,7 +23,7 @@ import { mockMainBranch } from '../../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../../helpers/mocks/component';
import {
mockQualityGateStatus,
- mockQualityGateStatusConditionEnhanced
+ mockQualityGateStatusConditionEnhanced,
} from '../../../../helpers/mocks/quality-gates';
import { ComponentQualifier } from '../../../../types/component';
import { MetricKey } from '../../../../types/metrics';
@@ -35,8 +35,8 @@ it('should render correctly', () => {
shallowRender({
qgStatus: mockQualityGateStatus({
failedConditions: [],
- status: 'OK'
- })
+ status: 'OK',
+ }),
}).type()
).toBeNull();
expect(
@@ -52,9 +52,9 @@ function shallowRender(props: Partial<QualityGatePanelSectionProps> = {}) {
qgStatus={mockQualityGateStatus({
failedConditions: [
mockQualityGateStatusConditionEnhanced({ metric: MetricKey.bugs }),
- mockQualityGateStatusConditionEnhanced({ metric: MetricKey.new_bugs })
+ mockQualityGateStatusConditionEnhanced({ metric: MetricKey.new_bugs }),
],
- status: 'ERROR'
+ status: 'ERROR',
})}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/SecurityHotspotsReviewed-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/SecurityHotspotsReviewed-test.tsx
index e65141a4e8d..4cde0bcd7fe 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/SecurityHotspotsReviewed-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/SecurityHotspotsReviewed-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { mockMeasureEnhanced, mockMetric } from '../../../../helpers/testMocks';
import { MetricKey } from '../../../../types/metrics';
import SecurityHotspotsReviewed, {
- SecurityHotspotsReviewedProps
+ SecurityHotspotsReviewedProps,
} from '../SecurityHotspotsReviewed';
it('should render correctly', () => {
@@ -37,8 +37,8 @@ function shallowRender(props: Partial<SecurityHotspotsReviewedProps> = {}) {
measures={[
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.security_hotspots_reviewed }) }),
mockMeasureEnhanced({
- metric: mockMetric({ key: MetricKey.new_security_hotspots_reviewed })
- })
+ metric: mockMetric({ key: MetricKey.new_security_hotspots_reviewed }),
+ }),
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/overview/components/App.tsx b/server/sonar-web/src/main/js/apps/overview/components/App.tsx
index 26771be6dcb..1d23de7b263 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/App.tsx
@@ -19,7 +19,7 @@
*/
import * as React from 'react';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import withComponentContext from '../../../app/components/componentContext/withComponentContext';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
diff --git a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx
index d85ec9885b1..4f5ba161051 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/EmptyOverview.tsx
@@ -55,7 +55,7 @@ export function EmptyOverview(props: EmptyOverviewProps) {
const hasBranches = branchLikes.length > 1;
const hasBadBranchConfig =
branchLikes.length > 2 ||
- (branchLikes.length === 2 && branchLikes.some(branch => isBranch(branch)));
+ (branchLikes.length === 2 && branchLikes.some((branch) => isBranch(branch)));
const showWarning = isMainBranch(branchLike) && hasBranches;
const showTutorial = isMainBranch(branchLike) && !hasBranches && !hasAnalyses;
@@ -68,7 +68,7 @@ export function EmptyOverview(props: EmptyOverviewProps) {
id="provisioning.no_analysis_on_main_branch.bad_configuration"
values={{
branchName: getBranchLikeDisplayName(branchLike),
- branchType: translate('branches.main_branch')
+ branchType: translate('branches.main_branch'),
}}
/>
);
@@ -78,7 +78,7 @@ export function EmptyOverview(props: EmptyOverviewProps) {
defaultMessage={translate('provisioning.no_analysis_on_main_branch')}
id="provisioning.no_analysis_on_main_branch"
values={{
- branchName: getBranchLikeDisplayName(branchLike)
+ branchName: getBranchLikeDisplayName(branchLike),
}}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx b/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx
index fecd47bd0f5..140d31feb91 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/IssueLabel.tsx
@@ -54,7 +54,7 @@ export function IssueLabel(props: IssueLabelProps) {
...getBranchLikeQuery(branchLike),
resolved: 'false',
types: type,
- inNewCodePeriod: useDiffMetric ? 'true' : 'false'
+ inNewCodePeriod: useDiffMetric ? 'true' : 'false',
};
const url =
@@ -74,7 +74,8 @@ export function IssueLabel(props: IssueLabelProps) {
localizeMetric(metricKey)
)}
className="overview-measures-value text-light"
- to={url}>
+ to={url}
+ >
{formatMeasure(value, 'SHORT_INT')}
</Link>
)}
diff --git a/server/sonar-web/src/main/js/apps/overview/components/IssueRating.tsx b/server/sonar-web/src/main/js/apps/overview/components/IssueRating.tsx
index df9280474bf..670f1eacfbd 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/IssueRating.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/IssueRating.tsx
@@ -62,7 +62,8 @@ function renderRatingLink(props: IssueRatingProps) {
branchLike={branchLike}
className="link-no-underline link-rating"
component={component.key}
- metric={rating}>
+ metric={rating}
+ >
<Rating value={value} />
</DrilldownLink>
</span>
diff --git a/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx b/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx
index 297e0fe3b36..181d74482dd 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.tsx
@@ -34,7 +34,7 @@ interface Props {
const MODE_INCLUDES_TIME: Dict<boolean> = {
manual_baseline: true,
- SPECIFIC_ANALYSIS: true
+ SPECIFIC_ANALYSIS: true,
};
export class LeakPeriodLegend extends React.PureComponent<Props & WrappedComponentProps> {
@@ -95,7 +95,7 @@ export class LeakPeriodLegend extends React.PureComponent<Props & WrappedCompone
{translateWithParameters('overview.new_code_period_x', leakPeriodLabel)}
<br />
<DateFromNow date={leakPeriodDate}>
- {fromNow => (
+ {(fromNow) => (
<span className="note">
{translateWithParameters(
period.mode === 'previous_analysis'
diff --git a/server/sonar-web/src/main/js/apps/overview/components/MeasurementLabel.tsx b/server/sonar-web/src/main/js/apps/overview/components/MeasurementLabel.tsx
index 9532e2e18b3..139bbcccee0 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/MeasurementLabel.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/MeasurementLabel.tsx
@@ -30,7 +30,7 @@ import {
getMeasurementLabelKeys,
getMeasurementLinesMetricKey,
getMeasurementMetricKey,
- MeasurementType
+ MeasurementType,
} from '../utils';
interface Props {
@@ -65,10 +65,11 @@ export default class MeasurementLabel extends React.Component<Props> {
branchLike={branchLike}
className="big"
component={component.key}
- metric={linesMetric}>
+ metric={linesMetric}
+ >
{formatMeasure(value, 'SHORT_INT')}
</DrilldownLink>
- )
+ ),
}}
/>
);
@@ -97,7 +98,7 @@ export default class MeasurementLabel extends React.Component<Props> {
const icon = React.createElement(iconClass, { size: 'big', value: Number(value) });
const formattedValue = formatMeasure(value, 'PERCENT', {
decimals: 2,
- omitExtraDecimalZeros: true
+ omitExtraDecimalZeros: true,
});
const link = (
<DrilldownLink
@@ -109,7 +110,8 @@ export default class MeasurementLabel extends React.Component<Props> {
branchLike={branchLike}
className="overview-measures-value text-light"
component={component.key}
- metric={metricKey}>
+ metric={metricKey}
+ >
{formattedValue}
</DrilldownLink>
);
diff --git a/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx b/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx
index d9335143d60..d042f9caa21 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/QualityGateCondition.tsx
@@ -45,7 +45,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> {
const query: Dict<string | undefined> = {
resolved: 'false',
...getBranchLikeQuery(this.props.branchLike),
- ...customQuery
+ ...customQuery,
};
if (inNewCodePeriod) {
Object.assign(query, { inNewCodePeriod: 'true' });
@@ -55,7 +55,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> {
getUrlForSecurityHotspot(inNewCodePeriod: boolean) {
const query: Dict<string | undefined> = {
- ...getBranchLikeQuery(this.props.branchLike)
+ ...getBranchLikeQuery(this.props.branchLike),
};
if (inNewCodePeriod) {
Object.assign(query, { inNewCodePeriod: 'true' });
@@ -72,7 +72,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> {
'BLOCKER,CRITICAL,MAJOR,MINOR',
'BLOCKER,CRITICAL,MAJOR',
'BLOCKER,CRITICAL',
- 'BLOCKER'
+ 'BLOCKER',
];
const { condition } = this.props;
@@ -80,7 +80,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> {
return this.getIssuesUrl(inNewCodePeriod, {
types: type,
- severities: RATING_TO_SEVERITIES_MAPPING[Number(threshold) - 1]
+ severities: RATING_TO_SEVERITIES_MAPPING[Number(threshold) - 1],
});
}
@@ -106,7 +106,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> {
[MetricKey.sqale_rating]: () => this.getUrlForCodeSmells(false),
[MetricKey.new_maintainability_rating]: () => this.getUrlForCodeSmells(true),
[MetricKey.security_hotspots_reviewed]: () => this.getUrlForSecurityHotspot(false),
- [MetricKey.new_security_hotspots_reviewed]: () => this.getUrlForSecurityHotspot(true)
+ [MetricKey.new_security_hotspots_reviewed]: () => this.getUrlForSecurityHotspot(true),
};
return (
@@ -121,7 +121,8 @@ export default class QualityGateCondition extends React.PureComponent<Props> {
className={className}
component={component.key}
metric={condition.measure.metric.key}
- inNewCodePeriod={condition.period != null}>
+ inNewCodePeriod={condition.period != null}
+ >
{children}
</DrilldownLink>
)}
diff --git a/server/sonar-web/src/main/js/apps/overview/components/QualityGateConditions.tsx b/server/sonar-web/src/main/js/apps/overview/components/QualityGateConditions.tsx
index 486d802e10f..16c4a631784 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/QualityGateConditions.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/QualityGateConditions.tsx
@@ -46,7 +46,7 @@ export function QualityGateConditions(props: QualityGateConditionsProps) {
return null;
}
- const sortedConditions = sortBy(failedConditions, condition =>
+ const sortedConditions = sortBy(failedConditions, (condition) =>
LEVEL_ORDER.indexOf(condition.level)
);
@@ -63,8 +63,9 @@ export function QualityGateConditions(props: QualityGateConditionsProps) {
return (
<ul
className="overview-quality-gate-conditions-list"
- id="overview-quality-gate-conditions-list">
- {renderConditions.map(condition => (
+ id="overview-quality-gate-conditions-list"
+ >
+ {renderConditions.map((condition) => (
<QualityGateCondition
branchLike={branchLike}
component={component}
@@ -76,7 +77,8 @@ export function QualityGateConditions(props: QualityGateConditionsProps) {
<li>
<ButtonLink
className="overview-quality-gate-conditions-list-collapse"
- onClick={() => toggleCollapsed(!collapsed)}>
+ onClick={() => toggleCollapsed(!collapsed)}
+ >
{translateWithParameters(
'overview.X_more_failed_conditions',
sortedConditions.length - MAX_CONDITIONS
diff --git a/server/sonar-web/src/main/js/apps/overview/components/SonarLintPromotion.tsx b/server/sonar-web/src/main/js/apps/overview/components/SonarLintPromotion.tsx
index e183f17cc6e..b6044de79df 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/SonarLintPromotion.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/SonarLintPromotion.tsx
@@ -43,12 +43,12 @@ const CONDITIONS_TO_SHOW = [
MetricKey.new_vulnerabilities,
MetricKey.new_security_rating,
MetricKey.new_maintainability_rating,
- MetricKey.new_reliability_rating
+ MetricKey.new_reliability_rating,
];
export function SonarLintPromotion({ currentUser, qgConditions }: SonarLintPromotionProps) {
const showMessage = qgConditions?.some(
- qgCondition =>
+ (qgCondition) =>
CONDITIONS_TO_SHOW.includes(qgCondition.metric as MetricKey) && qgCondition.level === 'ERROR'
);
if (!showMessage || currentUser.usingSonarLintConnectedMode) {
@@ -65,12 +65,13 @@ export function SonarLintPromotion({ currentUser, qgConditions }: SonarLintPromo
<a
href="https://www.sonarqube.org/sonarlint/?referrer=sonarqube"
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
SonarLint
</a>
<SonarLintIcon size={16} />
</>
- )
+ ),
}}
/>
</div>
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx
index 6d9959e0bf5..117f6c8b91f 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx
@@ -28,15 +28,11 @@ const component = {
breadcrumbs: [],
name: 'Foo',
qualifier: 'TRK',
- version: '0.0.1'
+ version: '0.0.1',
};
it('should render BranchOverview', () => {
- expect(
- getWrapper()
- .find(BranchOverview)
- .exists()
- ).toBe(true);
+ expect(getWrapper().find(BranchOverview).exists()).toBe(true);
});
function getWrapper(props = {}) {
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx
index ec01374e7c6..3d587bca6ac 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx
@@ -37,7 +37,7 @@ it('should render another message when there are branches', () => {
expect(shallowRender({ branchLikes: [mockMainBranch(), mockBranch()] })).toMatchSnapshot();
expect(
shallowRender({
- branchLikes: [mockMainBranch(), mockBranch(), mockBranch({ name: 'branch-7.8' })]
+ branchLikes: [mockMainBranch(), mockBranch(), mockBranch({ name: 'branch-7.8' })],
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueLabel-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueLabel-test.tsx
index 65881b99565..220149d24a8 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueLabel-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueLabel-test.tsx
@@ -29,7 +29,7 @@ import { IssueLabel, IssueLabelProps } from '../IssueLabel';
it('should render correctly for bugs', () => {
const measures = [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.bugs }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_bugs }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_bugs }) }),
];
expect(shallowRender({ measures })).toMatchSnapshot();
expect(shallowRender({ measures, useDiffMetric: true })).toMatchSnapshot();
@@ -39,7 +39,7 @@ it('should render correctly for code smells', () => {
const type = IssueType.CodeSmell;
const measures = [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.code_smells }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_code_smells }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_code_smells }) }),
];
expect(shallowRender({ measures, type })).toMatchSnapshot();
expect(shallowRender({ measures, type, useDiffMetric: true })).toMatchSnapshot();
@@ -49,7 +49,7 @@ it('should render correctly for vulnerabilities', () => {
const type = IssueType.Vulnerability;
const measures = [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.vulnerabilities }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_vulnerabilities }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_vulnerabilities }) }),
];
expect(shallowRender({ measures, type })).toMatchSnapshot();
expect(shallowRender({ measures, type, useDiffMetric: true })).toMatchSnapshot();
@@ -60,13 +60,13 @@ it('should render correctly for hotspots', () => {
const type = IssueType.SecurityHotspot;
const measures = [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.security_hotspots }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_security_hotspots }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_security_hotspots }) }),
];
expect(
shallowRender({
helpTooltip,
measures,
- type
+ type,
})
).toMatchSnapshot();
expect(
@@ -74,7 +74,7 @@ it('should render correctly for hotspots', () => {
helpTooltip,
measures,
type,
- useDiffMetric: true
+ useDiffMetric: true,
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueRating-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueRating-test.tsx
index 0f317f5a501..1059aa6a141 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueRating-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/IssueRating-test.tsx
@@ -44,7 +44,7 @@ it('should render correctly for vulnerabilities', () => {
it('should render correctly if no values are present', () => {
expect(
shallowRender({
- measures: [mockMeasureEnhanced({ metric: mockMetric({ key: 'NONE' }) })]
+ measures: [mockMeasureEnhanced({ metric: mockMetric({ key: 'NONE' }) })],
})
).toMatchSnapshot();
});
@@ -60,7 +60,7 @@ function shallowRender(props: Partial<IssueRatingProps> = {}) {
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_maintainability_rating }) }),
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.sqale_rating }) }),
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_security_rating }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.security_rating }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.security_rating }) }),
]}
type={IssueType.Bug}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx
index 156a425fd51..93d794f81eb 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/LeakPeriodLegend-test.tsx
@@ -67,14 +67,14 @@ function getWrapper(period: Partial<Period> = {}) {
intl={
{
formatDate: (date: string) => 'formatted.' + date,
- formatTime: (date: string) => 'formattedTime.' + date
+ formatTime: (date: string) => 'formattedTime.' + date,
} as IntlShape
}
period={{
date: '2013-09-22T00:00:00+0200',
index: 0,
mode: 'version',
- ...period
+ ...period,
}}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/MeasurementLabel-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/MeasurementLabel-test.tsx
index 89f40459064..d0569af765f 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/MeasurementLabel-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/MeasurementLabel-test.tsx
@@ -32,17 +32,17 @@ it('should render correctly for coverage', () => {
shallowRender({
measures: [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.coverage }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.lines_to_cover }) })
- ]
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.lines_to_cover }) }),
+ ],
})
).toMatchSnapshot();
expect(
shallowRender({
measures: [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_coverage }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_lines_to_cover }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_lines_to_cover }) }),
],
- useDiffMetric: true
+ useDiffMetric: true,
})
).toMatchSnapshot();
});
@@ -51,30 +51,30 @@ it('should render correctly for duplications', () => {
expect(
shallowRender({
measures: [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.duplicated_lines_density }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.duplicated_lines_density }) }),
],
- type: MeasurementType.Duplication
+ type: MeasurementType.Duplication,
})
).toMatchSnapshot();
expect(
shallowRender({
measures: [
mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.duplicated_lines_density }) }),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.ncloc }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.ncloc }) }),
],
- type: MeasurementType.Duplication
+ type: MeasurementType.Duplication,
})
).toMatchSnapshot();
expect(
shallowRender({
measures: [
mockMeasureEnhanced({
- metric: mockMetric({ key: MetricKey.new_duplicated_lines_density })
+ metric: mockMetric({ key: MetricKey.new_duplicated_lines_density }),
}),
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_lines }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.new_lines }) }),
],
type: MeasurementType.Duplication,
- useDiffMetric: true
+ useDiffMetric: true,
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateCondition-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateCondition-test.tsx
index 7d031f698c8..21239787a6d 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateCondition-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/QualityGateCondition-test.tsx
@@ -35,8 +35,8 @@ it.each([
[quickMock(MetricKey.new_security_rating, 'RATING', true)],
[quickMock(MetricKey.new_maintainability_rating, 'RATING', true)],
[quickMock(MetricKey.security_hotspots_reviewed)],
- [quickMock(MetricKey.new_security_hotspots_reviewed, 'RATING', true)]
-])('should render correclty', condition => {
+ [quickMock(MetricKey.new_security_hotspots_reviewed, 'RATING', true)],
+])('should render correclty', (condition) => {
expect(shallowRender({ condition })).toMatchSnapshot();
});
@@ -66,12 +66,12 @@ function quickMock(
metric: mockMetric({
key: metric,
name: metric,
- type
+ type,
}),
value: '3',
- ...(addPeriod ? { period: { value: '3', index: 1 } } : {})
+ ...(addPeriod ? { period: { value: '3', index: 1 } } : {}),
},
metric,
- ...(addPeriod ? { period: 1 } : {})
+ ...(addPeriod ? { period: 1 } : {}),
});
}
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/SonarLintPromition-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/SonarLintPromition-test.tsx
index 1513fd41264..c3c1f43efd8 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/SonarLintPromition-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/SonarLintPromition-test.tsx
@@ -31,7 +31,9 @@ it('should render correctly', () => {
).toBeNull();
expect(
shallowRender({
- qgConditions: [mockQualityGateStatusCondition({ metric: MetricKey.new_bugs, level: 'ERROR' })]
+ qgConditions: [
+ mockQualityGateStatusCondition({ metric: MetricKey.new_bugs, level: 'ERROR' }),
+ ],
})
).toMatchSnapshot('has failed condition');
});
@@ -49,11 +51,11 @@ it.each(
MetricKey.new_vulnerabilities,
MetricKey.new_security_rating,
MetricKey.new_maintainability_rating,
- MetricKey.new_reliability_rating
+ MetricKey.new_reliability_rating,
].map(Array.of)
-)('should show message for %s', metric => {
+)('should show message for %s', (metric) => {
const wrapper = shallowRender({
- qgConditions: [mockQualityGateStatusCondition({ metric: metric as string })]
+ qgConditions: [mockQualityGateStatusCondition({ metric: metric as string })],
});
expect(wrapper.type()).not.toBeNull();
});
diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx
index 46c3f448280..2563e6c7f0e 100644
--- a/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/LargeQualityGateBadge.tsx
@@ -45,8 +45,9 @@ export function LargeQualityGateBadge({ component, level }: Props) {
<div
className={classNames('overview-quality-gate-badge-large small', {
failed: !success,
- success
- })}>
+ success,
+ })}
+ >
<div className="display-flex-center">
<span>{translate('overview.on_new_code_long')}</span>
@@ -57,10 +58,11 @@ export function LargeQualityGateBadge({ component, level }: Props) {
defaultMessage={translate('overview.quality_gate.conditions_on_new_code')}
id="overview.quality_gate.conditions_on_new_code"
values={{
- link: <Link to={path}>{translate('overview.quality_gate')}</Link>
+ link: <Link to={path}>{translate('overview.quality_gate')}</Link>,
}}
/>
- }>
+ }
+ >
<HelpIcon fill={colors.transparentWhite} size={12} />
</HelpTooltip>
</div>
diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx
index 50b98a20b64..870db6918ed 100644
--- a/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/PullRequestOverview.tsx
@@ -58,7 +58,7 @@ export class PullRequestOverview extends React.PureComponent<Props, State> {
state: State = {
loading: false,
- measures: []
+ measures: [],
};
componentDidMount() {
@@ -84,9 +84,9 @@ export class PullRequestOverview extends React.PureComponent<Props, State> {
const prevConditions = prevProps.conditions ?? [];
const newConditions = this.props.conditions ?? [];
const diff = differenceBy(
- prevConditions.filter(c => c.level === 'ERROR'),
- newConditions.filter(c => c.level === 'ERROR'),
- c => c.metric
+ prevConditions.filter((c) => c.level === 'ERROR'),
+ newConditions.filter((c) => c.level === 'ERROR'),
+ (c) => c.metric
);
return (
@@ -97,7 +97,7 @@ export class PullRequestOverview extends React.PureComponent<Props, State> {
fetchBranchStatusData = () => {
const {
branchLike,
- component: { key }
+ component: { key },
} = this.props;
this.props.fetchBranchStatus(branchLike, key);
};
@@ -106,7 +106,7 @@ export class PullRequestOverview extends React.PureComponent<Props, State> {
const {
branchLike,
component: { key },
- conditions
+ conditions,
} = this.props;
this.setState({ loading: true });
@@ -114,7 +114,7 @@ export class PullRequestOverview extends React.PureComponent<Props, State> {
const metricKeys =
conditions !== undefined
? // Also load metrics that apply to failing QG conditions.
- uniq([...PR_METRICS, ...conditions.filter(c => c.level !== 'OK').map(c => c.metric)])
+ uniq([...PR_METRICS, ...conditions.filter((c) => c.level !== 'OK').map((c) => c.metric)])
: PR_METRICS;
getMeasuresWithMetrics(key, metricKeys, getBranchLikeQuery(branchLike)).then(
@@ -122,7 +122,7 @@ export class PullRequestOverview extends React.PureComponent<Props, State> {
if (this.mounted && component.measures) {
this.setState({
loading: false,
- measures: enhanceMeasuresWithMetrics(component.measures || [], metrics)
+ measures: enhanceMeasuresWithMetrics(component.measures || [], metrics),
});
}
},
@@ -151,16 +151,17 @@ export class PullRequestOverview extends React.PureComponent<Props, State> {
}
const failedConditions = conditions
- .filter(condition => condition.level === 'ERROR')
- .map(c => enhanceConditionWithMeasure(c, measures))
+ .filter((condition) => condition.level === 'ERROR')
+ .map((c) => enhanceConditionWithMeasure(c, measures))
.filter(isDefined);
return (
<div className="page page-limited">
<div
className={classNames('pr-overview', {
- 'has-conditions': failedConditions.length > 0
- })}>
+ 'has-conditions': failedConditions.length > 0,
+ })}
+ >
{ignoredConditions && (
<Alert className="big-spacer-bottom" display="inline" variant="info">
<span className="text-middle">
@@ -214,7 +215,7 @@ export class PullRequestOverview extends React.PureComponent<Props, State> {
IssueType.Bug,
IssueType.Vulnerability,
IssueType.SecurityHotspot,
- IssueType.CodeSmell
+ IssueType.CodeSmell,
].map((type: IssueType) => (
<div className="overview-measures-row display-flex-row" key={type}>
<div className="overview-panel-big-padded flex-1 small display-flex-center">
diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/AfterMergeEstimate-test.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/AfterMergeEstimate-test.tsx
index 31a99739b19..1e419b7d459 100644
--- a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/AfterMergeEstimate-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/AfterMergeEstimate-test.tsx
@@ -32,9 +32,9 @@ it('should render correctly for duplications', () => {
expect(
shallowRender({
measures: [
- mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.duplicated_lines_density }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: MetricKey.duplicated_lines_density }) }),
],
- type: MeasurementType.Duplication
+ type: MeasurementType.Duplication,
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-test.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-test.tsx
index 952f8c37802..e85465511ac 100644
--- a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-test.tsx
@@ -36,24 +36,24 @@ jest.mock('../../../../api/measures', () => {
mockMeasure({ metric: 'new_bugs' }),
mockMeasure({ metric: 'new_vulnerabilities' }),
mockMeasure({ metric: 'new_code_smells' }),
- mockMeasure({ metric: 'new_security_hotspots' })
- ]
+ mockMeasure({ metric: 'new_security_hotspots' }),
+ ],
},
metrics: [
mockMetric({ key: 'new_bugs', name: 'new_bugs', id: 'new_bugs' }),
mockMetric({
key: 'new_vulnerabilities',
name: 'new_vulnerabilities',
- id: 'new_vulnerabilities'
+ id: 'new_vulnerabilities',
}),
mockMetric({ key: 'new_code_smells', name: 'new_code_smells', id: 'new_code_smells' }),
mockMetric({
key: 'new_security_hotspots',
name: 'new_security_hotspots',
- id: 'new_security_hotspots'
- })
- ]
- })
+ id: 'new_security_hotspots',
+ }),
+ ],
+ }),
};
});
@@ -91,14 +91,14 @@ it('should render correctly for a failed QG', async () => {
error: '1.0',
level: 'OK',
metric: 'new_bugs',
- period: 1
+ period: 1,
}),
mockQualityGateStatusCondition({
error: '1.0',
metric: 'new_code_smells',
- period: 1
- })
- ]
+ period: 1,
+ }),
+ ],
});
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot();
@@ -112,7 +112,7 @@ it('should correctly fetch all required metrics for a passing QG', async () => {
it('should correctly fetch all required metrics for a failing QG', async () => {
const wrapper = shallowRender({
- conditions: [mockQualityGateStatusCondition({ level: 'ERROR', metric: 'foo' })]
+ conditions: [mockQualityGateStatusCondition({ level: 'ERROR', metric: 'foo' })],
});
await waitAndUpdate(wrapper);
expect(getMeasuresWithMetrics).toHaveBeenCalledWith(
diff --git a/server/sonar-web/src/main/js/apps/overview/utils.ts b/server/sonar-web/src/main/js/apps/overview/utils.ts
index d49a26488bc..f460eb42eb1 100644
--- a/server/sonar-web/src/main/js/apps/overview/utils.ts
+++ b/server/sonar-web/src/main/js/apps/overview/utils.ts
@@ -77,7 +77,7 @@ export const METRICS: string[] = [
MetricKey.ncloc_language_distribution,
MetricKey.projects,
MetricKey.lines,
- MetricKey.new_lines
+ MetricKey.new_lines,
];
export const PR_METRICS: string[] = [
@@ -95,7 +95,7 @@ export const PR_METRICS: string[] = [
MetricKey.new_vulnerabilities,
MetricKey.new_security_hotspots,
MetricKey.new_security_review_rating,
- MetricKey.new_security_rating
+ MetricKey.new_security_rating,
];
export const HISTORY_METRICS_LIST: string[] = [
@@ -104,12 +104,12 @@ export const HISTORY_METRICS_LIST: string[] = [
MetricKey.sqale_index,
MetricKey.duplicated_lines_density,
MetricKey.ncloc,
- MetricKey.coverage
+ MetricKey.coverage,
];
export enum MeasurementType {
Coverage = 'COVERAGE',
- Duplication = 'DUPLICATION'
+ Duplication = 'DUPLICATION',
}
const MEASUREMENTS_MAP = {
@@ -122,7 +122,7 @@ const MEASUREMENTS_MAP = {
labelKey: 'metric.coverage.name',
expandedLabelKey: 'overview.coverage_on_X_lines',
newLinesExpandedLabelKey: 'overview.coverage_on_X_new_lines',
- iconClass: CoverageRating
+ iconClass: CoverageRating,
},
[MeasurementType.Duplication]: {
metric: MetricKey.duplicated_lines_density,
@@ -133,8 +133,8 @@ const MEASUREMENTS_MAP = {
labelKey: 'metric.duplicated_lines_density.short_name',
expandedLabelKey: 'overview.duplications_on_X_lines',
newLinesExpandedLabelKey: 'overview.duplications_on_X_new_lines',
- iconClass: DuplicationsRating
- }
+ iconClass: DuplicationsRating,
+ },
};
export function getIssueRatingName(type: IssueType) {
@@ -178,12 +178,12 @@ export function getMeasurementLabelKeys(type: MeasurementType, useDiffMetric: bo
expandedLabelKey: useDiffMetric
? MEASUREMENTS_MAP[type].newLinesExpandedLabelKey
: MEASUREMENTS_MAP[type].expandedLabelKey,
- labelKey: MEASUREMENTS_MAP[type].labelKey
+ labelKey: MEASUREMENTS_MAP[type].labelKey,
};
}
export const parseQuery = memoize((urlQuery: RawQuery): { codeScope: string } => {
return {
- codeScope: parseAsString(urlQuery['code_scope'])
+ codeScope: parseAsString(urlQuery['code_scope']),
};
});
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.tsx
index da13a3a8d61..2ae8ea5a2ca 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/ActionsCell.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import {
deletePermissionTemplate,
setDefaultPermissionTemplate,
- updatePermissionTemplate
+ updatePermissionTemplate,
} from '../../../api/permissions';
import ActionsDropdown, { ActionsDropdownItem } from '../../../components/controls/ActionsDropdown';
import { Router, withRouter } from '../../../components/hoc/withRouter';
@@ -125,14 +125,15 @@ export class ActionsCell extends React.PureComponent<Props, State> {
className="js-set-default"
data-qualifier={qualifier}
key={qualifier}
- onClick={this.setDefault(qualifier)}>
+ onClick={this.setDefault(qualifier)}
+ >
{child}
</ActionsDropdownItem>
);
}
renderIfSingleTopQualifier(availableQualifiers: string[]) {
- return availableQualifiers.map(qualifier =>
+ return availableQualifiers.map((qualifier) =>
this.renderSetDefaultLink(
qualifier,
<span>{translate('permission_templates.set_default')}</span>
@@ -141,7 +142,7 @@ export class ActionsCell extends React.PureComponent<Props, State> {
}
renderIfMultipleTopQualifiers(availableQualifiers: string[]) {
- return availableQualifiers.map(qualifier =>
+ return availableQualifiers.map((qualifier) =>
this.renderSetDefaultLink(
qualifier,
<span>
@@ -162,7 +163,8 @@ export class ActionsCell extends React.PureComponent<Props, State> {
{!this.props.fromDetails && (
<ActionsDropdownItem
- to={{ pathname: PERMISSION_TEMPLATES_PATH, search: queryToSearch({ id: t.id }) }}>
+ to={{ pathname: PERMISSION_TEMPLATES_PATH, search: queryToSearch({ id: t.id }) }}
+ >
{translate('edit_permissions')}
</ActionsDropdownItem>
)}
@@ -175,7 +177,8 @@ export class ActionsCell extends React.PureComponent<Props, State> {
<ActionsDropdownItem
className="js-delete"
destructive={true}
- onClick={this.handleDeleteClick}>
+ onClick={this.handleDeleteClick}
+ >
{translate('delete')}
</ActionsDropdownItem>
)}
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/App.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/App.tsx
index 649ee420207..fce2ef87a33 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/App.tsx
@@ -47,7 +47,7 @@ export class App extends React.PureComponent<Props, State> {
state: State = {
ready: false,
permissions: [],
- permissionTemplates: []
+ permissionTemplates: [],
};
componentDidMount() {
@@ -71,7 +71,7 @@ export class App extends React.PureComponent<Props, State> {
this.setState({
ready: true,
permissionTemplates: permissionTemplatesMerged,
- permissions: sortedPerm
+ permissions: sortedPerm,
});
}
};
@@ -81,7 +81,7 @@ export class App extends React.PureComponent<Props, State> {
return null;
}
- const template = this.state.permissionTemplates.find(t => t.id === id);
+ const template = this.state.permissionTemplates.find((t) => t.id === id);
if (!template) {
return null;
}
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/Defaults.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/Defaults.tsx
index 02ff003aae4..b47f2592a5e 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/Defaults.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/Defaults.tsx
@@ -30,7 +30,7 @@ export default function Defaults({ template }: Props) {
const qualifiersToDisplay = template.defaultFor;
const qualifiers = sortBy(qualifiersToDisplay)
- .map(qualifier => translate('qualifiers', qualifier))
+ .map((qualifier) => translate('qualifiers', qualifier))
.join(', ');
return (
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/Form.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/Form.tsx
index e302f615198..e2242c8a3b8 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/Form.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/Form.tsx
@@ -52,7 +52,7 @@ export default class Form extends React.PureComponent<Props, State> {
description: (props.permissionTemplate && props.permissionTemplate.description) || '',
name: (props.permissionTemplate && props.permissionTemplate.name) || '',
projectKeyPattern:
- (props.permissionTemplate && props.permissionTemplate.projectKeyPattern) || ''
+ (props.permissionTemplate && props.permissionTemplate.projectKeyPattern) || '',
};
}
@@ -61,7 +61,7 @@ export default class Form extends React.PureComponent<Props, State> {
.onSubmit({
description: this.state.description,
name: this.state.name,
- projectKeyPattern: this.state.projectKeyPattern
+ projectKeyPattern: this.state.projectKeyPattern,
})
.then(this.props.onClose);
};
@@ -84,7 +84,8 @@ export default class Form extends React.PureComponent<Props, State> {
header={this.props.header}
onClose={this.props.onClose}
onSubmit={this.handleSubmit}
- size="small">
+ size="small"
+ >
{({ onCloseClick, onFormSubmit, submitting }) => (
<form id="permission-template-form" onSubmit={onFormSubmit}>
<header className="modal-head">
@@ -147,7 +148,8 @@ export default class Form extends React.PureComponent<Props, State> {
<ResetButtonLink
disabled={submitting}
id="permission-template-cancel"
- onClick={onCloseClick}>
+ onClick={onCloseClick}
+ >
{translate('cancel')}
</ResetButtonLink>
</footer>
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/Header.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/Header.tsx
index 7494e4260da..9152371d3f6 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/Header.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/Header.tsx
@@ -62,11 +62,11 @@ class Header extends React.PureComponent<Props, State> {
name: string;
projectKeyPattern: string;
}) => {
- return createPermissionTemplate({ ...data }).then(response => {
+ return createPermissionTemplate({ ...data }).then((response) => {
this.props.refresh().then(() => {
this.props.router.push({
pathname: PERMISSION_TEMPLATES_PATH,
- query: { id: response.permissionTemplate.id }
+ query: { id: response.permissionTemplate.id },
});
});
});
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/List.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/List.tsx
index 226a3f63250..4c34edff7dd 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/List.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/List.tsx
@@ -30,7 +30,7 @@ interface Props {
}
export default function List(props: Props) {
- const permissionTemplates = props.permissionTemplates.map(p => (
+ const permissionTemplates = props.permissionTemplates.map((p) => (
<ListItem key={p.id} refresh={props.refresh} template={p} topQualifiers={props.topQualifiers} />
));
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/ListHeader.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/ListHeader.tsx
index db38452c456..8edbf023f4d 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/ListHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/ListHeader.tsx
@@ -43,7 +43,7 @@ export default class ListHeader extends React.PureComponent<Props> {
}
render() {
- const cells = this.props.permissions.map(permission => (
+ const cells = this.props.permissions.map((permission) => (
<th className="permission-column little-padded-left little-padded-right" key={permission.key}>
<div className="permission-column-inner">
<span className="text-middle">{translate('projects_role', permission.key)}</span>
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.tsx
index 2415db413f0..d796977cb94 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.tsx
@@ -30,7 +30,7 @@ interface Props {
}
export default function ListItem(props: Props) {
- const permissions = props.template.permissions.map(p => (
+ const permissions = props.template.permissions.map((p) => (
<PermissionCell key={p.key} permission={p} />
));
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/Template.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/Template.tsx
index a699420452d..7e0ad42157c 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/Template.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/Template.tsx
@@ -26,7 +26,7 @@ import HoldersList from '../../permissions/shared/components/HoldersList';
import SearchForm from '../../permissions/shared/components/SearchForm';
import {
convertToPermissionDefinitions,
- PERMISSIONS_ORDER_FOR_PROJECT_TEMPLATE
+ PERMISSIONS_ORDER_FOR_PROJECT_TEMPLATE,
} from '../../permissions/utils';
import TemplateDetails from './TemplateDetails';
import TemplateHeader from './TemplateHeader';
@@ -53,7 +53,7 @@ export default class Template extends React.PureComponent<Props, State> {
groups: [],
loading: false,
query: '',
- users: []
+ users: [],
};
componentDidMount() {
@@ -90,7 +90,7 @@ export default class Template extends React.PureComponent<Props, State> {
this.setState({
users,
groups,
- loading: false
+ loading: false,
});
}
});
@@ -105,7 +105,7 @@ export default class Template extends React.PureComponent<Props, State> {
const data: { templateId: string; login: string; permission: string } = {
templateId: template.id,
login: user.login,
- permission
+ permission,
};
const request = hasPermission
@@ -129,7 +129,7 @@ export default class Template extends React.PureComponent<Props, State> {
const data = {
templateId: template.id,
groupName: group.name,
- permission
+ permission,
};
const request = hasPermission
? api.revokeTemplatePermissionFromGroup(data)
@@ -176,14 +176,14 @@ export default class Template extends React.PureComponent<Props, State> {
const allUsers = [...this.state.users];
const creatorPermissions = this.props.template.permissions
- .filter(p => p.withProjectCreator)
- .map(p => p.key);
+ .filter((p) => p.withProjectCreator)
+ .map((p) => p.key);
if (this.shouldDisplayCreator(creatorPermissions)) {
const creator = {
login: '<creator>',
name: translate('permission_templates.project_creators'),
- permissions: creatorPermissions
+ permissions: creatorPermissions,
};
allUsers.unshift(creator);
@@ -210,7 +210,8 @@ export default class Template extends React.PureComponent<Props, State> {
permissions={permissions}
selectedPermission={this.state.selectedPermission}
showPublicProjectsWarning={true}
- users={allUsers}>
+ users={allUsers}
+ >
<SearchForm
filter={this.state.filter}
onFilter={this.handleFilter}
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/ActionsCell-test.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/ActionsCell-test.tsx
index f079f5b0477..83cdec1ab7e 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/ActionsCell-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/ActionsCell-test.tsx
@@ -27,7 +27,7 @@ const SAMPLE = {
id: 'id',
name: 'name',
permissions: [],
- defaultFor: []
+ defaultFor: [],
};
function renderActionsCell(props?: Partial<ActionsCell['props']>) {
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/App-test.tsx
index 7dbbdfa0f9f..839206fa0a6 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/App-test.tsx
@@ -34,16 +34,16 @@ jest.mock('../../../../api/permissions', () => ({
updatedAt: '2019-02-07T17:23:26+0100',
permissions: [
{ key: 'admin', usersCount: 0, groupsCount: 1, withProjectCreator: false },
- { key: 'codeviewer', usersCount: 0, groupsCount: 1, withProjectCreator: false }
- ]
- }
+ { key: 'codeviewer', usersCount: 0, groupsCount: 1, withProjectCreator: false },
+ ],
+ },
],
defaultTemplates: [{ templateId: '1', qualifier: 'TRK' }],
permissions: [
{ key: 'admin', name: 'Administer', description: 'Admin permission' },
- { key: 'codeviewer', name: 'See Source Code', description: 'Code viewer permission' }
- ]
- })
+ { key: 'codeviewer', name: 'See Source Code', description: 'Code viewer permission' },
+ ],
+ }),
}));
it('should render correctly', async () => {
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Defaults-test.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Defaults-test.tsx
index cc490d629a1..c091c14fe58 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Defaults-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Defaults-test.tsx
@@ -27,7 +27,7 @@ const SAMPLE: PermissionTemplate = {
defaultFor: [],
id: 'id',
name: 'name',
- permissions: []
+ permissions: [],
};
it('should render one qualifier', () => {
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/ListItem-test.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/ListItem-test.tsx
index 23f9522b23c..c800e57c9de 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/ListItem-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/ListItem-test.tsx
@@ -35,7 +35,7 @@ function shallowRender() {
createdAt: '2020-01-01',
name: 'test',
defaultFor: [],
- permissions: []
+ permissions: [],
}}
topQualifiers={[]}
/>
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/NameCell-test.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/NameCell-test.tsx
index 61b817ecbba..7b2c0470689 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/NameCell-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/NameCell-test.tsx
@@ -33,7 +33,7 @@ function shallowRender() {
createdAt: '2020-01-01',
name: 'test',
defaultFor: ['user'],
- permissions: []
+ permissions: [],
}}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Template-test.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Template-test.tsx
index 371492549ba..a06d0fb8bf3 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Template-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Template-test.tsx
@@ -23,7 +23,7 @@ import {
grantTemplatePermissionToGroup,
grantTemplatePermissionToUser,
revokeTemplatePermissionFromGroup,
- revokeTemplatePermissionFromUser
+ revokeTemplatePermissionFromUser,
} from '../../../../api/permissions';
import Template from '../Template';
@@ -33,7 +33,7 @@ jest.mock('../../../../api/permissions', () => ({
grantTemplatePermissionToGroup: jest.fn().mockResolvedValue({}),
revokeTemplatePermissionFromGroup: jest.fn().mockResolvedValue({}),
getPermissionTemplateGroups: jest.fn().mockResolvedValue([]),
- getPermissionTemplateUsers: jest.fn().mockResolvedValue([])
+ getPermissionTemplateUsers: jest.fn().mockResolvedValue([]),
}));
it('render correctly', () => {
@@ -44,16 +44,16 @@ it('revoke group permission if granted', async () => {
const wrapper = shallowRender();
const group = {
name: 'foo',
- permissions: ['bar']
+ permissions: ['bar'],
};
wrapper.setState({
- groups: [group]
+ groups: [group],
});
await wrapper.instance().handleToggleGroup(group, 'bar');
expect(revokeTemplatePermissionFromGroup).toHaveBeenCalledWith({
groupName: 'foo',
templateId: '1',
- permission: 'bar'
+ permission: 'bar',
});
});
@@ -61,16 +61,16 @@ it('grant group permission', async () => {
const wrapper = shallowRender();
const group = {
name: 'foo',
- permissions: []
+ permissions: [],
};
wrapper.setState({
- groups: [group]
+ groups: [group],
});
await wrapper.instance().handleToggleGroup(group, 'bar');
expect(grantTemplatePermissionToGroup).toHaveBeenCalledWith({
groupName: 'foo',
templateId: '1',
- permission: 'bar'
+ permission: 'bar',
});
});
@@ -79,16 +79,16 @@ it('revoke user permission if granted', async () => {
const user = {
login: 'foo',
name: 'foo',
- permissions: ['bar']
+ permissions: ['bar'],
};
wrapper.setState({
- users: [user]
+ users: [user],
});
await wrapper.instance().handleToggleUser(user, 'bar');
expect(revokeTemplatePermissionFromUser).toHaveBeenCalledWith({
templateId: '1',
login: 'foo',
- permission: 'bar'
+ permission: 'bar',
});
});
@@ -97,16 +97,16 @@ it('grant user permission', async () => {
const user = {
login: 'foo',
name: 'foo',
- permissions: []
+ permissions: [],
};
wrapper.setState({
- users: [user]
+ users: [user],
});
await wrapper.instance().handleToggleUser(user, 'bar');
expect(grantTemplatePermissionToUser).toHaveBeenCalledWith({
templateId: '1',
login: 'foo',
- permission: 'bar'
+ permission: 'bar',
});
});
@@ -119,7 +119,7 @@ function shallowRender() {
createdAt: '2020-01-01',
name: 'test',
defaultFor: [],
- permissions: []
+ permissions: [],
}}
topQualifiers={[]}
/>
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/utils.ts b/server/sonar-web/src/main/js/apps/permission-templates/utils.ts
index f94ca1bd315..8e3a3762202 100644
--- a/server/sonar-web/src/main/js/apps/permission-templates/utils.ts
+++ b/server/sonar-web/src/main/js/apps/permission-templates/utils.ts
@@ -26,25 +26,25 @@ export const PERMISSIONS_ORDER = [
'issueadmin',
'securityhotspotadmin',
'admin',
- 'scan'
+ 'scan',
];
export const PERMISSION_TEMPLATES_PATH = '/admin/permission_templates';
export function sortPermissions(permissions: Permission[]) {
- return sortBy(permissions, p => PERMISSIONS_ORDER.indexOf(p.key));
+ return sortBy(permissions, (p) => PERMISSIONS_ORDER.indexOf(p.key));
}
export function mergePermissionsToTemplates(
permissionTemplates: PermissionTemplate[],
basePermissions: Permission[]
): PermissionTemplate[] {
- return permissionTemplates.map(permissionTemplate => {
+ return permissionTemplates.map((permissionTemplate) => {
// it's important to keep the order of the permission template's permissions
// the same as the order of base permissions
- const permissions = basePermissions.map(basePermission => {
+ const permissions = basePermissions.map((basePermission) => {
const projectPermission = permissionTemplate.permissions.find(
- p => p.key === basePermission.key
+ (p) => p.key === basePermission.key
);
return { usersCount: 0, groupsCount: 0, ...basePermission, ...projectPermission };
});
@@ -57,10 +57,10 @@ export function mergeDefaultsToTemplates(
permissionTemplates: PermissionTemplate[],
defaultTemplates: Array<{ templateId: string; qualifier: string }> = []
): PermissionTemplate[] {
- return permissionTemplates.map(permissionTemplate => {
+ return permissionTemplates.map((permissionTemplate) => {
const defaultFor: string[] = [];
- defaultTemplates.forEach(defaultTemplate => {
+ defaultTemplates.forEach((defaultTemplate) => {
if (defaultTemplate.templateId === permissionTemplate.id) {
defaultFor.push(defaultTemplate.qualifier);
}
diff --git a/server/sonar-web/src/main/js/apps/permissions/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/permissions/__tests__/utils-test.ts
index c322579fe2d..6d47dcb1936 100644
--- a/server/sonar-web/src/main/js/apps/permissions/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/permissions/__tests__/utils-test.ts
@@ -20,7 +20,7 @@
import { convertToPermissionDefinitions } from '../utils';
jest.mock('../../../helpers/l10nBundle', () => ({
- getMessages: jest.fn().mockReturnValue({})
+ getMessages: jest.fn().mockReturnValue({}),
}));
describe('convertToPermissionDefinitions', () => {
@@ -30,8 +30,8 @@ describe('convertToPermissionDefinitions', () => {
{
description: 'global_permissions.admin.desc',
key: 'admin',
- name: 'global_permissions.admin'
- }
+ name: 'global_permissions.admin',
+ },
];
expect(data).toEqual(expected);
diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/AllHoldersList.tsx b/server/sonar-web/src/main/js/apps/permissions/global/components/AllHoldersList.tsx
index 630e78f5217..03512413299 100644
--- a/server/sonar-web/src/main/js/apps/permissions/global/components/AllHoldersList.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/global/components/AllHoldersList.tsx
@@ -28,7 +28,7 @@ import SearchForm from '../../shared/components/SearchForm';
import {
convertToPermissionDefinitions,
filterPermissions,
- PERMISSIONS_ORDER_GLOBAL
+ PERMISSIONS_ORDER_GLOBAL,
} from '../../utils';
interface StateProps {
@@ -73,16 +73,8 @@ export class AllHoldersList extends React.PureComponent<Props> {
};
render() {
- const {
- appState,
- filter,
- groups,
- groupsPaging,
- users,
- usersPaging,
- loading,
- query
- } = this.props;
+ const { appState, filter, groups, groupsPaging, users, usersPaging, loading, query } =
+ this.props;
const l10nPrefix = 'global_permissions';
const hasPortfoliosEnabled = appState.qualifiers.includes(ComponentQualifier.Portfolio);
@@ -113,7 +105,8 @@ export class AllHoldersList extends React.PureComponent<Props> {
onToggleUser={this.handleToggleUser}
permissions={permissions}
query={query}
- users={users}>
+ users={users}
+ >
<SearchForm
filter={filter}
onFilter={this.props.onFilter}
diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx b/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx
index 127c324562a..a412b8f2db8 100644
--- a/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx
@@ -48,7 +48,7 @@ export default class App extends React.PureComponent<{}, State> {
groups: [],
loading: true,
query: '',
- users: []
+ users: [],
};
}
@@ -68,7 +68,7 @@ export default class App extends React.PureComponent<{}, State> {
filter !== 'groups'
? api.getGlobalPermissionsUsers({
q: query || undefined,
- p: userPage
+ p: userPage,
})
: Promise.resolve({ paging: undefined, users: [] });
@@ -76,7 +76,7 @@ export default class App extends React.PureComponent<{}, State> {
filter !== 'users'
? api.getGlobalPermissionsGroups({
q: query || undefined,
- p: groupsPage
+ p: groupsPage,
})
: Promise.resolve({ paging: undefined, groups: [] });
@@ -92,7 +92,7 @@ export default class App extends React.PureComponent<{}, State> {
groupsPaging: groupsResponse.paging,
loading: false,
users: usersResponse.users,
- usersPaging: usersResponse.paging
+ usersPaging: usersResponse.paging,
});
}
}, this.stopLoading);
@@ -111,7 +111,7 @@ export default class App extends React.PureComponent<{}, State> {
groupsPaging: groupsResponse.paging,
loading: false,
users: [...users, ...usersResponse.users],
- usersPaging: usersResponse.paging
+ usersPaging: usersResponse.paging,
}));
}
}, this.stopLoading);
@@ -126,7 +126,7 @@ export default class App extends React.PureComponent<{}, State> {
};
addPermissionToGroup = (groups: PermissionGroup[], group: string, permission: string) => {
- return groups.map(candidate =>
+ return groups.map((candidate) =>
candidate.name === group
? { ...candidate, permissions: [...candidate.permissions, permission] }
: candidate
@@ -134,7 +134,7 @@ export default class App extends React.PureComponent<{}, State> {
};
addPermissionToUser = (users: PermissionUser[], user: string, permission: string) => {
- return users.map(candidate =>
+ return users.map((candidate) =>
candidate.login === user
? { ...candidate, permissions: [...candidate.permissions, permission] }
: candidate
@@ -142,7 +142,7 @@ export default class App extends React.PureComponent<{}, State> {
};
removePermissionFromGroup = (groups: PermissionGroup[], group: string, permission: string) => {
- return groups.map(candidate =>
+ return groups.map((candidate) =>
candidate.name === group
? { ...candidate, permissions: without(candidate.permissions, permission) }
: candidate
@@ -150,7 +150,7 @@ export default class App extends React.PureComponent<{}, State> {
};
removePermissionFromUser = (users: PermissionUser[], user: string, permission: string) => {
- return users.map(candidate =>
+ return users.map((candidate) =>
candidate.login === user
? { ...candidate, permissions: without(candidate.permissions, permission) }
: candidate
@@ -160,19 +160,19 @@ export default class App extends React.PureComponent<{}, State> {
grantPermissionToGroup = (group: string, permission: string) => {
if (this.mounted) {
this.setState(({ groups }) => ({
- groups: this.addPermissionToGroup(groups, group, permission)
+ groups: this.addPermissionToGroup(groups, group, permission),
}));
return api
.grantPermissionToGroup({
groupName: group,
- permission
+ permission,
})
.then(
() => {},
() => {
if (this.mounted) {
this.setState(({ groups }) => ({
- groups: this.removePermissionFromGroup(groups, group, permission)
+ groups: this.removePermissionFromGroup(groups, group, permission),
}));
}
}
@@ -184,19 +184,19 @@ export default class App extends React.PureComponent<{}, State> {
grantPermissionToUser = (user: string, permission: string) => {
if (this.mounted) {
this.setState(({ users }) => ({
- users: this.addPermissionToUser(users, user, permission)
+ users: this.addPermissionToUser(users, user, permission),
}));
return api
.grantPermissionToUser({
login: user,
- permission
+ permission,
})
.then(
() => {},
() => {
if (this.mounted) {
this.setState(({ users }) => ({
- users: this.removePermissionFromUser(users, user, permission)
+ users: this.removePermissionFromUser(users, user, permission),
}));
}
}
@@ -208,19 +208,19 @@ export default class App extends React.PureComponent<{}, State> {
revokePermissionFromGroup = (group: string, permission: string) => {
if (this.mounted) {
this.setState(({ groups }) => ({
- groups: this.removePermissionFromGroup(groups, group, permission)
+ groups: this.removePermissionFromGroup(groups, group, permission),
}));
return api
.revokePermissionFromGroup({
groupName: group,
- permission
+ permission,
})
.then(
() => {},
() => {
if (this.mounted) {
this.setState(({ groups }) => ({
- groups: this.addPermissionToGroup(groups, group, permission)
+ groups: this.addPermissionToGroup(groups, group, permission),
}));
}
}
@@ -232,19 +232,19 @@ export default class App extends React.PureComponent<{}, State> {
revokePermissionFromUser = (user: string, permission: string) => {
if (this.mounted) {
this.setState(({ users }) => ({
- users: this.removePermissionFromUser(users, user, permission)
+ users: this.removePermissionFromUser(users, user, permission),
}));
return api
.revokePermissionFromUser({
login: user,
- permission
+ permission,
})
.then(
() => {},
() => {
if (this.mounted) {
this.setState(({ users }) => ({
- users: this.addPermissionToUser(users, user, permission)
+ users: this.addPermissionToUser(users, user, permission),
}));
}
}
diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/AllHoldersList-test.tsx b/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/AllHoldersList-test.tsx
index 08278fe5912..5a2f9686d8c 100644
--- a/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/AllHoldersList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/AllHoldersList-test.tsx
@@ -31,15 +31,15 @@ it('should render correctly', () => {
expect(
shallowRender({
appState: mockAppState({
- qualifiers: [ComponentQualifier.Project, ComponentQualifier.Application]
- })
+ qualifiers: [ComponentQualifier.Project, ComponentQualifier.Application],
+ }),
})
).toMatchSnapshot('applications available');
expect(
shallowRender({
appState: mockAppState({
- qualifiers: [ComponentQualifier.Project, ComponentQualifier.Portfolio]
- })
+ qualifiers: [ComponentQualifier.Project, ComponentQualifier.Portfolio],
+ }),
})
).toMatchSnapshot('portfolios available');
});
diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/App-test.tsx
index 02a97b57fd8..fe4450bba7d 100644
--- a/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/global/components/__tests__/App-test.tsx
@@ -23,7 +23,7 @@ import {
grantPermissionToGroup,
grantPermissionToUser,
revokePermissionFromGroup,
- revokePermissionFromUser
+ revokePermissionFromUser,
} from '../../../../../api/permissions';
import { waitAndUpdate } from '../../../../../helpers/testUtils';
import App from '../App';
@@ -33,8 +33,8 @@ jest.mock('../../../../../api/permissions', () => ({
paging: { pageIndex: 1, pageSize: 100, total: 2 },
groups: [
{ name: 'Anyone', permissions: ['admin', 'codeviewer', 'issueadmin'] },
- { id: '1', name: 'SonarSource', description: 'SonarSource team', permissions: [] }
- ]
+ { id: '1', name: 'SonarSource', description: 'SonarSource team', permissions: [] },
+ ],
}),
getGlobalPermissionsUsers: jest.fn().mockResolvedValue({
paging: { pageIndex: 1, pageSize: 100, total: 3 },
@@ -44,28 +44,28 @@ jest.mock('../../../../../api/permissions', () => ({
email: 'admin@gmail.com',
login: 'admin',
name: 'Admin Admin',
- permissions: ['admin']
+ permissions: ['admin'],
},
{
avatar: 'user-avatar-1',
email: 'user1@gmail.com',
login: 'user1',
name: 'User Number 1',
- permissions: []
+ permissions: [],
},
{
avatar: 'user-avatar-2',
email: 'user2@gmail.com',
login: 'user2',
name: 'User Number 2',
- permissions: []
- }
- ]
+ permissions: [],
+ },
+ ],
}),
grantPermissionToGroup: jest.fn().mockResolvedValue({}),
grantPermissionToUser: jest.fn().mockResolvedValue({}),
revokePermissionFromGroup: jest.fn().mockResolvedValue({}),
- revokePermissionFromUser: jest.fn().mockResolvedValue({})
+ revokePermissionFromUser: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/AllHoldersList.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/AllHoldersList.tsx
index 059ea184e17..7e785bac565 100644
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/AllHoldersList.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/AllHoldersList.tsx
@@ -25,7 +25,7 @@ import {
Paging,
PermissionGroup,
PermissionUser,
- Visibility
+ Visibility,
} from '../../../../types/types';
import HoldersList from '../../shared/components/HoldersList';
import SearchForm from '../../shared/components/SearchForm';
@@ -106,7 +106,8 @@ export default class AllHoldersList extends React.PureComponent<Props> {
permissions={permissions}
query={this.props.query}
selectedPermission={this.props.selectedPermission}
- users={this.props.users}>
+ users={this.props.users}
+ >
<SearchForm
filter={this.props.filter}
onFilter={this.props.onFilterChange}
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/App.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/App.tsx
index d3b830873e3..8f10a35b65e 100644
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/App.tsx
@@ -58,7 +58,7 @@ export class App extends React.PureComponent<Props, State> {
groups: [],
loading: true,
query: '',
- users: []
+ users: [],
};
}
@@ -87,7 +87,7 @@ export class App extends React.PureComponent<Props, State> {
projectKey: component.key,
q: query || undefined,
permission: selectedPermission,
- p: userPage
+ p: userPage,
})
: Promise.resolve({ paging: undefined, users: [] });
@@ -97,7 +97,7 @@ export class App extends React.PureComponent<Props, State> {
projectKey: component.key,
q: query || undefined,
permission: selectedPermission,
- p: groupsPage
+ p: groupsPage,
})
: Promise.resolve({ paging: undefined, groups: [] });
@@ -113,7 +113,7 @@ export class App extends React.PureComponent<Props, State> {
groupsPaging: groupsResponse.paging,
loading: false,
users: usersResponse.users,
- usersPaging: usersResponse.paging
+ usersPaging: usersResponse.paging,
});
}
}, this.stopLoading);
@@ -132,7 +132,7 @@ export class App extends React.PureComponent<Props, State> {
groupsPaging: groupsResponse.paging,
loading: false,
users: [...users, ...usersResponse.users],
- usersPaging: usersResponse.paging
+ usersPaging: usersResponse.paging,
}));
}
}, this.stopLoading);
@@ -155,7 +155,7 @@ export class App extends React.PureComponent<Props, State> {
this.setState(
(state: State) => ({
selectedPermission:
- state.selectedPermission === selectedPermission ? undefined : selectedPermission
+ state.selectedPermission === selectedPermission ? undefined : selectedPermission,
}),
this.loadHolders
);
@@ -163,7 +163,7 @@ export class App extends React.PureComponent<Props, State> {
};
addPermissionToGroup = (group: string, permission: string) => {
- return this.state.groups.map(candidate =>
+ return this.state.groups.map((candidate) =>
candidate.name === group
? { ...candidate, permissions: [...candidate.permissions, permission] }
: candidate
@@ -171,7 +171,7 @@ export class App extends React.PureComponent<Props, State> {
};
addPermissionToUser = (user: string, permission: string) => {
- return this.state.users.map(candidate =>
+ return this.state.users.map((candidate) =>
candidate.login === user
? { ...candidate, permissions: [...candidate.permissions, permission] }
: candidate
@@ -179,7 +179,7 @@ export class App extends React.PureComponent<Props, State> {
};
removePermissionFromGroup = (group: string, permission: string) => {
- return this.state.groups.map(candidate =>
+ return this.state.groups.map((candidate) =>
candidate.name === group
? { ...candidate, permissions: without(candidate.permissions, permission) }
: candidate
@@ -187,7 +187,7 @@ export class App extends React.PureComponent<Props, State> {
};
removePermissionFromUser = (user: string, permission: string) => {
- return this.state.users.map(candidate =>
+ return this.state.users.map((candidate) =>
candidate.login === user
? { ...candidate, permissions: without(candidate.permissions, permission) }
: candidate
@@ -198,19 +198,19 @@ export class App extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
loading: true,
- groups: this.addPermissionToGroup(group, permission)
+ groups: this.addPermissionToGroup(group, permission),
});
return api
.grantPermissionToGroup({
projectKey: this.props.component.key,
groupName: group,
- permission
+ permission,
})
.then(this.stopLoading, () => {
if (this.mounted) {
this.setState({
loading: false,
- groups: this.removePermissionFromGroup(group, permission)
+ groups: this.removePermissionFromGroup(group, permission),
});
}
});
@@ -222,19 +222,19 @@ export class App extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
loading: true,
- users: this.addPermissionToUser(user, permission)
+ users: this.addPermissionToUser(user, permission),
});
return api
.grantPermissionToUser({
projectKey: this.props.component.key,
login: user,
- permission
+ permission,
})
.then(this.stopLoading, () => {
if (this.mounted) {
this.setState({
loading: false,
- users: this.removePermissionFromUser(user, permission)
+ users: this.removePermissionFromUser(user, permission),
});
}
});
@@ -246,19 +246,19 @@ export class App extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
loading: true,
- groups: this.removePermissionFromGroup(group, permission)
+ groups: this.removePermissionFromGroup(group, permission),
});
return api
.revokePermissionFromGroup({
projectKey: this.props.component.key,
groupName: group,
- permission
+ permission,
})
.then(this.stopLoading, () => {
if (this.mounted) {
this.setState({
loading: false,
- groups: this.addPermissionToGroup(group, permission)
+ groups: this.addPermissionToGroup(group, permission),
});
}
});
@@ -270,19 +270,19 @@ export class App extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
loading: true,
- users: this.removePermissionFromUser(user, permission)
+ users: this.removePermissionFromUser(user, permission),
});
return api
.revokePermissionFromUser({
projectKey: this.props.component.key,
login: user,
- permission
+ permission,
})
.then(this.stopLoading, () => {
if (this.mounted) {
this.setState({
loading: false,
- users: this.addPermissionToUser(user, permission)
+ users: this.addPermissionToUser(user, permission),
});
}
});
@@ -306,7 +306,7 @@ export class App extends React.PureComponent<Props, State> {
},
() => {
this.props.onComponentChange({
- visibility: 'private'
+ visibility: 'private',
});
}
);
@@ -320,7 +320,7 @@ export class App extends React.PureComponent<Props, State> {
},
() => {
this.props.onComponentChange({
- visibility: 'public'
+ visibility: 'public',
});
}
);
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx
index 9ae8fb49949..ceb50e65967 100644
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx
@@ -74,7 +74,7 @@ export default class ApplyTemplate extends React.PureComponent<Props, State> {
if (this.state.permissionTemplate) {
return applyTemplateToProject({
projectKey: this.props.project.key,
- templateId: this.state.permissionTemplate
+ templateId: this.state.permissionTemplate,
}).then(() => {
if (this.mounted) {
if (this.props.onApply) {
@@ -99,9 +99,9 @@ export default class ApplyTemplate extends React.PureComponent<Props, State> {
);
const options = this.state.permissionTemplates
- ? this.state.permissionTemplates.map(permissionTemplate => ({
+ ? this.state.permissionTemplates.map((permissionTemplate) => ({
label: permissionTemplate.name,
- value: permissionTemplate.id
+ value: permissionTemplate.id,
}))
: [];
@@ -110,7 +110,8 @@ export default class ApplyTemplate extends React.PureComponent<Props, State> {
header={header}
onClose={this.props.onClose}
onSubmit={this.handleSubmit}
- size="small">
+ size="small"
+ >
{({ onCloseClick, onFormSubmit, submitting }) => (
<form id="project-permissions-apply-template-form" onSubmit={onFormSubmit}>
<header className="modal-head">
@@ -139,7 +140,7 @@ export default class ApplyTemplate extends React.PureComponent<Props, State> {
inputId="project-permissions-template-input"
onChange={this.handlePermissionTemplateChange}
options={options}
- value={options.filter(o => o.value === this.state.permissionTemplate)}
+ value={options.filter((o) => o.value === this.state.permissionTemplate)}
/>
)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.tsx
index 032d81dc936..3b198a33e62 100644
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/PublicProjectDisclaimer.tsx
@@ -38,7 +38,8 @@ export default function PublicProjectDisclaimer({ component, onClose, onConfirm
confirmButtonText={translate('projects_role.turn_project_to_public', qualifier)}
header={translateWithParameters('projects_role.turn_x_to_public', component.name)}
onClose={onClose}
- onConfirm={onConfirm}>
+ onConfirm={onConfirm}
+ >
<Alert variant="warning">
{translate('projects_role.are_you_sure_to_turn_project_to_public.warning', qualifier)}
</Alert>
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/App-test.tsx
index de0d08d4d63..21592eca11f 100644
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/App-test.tsx
@@ -23,7 +23,7 @@ import {
grantPermissionToGroup,
grantPermissionToUser,
revokePermissionFromGroup,
- revokePermissionFromUser
+ revokePermissionFromUser,
} from '../../../../../api/permissions';
import { mockComponent } from '../../../../../helpers/mocks/component';
import { waitAndUpdate } from '../../../../../helpers/testUtils';
@@ -34,8 +34,8 @@ jest.mock('../../../../../api/permissions', () => ({
paging: { pageIndex: 1, pageSize: 100, total: 2 },
groups: [
{ name: 'Anyone', permissions: ['admin', 'codeviewer', 'issueadmin'] },
- { id: '1', name: 'SonarSource', description: 'SonarSource team', permissions: [] }
- ]
+ { id: '1', name: 'SonarSource', description: 'SonarSource team', permissions: [] },
+ ],
}),
getPermissionsUsersForComponent: jest.fn().mockResolvedValue({
paging: { pageIndex: 1, pageSize: 100, total: 3 },
@@ -45,28 +45,28 @@ jest.mock('../../../../../api/permissions', () => ({
email: 'admin@gmail.com',
login: 'admin',
name: 'Admin Admin',
- permissions: ['admin']
+ permissions: ['admin'],
},
{
avatar: 'user-avatar-1',
email: 'user1@gmail.com',
login: 'user1',
name: 'User Number 1',
- permissions: []
+ permissions: [],
},
{
avatar: 'user-avatar-2',
email: 'user2@gmail.com',
login: 'user2',
name: 'User Number 2',
- permissions: []
- }
- ]
+ permissions: [],
+ },
+ ],
}),
grantPermissionToGroup: jest.fn().mockResolvedValue({}),
grantPermissionToUser: jest.fn().mockResolvedValue({}),
revokePermissionFromGroup: jest.fn().mockResolvedValue({}),
- revokePermissionFromUser: jest.fn().mockResolvedValue({})
+ revokePermissionFromUser: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
@@ -98,7 +98,7 @@ describe('should manage state correctly', () => {
const apiPayload = {
projectKey: 'my-project',
groupName: 'Anyone',
- permission: 'foo'
+ permission: 'foo',
};
instance.grantPermissionToGroup('Anyone', 'foo');
@@ -131,7 +131,7 @@ describe('should manage state correctly', () => {
const apiPayload = {
projectKey: 'my-project',
login: 'user1',
- permission: 'foo'
+ permission: 'foo',
};
instance.grantPermissionToUser('user1', 'foo');
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/ApplyTemplate-test.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/ApplyTemplate-test.tsx
index 65edfd756ba..927c87b95c5 100644
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/ApplyTemplate-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/ApplyTemplate-test.tsx
@@ -31,16 +31,16 @@ jest.mock('../../../../../api/permissions', () => ({
createdAt: '2015-11-27T15:20:32+0100',
permissions: [
{ key: 'admin', usersCount: 0, groupsCount: 3 },
- { key: 'codeviewer', usersCount: 0, groupsCount: 6 }
- ]
- }
+ { key: 'codeviewer', usersCount: 0, groupsCount: 6 },
+ ],
+ },
],
defaultTemplates: [{ templateId: 'tmp1', qualifier: 'TRK' }],
permissions: [
{ key: 'admin', name: 'Administer', description: 'Administer access' },
- { key: 'codeviewer', name: 'See Source Code', description: 'View code' }
- ]
- })
+ { key: 'codeviewer', name: 'See Source Code', description: 'View code' },
+ ],
+ }),
}));
it('render correctly', async () => {
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.tsx
index 9e1c085abe9..0203577dab6 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/GroupHolder.tsx
@@ -49,13 +49,13 @@ export default class GroupHolder extends React.PureComponent<Props, State> {
stopLoading = (permission: string) => {
if (this.mounted) {
- this.setState(state => ({ loading: without(state.loading, permission) }));
+ this.setState((state) => ({ loading: without(state.loading, permission) }));
}
};
handleCheck = (_checked: boolean, permission?: string) => {
if (permission !== undefined) {
- this.setState(state => ({ loading: [...state.loading, permission] }));
+ this.setState((state) => ({ loading: [...state.loading, permission] }));
this.props.onToggle(this.props.group, permission).then(
() => this.stopLoading(permission),
() => this.stopLoading(permission)
@@ -81,7 +81,7 @@ export default class GroupHolder extends React.PureComponent<Props, State> {
</div>
</div>
</td>
- {this.props.permissions.map(permission => (
+ {this.props.permissions.map((permission) => (
<PermissionCell
key={isPermissionDefinitionGroup(permission) ? permission.category : permission.key}
loading={this.state.loading}
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx
index 7297d18694f..e9fbcc5ab59 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/HoldersList.tsx
@@ -24,7 +24,7 @@ import {
Dict,
PermissionDefinitions,
PermissionGroup,
- PermissionUser
+ PermissionUser,
} from '../../../../types/types';
import { isPermissionDefinitionGroup } from '../../utils';
import GroupHolder from './GroupHolder';
@@ -63,11 +63,11 @@ export default class HoldersList extends React.PureComponent<Props, State> {
handleGroupToggle = (group: PermissionGroup, permission: string) => {
const key = group.id || group.name;
if (this.state.initialPermissionsCount[key] === undefined) {
- this.setState(state => ({
+ this.setState((state) => ({
initialPermissionsCount: {
...state.initialPermissionsCount,
- [key]: group.permissions.length
- }
+ [key]: group.permissions.length,
+ },
}));
}
return this.props.onToggleGroup(group, permission);
@@ -75,11 +75,11 @@ export default class HoldersList extends React.PureComponent<Props, State> {
handleUserToggle = (user: PermissionUser, permission: string) => {
if (this.state.initialPermissionsCount[user.login] === undefined) {
- this.setState(state => ({
+ this.setState((state) => ({
initialPermissionsCount: {
...state.initialPermissionsCount,
- [user.login]: user.permissions.length
- }
+ [user.login]: user.permissions.length,
+ },
}));
}
return this.props.onToggleUser(user, permission);
@@ -123,13 +123,13 @@ export default class HoldersList extends React.PureComponent<Props, State> {
render() {
const { permissions } = this.props;
- const items = sortBy([...this.props.users, ...this.props.groups], item => {
+ const items = sortBy([...this.props.users, ...this.props.groups], (item) => {
if (this.isPermissionUser(item) && item.login === '<creator>') {
return 0;
}
return item.name;
});
- const [itemWithPermissions, itemWithoutPermissions] = partition(items, item =>
+ const [itemWithPermissions, itemWithoutPermissions] = partition(items, (item) =>
this.getItemInitialPermissionsCount(item)
);
return (
@@ -138,7 +138,7 @@ export default class HoldersList extends React.PureComponent<Props, State> {
<thead>
<tr>
<td className="nowrap bordered-bottom">{this.props.children}</td>
- {permissions.map(permission => (
+ {permissions.map((permission) => (
<PermissionHeader
key={
isPermissionDefinitionGroup(permission) ? permission.category : permission.key
@@ -153,7 +153,7 @@ export default class HoldersList extends React.PureComponent<Props, State> {
</thead>
<tbody>
{items.length === 0 && !this.props.loading && this.renderEmpty()}
- {itemWithPermissions.map(item => this.renderItem(item, permissions))}
+ {itemWithPermissions.map((item) => this.renderItem(item, permissions))}
{itemWithPermissions.length > 0 && itemWithoutPermissions.length > 0 && (
<>
<tr>
@@ -163,7 +163,7 @@ export default class HoldersList extends React.PureComponent<Props, State> {
{/* Keep correct zebra colors in the table */}
</>
)}
- {itemWithoutPermissions.map(item => this.renderItem(item, permissions))}
+ {itemWithoutPermissions.map((item) => this.renderItem(item, permissions))}
</tbody>
</table>
</div>
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionCell.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionCell.tsx
index 81efb3ab9e4..af56a283964 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionCell.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionCell.tsx
@@ -24,7 +24,7 @@ import {
PermissionDefinition,
PermissionDefinitionGroup,
PermissionGroup,
- PermissionUser
+ PermissionUser,
} from '../../../../types/types';
import { isPermissionDefinitionGroup } from '../../utils';
@@ -42,13 +42,14 @@ export default class PermissionCell extends React.PureComponent<Props> {
if (isPermissionDefinitionGroup(permission)) {
return (
<td className="text-middle">
- {permission.permissions.map(permission => (
+ {permission.permissions.map((permission) => (
<div key={permission.key}>
<Checkbox
checked={permissionItem.permissions.includes(permission.key)}
disabled={loading.includes(permission.key)}
id={permission.key}
- onCheck={onCheck}>
+ onCheck={onCheck}
+ >
<span className="little-spacer-left">{permission.name}</span>
</Checkbox>
</div>
@@ -59,8 +60,9 @@ export default class PermissionCell extends React.PureComponent<Props> {
return (
<td
className={classNames('permission-column text-center text-middle', {
- selected: permission.key === selectedPermission
- })}>
+ selected: permission.key === selectedPermission,
+ })}
+ >
<Checkbox
checked={permissionItem.permissions.includes(permission.key)}
disabled={loading.includes(permission.key)}
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionHeader.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionHeader.tsx
index 7a8925bd7c5..518a80f69a1 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/PermissionHeader.tsx
@@ -48,7 +48,7 @@ export default class PermissionHeader extends React.PureComponent<Props> {
const { permission } = this.props;
if (isPermissionDefinitionGroup(permission)) {
- return permission.permissions.map(permission => (
+ return permission.permissions.map((permission) => (
<React.Fragment key={permission.key}>
<b className="little-spacer-right">{permission.name}:</b>
<InstanceMessage key={permission.key} message={permission.description} />
@@ -81,7 +81,8 @@ export default class PermissionHeader extends React.PureComponent<Props> {
overlay={translateWithParameters(
'global_permissions.filter_by_x_permission',
permission.name
- )}>
+ )}
+ >
<a href="#" onClick={this.handlePermissionClick}>
{permission.name}
</a>
@@ -95,8 +96,9 @@ export default class PermissionHeader extends React.PureComponent<Props> {
className={classNames('permission-column text-center text-middle', {
selected:
!isPermissionDefinitionGroup(permission) &&
- permission.key === this.props.selectedPermission
- })}>
+ permission.key === this.props.selectedPermission,
+ })}
+ >
<div className="permission-column-inner">
{name}
<HelpTooltip className="spacer-left" overlay={this.getTooltipOverlay()} />
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/SearchForm.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/SearchForm.tsx
index 05473328be1..e46ed4a4cb6 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/SearchForm.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/SearchForm.tsx
@@ -33,7 +33,7 @@ export default function SearchForm(props: Props) {
const filterOptions = [
{ value: 'all', label: translate('all') },
{ value: 'users', label: translate('users.page') },
- { value: 'groups', label: translate('user_groups.page') }
+ { value: 'groups', label: translate('user_groups.page') },
];
return (
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.tsx
index d92b6d8ecf1..300ad69ead5 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/UserHolder.tsx
@@ -50,13 +50,13 @@ export default class UserHolder extends React.PureComponent<Props, State> {
stopLoading = (permission: string) => {
if (this.mounted) {
- this.setState(state => ({ loading: without(state.loading, permission) }));
+ this.setState((state) => ({ loading: without(state.loading, permission) }));
}
};
handleCheck = (_checked: boolean, permission?: string) => {
if (permission !== undefined) {
- this.setState(state => ({ loading: [...state.loading, permission] }));
+ this.setState((state) => ({ loading: [...state.loading, permission] }));
this.props.onToggle(this.props.user, permission).then(
() => this.stopLoading(permission),
() => this.stopLoading(permission)
@@ -66,7 +66,7 @@ export default class UserHolder extends React.PureComponent<Props, State> {
render() {
const { user } = this.props;
- const permissionCells = this.props.permissions.map(permission => (
+ const permissionCells = this.props.permissions.map((permission) => (
<PermissionCell
key={isPermissionDefinitionGroup(permission) ? permission.category : permission.key}
loading={this.state.loading}
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/GroupHolder-test.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/GroupHolder-test.tsx
index 7401538190b..0b354b22f6b 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/GroupHolder-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/GroupHolder-test.tsx
@@ -53,10 +53,10 @@ function shallowRender(props: Partial<GroupHolder['props']> = {}) {
category: 'admin',
permissions: [
{ key: 'foo', name: 'Foo', description: '' },
- { key: 'bar', name: 'Bar', description: '' }
- ]
+ { key: 'bar', name: 'Bar', description: '' },
+ ],
},
- { key: 'baz', name: 'Baz', description: '' }
+ { key: 'baz', name: 'Baz', description: '' },
]}
selectedPermission="bar"
{...props}
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/HoldersList-test.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/HoldersList-test.tsx
index 4cd1ce4abfb..a9f6538c553 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/HoldersList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/HoldersList-test.tsx
@@ -27,21 +27,21 @@ const permissions = [
category: 'admin',
permissions: [
{ key: 'bar', name: 'Bar', description: '' },
- { key: 'baz', name: 'Baz', description: '' }
- ]
- }
+ { key: 'baz', name: 'Baz', description: '' },
+ ],
+ },
];
const groups = [
{ id: 'foobar', name: 'Foobar', permissions: ['bar'] },
{ id: 'barbaz', name: 'Barbaz', permissions: ['bar'] },
- { id: 'abc', name: 'abc', permissions: [] }
+ { id: 'abc', name: 'abc', permissions: [] },
];
const users = [
{ login: 'foobar', name: 'Foobar', permissions: ['bar'] },
{ login: 'barbaz', name: 'Barbaz', permissions: ['bar'] },
- { login: 'bcd', name: 'bcd', permissions: [] }
+ { login: 'bcd', name: 'bcd', permissions: [] },
];
const elementsContainer = (
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/PermissionCell-test.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/PermissionCell-test.tsx
index 7e99f3b2310..28cadbd40f2 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/PermissionCell-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/PermissionCell-test.tsx
@@ -24,7 +24,7 @@ import PermissionCell from '../PermissionCell';
const permissionItem = {
id: 'foobar',
name: 'Foobar',
- permissions: ['bar']
+ permissions: ['bar'],
};
const permission = { key: 'baz', name: 'Baz', description: '' };
@@ -32,8 +32,8 @@ const permissionGroup = {
category: 'admin',
permissions: [
{ key: 'foo', name: 'Foo', description: '' },
- { key: 'bar', name: 'Bar', description: '' }
- ]
+ { key: 'bar', name: 'Bar', description: '' },
+ ],
};
it('should display unchecked checkbox', () => {
expect(
diff --git a/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/UserHolder-test.tsx b/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/UserHolder-test.tsx
index 44dfc941c18..cca4b7ff392 100644
--- a/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/UserHolder-test.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/shared/components/__tests__/UserHolder-test.tsx
@@ -55,10 +55,10 @@ function shallowRender(props: Partial<UserHolder['props']> = {}) {
category: 'admin',
permissions: [
{ key: 'foo', name: 'Foo', description: '' },
- { key: 'bar', name: 'Bar', description: '' }
- ]
+ { key: 'bar', name: 'Bar', description: '' },
+ ],
},
- { key: 'baz', name: 'Baz', description: '' }
+ { key: 'baz', name: 'Baz', description: '' },
]}
selectedPermission="bar"
user={mockPermissionUser({ email: 'john.doe@sonarsource.com', name: 'John Doe' })}
diff --git a/server/sonar-web/src/main/js/apps/permissions/utils.ts b/server/sonar-web/src/main/js/apps/permissions/utils.ts
index 2fe4d741417..0de7dfba51e 100644
--- a/server/sonar-web/src/main/js/apps/permissions/utils.ts
+++ b/server/sonar-web/src/main/js/apps/permissions/utils.ts
@@ -26,14 +26,14 @@ export const PERMISSIONS_ORDER_FOR_PROJECT_TEMPLATE = [
'issueadmin',
'securityhotspotadmin',
'admin',
- 'scan'
+ 'scan',
];
export const PERMISSIONS_ORDER_GLOBAL = [
'admin',
{ category: 'administer', permissions: ['gateadmin', 'profileadmin'] },
'scan',
- { category: 'creator', permissions: ['provisioning', 'applicationcreator', 'portfoliocreator'] }
+ { category: 'creator', permissions: ['provisioning', 'applicationcreator', 'portfoliocreator'] },
];
export const PERMISSIONS_ORDER_FOR_VIEW = ['user', 'admin'];
@@ -45,7 +45,7 @@ export const PERMISSIONS_ORDER_BY_QUALIFIER: Dict<string[]> = {
VW: PERMISSIONS_ORDER_FOR_VIEW,
SVW: PERMISSIONS_ORDER_FOR_VIEW,
APP: PERMISSIONS_ORDER_FOR_VIEW,
- DEV: PERMISSIONS_ORDER_FOR_DEV
+ DEV: PERMISSIONS_ORDER_FOR_DEV,
};
function convertToPermissionDefinition(permission: string, l10nPrefix: string) {
@@ -55,7 +55,7 @@ function convertToPermissionDefinition(permission: string, l10nPrefix: string) {
return {
key: permission,
name,
- description
+ description,
};
}
@@ -64,17 +64,17 @@ export function filterPermissions(
hasApplicationsEnabled: boolean,
hasPortfoliosEnabled: boolean
) {
- return permissions.map(permission => {
+ return permissions.map((permission) => {
if (typeof permission === 'object' && permission.category === 'creator') {
return {
...permission,
- permissions: permission.permissions.filter(p => {
+ permissions: permission.permissions.filter((p) => {
return (
p === 'provisioning' ||
(p === 'portfoliocreator' && hasPortfoliosEnabled) ||
(p === 'applicationcreator' && hasApplicationsEnabled)
);
- })
+ }),
};
}
return permission;
@@ -85,13 +85,13 @@ export function convertToPermissionDefinitions(
permissions: Array<string | { category: string; permissions: string[] }>,
l10nPrefix: string
): Array<PermissionDefinition | PermissionDefinitionGroup> {
- return permissions.map(permission => {
+ return permissions.map((permission) => {
if (typeof permission === 'object') {
return {
category: permission.category,
- permissions: permission.permissions.map(permission =>
+ permissions: permission.permissions.map((permission) =>
convertToPermissionDefinition(permission, l10nPrefix)
- )
+ ),
};
}
return convertToPermissionDefinition(permission, l10nPrefix);
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/actions-test.ts b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/actions-test.ts
index f25bb180e95..7f16ddc7d5a 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/actions-test.ts
+++ b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/actions-test.ts
@@ -29,14 +29,14 @@ const ANALYSES = [
{
key: 'E1',
category: 'VERSION',
- name: '6.5-SNAPSHOT'
- }
- ]
+ name: '6.5-SNAPSHOT',
+ },
+ ],
},
{
key: 'A2',
date: parseDate('2016-10-27T12:21:15+0200'),
- events: []
+ events: [],
},
{
key: 'A3',
@@ -45,21 +45,21 @@ const ANALYSES = [
{
key: 'E2',
category: 'OTHER',
- name: 'foo'
+ name: 'foo',
},
{
key: 'E3',
category: 'OTHER',
- name: 'foo'
- }
- ]
- }
+ name: 'foo',
+ },
+ ],
+ },
];
const newEvent = {
key: 'Enew',
name: 'Foo',
- category: 'Custom'
+ category: 'Custom',
};
const emptyState = {
@@ -70,7 +70,7 @@ const emptyState = {
measuresHistory: [],
measures: [],
metrics: [],
- query: { category: '', graph: DEFAULT_GRAPH, project: '', customMetrics: [] }
+ query: { category: '', graph: DEFAULT_GRAPH, project: '', customMetrics: [] },
};
const state = { ...emptyState, analyses: ANALYSES };
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.ts
index 14dcde23d9b..8c4787fe9ab 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.ts
@@ -26,11 +26,11 @@ jest.mock('date-fns', () => {
const actual = jest.requireActual('date-fns');
return {
...actual,
- startOfDay: jest.fn(date => {
+ startOfDay: jest.fn((date) => {
const startDay = new Date(date);
startDay.setUTCHours(0, 0, 0, 0);
return startDay;
- })
+ }),
};
});
@@ -38,13 +38,13 @@ const ANALYSES = [
{
key: 'AVyMjlK1HjR_PLDzRbB9',
date: dates.parseDate('2017-06-09T13:06:10.000Z'),
- events: [{ key: 'AVyM9oI1HjR_PLDzRciU', category: 'VERSION', name: '1.1-SNAPSHOT' }]
+ events: [{ key: 'AVyM9oI1HjR_PLDzRciU', category: 'VERSION', name: '1.1-SNAPSHOT' }],
},
{ key: 'AVyM9n3cHjR_PLDzRciT', date: dates.parseDate('2017-06-09T11:12:27.000Z'), events: [] },
{
key: 'AVyMjlK1HjR_PLDzRbB9',
date: dates.parseDate('2017-06-09T11:12:27.000Z'),
- events: [{ key: 'AVyM9oI1HjR_PLDzRciU', category: 'VERSION', name: '1.1' }]
+ events: [{ key: 'AVyM9oI1HjR_PLDzRciU', category: 'VERSION', name: '1.1' }],
},
{
key: 'AVxZtCpH7841nF4RNEMI',
@@ -53,9 +53,9 @@ const ANALYSES = [
{
key: 'AVxZtC-N7841nF4RNEMJ',
category: 'QUALITY_PROFILE',
- name: 'Changes in "Default - SonarSource conventions" (Java)'
- }
- ]
+ name: 'Changes in "Default - SonarSource conventions" (Java)',
+ },
+ ],
},
{ key: 'AVwaa1qkpbBde8B6UhYI', date: dates.parseDate('2017-05-18T07:17:32.000Z'), events: [] },
{
@@ -66,11 +66,11 @@ const ANALYSES = [
{
key: 'AVwQF7zXl-nNFgFWOJ3W',
category: 'QUALITY_PROFILE',
- name: 'Changes in "Default - SonarSource conventions" (Java)'
- }
- ]
+ name: 'Changes in "Default - SonarSource conventions" (Java)',
+ },
+ ],
},
- { key: 'AVvtGF3IY6vCuQNDdwxI', date: dates.parseDate('2017-05-09T12:03:59.000Z'), events: [] }
+ { key: 'AVvtGF3IY6vCuQNDdwxI', date: dates.parseDate('2017-05-09T12:03:59.000Z'), events: [] },
];
const QUERY = {
@@ -80,21 +80,21 @@ const QUERY = {
project: 'foo',
to: undefined,
selectedDate: undefined,
- customMetrics: ['foo', 'bar', 'baz']
+ customMetrics: ['foo', 'bar', 'baz'],
};
describe('getAnalysesByVersionByDay', () => {
it('should correctly map analysis by versions and by days', () => {
expect(
utils.getAnalysesByVersionByDay(ANALYSES, {
- category: ''
+ category: '',
})
).toMatchSnapshot();
});
it('should also filter analysis based on the query', () => {
expect(
utils.getAnalysesByVersionByDay(ANALYSES, {
- category: 'QUALITY_PROFILE'
+ category: 'QUALITY_PROFILE',
})
).toMatchSnapshot();
expect(
@@ -102,7 +102,7 @@ describe('getAnalysesByVersionByDay', () => {
category: '',
to: dates.parseDate('2017-06-09T11:12:27.000Z'),
- from: dates.parseDate('2017-05-18T14:13:07.000Z')
+ from: dates.parseDate('2017-05-18T14:13:07.000Z'),
})
).toMatchSnapshot();
});
@@ -113,26 +113,26 @@ describe('getAnalysesByVersionByDay', () => {
{
key: 'AVyMjlK1HjR_PLDzRbB9',
date: dates.parseDate('2017-06-09T13:06:10.000Z'),
- events: []
+ events: [],
},
{
key: 'AVyM9n3cHjR_PLDzRciT',
date: dates.parseDate('2017-06-09T11:12:27.000Z'),
- events: []
+ events: [],
},
{
key: 'AVyMjlK1HjR_PLDzRbB9',
date: dates.parseDate('2017-06-09T11:12:27.000Z'),
- events: []
+ events: [],
},
{
key: 'AVxZtCpH7841nF4RNEMI',
date: dates.parseDate('2017-05-18T14:13:07.000Z'),
- events: []
- }
+ events: [],
+ },
],
{
- category: ''
+ category: '',
}
)
).toMatchSnapshot();
@@ -145,7 +145,7 @@ describe('parseQuery', () => {
utils.parseQuery({
from: '2017-04-27T08:21:32.000Z',
custom_metrics: 'foo,bar,baz',
- id: 'foo'
+ id: 'foo',
})
).toEqual(QUERY);
});
@@ -155,13 +155,13 @@ describe('serializeQuery', () => {
it('should serialize query for api request', () => {
expect(utils.serializeQuery(QUERY)).toEqual({
from: '2017-04-27T08:21:32+0000',
- project: 'foo'
+ project: 'foo',
});
expect(utils.serializeQuery({ ...QUERY, graph: GraphType.coverage, category: 'test' })).toEqual(
{
from: '2017-04-27T08:21:32+0000',
project: 'foo',
- category: 'test'
+ category: 'test',
}
);
});
@@ -172,20 +172,20 @@ describe('serializeUrlQuery', () => {
expect(utils.serializeUrlQuery(QUERY)).toEqual({
from: '2017-04-27T08:21:32+0000',
id: 'foo',
- custom_metrics: 'foo,bar,baz'
+ custom_metrics: 'foo,bar,baz',
});
expect(
utils.serializeUrlQuery({
...QUERY,
graph: GraphType.coverage,
category: 'test',
- customMetrics: []
+ customMetrics: [],
})
).toEqual({
from: '2017-04-27T08:21:32+0000',
id: 'foo',
graph: GraphType.coverage,
- category: 'test'
+ category: 'test',
});
});
});
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/actions.ts b/server/sonar-web/src/main/js/apps/projectActivity/actions.ts
index 52b46181dfc..a2e9fa1d5d6 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/actions.ts
+++ b/server/sonar-web/src/main/js/apps/projectActivity/actions.ts
@@ -22,42 +22,42 @@ import { State } from './components/ProjectActivityApp';
export function addCustomEvent(analysis: string, event: AnalysisEvent) {
return (state: State) => ({
- analyses: state.analyses.map(item => {
+ analyses: state.analyses.map((item) => {
if (item.key !== analysis) {
return item;
}
return { ...item, events: [...item.events, event] };
- })
+ }),
});
}
export function deleteEvent(analysis: string, event: string) {
return (state: State) => ({
- analyses: state.analyses.map(item => {
+ analyses: state.analyses.map((item) => {
if (item.key !== analysis) {
return item;
}
- return { ...item, events: item.events.filter(eventItem => eventItem.key !== event) };
- })
+ return { ...item, events: item.events.filter((eventItem) => eventItem.key !== event) };
+ }),
});
}
export function changeEvent(analysis: string, event: AnalysisEvent) {
return (state: State) => ({
- analyses: state.analyses.map(item => {
+ analyses: state.analyses.map((item) => {
if (item.key !== analysis) {
return item;
}
return {
...item,
- events: item.events.map(eventItem =>
+ events: item.events.map((eventItem) =>
eventItem.key === event.key ? { ...eventItem, ...event } : eventItem
- )
+ ),
};
- })
+ }),
});
}
export function deleteAnalysis(analysis: string) {
- return (state: State) => ({ analyses: state.analyses.filter(item => item.key !== analysis) });
+ return (state: State) => ({ analyses: state.analyses.filter((item) => item.key !== analysis) });
}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/Events.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/Events.tsx
index df33ccca603..e98e2735e64 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/Events.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/Events.tsx
@@ -37,14 +37,14 @@ export function Events(props: EventsProps) {
const sortedEvents = sortBy(
events,
// versions last
- event => (event.category === 'VERSION' ? 1 : 0),
+ (event) => (event.category === 'VERSION' ? 1 : 0),
// then the rest sorted by category
'category'
);
return (
<div className="big-spacer-top">
- {sortedEvents.map(event => (
+ {sortedEvents.map((event) => (
<Event
analysisKey={analysisKey}
canAdmin={canAdmin}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.tsx
index 3e8b7b2ba4a..bd90397c0b0 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.tsx
@@ -183,10 +183,11 @@ export default class ProjectActivityAnalysesList extends React.PureComponent<Pro
<ul
className="project-activity-versions-list"
onScroll={this.handleScroll}
- ref={element => (this.scrollContainer = element)}
+ ref={(element) => (this.scrollContainer = element)}
style={{
- paddingTop: this.props.project.qualifier === ComponentQualifier.Project ? 52 : undefined
- }}>
+ paddingTop: this.props.project.qualifier === ComponentQualifier.Project ? 52 : undefined,
+ }}
+ >
{byVersionByDay.map((version, idx) => {
const days = Object.keys(version.byDay);
if (days.length <= 0) {
@@ -198,23 +199,25 @@ export default class ProjectActivityAnalysesList extends React.PureComponent<Pro
<div className={classNames('project-activity-version-badge', { first: idx === 0 })}>
<Tooltip
mouseEnterDelay={0.5}
- overlay={`${translate('version')} ${version.version}`}>
+ overlay={`${translate('version')} ${version.version}`}
+ >
<h2 className="analysis-version">{version.version}</h2>
</Tooltip>
</div>
)}
<ul className="project-activity-days-list">
- {days.map(day => (
+ {days.map((day) => (
<li
className="project-activity-day"
data-day={toShortNotSoISOString(Number(day))}
- key={day}>
+ key={day}
+ >
<h3>
<DateFormatter date={Number(day)} long={true} />
</h3>
<ul className="project-activity-analyses-list">
{version.byDay[day] != null &&
- version.byDay[day].map(analysis => this.renderAnalysis(analysis))}
+ version.byDay[day].map((analysis) => this.renderAnalysis(analysis))}
</ul>
</li>
))}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.tsx
index a38c2459ba2..6623306495a 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.tsx
@@ -21,7 +21,7 @@ import classNames from 'classnames';
import * as React from 'react';
import ActionsDropdown, {
ActionsDropdownDivider,
- ActionsDropdownItem
+ ActionsDropdownItem,
} from '../../../components/controls/ActionsDropdown';
import ClickEventBoundary from '../../../components/controls/ClickEventBoundary';
import HelpTooltip from '../../../components/controls/HelpTooltip';
@@ -62,7 +62,7 @@ export function ProjectActivityAnalysis(props: ProjectActivityAnalysisProps) {
canAdmin,
canCreateVersion,
parentScrollContainer,
- selected
+ selected,
} = props;
React.useEffect(() => {
@@ -72,7 +72,7 @@ export function ProjectActivityAnalysis(props: ProjectActivityAnalysisProps) {
bottomOffset: height + 20,
topOffset: 60,
parent: parentScrollContainer,
- smooth: false
+ smooth: false,
});
}
});
@@ -82,7 +82,7 @@ export function ProjectActivityAnalysis(props: ProjectActivityAnalysisProps) {
const [removeAnalysisForm, setRemoveAnalysisForm] = React.useState(false);
const parsedDate = parseDate(analysis.date);
- const hasVersion = analysis.events.find(event => event.category === 'VERSION') != null;
+ const hasVersion = analysis.events.find((event) => event.category === 'VERSION') != null;
const canAddVersion = canAdmin && !hasVersion && canCreateVersion;
const canAddEvent = canAdmin;
@@ -92,14 +92,15 @@ export function ProjectActivityAnalysis(props: ProjectActivityAnalysisProps) {
return (
<li
className={classNames('project-activity-analysis bordered-top bordered-bottom', {
- selected
+ selected,
})}
onClick={() => props.updateSelectedDate(analysis.date)}
- ref={ref => (node = ref)}>
+ ref={(ref) => (node = ref)}
+ >
<div className="display-flex-center display-flex-space-between">
<div className="project-activity-time">
<TimeFormatter date={parsedDate} long={false}>
- {formattedTime => (
+ {(formattedTime) => (
<time className="text-middle" dateTime={parsedDate.toISOString()}>
{formattedTime}
</time>
@@ -122,18 +123,21 @@ export function ProjectActivityAnalysis(props: ProjectActivityAnalysisProps) {
<ActionsDropdown
overlayPlacement={PopupPlacement.BottomRight}
small={true}
- toggleClassName="js-analysis-actions">
+ toggleClassName="js-analysis-actions"
+ >
{canAddVersion && (
<ActionsDropdownItem
className="js-add-version"
- onClick={() => setAddVersionForm(true)}>
+ onClick={() => setAddVersionForm(true)}
+ >
{translate('project_activity.add_version')}
</ActionsDropdownItem>
)}
{canAddEvent && (
<ActionsDropdownItem
className="js-add-event"
- onClick={() => setAddEventForm(true)}>
+ onClick={() => setAddEventForm(true)}
+ >
{translate('project_activity.add_custom_event')}
</ActionsDropdownItem>
)}
@@ -142,7 +146,8 @@ export function ProjectActivityAnalysis(props: ProjectActivityAnalysisProps) {
<ActionsDropdownItem
className="js-delete-analysis"
destructive={true}
- onClick={() => setRemoveAnalysisForm(true)}>
+ onClick={() => setRemoveAnalysisForm(true)}
+ >
{translate('project_activity.delete_analysis')}
</ActionsDropdownItem>
)}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx
index 9d92b92c38a..c442f116bc8 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx
@@ -26,7 +26,7 @@ import {
deleteAnalysis,
deleteEvent,
getProjectActivity,
- ProjectActivityStatuses
+ ProjectActivityStatuses,
} from '../../../api/projectActivity';
import { getAllTimeMachineData } from '../../../api/time-machine';
import withComponentContext from '../../../app/components/componentContext/withComponentContext';
@@ -34,7 +34,7 @@ import {
DEFAULT_GRAPH,
getActivityGraph,
getHistoryMetrics,
- isCustomGraph
+ isCustomGraph,
} from '../../../components/activity-graph/utils';
import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import { getBranchLikeQuery } from '../../../helpers/branch-like';
@@ -50,7 +50,7 @@ import {
parseQuery,
Query,
serializeQuery,
- serializeUrlQuery
+ serializeUrlQuery,
} from '../utils';
import ProjectActivityAppRenderer from './ProjectActivityAppRenderer';
@@ -88,7 +88,7 @@ export class ProjectActivityApp extends React.PureComponent<Props, State> {
initialized: false,
measuresHistory: [],
metrics: [],
- query: parseQuery(props.location.query)
+ query: parseQuery(props.location.query),
};
}
@@ -168,14 +168,14 @@ export class ProjectActivityApp extends React.PureComponent<Props, State> {
statuses: serializeStringArray(statuses),
p,
ps,
- ...getBranchLikeQuery(this.props.branchLike)
+ ...getBranchLikeQuery(this.props.branchLike),
};
return getProjectActivity({ ...additional, ...parameters }).then(({ analyses, paging }) => ({
- analyses: analyses.map(analysis => ({
+ analyses: analyses.map((analysis) => ({
...analysis,
- date: parseDate(analysis.date)
+ date: parseDate(analysis.date),
})) as ParsedAnalysis[],
- paging
+ paging,
}));
};
@@ -186,14 +186,14 @@ export class ProjectActivityApp extends React.PureComponent<Props, State> {
return getAllTimeMachineData({
component: this.props.component.key,
metrics: metrics.join(),
- ...getBranchLikeQuery(this.props.branchLike)
+ ...getBranchLikeQuery(this.props.branchLike),
}).then(({ measures }) =>
- measures.map(measure => ({
+ measures.map((measure) => ({
metric: measure.metric,
- history: measure.history.map(analysis => ({
+ history: measure.history.map((analysis) => ({
date: parseDate(analysis.date),
- value: analysis.value
- }))
+ value: analysis.value,
+ })),
}))
);
};
@@ -205,7 +205,7 @@ export class ProjectActivityApp extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
analyses,
- analysesLoading: false
+ analysesLoading: false,
});
}
},
@@ -232,17 +232,17 @@ export class ProjectActivityApp extends React.PureComponent<Props, State> {
project,
[
ProjectActivityStatuses.STATUS_PROCESSED,
- ProjectActivityStatuses.STATUS_LIVE_MEASURE_COMPUTE
+ ProjectActivityStatuses.STATUS_LIVE_MEASURE_COMPUTE,
],
nextPage,
ACTIVITY_PAGE_SIZE
- ).then(result => {
+ ).then((result) => {
if (!prevResult) {
return this.loadAllActivities(project, result);
}
return this.loadAllActivities(project, {
analyses: prevResult.analyses.concat(result.analyses),
- paging: result.paging
+ paging: result.paging,
});
});
};
@@ -260,8 +260,8 @@ export class ProjectActivityApp extends React.PureComponent<Props, State> {
filterMetrics({ qualifier }: Component, metrics: Metric[]) {
return ['VW', 'SVW'].includes(qualifier)
- ? metrics.filter(metric => metric.key !== MetricKey.security_hotspots_reviewed)
- : metrics.filter(metric => metric.key !== MetricKey.security_review_rating);
+ ? metrics.filter((metric) => metric.key !== MetricKey.security_hotspots_reviewed)
+ : metrics.filter((metric) => metric.key !== MetricKey.security_review_rating);
}
firstLoadData(query: Query, component: Component) {
@@ -272,14 +272,14 @@ export class ProjectActivityApp extends React.PureComponent<Props, State> {
topLevelComponent,
[
ProjectActivityStatuses.STATUS_PROCESSED,
- ProjectActivityStatuses.STATUS_LIVE_MEASURE_COMPUTE
+ ProjectActivityStatuses.STATUS_LIVE_MEASURE_COMPUTE,
],
1,
ACTIVITY_PAGE_SIZE_FIRST_BATCH,
serializeQuery(query)
),
getAllMetrics(),
- this.fetchMeasuresHistory(graphMetrics)
+ this.fetchMeasuresHistory(graphMetrics),
]).then(
([{ analyses }, metrics, measuresHistory]) => {
if (this.mounted) {
@@ -288,7 +288,7 @@ export class ProjectActivityApp extends React.PureComponent<Props, State> {
graphLoading: false,
initialized: true,
measuresHistory,
- metrics: this.filterMetrics(component, metrics)
+ metrics: this.filterMetrics(component, metrics),
});
this.fetchAllActivities(topLevelComponent);
@@ -306,7 +306,7 @@ export class ProjectActivityApp extends React.PureComponent<Props, State> {
const graphMetrics = getHistoryMetrics(graph, customMetrics);
this.setState({ graphLoading: true });
this.fetchMeasuresHistory(graphMetrics).then(
- measuresHistory => {
+ (measuresHistory) => {
if (this.mounted) {
this.setState({ graphLoading: false, measuresHistory });
}
@@ -322,15 +322,15 @@ export class ProjectActivityApp extends React.PureComponent<Props, State> {
updateQuery = (newQuery: Query) => {
const query = serializeUrlQuery({
...this.state.query,
- ...newQuery
+ ...newQuery,
});
this.props.router.push({
pathname: this.props.location.pathname,
query: {
...query,
...getBranchLikeQuery(this.props.branchLike),
- id: this.props.component.key
- }
+ id: this.props.component.key,
+ },
});
};
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityDateInput.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityDateInput.tsx
index 03fa34586d9..3fa7bbb5fae 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityDateInput.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityDateInput.tsx
@@ -48,7 +48,8 @@ export default class ProjectActivityDateInput extends React.PureComponent<Props>
<Button
className="spacer-left"
disabled={this.props.from === undefined && this.props.to === undefined}
- onClick={this.handleResetClick}>
+ onClick={this.handleResetClick}
+ >
{translate('project_activity.reset_dates')}
</Button>
</div>
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx
index ed7fa1f675c..aa36ab59749 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx
@@ -29,14 +29,14 @@ import {
getSeriesMetricType,
isCustomGraph,
saveActivityGraph,
- splitSeriesInGraphs
+ splitSeriesInGraphs,
} from '../../../components/activity-graph/utils';
import {
GraphType,
MeasureHistory,
ParsedAnalysis,
Point,
- Serie
+ Serie,
} from '../../../types/project-activity';
import { Metric } from '../../../types/types';
import { datesQueryChanged, historyQueryChanged, Query } from '../utils';
@@ -75,7 +75,7 @@ export default class ProjectActivityGraphs extends React.PureComponent<Props, St
this.state = {
series,
graphs: splitSeriesInGraphs(series, MAX_GRAPH_NB, MAX_SERIES_PER_GRAPH),
- ...this.getStateZoomDates(undefined, props, series)
+ ...this.getStateZoomDates(undefined, props, series),
};
this.updateQueryDateRange = debounce(this.updateQueryDateRange, 500);
}
@@ -116,7 +116,7 @@ export default class ProjectActivityGraphs extends React.PureComponent<Props, St
getStateZoomDates = (prevProps: Props | undefined, props: Props, newSeries?: Serie[]) => {
const newDates = {
from: props.query.from || undefined,
- to: props.query.to || undefined
+ to: props.query.to || undefined,
};
if (!prevProps || datesQueryChanged(prevProps.query, props.query)) {
return { graphEndDate: newDates.to, graphStartDate: newDates.from };
@@ -124,16 +124,16 @@ export default class ProjectActivityGraphs extends React.PureComponent<Props, St
if (newDates.to === undefined && newDates.from === undefined && newSeries !== undefined) {
const firstValid = minBy(
- newSeries.map(serie => serie.data.find(p => Boolean(p.y || p.y === 0))),
+ newSeries.map((serie) => serie.data.find((p) => Boolean(p.y || p.y === 0))),
'x'
);
const lastValid = maxBy<Point>(
- newSeries.map(serie => findLast(serie.data, p => Boolean(p.y || p.y === 0))!),
+ newSeries.map((serie) => findLast(serie.data, (p) => Boolean(p.y || p.y === 0))!),
'x'
);
return {
graphEndDate: lastValid && lastValid.x,
- graphStartDate: firstValid && firstValid.x
+ graphStartDate: firstValid && firstValid.x,
};
}
return null;
@@ -144,8 +144,8 @@ export default class ProjectActivityGraphs extends React.PureComponent<Props, St
return undefined;
}
return this.state.graphs
- .filter(graph => graph.length < MAX_SERIES_PER_GRAPH)
- .map(graph => graph[0].type);
+ .filter((graph) => graph.length < MAX_SERIES_PER_GRAPH)
+ .map((graph) => graph[0].type);
};
addCustomMetric = (metric: string) => {
@@ -155,7 +155,9 @@ export default class ProjectActivityGraphs extends React.PureComponent<Props, St
};
removeCustomMetric = (removedMetric: string) => {
- const customMetrics = this.props.query.customMetrics.filter(metric => metric !== removedMetric);
+ const customMetrics = this.props.query.customMetrics.filter(
+ (metric) => metric !== removedMetric
+ );
saveActivityGraph(PROJECT_ACTIVITY_GRAPH, this.props.project, GraphType.custom, customMetrics);
this.props.updateQuery({ customMetrics });
};
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx
index 4e6dd15c6f8..e577cec5c2b 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx
@@ -38,9 +38,9 @@ export default function ProjectActivityPageFilters(props: ProjectActivityPageFil
const isApp = project.qualifier === ComponentQualifier.Application;
const eventTypes = isApp ? APPLICATION_EVENT_TYPES : EVENT_TYPES;
- const options = eventTypes.map(category => ({
+ const options = eventTypes.map((category) => ({
label: translate('event.category', category),
- value: category
+ value: category,
}));
const handleCategoryChange = React.useCallback(
@@ -66,7 +66,7 @@ export default function ProjectActivityPageFilters(props: ProjectActivityPageFil
isSearchable={false}
onChange={handleCategoryChange}
options={options}
- value={options.filter(o => o.value === category)}
+ value={options.filter((o) => o.value === category)}
/>
</div>
)}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/Event-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/Event-test.tsx
index b70d0efbd6b..e366f3462d6 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/Event-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/Event-test.tsx
@@ -36,42 +36,26 @@ it('should correctly allow deletion', () => {
shallowRender({
canAdmin: true,
event: mockAnalysisEvent({ category: 'VERSION' }),
- isFirst: true
+ isFirst: true,
})
.find(DeleteButton)
.exists()
).toBe(false);
expect(
- shallowRender({ canAdmin: true, event: mockAnalysisEvent() })
- .find(DeleteButton)
- .exists()
+ shallowRender({ canAdmin: true, event: mockAnalysisEvent() }).find(DeleteButton).exists()
).toBe(false);
- expect(
- shallowRender({ canAdmin: true })
- .find(DeleteButton)
- .exists()
- ).toBe(true);
+ expect(shallowRender({ canAdmin: true }).find(DeleteButton).exists()).toBe(true);
});
it('should correctly allow edition', () => {
- expect(
- shallowRender({ canAdmin: true })
- .find(EditButton)
- .exists()
- ).toBe(true);
+ expect(shallowRender({ canAdmin: true }).find(EditButton).exists()).toBe(true);
- expect(
- shallowRender({ canAdmin: true, isFirst: true })
- .find(EditButton)
- .exists()
- ).toBe(true);
+ expect(shallowRender({ canAdmin: true, isFirst: true }).find(EditButton).exists()).toBe(true);
expect(
- shallowRender({ canAdmin: true, event: mockAnalysisEvent() })
- .find(EditButton)
- .exists()
+ shallowRender({ canAdmin: true, event: mockAnalysisEvent() }).find(EditButton).exists()
).toBe(false);
});
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/Events-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/Events-test.tsx
index a581ab44e67..9a5166a380b 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/Events-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/Events-test.tsx
@@ -33,7 +33,7 @@ function shallowRender(props: Partial<EventsProps> = {}) {
events={[
mockAnalysisEvent(),
mockAnalysisEvent({ category: 'VERSION' }),
- mockAnalysisEvent({ category: 'OTHER' })
+ mockAnalysisEvent({ category: 'OTHER' }),
]}
onChange={jest.fn()}
onDelete={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysesList-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysesList-test.tsx
index 7d0397e728e..f02fe2f2788 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysesList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysesList-test.tsx
@@ -33,7 +33,7 @@ jest.mock('date-fns', () => {
const startDay = new Date(date);
startDay.setUTCHours(0, 0, 0, 0);
return startDay;
- }
+ },
};
});
@@ -48,7 +48,7 @@ const DEFAULT_QUERY = {
category: '',
customMetrics: [],
graph: DEFAULT_GRAPH,
- project: 'org.sonarsource.sonarqube:sonarqube'
+ project: 'org.sonarsource.sonarqube:sonarqube',
};
it('should render correctly', () => {
@@ -72,8 +72,8 @@ it('should correctly filter analyses by date range', () => {
query: {
...DEFAULT_QUERY,
from: DATE,
- to: DATE
- }
+ to: DATE,
+ },
});
expect(wrapper).toMatchSnapshot();
});
@@ -107,7 +107,7 @@ function shallowRender(props: Partial<ProjectActivityAnalysesList['props']> = {}
mockParsedAnalysis({
key: 'A1',
date: DATE,
- events: [{ key: 'E1', category: 'VERSION', name: '6.5-SNAPSHOT' }]
+ events: [{ key: 'E1', category: 'VERSION', name: '6.5-SNAPSHOT' }],
}),
mockParsedAnalysis({ key: 'A2', date: parseDate('2016-10-27T12:21:15+0000') }),
mockParsedAnalysis({
@@ -115,14 +115,14 @@ function shallowRender(props: Partial<ProjectActivityAnalysesList['props']> = {}
date: parseDate('2016-10-26T12:17:29+0000'),
events: [
{ key: 'E2', category: 'VERSION', name: '6.4' },
- { key: 'E3', category: 'OTHER', name: 'foo' }
- ]
+ { key: 'E3', category: 'OTHER', name: 'foo' },
+ ],
}),
mockParsedAnalysis({
key: 'A4',
date: parseDate('2016-10-24T16:33:50+0000'),
- events: [{ key: 'E1', category: 'QUALITY_GATE', name: 'Quality gate changed to red...' }]
- })
+ events: [{ key: 'E1', category: 'QUALITY_GATE', name: 'Quality gate changed to red...' }],
+ }),
]}
analysesLoading={false}
canAdmin={false}
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysis-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysis-test.tsx
index 45bdc5c08b6..2d118b8a82f 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysis-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysis-test.tsx
@@ -31,12 +31,12 @@ import { ProjectActivityAnalysis, ProjectActivityAnalysisProps } from '../Projec
jest.mock('../../../../helpers/dates', () => ({
parseDate: () => ({
valueOf: () => 1546333200000,
- toISOString: () => '2019-01-01T09:00:00.000Z'
- })
+ toISOString: () => '2019-01-01T09:00:00.000Z',
+ }),
}));
jest.mock('../../../../helpers/scrolling', () => ({
- scrollToElement: jest.fn()
+ scrollToElement: jest.fn(),
}));
it('should render correctly', () => {
@@ -52,13 +52,11 @@ it('should render correctly', () => {
shallowRender({
canAdmin: true,
canCreateVersion: true,
- canDeleteAnalyses: true
+ canDeleteAnalyses: true,
})
).toMatchSnapshot('with admin options');
- const timeFormatter = shallowRender()
- .find(TimeFormatter)
- .prop('children');
+ const timeFormatter = shallowRender().find(TimeFormatter).prop('children');
expect(timeFormatter!('formatted_time')).toMatchSnapshot('formatted time');
});
@@ -66,7 +64,7 @@ it('should show the correct admin options', () => {
const wrapper = shallowRender({
canAdmin: true,
canCreateVersion: true,
- canDeleteAnalyses: true
+ canDeleteAnalyses: true,
});
expect(wrapper.find('.js-add-version').exists()).toBe(true);
@@ -97,7 +95,7 @@ it('should not allow the first item to be deleted', () => {
canAdmin: true,
canCreateVersion: true,
canDeleteAnalyses: true,
- isFirst: true
+ isFirst: true,
})
.find('.js-delete-analysis')
.exists()
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-it.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-it.tsx
index 377f26c8032..b6ae4b28c23 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-it.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-it.tsx
@@ -34,18 +34,18 @@ jest.mock('../../../../api/time-machine', () => {
measures: [
{
metric: 'bugs',
- history: [{ date: '2022-01-01', value: '10' }]
- }
+ history: [{ date: '2022-01-01', value: '10' }],
+ },
],
- paging: mockPaging({ total: 1 })
- })
+ paging: mockPaging({ total: 1 }),
+ }),
};
});
jest.mock('../../../../api/metrics', () => {
const { mockMetric } = jest.requireActual('../../../../helpers/testMocks');
return {
- getAllMetrics: jest.fn().mockResolvedValue([mockMetric()])
+ getAllMetrics: jest.fn().mockResolvedValue([mockMetric()]),
};
});
@@ -58,8 +58,8 @@ jest.mock('../../../../api/projectActivity', () => {
changeEvent: jest.fn(),
getProjectActivity: jest.fn().mockResolvedValue({
analyses: [mockAnalysis({ key: 'foo' })],
- paging: mockPaging({ total: 1 })
- })
+ paging: mockPaging({ total: 1 }),
+ }),
};
});
@@ -67,14 +67,14 @@ jest.mock('../../../../components/activity-graph/utils', () => {
const actual = jest.requireActual('../../../../components/activity-graph/utils');
return {
...actual,
- getActivityGraph: jest.fn()
+ getActivityGraph: jest.fn(),
};
});
it('should render default graph', async () => {
(getActivityGraph as jest.Mock).mockImplementation(() => {
return {
- graph: 'issues'
+ graph: 'issues',
};
});
@@ -87,7 +87,7 @@ it('should reload custom graph from local storage', async () => {
(getActivityGraph as jest.Mock).mockImplementation(() => {
return {
graph: 'custom',
- customGraphs: ['bugs', 'code_smells']
+ customGraphs: ['bugs', 'code_smells'],
};
});
@@ -100,9 +100,9 @@ function renderProjectActivityAppContainer(
{ component, navigateTo }: { component: Component; navigateTo?: string } = {
component: mockComponent({
breadcrumbs: [
- { key: 'breadcrumb', name: 'breadcrumb', qualifier: ComponentQualifier.Project }
- ]
- })
+ { key: 'breadcrumb', name: 'breadcrumb', qualifier: ComponentQualifier.Project },
+ ],
+ }),
}
) {
return renderApp(
@@ -112,8 +112,9 @@ function renderProjectActivityAppContainer(
branchLikes: [],
onBranchesChange: jest.fn(),
onComponentChange: jest.fn(),
- component
- }}>
+ component,
+ }}
+ >
<ProjectActivityAppContainer />
</ComponentContext.Provider>,
{ navigateTo }
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-test.tsx
index 6d5034e75fa..85b58a0f8fc 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-test.tsx
@@ -29,7 +29,7 @@ import { MetricKey } from '../../../../types/metrics';
import { ProjectActivityApp } from '../ProjectActivityApp';
jest.mock('../../../../helpers/dates', () => ({
- parseDate: jest.fn(date => `PARSED:${date}`)
+ parseDate: jest.fn((date) => `PARSED:${date}`),
}));
jest.mock('../../../../api/time-machine', () => {
@@ -39,18 +39,18 @@ jest.mock('../../../../api/time-machine', () => {
measures: [
{
metric: 'bugs',
- history: [{ date: '2022-01-01', value: '10' }]
- }
+ history: [{ date: '2022-01-01', value: '10' }],
+ },
],
- paging: mockPaging({ total: 1 })
- })
+ paging: mockPaging({ total: 1 }),
+ }),
};
});
jest.mock('../../../../api/metrics', () => {
const { mockMetric } = jest.requireActual('../../../../helpers/testMocks');
return {
- getAllMetrics: jest.fn().mockResolvedValue([mockMetric()])
+ getAllMetrics: jest.fn().mockResolvedValue([mockMetric()]),
};
});
@@ -63,8 +63,8 @@ jest.mock('../../../../api/projectActivity', () => {
changeEvent: jest.fn(),
getProjectActivity: jest.fn().mockResolvedValue({
analyses: [mockAnalysis({ key: 'foo' })],
- paging: mockPaging({ total: 1 })
- })
+ paging: mockPaging({ total: 1 }),
+ }),
};
});
@@ -78,14 +78,14 @@ it('should filter metric correctly', () => {
.instance()
.filterMetrics(mockComponent({ qualifier: ComponentQualifier.Project }), [
mockMetric({ key: MetricKey.bugs }),
- mockMetric({ key: MetricKey.security_review_rating })
+ mockMetric({ key: MetricKey.security_review_rating }),
]);
expect(metrics).toHaveLength(1);
metrics = wrapper
.instance()
.filterMetrics(mockComponent({ qualifier: ComponentQualifier.Portfolio }), [
mockMetric({ key: MetricKey.bugs }),
- mockMetric({ key: MetricKey.security_hotspots_reviewed })
+ mockMetric({ key: MetricKey.security_hotspots_reviewed }),
]);
expect(metrics).toHaveLength(1);
});
@@ -99,7 +99,7 @@ it('should correctly create and update custom events', async () => {
(changeEvent as jest.Mock).mockResolvedValueOnce({
analysis: analysisKey,
...event,
- name: newName
+ name: newName,
});
const wrapper = shallowRender();
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppRenderer-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppRenderer-test.tsx
index 3cff65f626c..400eff16ecf 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppRenderer-test.tsx
@@ -31,14 +31,14 @@ const ANALYSES = [
{
key: 'E1',
category: 'VERSION',
- name: '6.5-SNAPSHOT'
- }
- ]
+ name: '6.5-SNAPSHOT',
+ },
+ ],
},
{
key: 'A2',
date: parseDate('2016-10-27T12:21:15+0200'),
- events: []
+ events: [],
},
{
key: 'A3',
@@ -47,15 +47,15 @@ const ANALYSES = [
{
key: 'E2',
category: 'VERSION',
- name: '6.4'
+ name: '6.4',
},
{
key: 'E3',
category: 'OTHER',
- name: 'foo'
- }
- ]
- }
+ name: 'foo',
+ },
+ ],
+ },
];
const DEFAULT_PROPS = {
@@ -72,7 +72,7 @@ const DEFAULT_PROPS = {
project: {
key: 'foo',
leakPeriodDate: '2017-05-16T13:50:02+0200',
- qualifier: 'TRK'
+ qualifier: 'TRK',
},
metrics: [{ id: '1', key: 'code_smells', name: 'Code Smells', type: 'INT' }],
measuresHistory: [
@@ -80,17 +80,17 @@ const DEFAULT_PROPS = {
metric: 'code_smells',
history: [
{ date: parseDate('Fri Mar 04 2016 10:40:12 GMT+0100 (CET)'), value: '1749' },
- { date: parseDate('Fri Mar 04 2016 18:40:16 GMT+0100 (CET)'), value: '2286' }
- ]
- }
+ { date: parseDate('Fri Mar 04 2016 18:40:16 GMT+0100 (CET)'), value: '2286' },
+ ],
+ },
],
query: {
category: '',
customMetrics: [],
graph: DEFAULT_GRAPH,
- project: 'org.sonarsource.sonarqube:sonarqube'
+ project: 'org.sonarsource.sonarqube:sonarqube',
},
- updateQuery: () => {}
+ updateQuery: () => {},
};
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityGraphs-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityGraphs-test.tsx
index f7a21453e04..39c26d04817 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityGraphs-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityGraphs-test.tsx
@@ -27,21 +27,21 @@ const ANALYSES = [
{
key: 'A1',
date: parseDate('2016-10-27T16:33:50+0200'),
- events: [{ key: 'E1', category: 'VERSION', name: '6.5-SNAPSHOT' }]
+ events: [{ key: 'E1', category: 'VERSION', name: '6.5-SNAPSHOT' }],
},
{
key: 'A2',
date: parseDate('2016-10-27T12:21:15+0200'),
- events: []
+ events: [],
},
{
key: 'A3',
date: parseDate('2016-10-26T12:17:29+0200'),
events: [
{ key: 'E2', category: 'VERSION', name: '6.4' },
- { key: 'E3', category: 'OTHER', name: 'foo' }
- ]
- }
+ { key: 'E3', category: 'OTHER', name: 'foo' },
+ ],
+ },
];
const METRICS = [{ id: '1', key: 'code_smells', name: 'Code Smells', type: 'INT' }];
@@ -56,9 +56,9 @@ const DEFAULT_PROPS: ProjectActivityGraphs['props'] = {
history: [
{ date: parseDate('2016-10-26T12:17:29+0200'), value: '2286' },
{ date: parseDate('2016-10-27T12:21:15+0200'), value: '1749' },
- { date: parseDate('2016-10-27T16:33:50+0200'), value: '500' }
- ]
- }
+ { date: parseDate('2016-10-27T16:33:50+0200'), value: '500' },
+ ],
+ },
],
metrics: METRICS,
project: 'foo',
@@ -66,9 +66,9 @@ const DEFAULT_PROPS: ProjectActivityGraphs['props'] = {
category: '',
customMetrics: [],
graph: DEFAULT_GRAPH,
- project: 'org.sonarsource.sonarqube:sonarqube'
+ project: 'org.sonarsource.sonarqube:sonarqube',
},
- updateQuery: () => {}
+ updateQuery: () => {},
};
it('should render correctly the graph and legends', () => {
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddEventForm.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddEventForm.tsx
index e6e655466bc..374f81c5607 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddEventForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddEventForm.tsx
@@ -52,7 +52,8 @@ export default class AddEventForm extends React.PureComponent<Props, State> {
header={translate(this.props.addEventButtonText)}
onClose={this.props.onClose}
onConfirm={this.handleSubmit}
- size="small">
+ size="small"
+ >
<div className="modal-field">
<label>{translate('name')}</label>
<input
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.tsx
index 177e1878486..bb0b8b0d57b 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.tsx
@@ -56,7 +56,8 @@ export default class ChangeEventForm extends React.PureComponent<Props, State> {
header={this.props.header}
onClose={this.props.onClose}
onConfirm={this.handleSubmit}
- size="small">
+ size="small"
+ >
<div className="modal-field">
<label>{translate('name')}</label>
<input autoFocus={true} onChange={this.changeInput} type="text" value={name} />
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveAnalysisForm.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveAnalysisForm.tsx
index f8548fd77c8..ab21308a2db 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveAnalysisForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveAnalysisForm.tsx
@@ -36,7 +36,8 @@ export default function RemoveAnalysisForm({ analysis, deleteAnalysis, onClose }
header={translate('project_activity.delete_analysis')}
isDestructive={true}
onClose={onClose}
- onConfirm={deleteAnalysis}>
+ onConfirm={deleteAnalysis}
+ >
{translate('project_activity.delete_analysis.question')}
</ConfirmModal>
);
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.tsx
index 947b2ba65cd..f5e2ce33ca9 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.tsx
@@ -39,7 +39,8 @@ export default function RemoveEventForm(props: RemoveEventFormProps) {
header={header}
isDestructive={true}
onClose={props.onClose}
- onConfirm={() => props.onConfirm(analysisKey, event.key)}>
+ onConfirm={() => props.onConfirm(analysisKey, event.key)}
+ >
{removeEventQuestion}
</ConfirmModal>
);
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/__tests__/AddEventForm-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/__tests__/AddEventForm-test.tsx
index ee87304af6e..a760c88b6f6 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/forms/__tests__/AddEventForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/forms/__tests__/AddEventForm-test.tsx
@@ -32,7 +32,7 @@ it('should render correctly', () => {
date: new Date('2019-01-14T15:44:51.000Z'),
events: [{ key: '2', category: 'VERSION', name: '1.0' }],
projectVersion: '1.0',
- manualNewCodePeriodBaseline: false
+ manualNewCodePeriodBaseline: false,
}}
onClose={jest.fn()}
/>
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/utils.ts b/server/sonar-web/src/main/js/apps/projectActivity/utils.ts
index 679b47ac194..52c2f7e5a71 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/utils.ts
+++ b/server/sonar-web/src/main/js/apps/projectActivity/utils.ts
@@ -28,7 +28,7 @@ import {
parseAsString,
serializeDate,
serializeString,
- serializeStringArray
+ serializeStringArray,
} from '../../helpers/query';
import { GraphType, ParsedAnalysis } from '../../types/project-activity';
import { Dict, RawQuery } from '../../types/types';
@@ -78,7 +78,7 @@ export function getAnalysesByVersionByDay(
) {
return analyses.reduce<AnalysesByDay[]>((acc, analysis) => {
let currentVersion = acc[acc.length - 1];
- const versionEvent = analysis.events.find(event => event.category === 'VERSION');
+ const versionEvent = analysis.events.find((event) => event.category === 'VERSION');
if (versionEvent) {
const newVersion = { version: versionEvent.name, key: versionEvent.key, byDay: {} };
if (!currentVersion || Object.keys(currentVersion.byDay).length > 0) {
@@ -93,16 +93,15 @@ export function getAnalysesByVersionByDay(
acc.push(currentVersion);
}
- const day = startOfDay(parseDate(analysis.date))
- .getTime()
- .toString();
+ const day = startOfDay(parseDate(analysis.date)).getTime().toString();
let matchFilters = true;
if (query.category || query.from || query.to) {
const isAfterFrom = !query.from || analysis.date >= query.from;
const isBeforeTo = !query.to || analysis.date <= query.to;
const hasSelectedCategoryEvents =
- !query.category || analysis.events.find(event => event.category === query.category) != null;
+ !query.category ||
+ analysis.events.find((event) => event.category === query.category) != null;
matchFilters = isAfterFrom && isBeforeTo && hasSelectedCategoryEvents;
}
@@ -124,7 +123,7 @@ export function parseQuery(urlQuery: RawQuery): Query {
graph: parseGraph(urlQuery['graph']),
project: parseAsString(urlQuery['id']),
to: parseAsDate(urlQuery['to']),
- selectedDate: parseAsDate(urlQuery['selected_date'])
+ selectedDate: parseAsDate(urlQuery['selected_date']),
};
}
@@ -133,7 +132,7 @@ export function serializeQuery(query: Query): RawQuery {
category: serializeString(query.category),
from: serializeDate(query.from),
project: serializeString(query.project),
- to: serializeDate(query.to)
+ to: serializeDate(query.to),
});
}
@@ -145,7 +144,7 @@ export function serializeUrlQuery(query: Query): RawQuery {
graph: serializeGraph(query.graph),
id: serializeString(query.project),
to: serializeDate(query.to),
- selected_date: serializeDate(query.selectedDate)
+ selected_date: serializeDate(query.selectedDate),
});
}
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/App.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/App.tsx
index 17f9c960606..602c15185db 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/App.tsx
@@ -23,7 +23,7 @@ import * as React from 'react';
import { getNewCodePeriod, resetNewCodePeriod, setNewCodePeriod } from '../../../api/newCodePeriod';
import withAppStateContext from '../../../app/components/app-state/withAppStateContext';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import withComponentContext from '../../../app/components/componentContext/withComponentContext';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
@@ -67,7 +67,7 @@ interface State {
const DEFAULT_NUMBER_OF_DAYS = '30';
const DEFAULT_GENERAL_SETTING: { type: NewCodePeriodSettingType } = {
- type: 'PREVIOUS_VERSION'
+ type: 'PREVIOUS_VERSION',
};
export class App extends React.PureComponent<Props, State> {
@@ -76,7 +76,7 @@ export class App extends React.PureComponent<Props, State> {
branchList: [],
days: DEFAULT_NUMBER_OF_DAYS,
loading: true,
- saving: false
+ saving: false,
};
// We use debounce as we could have multiple save in less that 3sec.
@@ -119,7 +119,7 @@ export class App extends React.PureComponent<Props, State> {
days: (currentSetting === 'NUMBER_OF_DAYS' && currentSettingValue) || defaultDays,
analysis: (currentSetting === 'SPECIFIC_ANALYSIS' && currentSettingValue) || '',
referenceBranch:
- (currentSetting === 'REFERENCE_BRANCH' && currentSettingValue) || referenceBranch
+ (currentSetting === 'REFERENCE_BRANCH' && currentSettingValue) || referenceBranch,
};
}
@@ -137,8 +137,8 @@ export class App extends React.PureComponent<Props, State> {
getNewCodePeriod(),
getNewCodePeriod({
branch: this.props.hasFeature(Feature.BranchSupport) ? undefined : branchLike.name,
- project: component.key
- })
+ project: component.key,
+ }),
]).then(
([generalSetting, setting]) => {
if (this.mounted) {
@@ -152,7 +152,7 @@ export class App extends React.PureComponent<Props, State> {
this.getUpdatedState({
generalSetting,
currentSetting,
- currentSettingValue
+ currentSettingValue,
})
);
}
@@ -171,7 +171,7 @@ export class App extends React.PureComponent<Props, State> {
saving: false,
currentSetting: undefined,
selected: undefined,
- success: true
+ success: true,
});
this.resetSuccess();
},
@@ -218,14 +218,14 @@ export class App extends React.PureComponent<Props, State> {
setNewCodePeriod({
project: component.key,
type,
- value
+ value,
}).then(
() => {
this.setState({
saving: false,
currentSetting: type,
currentSettingValue: value || undefined,
- success: true
+ success: true,
});
this.resetSuccess();
},
@@ -250,7 +250,7 @@ export class App extends React.PureComponent<Props, State> {
referenceBranch,
saving,
selected,
- success
+ success,
} = this.state;
const branchSupportEnabled = this.props.hasFeature(Feature.BranchSupport);
@@ -307,7 +307,7 @@ export class App extends React.PureComponent<Props, State> {
currentSetting
? {
type: currentSetting,
- value: currentSettingValue
+ value: currentSettingValue,
}
: generalSetting
}
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/AppHeader.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/AppHeader.tsx
index b1ca7a8665b..feba6afdb1e 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/AppHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/AppHeader.tsx
@@ -42,7 +42,7 @@ export default function AppHeader(props: AppHeaderProps) {
<DocLink to="/project-administration/new-code-period/">
{translate('project_baseline.page.description.link')}
</DocLink>
- )
+ ),
}}
/>
<br />
@@ -55,7 +55,7 @@ export default function AppHeader(props: AppHeaderProps) {
<Link to="/admin/settings?category=new_code_period">
{translate('project_baseline.page.description2.link')}
</Link>
- )
+ ),
}}
/>
)}
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingAnalysis.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingAnalysis.tsx
index fc94bb7faaa..b29cf8ccbd7 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingAnalysis.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingAnalysis.tsx
@@ -34,7 +34,8 @@ export default function BaselineSettingAnalysis({ disabled, onSelect, selected }
disabled={disabled}
onClick={() => onSelect('SPECIFIC_ANALYSIS')}
selected={selected}
- title={translate('baseline.specific_analysis')}>
+ title={translate('baseline.specific_analysis')}
+ >
<p className="big-spacer-bottom">{translate('baseline.specific_analysis.description')}</p>
</RadioCard>
);
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingDays.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingDays.tsx
index 1e703700590..b4fa182eca3 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingDays.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingDays.tsx
@@ -43,7 +43,8 @@ export default function BaselineSettingDays(props: Props) {
disabled={disabled}
onClick={() => onSelect('NUMBER_OF_DAYS')}
selected={selected}
- title={translate('baseline.number_days')}>
+ title={translate('baseline.number_days')}
+ >
<>
<p className="big-spacer-bottom">{translate('baseline.number_days.description')}</p>
{selected && (
@@ -56,8 +57,13 @@ export default function BaselineSettingDays(props: Props) {
isInvalid={isChanged && !isValid}
isValid={isChanged && isValid}
label={translate('baseline.specify_days')}
- required={true}>
- <input onChange={e => onChangeDays(e.currentTarget.value)} type="text" value={days} />
+ required={true}
+ >
+ <input
+ onChange={(e) => onChangeDays(e.currentTarget.value)}
+ type="text"
+ value={days}
+ />
</ValidationInput>
</>
)}
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingPreviousVersion.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingPreviousVersion.tsx
index 92d0678d9ea..a0be4c068fe 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingPreviousVersion.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingPreviousVersion.tsx
@@ -38,7 +38,8 @@ export default function BaselineSettingPreviousVersion(props: Props) {
selected={selected}
title={
translate('baseline.previous_version') + (isDefault ? ` (${translate('default')})` : '')
- }>
+ }
+ >
<p>{translate('baseline.previous_version.description')}</p>
</RadioCard>
);
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingReferenceBranch.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingReferenceBranch.tsx
index 7a34d01e6d3..84dccfb3584 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingReferenceBranch.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/BaselineSettingReferenceBranch.tsx
@@ -58,7 +58,8 @@ export function renderBranchOption(props: OptionProps<BranchOption, false>) {
overlay={translateWithParameters(
'baseline.reference_branch.does_not_exist',
option.value
- )}>
+ )}
+ >
<span>
{option.value} <AlertErrorIcon />
</span>
@@ -70,7 +71,8 @@ export function renderBranchOption(props: OptionProps<BranchOption, false>) {
option.isDisabled
? translate('baseline.reference_branch.cannot_be_itself')
: undefined
- }>
+ }
+ >
{option.value}
</span>
{option.isMain && (
@@ -85,11 +87,11 @@ export function renderBranchOption(props: OptionProps<BranchOption, false>) {
export default function BaselineSettingReferenceBranch(props: BaselineSettingReferenceBranchProps) {
const { branchList, className, disabled, referenceBranch, selected, settingLevel } = props;
- const currentBranch = branchList.find(b => b.value === referenceBranch) || {
+ const currentBranch = branchList.find((b) => b.value === referenceBranch) || {
label: referenceBranch,
value: referenceBranch,
isMain: false,
- isInvalid: true
+ isInvalid: true,
};
return (
@@ -98,7 +100,8 @@ export default function BaselineSettingReferenceBranch(props: BaselineSettingRef
disabled={disabled}
onClick={() => props.onSelect('REFERENCE_BRANCH')}
selected={selected}
- title={translate('baseline.reference_branch')}>
+ title={translate('baseline.reference_branch')}
+ >
<>
<p>{translate('baseline.reference_branch.description')}</p>
{selected && (
@@ -118,7 +121,7 @@ export default function BaselineSettingReferenceBranch(props: BaselineSettingRef
onChange={(option: BranchOption) => props.onChangeReferenceBranch(option.value)}
value={currentBranch}
components={{
- Option: renderBranchOption
+ Option: renderBranchOption,
}}
/>
</div>
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisList.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisList.tsx
index ac39e3d3279..bc59ca60fc4 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisList.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisList.tsx
@@ -51,7 +51,7 @@ export default class BranchAnalysisList extends React.PureComponent<Props, State
analyses: [],
loading: true,
range: 30,
- scroll: 0
+ scroll: 0,
};
constructor(props: Props) {
@@ -83,21 +83,21 @@ export default class BranchAnalysisList extends React.PureComponent<Props, State
return getProjectActivity({
branch,
project: component,
- from: range ? toShortNotSoISOString(subDays(new Date(), range)) : undefined
+ from: range ? toShortNotSoISOString(subDays(new Date(), range)) : undefined,
}).then((result: { analyses: Analysis[] }) => {
// If the selected analysis wasn't found in the default 30 days range, redo the search
- if (initial && analysis && !result.analyses.find(a => a.key === analysis)) {
+ if (initial && analysis && !result.analyses.find((a) => a.key === analysis)) {
this.handleRangeChange({ value: 0 });
return;
}
this.setState(
{
- analyses: result.analyses.map(analysis => ({
+ analyses: result.analyses.map((analysis) => ({
...analysis,
- date: parseDate(analysis.date)
+ date: parseDate(analysis.date),
})) as ParsedAnalysis[],
- loading: false
+ loading: false,
},
() => {
this.scrollToSelected();
@@ -150,7 +150,7 @@ export default class BranchAnalysisList extends React.PureComponent<Props, State
onSelectAnalysis={onSelectAnalysis}
range={range}
registerBadgeNode={this.registerBadgeNode}
- registerScrollableNode={el => {
+ registerScrollableNode={(el) => {
this.scrollableNode = el;
}}
selectedAnalysisKey={analysis}
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisListRenderer.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisListRenderer.tsx
index 59e9734ab6c..09cb23339ad 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisListRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchAnalysisListRenderer.tsx
@@ -54,14 +54,15 @@ function renderAnalysis(args: {
return (
<li
className={classNames('branch-analysis', {
- selected: analysis.key === selectedAnalysisKey
+ selected: analysis.key === selectedAnalysisKey,
})}
data-date={parseDate(analysis.date).valueOf()}
key={analysis.key}
- onClick={() => onSelectAnalysis(analysis)}>
+ onClick={() => onSelectAnalysis(analysis)}
+ >
<div className="branch-analysis-time spacer-right">
<TimeFormatter date={parseDate(analysis.date)} long={false}>
- {formattedTime => (
+ {(formattedTime) => (
<time className="text-middle" dateTime={parseDate(analysis.date).toISOString()}>
{formattedTime}
</time>
@@ -86,7 +87,7 @@ export default function BranchAnalysisListRenderer(props: BranchAnalysisListRend
const byVersionByDay = React.useMemo(
() =>
getAnalysesByVersionByDay(analyses, {
- category: ''
+ category: '',
}),
[analyses]
);
@@ -98,12 +99,12 @@ export default function BranchAnalysisListRenderer(props: BranchAnalysisListRend
const options = [
{
label: translate('baseline.branch_analyses.ranges.30days'),
- value: 30
+ value: 30,
},
{
label: translate('baseline.branch_analyses.ranges.allTime'),
- value: 0
- }
+ value: 0,
+ },
];
return (
@@ -119,14 +120,15 @@ export default function BranchAnalysisListRenderer(props: BranchAnalysisListRend
onChange={props.handleRangeChange}
options={options}
isSearchable={false}
- value={options.filter(o => o.value === range)}
+ value={options.filter((o) => o.value === range)}
/>
</div>
<div className="branch-analysis-list-wrapper">
<div
className="bordered branch-analysis-list"
onScroll={props.handleScroll}
- ref={props.registerScrollableNode}>
+ ref={props.registerScrollableNode}
+ >
{loading && <DeferredSpinner className="big-spacer-top" />}
{!loading && !hasFilteredData ? (
@@ -146,33 +148,36 @@ export default function BranchAnalysisListRenderer(props: BranchAnalysisListRend
<div
className={classNames('branch-analysis-version-badge', {
first: idx === 0,
- sticky: props.shouldStick(version.version)
+ sticky: props.shouldStick(version.version),
})}
- ref={props.registerBadgeNode(version.version)}>
+ ref={props.registerBadgeNode(version.version)}
+ >
<Tooltip
mouseEnterDelay={0.5}
- overlay={`${translate('version')} ${version.version}`}>
+ overlay={`${translate('version')} ${version.version}`}
+ >
<span className="badge">{version.version}</span>
</Tooltip>
</div>
)}
<ul className="branch-analysis-days-list">
- {days.map(day => (
+ {days.map((day) => (
<li
className="branch-analysis-day"
data-day={toShortNotSoISOString(Number(day))}
- key={day}>
+ key={day}
+ >
<div className="branch-analysis-date">
<DateFormatter date={Number(day)} long={true} />
</div>
<ul className="branch-analysis-analyses-list">
{version.byDay[day] != null &&
- version.byDay[day].map(analysis =>
+ version.byDay[day].map((analysis) =>
renderAnalysis({
analysis,
selectedAnalysisKey,
isFirst: analyses[0].key === analysis.key,
- onSelectAnalysis: props.onSelectAnalysis
+ onSelectAnalysis: props.onSelectAnalysis,
})
)}
</ul>
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchBaselineSettingModal.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchBaselineSettingModal.tsx
index 30fcb1080c0..5311954db05 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchBaselineSettingModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchBaselineSettingModal.tsx
@@ -56,7 +56,7 @@ export default class BranchBaselineSettingModal extends React.PureComponent<Prop
constructor(props: Props) {
super(props);
- const otherBranches = props.branchList.filter(b => b.name !== props.branch.name);
+ const otherBranches = props.branchList.filter((b) => b.name !== props.branch.name);
const defaultBranch = otherBranches.length > 0 ? otherBranches[0].name : '';
this.state = {
@@ -64,7 +64,7 @@ export default class BranchBaselineSettingModal extends React.PureComponent<Prop
days: this.getValueFromProps('NUMBER_OF_DAYS') || '30',
referenceBranch: this.getValueFromProps('REFERENCE_BRANCH') || defaultBranch,
saving: false,
- selected: this.props.branch.newCodePeriod && this.props.branch.newCodePeriod.type
+ selected: this.props.branch.newCodePeriod && this.props.branch.newCodePeriod.type,
};
}
@@ -86,7 +86,7 @@ export default class BranchBaselineSettingModal extends React.PureComponent<Prop
label: b.name,
value: b.name,
isMain: b.isMain,
- isDisabled: b.name === this.props.branch.name // cannot itself be used as a reference branch
+ isDisabled: b.name === this.props.branch.name, // cannot itself be used as a reference branch
});
handleSubmit = (e: React.SyntheticEvent<HTMLFormElement>) => {
@@ -103,21 +103,21 @@ export default class BranchBaselineSettingModal extends React.PureComponent<Prop
project: component,
type,
value,
- branch: branch.name
+ branch: branch.name,
}).then(
() => {
this.setState({
- saving: false
+ saving: false,
});
this.props.onClose(branch.name, {
type,
value,
- effectiveValue: analysisDate && toNotSoISOString(analysisDate)
+ effectiveValue: analysisDate && toNotSoISOString(analysisDate),
});
},
() => {
this.setState({
- saving: false
+ saving: false,
});
}
);
@@ -150,7 +150,7 @@ export default class BranchBaselineSettingModal extends React.PureComponent<Prop
currentSettingValue,
days,
referenceBranch,
- selected
+ selected,
});
return (
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchList.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchList.tsx
index 0874db2b54a..94206517d63 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchList.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/BranchList.tsx
@@ -43,7 +43,7 @@ export default class BranchList extends React.PureComponent<Props, State> {
mounted = false;
state: State = {
branches: [],
- loading: true
+ loading: true,
};
componentDidMount() {
@@ -64,20 +64,20 @@ export default class BranchList extends React.PureComponent<Props, State> {
this.setState({ loading: true });
listBranchesNewCodePeriod({ project }).then(
- branchSettings => {
+ (branchSettings) => {
const newCodePeriods = branchSettings.newCodePeriods
- ? branchSettings.newCodePeriods.filter(ncp => !ncp.inherited)
+ ? branchSettings.newCodePeriods.filter((ncp) => !ncp.inherited)
: [];
- const branchesWithBaseline = this.props.branchList.map(b => {
- const newCodePeriod = newCodePeriods.find(ncp => ncp.branchKey === b.name);
+ const branchesWithBaseline = this.props.branchList.map((b) => {
+ const newCodePeriod = newCodePeriods.find((ncp) => ncp.branchKey === b.name);
if (!newCodePeriod) {
return b;
}
const { type = 'PREVIOUS_VERSION', value, effectiveValue } = newCodePeriod;
return {
...b,
- newCodePeriod: { type, value, effectiveValue }
+ newCodePeriod: { type, value, effectiveValue },
};
});
@@ -92,7 +92,7 @@ export default class BranchList extends React.PureComponent<Props, State> {
updateBranchNewCodePeriod = (branch: string, newSetting: NewCodePeriod | undefined) => {
const { branches } = this.state;
- const updated = branches.find(b => b.name === branch);
+ const updated = branches.find((b) => b.name === branch);
if (updated) {
updated.newCodePeriod = newSetting;
}
@@ -107,7 +107,7 @@ export default class BranchList extends React.PureComponent<Props, State> {
if (branch) {
this.setState({
branches: this.updateBranchNewCodePeriod(branch, newSetting),
- editedBranch: undefined
+ editedBranch: undefined,
});
} else {
this.setState({ editedBranch: undefined });
@@ -117,7 +117,7 @@ export default class BranchList extends React.PureComponent<Props, State> {
resetToDefault = (branch: string) => {
return resetNewCodePeriod({
project: this.props.component.key,
- branch
+ branch,
}).then(() => {
this.setState({ branches: this.updateBranchNewCodePeriod(branch, undefined) });
});
@@ -148,10 +148,10 @@ export default class BranchList extends React.PureComponent<Props, State> {
</tr>
</thead>
<tbody>
- {branches.map(branch => (
+ {branches.map((branch) => (
<BranchListRow
branch={branch}
- existingBranches={branchList.map(b => b.name)}
+ existingBranches={branchList.map((b) => b.name)}
inheritedSetting={inheritedSetting}
key={branch.name}
onOpenEditModal={this.openEditModal}
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/ProjectBaselineSelector.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/ProjectBaselineSelector.tsx
index 724d16a6020..40de952e9d4 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/ProjectBaselineSelector.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/ProjectBaselineSelector.tsx
@@ -96,7 +96,7 @@ export default function ProjectBaselineSelector(props: ProjectBaselineSelectorPr
overrideGeneralSetting,
referenceBranch,
saving,
- selected
+ selected,
} = props;
const { isChanged, isValid } = validateSetting({
@@ -106,7 +106,7 @@ export default function ProjectBaselineSelector(props: ProjectBaselineSelectorPr
days,
overrideGeneralSetting,
referenceBranch,
- selected
+ selected,
});
return (
@@ -116,7 +116,8 @@ export default function ProjectBaselineSelector(props: ProjectBaselineSelectorPr
checked={!overrideGeneralSetting}
className="big-spacer-bottom"
onCheck={() => props.onToggleSpecificSetting(false)}
- value="general">
+ value="general"
+ >
{translate('project_baseline.general_setting')}
</Radio>
<div className="big-spacer-left">{renderGeneralSetting(generalSetting)}</div>
@@ -125,7 +126,8 @@ export default function ProjectBaselineSelector(props: ProjectBaselineSelectorPr
checked={overrideGeneralSetting}
className="huge-spacer-top"
onCheck={() => props.onToggleSpecificSetting(true)}
- value="specific">
+ value="specific"
+ >
{translate('project_baseline.specific_setting')}
</Radio>
</div>
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/App-test.tsx
index cbf4f74058f..36a4ca6fbd1 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/App-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import {
getNewCodePeriod,
resetNewCodePeriod,
- setNewCodePeriod
+ setNewCodePeriod,
} from '../../../../api/newCodePeriod';
import { mockBranch, mockMainBranch, mockPullRequest } from '../../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../../helpers/mocks/component';
@@ -33,7 +33,7 @@ import { App } from '../App';
jest.mock('../../../../api/newCodePeriod', () => ({
getNewCodePeriod: jest.fn().mockResolvedValue({}),
resetNewCodePeriod: jest.fn().mockResolvedValue({}),
- setNewCodePeriod: jest.fn().mockResolvedValue({})
+ setNewCodePeriod: jest.fn().mockResolvedValue({}),
}));
it('should render correctly', async () => {
@@ -48,7 +48,7 @@ it('should render correctly', async () => {
it('should initialize correctly', async () => {
const wrapper = shallowRender({
- branchLikes: [mockBranch(), mockPullRequest(), mockMainBranch()]
+ branchLikes: [mockBranch(), mockPullRequest(), mockMainBranch()],
});
await waitAndUpdate(wrapper);
@@ -81,7 +81,7 @@ it('should save correctly', async () => {
expect(setNewCodePeriod).toHaveBeenCalledWith({
project: component.key,
type: 'NUMBER_OF_DAYS',
- value: '23'
+ value: '23',
});
expect(wrapper.state('currentSetting')).toEqual(wrapper.state('selected'));
});
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingAnalysis-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingAnalysis-test.tsx
index 26fc81dba31..27d18c923ad 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingAnalysis-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingAnalysis-test.tsx
@@ -29,10 +29,7 @@ it('should callback when clicked', () => {
const onSelect = jest.fn();
const wrapper = shallowRender({ onSelect, selected: false });
- wrapper
- .find('RadioCard')
- .first()
- .simulate('click');
+ wrapper.find('RadioCard').first().simulate('click');
expect(onSelect).toHaveBeenCalledWith('SPECIFIC_ANALYSIS');
});
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingDays-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingDays-test.tsx
index b73d1a144f5..42364a64cbd 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingDays-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingDays-test.tsx
@@ -36,10 +36,7 @@ it('should callback when clicked', () => {
const onSelect = jest.fn();
const wrapper = shallowRender({ onSelect, selected: false });
- wrapper
- .find('RadioCard')
- .first()
- .simulate('click');
+ wrapper.find('RadioCard').first().simulate('click');
expect(onSelect).toHaveBeenCalledWith('NUMBER_OF_DAYS');
});
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingPreviousVersion-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingPreviousVersion-test.tsx
index c43565c269e..d484a8d348f 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingPreviousVersion-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingPreviousVersion-test.tsx
@@ -30,10 +30,7 @@ it('should callback when clicked', () => {
const onSelect = jest.fn();
const wrapper = shallowRender({ onSelect, selected: false });
- wrapper
- .find('RadioCard')
- .first()
- .simulate('click');
+ wrapper.find('RadioCard').first().simulate('click');
expect(onSelect).toHaveBeenCalledWith('PREVIOUS_VERSION');
});
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingReferenceBranch-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingReferenceBranch-test.tsx
index eba115e93b1..96dc6812eaa 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingReferenceBranch-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BaselineSettingReferenceBranch-test.tsx
@@ -25,7 +25,7 @@ import Select from '../../../../components/controls/Select';
import BaselineSettingReferenceBranch, {
BaselineSettingReferenceBranchProps,
BranchOption,
- renderBranchOption
+ renderBranchOption,
} from '../BaselineSettingReferenceBranch';
it('should render correctly', () => {
@@ -34,7 +34,7 @@ it('should render correctly', () => {
expect(
shallowRender({
branchList: [{ label: 'master', value: 'master', isMain: true }],
- settingLevel: 'branch'
+ settingLevel: 'branch',
})
).toMatchSnapshot('Branch level - no other branches');
});
@@ -48,10 +48,7 @@ it('should callback when clicked', () => {
const onSelect = jest.fn();
const wrapper = shallowRender({ onSelect, selected: false });
- wrapper
- .find(RadioCard)
- .first()
- .simulate('click');
+ wrapper.find(RadioCard).first().simulate('click');
expect(onSelect).toHaveBeenCalledWith('REFERENCE_BRANCH');
});
@@ -59,10 +56,7 @@ it('should callback when changing selection', () => {
const onChangeReferenceBranch = jest.fn();
const wrapper = shallowRender({ onChangeReferenceBranch });
- wrapper
- .find(Select)
- .first()
- .simulate('change', { value: 'branch-6.9' });
+ wrapper.find(Select).first().simulate('change', { value: 'branch-6.9' });
expect(onChangeReferenceBranch).toHaveBeenCalledWith('branch-6.9');
});
@@ -70,12 +64,12 @@ it('should handle an invalid branch', () => {
const unknownBranchName = 'branch-unknown';
const wrapper = shallowRender({ referenceBranch: unknownBranchName });
- expect(
- wrapper
- .find<ReactSelectProps>(Select)
- .first()
- .props().value
- ).toEqual({ label: unknownBranchName, value: unknownBranchName, isMain: false, isInvalid: true });
+ expect(wrapper.find<ReactSelectProps>(Select).first().props().value).toEqual({
+ label: unknownBranchName,
+ value: unknownBranchName,
+ isMain: false,
+ isInvalid: true,
+ });
});
describe('renderOption', () => {
@@ -89,19 +83,19 @@ describe('renderOption', () => {
expect(
renderBranchOption({
...props,
- data: { label: 'branch-7.4', value: 'branch-7.4', isMain: false }
+ data: { label: 'branch-7.4', value: 'branch-7.4', isMain: false },
})
).toMatchSnapshot('branch');
expect(
renderBranchOption({
...props,
- data: { label: 'disabled', value: 'disabled', isMain: false, isDisabled: true }
+ data: { label: 'disabled', value: 'disabled', isMain: false, isDisabled: true },
})
).toMatchSnapshot('disabled');
expect(
renderBranchOption({
...props,
- data: { value: 'branch-nope', isMain: false, isInvalid: true }
+ data: { value: 'branch-nope', isMain: false, isInvalid: true },
})
).toMatchSnapshot("branch doesn't exist");
});
@@ -110,7 +104,7 @@ describe('renderOption', () => {
function shallowRender(props: Partial<BaselineSettingReferenceBranchProps> = {}) {
const branchOptions = [
{ label: 'master', value: 'master', isMain: true },
- { label: 'branch-7.9', value: 'branch-7.9', isMain: false }
+ { label: 'branch-7.9', value: 'branch-7.9', isMain: false },
];
return shallow(
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchAnalysisList-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchAnalysisList-test.tsx
index 1d011ee0d6e..9ac38b13b35 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchAnalysisList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchAnalysisList-test.tsx
@@ -31,20 +31,20 @@ jest.mock('date-fns', () => {
return {
...actual,
startOfDay: jest.fn(() => ({
- getTime: () => '1488322800000' // 2017-03-02
- }))
+ getTime: () => '1488322800000', // 2017-03-02
+ })),
};
});
jest.mock('../../../../helpers/dates', () => ({
parseDate: jest.fn().mockReturnValue('2017-03-02'),
- toShortNotSoISOString: jest.fn().mockReturnValue('2017-03-02')
+ toShortNotSoISOString: jest.fn().mockReturnValue('2017-03-02'),
}));
jest.mock('../../../../api/projectActivity', () => ({
getProjectActivity: jest.fn().mockResolvedValue({
- analyses: []
- })
+ analyses: [],
+ }),
}));
beforeEach(() => {
@@ -57,25 +57,25 @@ it('should render correctly', async () => {
mockAnalysis({
key: '4',
date: '2017-03-02T10:36:01',
- projectVersion: '4.2'
+ projectVersion: '4.2',
}),
mockAnalysis({
key: '3',
date: '2017-03-02T09:36:01',
events: [mockAnalysisEvent()],
- projectVersion: '4.2'
+ projectVersion: '4.2',
}),
mockAnalysis({
key: '2',
date: '2017-03-02T08:36:01',
events: [
mockAnalysisEvent(),
- mockAnalysisEvent({ category: 'VERSION', qualityGate: undefined })
+ mockAnalysisEvent({ category: 'VERSION', qualityGate: undefined }),
],
- projectVersion: '4.1'
+ projectVersion: '4.1',
}),
- mockAnalysis({ key: '1', projectVersion: '4.1' })
- ]
+ mockAnalysis({ key: '1', projectVersion: '4.1' }),
+ ],
});
const wrapper = shallowRender();
@@ -92,7 +92,7 @@ it('should reload analyses after range change', () => {
expect(getProjectActivity).toHaveBeenCalledWith({
branch: 'master',
project: 'project1',
- from: toShortNotSoISOString(subDays(new Date(), 30))
+ from: toShortNotSoISOString(subDays(new Date(), 30)),
});
});
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchAnalysisListRenderer-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchAnalysisListRenderer-test.tsx
index 1fa07679e2c..0883605b2b4 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchAnalysisListRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchAnalysisListRenderer-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import { mockAnalysisEvent, mockParsedAnalysis } from '../../../../helpers/mocks/project-activity';
import BranchAnalysisListRenderer, {
- BranchAnalysisListRendererProps
+ BranchAnalysisListRendererProps,
} from '../BranchAnalysisListRenderer';
jest.mock('date-fns', () => {
@@ -32,7 +32,7 @@ jest.mock('date-fns', () => {
const startDay = new Date(date);
startDay.setUTCHours(0, 0, 0, 0);
return startDay;
- }
+ },
};
});
@@ -45,24 +45,24 @@ const analyses = [
mockParsedAnalysis({
key: '4',
date: new Date('2017-03-02T10:36:01Z'),
- projectVersion: '4.2'
+ projectVersion: '4.2',
}),
mockParsedAnalysis({
key: '3',
date: new Date('2017-03-02T09:36:01Z'),
events: [mockAnalysisEvent()],
- projectVersion: '4.2'
+ projectVersion: '4.2',
}),
mockParsedAnalysis({
key: '2',
date: new Date('2017-03-02T08:36:01Z'),
events: [
mockAnalysisEvent(),
- mockAnalysisEvent({ category: 'VERSION', qualityGate: undefined })
+ mockAnalysisEvent({ category: 'VERSION', qualityGate: undefined }),
],
- projectVersion: '4.1'
+ projectVersion: '4.1',
}),
- mockParsedAnalysis({ key: '1', projectVersion: '4.1' })
+ mockParsedAnalysis({ key: '1', projectVersion: '4.1' }),
];
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchBaselineSettingModal-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchBaselineSettingModal-test.tsx
index a01ef87dad6..b21e0a9f741 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchBaselineSettingModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchBaselineSettingModal-test.tsx
@@ -25,7 +25,7 @@ import { mockEvent, waitAndUpdate } from '../../../../helpers/testUtils';
import BranchBaselineSettingModal from '../BranchBaselineSettingModal';
jest.mock('../../../../api/newCodePeriod', () => ({
- setNewCodePeriod: jest.fn().mockResolvedValue({})
+ setNewCodePeriod: jest.fn().mockResolvedValue({}),
}));
it('should render correctly', () => {
@@ -48,7 +48,7 @@ it('should save correctly', async () => {
const component = 'compKey';
const wrapper = shallowRender({
branch,
- component
+ component,
});
wrapper.setState({ analysis: 'analysis572893', selected: 'SPECIFIC_ANALYSIS' });
@@ -61,7 +61,7 @@ it('should save correctly', async () => {
project: component,
type: 'SPECIFIC_ANALYSIS',
value: 'analysis572893',
- branch: 'branchname'
+ branch: 'branchname',
});
});
@@ -70,12 +70,7 @@ it('should disable the save button when saving', () => {
wrapper.setState({ saving: true });
- expect(
- wrapper
- .find('SubmitButton')
- .first()
- .prop('disabled')
- ).toBe(true);
+ expect(wrapper.find('SubmitButton').first().prop('disabled')).toBe(true);
});
it('should disable the save button when date is invalid', () => {
@@ -83,12 +78,7 @@ it('should disable the save button when date is invalid', () => {
wrapper.setState({ days: 'asdf' });
- expect(
- wrapper
- .find('SubmitButton')
- .first()
- .prop('disabled')
- ).toBe(true);
+ expect(wrapper.find('SubmitButton').first().prop('disabled')).toBe(true);
});
function shallowRender(props: Partial<BranchBaselineSettingModal['props']> = {}) {
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchList-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchList-test.tsx
index f714c6f23d6..2dc1830af38 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchList-test.tsx
@@ -28,7 +28,7 @@ import BranchList from '../BranchList';
jest.mock('../../../../api/newCodePeriod', () => ({
listBranchesNewCodePeriod: jest.fn().mockResolvedValue({ newCodePeriods: [] }),
- resetNewCodePeriod: jest.fn().mockResolvedValue(null)
+ resetNewCodePeriod: jest.fn().mockResolvedValue(null),
}));
const newCodePeriods = [
@@ -36,14 +36,14 @@ const newCodePeriods = [
projectKey: '',
branchKey: 'master',
type: 'NUMBER_OF_DAYS',
- value: '27'
- }
+ value: '27',
+ },
];
it('should render correctly', async () => {
(listBranchesNewCodePeriod as jest.Mock).mockResolvedValueOnce({ newCodePeriods });
const wrapper = shallowRender({
- branchList: [mockMainBranch(), mockBranch(), mockBranch({ name: 'branch-7.0' })]
+ branchList: [mockMainBranch(), mockBranch(), mockBranch({ name: 'branch-7.0' })],
});
await waitAndUpdate(wrapper);
expect(wrapper.state().branches).toHaveLength(3);
@@ -58,7 +58,7 @@ it('should handle reset', () => {
expect(resetNewCodePeriod).toHaveBeenCalledWith({
project: component.key,
- branch: 'master'
+ branch: 'master',
});
});
@@ -76,15 +76,15 @@ it('should toggle popup', async () => {
wrapper.instance().closeEditModal('master', { type: 'NUMBER_OF_DAYS', value: '23' });
expect(wrapper.find('BranchBaselineSettingModal')).toHaveLength(0);
- expect(wrapper.state().branches.find(b => b.name === 'master')).toEqual({
+ expect(wrapper.state().branches.find((b) => b.name === 'master')).toEqual({
analysisDate: '2018-01-01',
excludedFromPurge: true,
isMain: true,
name: 'master',
newCodePeriod: {
type: 'NUMBER_OF_DAYS',
- value: '23'
- }
+ value: '23',
+ },
});
});
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchListRow-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchListRow-test.tsx
index 253441842a6..3748b4bf6a0 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchListRow-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/BranchListRow-test.tsx
@@ -28,17 +28,17 @@ it('should render correctly', () => {
expect(
shallowRender({
branch: mockBranch({ name: 'branch-7.3' }),
- inheritedSetting: { type: 'REFERENCE_BRANCH', value: 'branch-7.3' }
+ inheritedSetting: { type: 'REFERENCE_BRANCH', value: 'branch-7.3' },
})
).toMatchSnapshot('faulty branch');
expect(
shallowRender({
- branch: { ...mockBranch(), newCodePeriod: { type: 'NUMBER_OF_DAYS', value: '21' } }
+ branch: { ...mockBranch(), newCodePeriod: { type: 'NUMBER_OF_DAYS', value: '21' } },
})
).toMatchSnapshot('branch with number of days');
expect(
shallowRender({
- branch: { ...mockBranch(), newCodePeriod: { type: 'PREVIOUS_VERSION' } }
+ branch: { ...mockBranch(), newCodePeriod: { type: 'PREVIOUS_VERSION' } },
})
).toMatchSnapshot('branch with previous version');
expect(
@@ -48,14 +48,14 @@ it('should render correctly', () => {
newCodePeriod: {
type: 'SPECIFIC_ANALYSIS',
value: 'A85835',
- effectiveValue: '2018-12-02T13:01:12'
- }
- }
+ effectiveValue: '2018-12-02T13:01:12',
+ },
+ },
})
).toMatchSnapshot('branch with specific analysis');
expect(
shallowRender({
- branch: { ...mockBranch(), newCodePeriod: { type: 'REFERENCE_BRANCH', value: 'master' } }
+ branch: { ...mockBranch(), newCodePeriod: { type: 'REFERENCE_BRANCH', value: 'master' } },
})
).toMatchSnapshot('branch with reference branch');
});
@@ -65,10 +65,7 @@ it('should callback to open modal when clicked', () => {
const branch = mockBranch();
const wrapper = shallowRender({ branch, onOpenEditModal: openEditModal });
- wrapper
- .find(ActionsDropdownItem)
- .first()
- .simulate('click');
+ wrapper.find(ActionsDropdownItem).first().simulate('click');
expect(openEditModal).toHaveBeenCalledWith(branch);
});
@@ -78,13 +75,10 @@ it('should callback to reset when clicked', () => {
const branchName = 'branch-6.5';
const wrapper = shallowRender({
branch: { ...mockBranch({ name: branchName }), newCodePeriod: { type: 'REFERENCE_BRANCH' } },
- onResetToDefault: resetToDefault
+ onResetToDefault: resetToDefault,
});
- wrapper
- .find(ActionsDropdownItem)
- .at(1)
- .simulate('click');
+ wrapper.find(ActionsDropdownItem).at(1).simulate('click');
expect(resetToDefault).toHaveBeenCalledWith(branchName);
});
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/ProjectBaselineSelector-test.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/ProjectBaselineSelector-test.tsx
index 4df2277939e..dcd4bea5e08 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/ProjectBaselineSelector-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/ProjectBaselineSelector-test.tsx
@@ -27,7 +27,7 @@ it('should render correctly', () => {
expect(
shallowRender({
branchesEnabled: false,
- generalSetting: { type: 'NUMBER_OF_DAYS', value: '23' }
+ generalSetting: { type: 'NUMBER_OF_DAYS', value: '23' },
})
).toMatchSnapshot();
expect(
@@ -39,21 +39,16 @@ it('should not show save button when unchanged', () => {
const wrapper = shallowRender({
currentSetting: 'PREVIOUS_VERSION',
selected: 'PREVIOUS_VERSION',
- overrideGeneralSetting: true
+ overrideGeneralSetting: true,
});
- expect(
- wrapper
- .find('SubmitButton')
- .parent()
- .hasClass('invisible')
- ).toBe(true);
+ expect(wrapper.find('SubmitButton').parent().hasClass('invisible')).toBe(true);
});
it('should show save button when changed', () => {
const wrapper = shallowRender({
currentSetting: 'PREVIOUS_VERSION',
selected: 'NUMBER_OF_DAYS',
- overrideGeneralSetting: true
+ overrideGeneralSetting: true,
});
expect(wrapper.find('SubmitButton')).toHaveLength(1);
});
@@ -64,7 +59,7 @@ it('should show save button when value changed', () => {
currentSettingValue: '23',
days: '25',
selected: 'NUMBER_OF_DAYS',
- overrideGeneralSetting: true
+ overrideGeneralSetting: true,
});
expect(wrapper.find('SubmitButton')).toHaveLength(1);
});
@@ -75,15 +70,10 @@ it('should disable the save button when saving', () => {
currentSettingValue: '25',
saving: true,
selected: 'PREVIOUS_VERSION',
- overrideGeneralSetting: true
+ overrideGeneralSetting: true,
});
- expect(
- wrapper
- .find('SubmitButton')
- .first()
- .prop('disabled')
- ).toBe(true);
+ expect(wrapper.find('SubmitButton').first().prop('disabled')).toBe(true);
});
it('should disable the save button when date is invalid', () => {
@@ -91,15 +81,10 @@ it('should disable the save button when date is invalid', () => {
currentSetting: 'PREVIOUS_VERSION',
days: 'hello',
selected: 'NUMBER_OF_DAYS',
- overrideGeneralSetting: true
+ overrideGeneralSetting: true,
});
- expect(
- wrapper
- .find('SubmitButton')
- .first()
- .prop('disabled')
- ).toBe(true);
+ expect(wrapper.find('SubmitButton').first().prop('disabled')).toBe(true);
});
function shallowRender(props: Partial<ProjectBaselineSelectorProps> = {}) {
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/utils-test.ts
index ddcbd6f6384..07a8272d2ed 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/__tests__/utils-test.ts
@@ -23,7 +23,7 @@ describe('getSettingValue', () => {
const state = {
analysis: 'analysis',
days: '35',
- referenceBranch: 'branch-4.2'
+ referenceBranch: 'branch-4.2',
};
it('should work for Days', () => {
@@ -50,14 +50,14 @@ describe('validateSettings', () => {
validateSetting({
currentSetting: 'PREVIOUS_VERSION',
days: '12',
- selected: 'NUMBER_OF_DAYS'
+ selected: 'NUMBER_OF_DAYS',
})
).toEqual({ isChanged: true, isValid: true });
expect(
validateSetting({
currentSetting: 'PREVIOUS_VERSION',
days: 'nope',
- selected: 'NUMBER_OF_DAYS'
+ selected: 'NUMBER_OF_DAYS',
})
).toEqual({ isChanged: true, isValid: false });
expect(
@@ -65,7 +65,7 @@ describe('validateSettings', () => {
currentSetting: 'NUMBER_OF_DAYS',
currentSettingValue: '15',
days: '15',
- selected: 'NUMBER_OF_DAYS'
+ selected: 'NUMBER_OF_DAYS',
})
).toEqual({ isChanged: false, isValid: true });
expect(
@@ -73,7 +73,7 @@ describe('validateSettings', () => {
currentSetting: 'NUMBER_OF_DAYS',
currentSettingValue: '15',
days: '13',
- selected: 'NUMBER_OF_DAYS'
+ selected: 'NUMBER_OF_DAYS',
})
).toEqual({ isChanged: true, isValid: true });
expect(
@@ -82,7 +82,7 @@ describe('validateSettings', () => {
currentSetting: 'SPECIFIC_ANALYSIS',
currentSettingValue: 'analysis1',
days: '',
- selected: 'SPECIFIC_ANALYSIS'
+ selected: 'SPECIFIC_ANALYSIS',
})
).toEqual({ isChanged: false, isValid: true });
expect(
@@ -91,7 +91,7 @@ describe('validateSettings', () => {
currentSetting: 'SPECIFIC_ANALYSIS',
currentSettingValue: 'analysis1',
days: '',
- selected: 'SPECIFIC_ANALYSIS'
+ selected: 'SPECIFIC_ANALYSIS',
})
).toEqual({ isChanged: true, isValid: true });
expect(
@@ -100,7 +100,7 @@ describe('validateSettings', () => {
currentSettingValue: 'master',
days: '',
referenceBranch: 'master',
- selected: 'REFERENCE_BRANCH'
+ selected: 'REFERENCE_BRANCH',
})
).toEqual({ isChanged: false, isValid: true });
expect(
@@ -109,7 +109,7 @@ describe('validateSettings', () => {
currentSettingValue: 'master',
days: '',
referenceBranch: '',
- selected: 'REFERENCE_BRANCH'
+ selected: 'REFERENCE_BRANCH',
})
).toEqual({ isChanged: true, isValid: false });
});
@@ -117,21 +117,21 @@ describe('validateSettings', () => {
it('should validate at project level', () => {
expect(validateSetting({ days: '', overrideGeneralSetting: false })).toEqual({
isChanged: false,
- isValid: true
+ isValid: true,
});
expect(validateSetting({ days: '', overrideGeneralSetting: true })).toEqual({
isChanged: true,
- isValid: false
+ isValid: false,
});
expect(
validateSetting({
currentSetting: 'PREVIOUS_VERSION',
days: '',
- overrideGeneralSetting: false
+ overrideGeneralSetting: false,
})
).toEqual({
isChanged: true,
- isValid: true
+ isValid: true,
});
});
});
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/utils.ts b/server/sonar-web/src/main/js/apps/projectBaseline/utils.ts
index 4374e6812e4..672e9f9e07b 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/utils.ts
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/utils.ts
@@ -29,7 +29,7 @@ export function getSettingValue({
analysis,
days,
referenceBranch,
- type
+ type,
}: {
analysis?: string;
days?: string;
@@ -64,7 +64,7 @@ export function validateSetting(state: {
days,
overrideGeneralSetting,
referenceBranch = '',
- selected
+ selected,
} = state;
let isChanged;
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx
index 50aa2dc36d9..c30df8a45cb 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx
@@ -26,7 +26,7 @@ import {
getBranchLikeDisplayName,
isBranch,
isMainBranch,
- isPullRequest
+ isPullRequest,
} from '../../../helpers/branch-like';
import { translate } from '../../../helpers/l10n';
import { BranchLike } from '../../../types/branch-like';
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTable.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTable.tsx
index a9cb25fe99a..06cbbaef865 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTable.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTable.tsx
@@ -73,7 +73,7 @@ export function BranchLikeTable(props: BranchLikeTableProps) {
</tr>
</thead>
<tbody>
- {branchLikes.map(branchLike => (
+ {branchLikes.map((branchLike) => (
<BranchLikeRow
branchLike={branchLike}
component={component}
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTabs.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTabs.tsx
index 77732e65287..92ef9cbd1b3 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTabs.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTabs.tsx
@@ -26,7 +26,7 @@ import {
isMainBranch,
isPullRequest,
sortBranches,
- sortPullRequests
+ sortPullRequests,
} from '../../../helpers/branch-like';
import { translate } from '../../../helpers/l10n';
import { BranchLike } from '../../../types/branch-like';
@@ -49,7 +49,7 @@ interface State {
export enum Tabs {
Branch,
- PullRequest
+ PullRequest,
}
const TABS = [
@@ -62,7 +62,7 @@ const TABS = [
{translate('project_branch_pull_request.tabs.branches')}
</span>
</>
- )
+ ),
},
{
key: Tabs.PullRequest,
@@ -73,8 +73,8 @@ const TABS = [
{translate('project_branch_pull_request.tabs.pull_requests')}
</span>
</>
- )
- }
+ ),
+ },
];
export default class BranchLikeTabs extends React.PureComponent<Props, State> {
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchPurgeSetting.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchPurgeSetting.tsx
index e692fa46a03..5d45e70e427 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchPurgeSetting.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchPurgeSetting.tsx
@@ -67,7 +67,7 @@ export default class BranchPurgeSetting extends React.PureComponent<Props, State
if (this.mounted) {
this.setState({
excludedFromPurge: newValue,
- loading: false
+ loading: false,
});
this.props.onUpdatePurgeSetting();
}
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx
index cc8791a5e1b..a8f9458c561 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx
@@ -55,11 +55,11 @@ export default class DeleteBranchModal extends React.PureComponent<Props, State>
const request = isPullRequest(this.props.branchLike)
? deletePullRequest({
project: this.props.component.key,
- pullRequest: this.props.branchLike.key
+ pullRequest: this.props.branchLike.key,
})
: deleteBranch({
branch: this.props.branchLike.name,
- project: this.props.component.key
+ project: this.props.component.key,
});
request.then(
() => {
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformation.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformation.tsx
index a6a0de260a4..04269fbd518 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformation.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformation.tsx
@@ -48,11 +48,11 @@ export class LifetimeInformation extends React.PureComponent<Props, State> {
fetchBranchAndPullRequestLifetimeSetting() {
getValue({ key: SettingsKey.DaysBeforeDeletingInactiveBranchesAndPRs }).then(
- settings => {
+ (settings) => {
if (this.mounted) {
this.setState({
loading: false,
- branchAndPullRequestLifeTimeInDays: settings?.value
+ branchAndPullRequestLifeTimeInDays: settings?.value,
});
}
},
@@ -66,7 +66,7 @@ export class LifetimeInformation extends React.PureComponent<Props, State> {
render() {
const {
- appState: { canAdmin }
+ appState: { canAdmin },
} = this.props;
const { branchAndPullRequestLifeTimeInDays, loading } = this.state;
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx
index efda55587f4..5c19bb1290a 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformationRenderer.tsx
@@ -47,7 +47,7 @@ export function LifetimeInformationRenderer(props: LifetimeInformationRendererPr
defaultMessage={translate('project_branch_pull_request.lifetime_information.admin')}
id="project_branch_pull_request.lifetime_information.admin"
values={{
- settings: <Link to="/admin/settings">{translate('settings.page')}</Link>
+ settings: <Link to="/admin/settings">{translate('settings.page')}</Link>,
}}
/>
)}
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTable-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTable-test.tsx
index cfec0e87bc5..477c37b62bc 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTable-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTable-test.tsx
@@ -38,11 +38,7 @@ it('should properly propagate delete event', () => {
const onDelete = jest.fn();
const wrapper = shallowRender({ onDelete });
- wrapper
- .find(BranchLikeRow)
- .first()
- .props()
- .onDelete();
+ wrapper.find(BranchLikeRow).first().props().onDelete();
expect(onDelete).toHaveBeenCalled();
});
@@ -52,11 +48,7 @@ it('should properly propagate rename event', () => {
const onRename = jest.fn();
const wrapper = shallowRender({ onDelete, onRename });
- wrapper
- .find(BranchLikeRow)
- .first()
- .props()
- .onRename();
+ wrapper.find(BranchLikeRow).first().props().onRename();
expect(onRename).toHaveBeenCalled();
});
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTabs-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTabs-test.tsx
index 7216b07cb1a..25336ae5754 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTabs-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchLikeTabs-test.tsx
@@ -23,7 +23,7 @@ import BoxedTabs from '../../../../components/controls/BoxedTabs';
import {
mockMainBranch,
mockPullRequest,
- mockSetOfBranchAndPullRequest
+ mockSetOfBranchAndPullRequest,
} from '../../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../../helpers/mocks/component';
import { BranchLikeTable } from '../BranchLikeTable';
@@ -48,28 +48,16 @@ it('should render deletion modal correctly', () => {
const onBranchesChange = jest.fn();
const wrapper = shallowRender({ onBranchesChange });
- wrapper
- .find(BranchLikeTable)
- .props()
- .onDelete(mockPullRequest());
+ wrapper.find(BranchLikeTable).props().onDelete(mockPullRequest());
expect(wrapper.state().deleting).toBeDefined();
expect(wrapper.find(DeleteBranchModal)).toMatchSnapshot();
- wrapper
- .find(DeleteBranchModal)
- .props()
- .onClose();
+ wrapper.find(DeleteBranchModal).props().onClose();
expect(wrapper.state().deleting).toBeUndefined();
expect(wrapper.find(DeleteBranchModal).exists()).toBe(false);
- wrapper
- .find(BranchLikeTable)
- .props()
- .onDelete(mockPullRequest());
- wrapper
- .find(DeleteBranchModal)
- .props()
- .onDelete();
+ wrapper.find(BranchLikeTable).props().onDelete(mockPullRequest());
+ wrapper.find(DeleteBranchModal).props().onDelete();
expect(wrapper.state().deleting).toBeUndefined();
expect(wrapper.find(DeleteBranchModal).exists()).toBe(false);
expect(onBranchesChange).toHaveBeenCalled();
@@ -79,28 +67,16 @@ it('should render renaming modal correctly', () => {
const onBranchesChange = jest.fn();
const wrapper = shallowRender({ onBranchesChange });
- wrapper
- .find(BranchLikeTable)
- .props()
- .onRename(mockMainBranch());
+ wrapper.find(BranchLikeTable).props().onRename(mockMainBranch());
expect(wrapper.state().renaming).toBeDefined();
expect(wrapper.find(RenameBranchModal)).toMatchSnapshot();
- wrapper
- .find(RenameBranchModal)
- .props()
- .onClose();
+ wrapper.find(RenameBranchModal).props().onClose();
expect(wrapper.state().renaming).toBeUndefined();
expect(wrapper.find(RenameBranchModal).exists()).toBe(false);
- wrapper
- .find(BranchLikeTable)
- .props()
- .onRename(mockMainBranch());
- wrapper
- .find(RenameBranchModal)
- .props()
- .onRename();
+ wrapper.find(BranchLikeTable).props().onRename(mockMainBranch());
+ wrapper.find(RenameBranchModal).props().onRename();
expect(wrapper.state().renaming).toBeUndefined();
expect(wrapper.find(RenameBranchModal).exists()).toBe(false);
expect(onBranchesChange).toHaveBeenCalled();
@@ -109,10 +85,7 @@ it('should render renaming modal correctly', () => {
it('should NOT render renaming modal for non-main branch', () => {
const wrapper = shallowRender();
- wrapper
- .find(BranchLikeTable)
- .props()
- .onRename(mockPullRequest());
+ wrapper.find(BranchLikeTable).props().onRename(mockPullRequest());
expect(wrapper.state().renaming).toBeDefined();
expect(wrapper.find(RenameBranchModal).exists()).toBe(false);
});
@@ -121,10 +94,7 @@ it('should correctly propagate an update of purge settings', () => {
const onBranchesChange = jest.fn();
const wrapper = shallowRender({ onBranchesChange });
- wrapper
- .find(BranchLikeTable)
- .props()
- .onUpdatePurgeSetting();
+ wrapper.find(BranchLikeTable).props().onUpdatePurgeSetting();
expect(onBranchesChange).toHaveBeenCalled();
});
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchPurgeSetting-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchPurgeSetting-test.tsx
index 7d0cef9078a..7184b8ce365 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchPurgeSetting-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchPurgeSetting-test.tsx
@@ -27,7 +27,7 @@ import { waitAndUpdate } from '../../../../helpers/testUtils';
import BranchPurgeSetting from '../BranchPurgeSetting';
jest.mock('../../../../api/branches', () => ({
- excludeBranchFromPurge: jest.fn().mockResolvedValue({})
+ excludeBranchFromPurge: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => jest.clearAllMocks());
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx
index a7f1c58ea07..698d3daeca3 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx
@@ -28,7 +28,7 @@ import DeleteBranchModal from '../DeleteBranchModal';
jest.mock('../../../../api/branches', () => ({
deleteBranch: jest.fn(),
- deletePullRequest: jest.fn()
+ deletePullRequest: jest.fn(),
}));
const branch = mockBranch({ name: 'feature/foo' });
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformation-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformation-test.tsx
index 17d4bd8d3ad..1b9cc4c59ff 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformation-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformation-test.tsx
@@ -26,7 +26,7 @@ import { SettingsKey } from '../../../../types/settings';
import { LifetimeInformation } from '../LifetimeInformation';
jest.mock('../../../../api/settings', () => ({
- getValue: jest.fn().mockResolvedValue({ value: '45' })
+ getValue: jest.fn().mockResolvedValue({ value: '45' }),
}));
it('should render correctly', async () => {
@@ -36,7 +36,7 @@ it('should render correctly', async () => {
await waitAndUpdate(wrapper);
expect(getValue).toHaveBeenCalledWith({
- key: SettingsKey.DaysBeforeDeletingInactiveBranchesAndPRs
+ key: SettingsKey.DaysBeforeDeletingInactiveBranchesAndPRs,
});
expect(wrapper).toMatchSnapshot('after_fetching_data');
});
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformationRenderer-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformationRenderer-test.tsx
index 74a06dc478d..0c4a8edda71 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformationRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformationRenderer-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
LifetimeInformationRenderer,
- LifetimeInformationRendererProps
+ LifetimeInformationRendererProps,
} from '../LifetimeInformationRenderer';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/ProjectBranchesApp-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/ProjectBranchesApp-test.tsx
index e06c159cfe1..cba7e8c2440 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/ProjectBranchesApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/ProjectBranchesApp-test.tsx
@@ -33,10 +33,7 @@ it('should properly notify that a branch or a pr has been changed/deleted', () =
const onBranchesChange = jest.fn();
const wrapper = shallowRender({ onBranchesChange });
- wrapper
- .find(BranchLikeTabs)
- .props()
- .onBranchesChange();
+ wrapper.find(BranchLikeTabs).props().onBranchesChange();
expect(onBranchesChange).toHaveBeenCalled();
});
diff --git a/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx b/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx
index c087dddab94..9dee6a5a1e0 100644
--- a/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx
@@ -64,7 +64,8 @@ export class Form extends React.PureComponent<Props> {
component.name
)}
modalHeader={translate('qualifier.delete', component.qualifier)}
- onConfirm={this.handleDelete}>
+ onConfirm={this.handleDelete}
+ >
{({ onClick }) => (
<Button className="button-red" id="delete-project" onClick={onClick}>
{translate('delete')}
diff --git a/server/sonar-web/src/main/js/apps/projectDeletion/__tests__/Form-test.tsx b/server/sonar-web/src/main/js/apps/projectDeletion/__tests__/Form-test.tsx
index 5f23662c5e6..af841fe8af9 100644
--- a/server/sonar-web/src/main/js/apps/projectDeletion/__tests__/Form-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDeletion/__tests__/Form-test.tsx
@@ -26,11 +26,11 @@ import { Form } from '../Form';
jest.mock('../../../api/components', () => ({
deleteProject: jest.fn().mockResolvedValue(undefined),
- deletePortfolio: jest.fn().mockResolvedValue(undefined)
+ deletePortfolio: jest.fn().mockResolvedValue(undefined),
}));
jest.mock('../../../api/application', () => ({
- deleteApplication: jest.fn().mockResolvedValue(undefined)
+ deleteApplication: jest.fn().mockResolvedValue(undefined),
}));
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx b/server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx
index 0e9dd698d05..8190a2b2cfe 100644
--- a/server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDump/ProjectDumpApp.tsx
@@ -21,7 +21,7 @@ import * as React from 'react';
import { getActivity } from '../../api/ce';
import { getStatus } from '../../api/project-dump';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../app/components/available-features/withAvailableFeatures';
import withComponentContext from '../../app/components/componentContext/withComponentContext';
import { throwGlobalError } from '../../helpers/error';
@@ -76,8 +76,8 @@ export class ProjectDumpApp extends React.Component<Props, State> {
TaskStatuses.InProgress,
TaskStatuses.Success,
TaskStatuses.Failed,
- TaskStatuses.Canceled
- ].join(',')
+ TaskStatuses.Canceled,
+ ].join(','),
};
return getActivity(data)
.then(({ tasks }) => (tasks.length > 0 ? tasks[0] : undefined), throwGlobalError)
@@ -90,17 +90,17 @@ export class ProjectDumpApp extends React.Component<Props, State> {
? [
this.getLastTask(componentKey, TaskTypes.ProjectExport),
this.getLastTask(componentKey, TaskTypes.ProjectImport),
- this.getLastTask(componentKey, TaskTypes.Report)
+ this.getLastTask(componentKey, TaskTypes.Report),
]
: [
this.getLastTask(componentKey, TaskTypes.ProjectExport),
Promise.resolve(),
- this.getLastTask(componentKey, TaskTypes.Report)
+ this.getLastTask(componentKey, TaskTypes.Report),
];
return Promise.all(all).then(([lastExportTask, lastImportTask, lastAnalysisTask]) => ({
lastExportTask,
lastImportTask,
- lastAnalysisTask
+ lastAnalysisTask,
}));
}
@@ -113,14 +113,14 @@ export class ProjectDumpApp extends React.Component<Props, State> {
status,
lastExportTask,
lastImportTask,
- lastAnalysisTask
+ lastAnalysisTask,
});
}
return {
status,
lastExportTask,
lastImportTask,
- lastAnalysisTask
+ lastAnalysisTask,
};
}
);
diff --git a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-test.tsx b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-test.tsx
index 255e926dca1..989c753fbdc 100644
--- a/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDump/__tests__/ProjectDumpApp-test.tsx
@@ -28,11 +28,11 @@ import { TaskStatuses } from '../../../types/tasks';
import { ProjectDumpApp } from '../ProjectDumpApp';
jest.mock('../../../api/ce', () => ({
- getActivity: jest.fn().mockResolvedValue({ tasks: [] })
+ getActivity: jest.fn().mockResolvedValue({ tasks: [] }),
}));
jest.mock('../../../api/project-dump', () => ({
- getStatus: jest.fn().mockResolvedValue({})
+ getStatus: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx b/server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx
index 473e17fbaec..712abe8055e 100644
--- a/server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDump/components/Export.tsx
@@ -70,7 +70,7 @@ export default class Export extends React.Component<Props> {
<div className="boxed-group-inner" id="export-pending">
<i className="spinner spacer-right" />
<DateTimeFormatter date={task.submittedAt}>
- {formatted => (
+ {(formatted) => (
<span>{translateWithParameters('project_dump.pending_export', formatted)}</span>
)}
</DateTimeFormatter>
@@ -88,7 +88,7 @@ export default class Export extends React.Component<Props> {
<i className="spinner spacer-right" />
{task.startedAt && (
<DateFromNow date={task.startedAt}>
- {fromNow => (
+ {(fromNow) => (
<span>{translateWithParameters('project_dump.in_progress_export', fromNow)}</span>
)}
</DateFromNow>
@@ -129,7 +129,7 @@ export default class Export extends React.Component<Props> {
<Alert className="export-dump" variant="success">
{task && task.executedAt && (
<DateTimeFormatter date={task.executedAt}>
- {formatted => (
+ {(formatted) => (
<div className="export-dump-message">
{translateWithParameters('project_dump.latest_export_available', formatted)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx b/server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx
index 39c61a03b37..649b42efc1a 100644
--- a/server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDump/components/Import.tsx
@@ -78,7 +78,7 @@ export default class Import extends React.Component<Props> {
<div className="boxed-group-inner">
{task.executedAt && (
<DateTimeFormatter date={task.executedAt}>
- {formatted => (
+ {(formatted) => (
<Alert variant="success">
{translateWithParameters('project_dump.import_success', formatted)}
</Alert>
@@ -94,7 +94,7 @@ export default class Import extends React.Component<Props> {
<div className="boxed-group-inner" id="import-pending">
<i className="spinner spacer-right" />
<DateTimeFormatter date={task.submittedAt}>
- {formatted => (
+ {(formatted) => (
<span>{translateWithParameters('project_dump.pending_import', formatted)}</span>
)}
</DateTimeFormatter>
@@ -108,7 +108,7 @@ export default class Import extends React.Component<Props> {
<i className="spinner spacer-right" />
{task.startedAt && (
<DateFromNow date={task.startedAt}>
- {fromNow => (
+ {(fromNow) => (
<span>{translateWithParameters('project_dump.in_progress_import', fromNow)}</span>
)}
</DateFromNow>
@@ -161,9 +161,10 @@ export default class Import extends React.Component<Props> {
return (
<div
className={classNames('boxed-group', {
- 'import-disabled text-muted': !importEnabled
+ 'import-disabled text-muted': !importEnabled,
})}
- id="project-import">
+ id="project-import"
+ >
<div className="boxed-group-header">
<h2>{translate('project_dump.import')}</h2>
</div>
diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Export-test.tsx b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Export-test.tsx
index f8a66029624..c17b4d8eb0b 100644
--- a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Export-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Export-test.tsx
@@ -24,7 +24,7 @@ import { TaskStatuses } from '../../../../types/tasks';
import Export from '../Export';
jest.mock('../../../../api/project-dump', () => ({
- doExport: jest.fn().mockResolvedValue({})
+ doExport: jest.fn().mockResolvedValue({}),
}));
it('should render correctly', () => {
@@ -44,7 +44,7 @@ it('should render correctly', () => {
expect(
shallowRender({
status: mockDumpStatus({ exportedDump: 'dump-file' }),
- task: mockDumpTask({ status: TaskStatuses.Success })
+ task: mockDumpTask({ status: TaskStatuses.Success }),
})
).toMatchSnapshot('success');
});
diff --git a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Import-test.tsx b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Import-test.tsx
index 725effa8c8e..0655e46b7e5 100644
--- a/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Import-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDump/components/__tests__/Import-test.tsx
@@ -24,7 +24,7 @@ import { TaskStatuses } from '../../../../types/tasks';
import Import from '../Import';
jest.mock('../../../../api/project-dump', () => ({
- doImport: jest.fn().mockResolvedValue({})
+ doImport: jest.fn().mockResolvedValue({}),
}));
it('should render correctly', () => {
@@ -41,7 +41,7 @@ it('should render correctly', () => {
expect(
shallowRender({
analysis: mockDumpTask(),
- task: mockDumpTask({ status: TaskStatuses.Success })
+ task: mockDumpTask({ status: TaskStatuses.Success }),
})
).toMatchSnapshot('success, but with analysis -> show form');
expect(shallowRender({ task: mockDumpTask({ status: TaskStatuses.Pending }) })).toMatchSnapshot(
diff --git a/server/sonar-web/src/main/js/apps/projectKey/UpdateForm.tsx b/server/sonar-web/src/main/js/apps/projectKey/UpdateForm.tsx
index 45ba212a8c4..4b97fa44c6a 100644
--- a/server/sonar-web/src/main/js/apps/projectKey/UpdateForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectKey/UpdateForm.tsx
@@ -64,7 +64,8 @@ export default function UpdateForm(props: UpdateFormProps) {
</>
}
modalHeader={translate('update_key.page')}
- onConfirm={props.onKeyChange}>
+ onConfirm={props.onKeyChange}
+ >
{({ onFormSubmit }) => (
<form onSubmit={onFormSubmit}>
<MandatoryFieldsExplanation className="spacer-bottom" />
@@ -93,7 +94,8 @@ export default function UpdateForm(props: UpdateFormProps) {
onClick={() => {
setNewKey(undefined);
}}
- type="reset">
+ type="reset"
+ >
{translate('reset_verb')}
</Button>
</div>
diff --git a/server/sonar-web/src/main/js/apps/projectKey/__tests__/Key-test.tsx b/server/sonar-web/src/main/js/apps/projectKey/__tests__/Key-test.tsx
index d7273ccb654..1f4ae76ad92 100644
--- a/server/sonar-web/src/main/js/apps/projectKey/__tests__/Key-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectKey/__tests__/Key-test.tsx
@@ -24,7 +24,7 @@ import { mockComponent } from '../../../helpers/mocks/component';
import { Key } from '../Key';
jest.mock('../../../api/components', () => ({
- changeKey: jest.fn().mockResolvedValue(undefined)
+ changeKey: jest.fn().mockResolvedValue(undefined),
}));
it('should render and change key', async () => {
@@ -39,6 +39,6 @@ it('should render and change key', async () => {
expect(changeKey).toHaveBeenCalledWith({ from: 'foo', to: 'bar' });
expect(withRouterProps.router.replace).toHaveBeenCalledWith({
pathname: '/project/key',
- query: { id: 'bar' }
+ query: { id: 'bar' },
});
});
diff --git a/server/sonar-web/src/main/js/apps/projectKey/__tests__/UpdateForm-test.tsx b/server/sonar-web/src/main/js/apps/projectKey/__tests__/UpdateForm-test.tsx
index d34022f1cda..1204ecffe31 100644
--- a/server/sonar-web/src/main/js/apps/projectKey/__tests__/UpdateForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectKey/__tests__/UpdateForm-test.tsx
@@ -69,20 +69,12 @@ function expectButtonDisabled(
button: React.ComponentType<{ disabled?: boolean }>
) {
// eslint-disable-next-line jest/valid-expect
- return expect(
- getForm(wrapper)
- .find(button)
- .props().disabled
- );
+ return expect(getForm(wrapper).find(button).props().disabled);
}
function expectProjectKeyInputValue(wrapper: ShallowWrapper) {
// eslint-disable-next-line jest/valid-expect
- return expect(
- getForm(wrapper)
- .find(ProjectKeyInput)
- .props().projectKey
- );
+ return expect(getForm(wrapper).find(ProjectKeyInput).props().projectKey);
}
function changeInput(wrapper: ShallowWrapper, value: string) {
diff --git a/server/sonar-web/src/main/js/apps/projectLinks/App.tsx b/server/sonar-web/src/main/js/apps/projectLinks/App.tsx
index c70f6a1648e..0663c9a24cf 100644
--- a/server/sonar-web/src/main/js/apps/projectLinks/App.tsx
+++ b/server/sonar-web/src/main/js/apps/projectLinks/App.tsx
@@ -58,7 +58,7 @@ export class App extends React.PureComponent<Props, State> {
fetchLinks = () => {
this.setState({ loading: true });
getProjectLinks(this.props.component.key).then(
- links => {
+ (links) => {
if (this.mounted) {
this.setState({ links, loading: false });
}
@@ -72,10 +72,10 @@ export class App extends React.PureComponent<Props, State> {
};
handleCreateLink = (name: string, url: string) => {
- return createLink({ name, projectKey: this.props.component.key, url }).then(link => {
+ return createLink({ name, projectKey: this.props.component.key, url }).then((link) => {
if (this.mounted) {
this.setState(({ links = [] }) => ({
- links: [...links, link]
+ links: [...links, link],
}));
}
});
@@ -85,7 +85,7 @@ export class App extends React.PureComponent<Props, State> {
return deleteLink(linkId).then(() => {
if (this.mounted) {
this.setState(({ links = [] }) => ({
- links: links.filter(link => link.id !== linkId)
+ links: links.filter((link) => link.id !== linkId),
}));
}
});
diff --git a/server/sonar-web/src/main/js/apps/projectLinks/CreationModal.tsx b/server/sonar-web/src/main/js/apps/projectLinks/CreationModal.tsx
index 86680aa647d..864073f25e9 100644
--- a/server/sonar-web/src/main/js/apps/projectLinks/CreationModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectLinks/CreationModal.tsx
@@ -58,7 +58,8 @@ export default class CreationModal extends React.PureComponent<Props, State> {
header={header}
onClose={this.props.onClose}
onSubmit={this.handleSubmit}
- size="small">
+ size="small"
+ >
{({ onCloseClick, onFormSubmit, submitting }) => (
<form onSubmit={onFormSubmit}>
<header className="modal-head">
diff --git a/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx b/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx
index 92ffdfe5690..9f26caa517f 100644
--- a/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx
+++ b/server/sonar-web/src/main/js/apps/projectLinks/LinkRow.tsx
@@ -76,7 +76,8 @@ export default class LinkRow extends React.PureComponent<Props> {
link.name!
)}
modalHeader={translate('project_links.delete_project_link')}
- onConfirm={this.props.onDelete}>
+ onConfirm={this.props.onDelete}
+ >
{({ onClick }) => (
<Button className="button-red js-delete-button" onClick={onClick}>
{translate('delete')}
diff --git a/server/sonar-web/src/main/js/apps/projectLinks/Table.tsx b/server/sonar-web/src/main/js/apps/projectLinks/Table.tsx
index 62655f64852..0c9aad57af9 100644
--- a/server/sonar-web/src/main/js/apps/projectLinks/Table.tsx
+++ b/server/sonar-web/src/main/js/apps/projectLinks/Table.tsx
@@ -49,7 +49,7 @@ export default class Table extends React.PureComponent<Props> {
const orderedLinks = orderLinks(this.props.links);
- const linkRows = orderedLinks.map(link => (
+ const linkRows = orderedLinks.map((link) => (
<LinkRow key={link.id} link={link} onDelete={this.props.onDelete} />
));
diff --git a/server/sonar-web/src/main/js/apps/projectLinks/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/projectLinks/__tests__/App-test.tsx
index ac1ca9b97ee..11fdb92fce8 100644
--- a/server/sonar-web/src/main/js/apps/projectLinks/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectLinks/__tests__/App-test.tsx
@@ -28,12 +28,12 @@ import { App } from '../App';
jest.mock('../../../api/projectLinks', () => ({
getProjectLinks: jest.fn().mockResolvedValue([
{ id: '1', type: 'homepage', url: 'http://example.com' },
- { id: '2', name: 'foo', type: 'foo', url: 'http://example.com/foo' }
+ { id: '2', name: 'foo', type: 'foo', url: 'http://example.com/foo' },
]),
createLink: jest
.fn()
.mockResolvedValue({ id: '3', name: 'bar', type: 'bar', url: 'http://example.com/bar' }),
- deleteLink: jest.fn().mockResolvedValue(undefined)
+ deleteLink: jest.fn().mockResolvedValue(undefined),
}));
it('should fetch links and render', async () => {
@@ -62,7 +62,7 @@ it('should create link', async () => {
expect(createLink).toHaveBeenCalledWith({
name: 'bar',
projectKey: 'comp',
- url: 'http://example.com/bar'
+ url: 'http://example.com/bar',
});
});
diff --git a/server/sonar-web/src/main/js/apps/projectLinks/__tests__/Table-test.tsx b/server/sonar-web/src/main/js/apps/projectLinks/__tests__/Table-test.tsx
index 901a594cd2e..e81636ff273 100644
--- a/server/sonar-web/src/main/js/apps/projectLinks/__tests__/Table-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectLinks/__tests__/Table-test.tsx
@@ -26,7 +26,7 @@ it('should render', () => {
{ id: '1', type: 'homepage', url: 'http://example.com/homepage' },
{ id: '2', type: 'issue', url: 'http://example.com/issue' },
{ id: '3', name: 'foo', type: 'foo', url: 'http://example.com/foo' },
- { id: '4', name: 'bar', type: 'bar', url: 'http://example.com/bar' }
+ { id: '4', name: 'bar', type: 'bar', url: 'http://example.com/bar' },
];
expect(shallow(<Table links={links} onDelete={jest.fn()} />)).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateApp.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateApp.tsx
index 64ba93947c4..14b6ad96388 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateApp.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateApp.tsx
@@ -24,7 +24,7 @@ import {
fetchQualityGate,
fetchQualityGates,
getGateForProject,
- searchProjects
+ searchProjects,
} from '../../api/quality-gates';
import withComponentContext from '../../app/components/componentContext/withComponentContext';
import handleRequiredAuthorization from '../../app/utils/handleRequiredAuthorization';
@@ -52,7 +52,7 @@ export class ProjectQualityGateApp extends React.PureComponent<Props, State> {
state: State = {
loading: true,
selectedQualityGateId: USE_SYSTEM_DEFAULT,
- submitting: false
+ submitting: false,
};
componentDidMount() {
@@ -85,10 +85,10 @@ export class ProjectQualityGateApp extends React.PureComponent<Props, State> {
// selected, or if we're inheriting the system default.
const selected = await searchProjects({
gateName: qualityGate.name,
- query: component.key
+ query: component.key,
})
.then(({ results }) => {
- return Boolean(results.find(r => r.key === component.key)?.selected);
+ return Boolean(results.find((r) => r.key === component.key)?.selected);
})
.catch(() => false);
@@ -99,7 +99,7 @@ export class ProjectQualityGateApp extends React.PureComponent<Props, State> {
fetchDetailedQualityGates = async () => {
const { qualitygates } = await fetchQualityGates();
return Promise.all(
- qualitygates.map(async qg => {
+ qualitygates.map(async (qg) => {
const detailedQp = await fetchQualityGate({ id: qg.id }).catch(() => qg);
return { ...detailedQp, ...qg };
})
@@ -112,7 +112,7 @@ export class ProjectQualityGateApp extends React.PureComponent<Props, State> {
const [allQualityGates, currentQualityGate] = await Promise.all([
this.fetchDetailedQualityGates(),
- getGateForProject({ project: component.key })
+ getGateForProject({ project: component.key }),
]).catch(() => []);
if (allQualityGates && currentQualityGate) {
@@ -123,7 +123,7 @@ export class ProjectQualityGateApp extends React.PureComponent<Props, State> {
allQualityGates,
currentQualityGate,
selectedQualityGateId: usingDefault ? USE_SYSTEM_DEFAULT : currentQualityGate.id,
- loading: false
+ loading: false,
});
}
} else if (this.mounted) {
@@ -148,14 +148,14 @@ export class ProjectQualityGateApp extends React.PureComponent<Props, State> {
if (selectedQualityGateId === USE_SYSTEM_DEFAULT) {
await dissociateGateWithProject({
gateId: currentQualityGate.id,
- projectKey: component.key
+ projectKey: component.key,
}).catch(() => {
/* noop */
});
} else {
await associateGateWithProject({
gateId: selectedQualityGateId,
- projectKey: component.key
+ projectKey: component.key,
}).catch(() => {
/* noop */
});
@@ -166,8 +166,8 @@ export class ProjectQualityGateApp extends React.PureComponent<Props, State> {
const newGate =
selectedQualityGateId === USE_SYSTEM_DEFAULT
- ? allQualityGates.find(gate => gate.isDefault)
- : allQualityGates.find(gate => gate.id === selectedQualityGateId);
+ ? allQualityGates.find((gate) => gate.isDefault)
+ : allQualityGates.find((gate) => gate.id === selectedQualityGateId);
if (newGate) {
this.setState({ currentQualityGate: newGate, submitting: false });
@@ -181,13 +181,8 @@ export class ProjectQualityGateApp extends React.PureComponent<Props, State> {
return null;
}
- const {
- allQualityGates,
- currentQualityGate,
- loading,
- selectedQualityGateId,
- submitting
- } = this.state;
+ const { allQualityGates, currentQualityGate, loading, selectedQualityGateId, submitting } =
+ this.state;
return (
<ProjectQualityGateAppRenderer
diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx
index cc6ef7da006..16cb8b3a7fd 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx
@@ -47,7 +47,7 @@ export interface ProjectQualityGateAppRendererProps {
}
function hasConditionOnNewCode(qualityGate: QualityGate): boolean {
- return !!qualityGate.conditions?.some(condition => isDiffMetric(condition.metric));
+ return !!qualityGate.conditions?.some((condition) => isDiffMetric(condition.metric));
}
interface QualityGateOption extends BasicSelectOption {
@@ -71,7 +71,7 @@ function renderQualitygateOption(props: OptionProps<QualityGateOption, false>) {
<Link to={{ pathname: `/quality_gates/show/${props.data.value}` }}>
{translate('project_quality_gate.no_condition.link')}
</Link>
- )
+ ),
}}
/>
)}
@@ -83,7 +83,7 @@ function renderQualitygateOption(props: OptionProps<QualityGateOption, false>) {
export default function ProjectQualityGateAppRenderer(props: ProjectQualityGateAppRendererProps) {
const { allQualityGates, currentQualityGate, loading, selectedQualityGateId, submitting } = props;
- const defaultQualityGate = allQualityGates?.find(g => g.isDefault);
+ const defaultQualityGate = allQualityGates?.find((g) => g.isDefault);
if (loading) {
return <i className="spinner" />;
@@ -104,12 +104,12 @@ export default function ProjectQualityGateAppRenderer(props: ProjectQualityGateA
defaultQualityGate.id !== currentQualityGate.id
: selectedQualityGateId !== currentQualityGate.id;
- const selectedQualityGate = allQualityGates.find(qg => qg.id === selectedQualityGateId);
+ const selectedQualityGate = allQualityGates.find((qg) => qg.id === selectedQualityGateId);
- const options: QualityGateOption[] = allQualityGates.map(g => ({
+ const options: QualityGateOption[] = allQualityGates.map((g) => ({
isDisabled: g.conditions === undefined || g.conditions.length === 0,
label: g.name,
- value: g.id
+ value: g.id,
}));
return (
@@ -137,10 +137,11 @@ export default function ProjectQualityGateAppRenderer(props: ProjectQualityGateA
<form
className="boxed-group-inner"
- onSubmit={e => {
+ onSubmit={(e) => {
e.preventDefault();
props.onSubmit();
- }}>
+ }}
+ >
<p className="big-spacer-bottom">{translate('project_quality_gate.page.description')}</p>
<div className="big-spacer-bottom">
@@ -149,7 +150,8 @@ export default function ProjectQualityGateAppRenderer(props: ProjectQualityGateA
checked={usesDefault}
disabled={submitting}
onCheck={() => props.onSelect(USE_SYSTEM_DEFAULT)}
- value={USE_SYSTEM_DEFAULT}>
+ value={USE_SYSTEM_DEFAULT}
+ >
<div className="spacer-left">
<div className="little-spacer-bottom">
{translate('project_quality_gate.always_use_default')}
@@ -172,12 +174,13 @@ export default function ProjectQualityGateAppRenderer(props: ProjectQualityGateA
className="display-flex-start"
checked={!usesDefault}
disabled={submitting}
- onCheck={value => {
+ onCheck={(value) => {
if (usesDefault) {
props.onSelect(value);
}
}}
- value={!usesDefault ? selectedQualityGateId : currentQualityGate.id}>
+ value={!usesDefault ? selectedQualityGateId : currentQualityGate.id}
+ >
<div className="spacer-left">
<div className="little-spacer-bottom">
{translate('project_quality_gate.always_use_specific')}
@@ -186,7 +189,7 @@ export default function ProjectQualityGateAppRenderer(props: ProjectQualityGateA
<Select
className="abs-width-300 it__project-quality-gate-select"
components={{
- Option: renderQualitygateOption
+ Option: renderQualitygateOption,
}}
isClearable={usesDefault}
isDisabled={submitting || usesDefault}
@@ -194,7 +197,7 @@ export default function ProjectQualityGateAppRenderer(props: ProjectQualityGateA
props.onSelect(value);
}}
options={options}
- value={options.find(o => o.value === selectedQualityGateId)}
+ value={options.find((o) => o.value === selectedQualityGateId)}
/>
</div>
</div>
@@ -210,7 +213,7 @@ export default function ProjectQualityGateAppRenderer(props: ProjectQualityGateA
<Link to={{ pathname: `/quality_gates/show/${selectedQualityGate.id}` }}>
{translate('project_quality_gate.no_condition.link')}
</Link>
- )
+ ),
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-test.tsx
index ca4e06e3f0f..cb60aec84e7 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateApp-test.tsx
@@ -24,7 +24,7 @@ import {
dissociateGateWithProject,
fetchQualityGates,
getGateForProject,
- searchProjects
+ searchProjects,
} from '../../../api/quality-gates';
import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization';
import { mockComponent } from '../../../helpers/mocks/component';
@@ -42,14 +42,14 @@ jest.mock('../../../api/quality-gates', () => {
gate1: mockQualityGate({ id: 'gate1' }),
gate2: mockQualityGate({ id: 'gate2', isBuiltIn: true }),
gate3: mockQualityGate({ id: 'gate3', isDefault: true }),
- gate4: mockQualityGate({ id: 'gate4' })
+ gate4: mockQualityGate({ id: 'gate4' }),
};
return {
associateGateWithProject: jest.fn().mockResolvedValue(null),
dissociateGateWithProject: jest.fn().mockResolvedValue(null),
fetchQualityGates: jest.fn().mockResolvedValue({
- qualitygates: Object.values(gates)
+ qualitygates: Object.values(gates),
}),
fetchQualityGate: jest.fn().mockImplementation((qg: { id: keyof typeof gates }) => {
if (qg.id === 'gate4') {
@@ -58,12 +58,12 @@ jest.mock('../../../api/quality-gates', () => {
return Promise.resolve({ conditions, ...gates[qg.id] });
}),
getGateForProject: jest.fn().mockResolvedValue(gates.gate2),
- searchProjects: jest.fn().mockResolvedValue({ results: [] })
+ searchProjects: jest.fn().mockResolvedValue({ results: [] }),
};
});
jest.mock('../../../helpers/globalMessages', () => ({
- addGlobalSuccessMessage: jest.fn()
+ addGlobalSuccessMessage: jest.fn(),
}));
jest.mock('../../../app/utils/handleRequiredAuthorization', () => jest.fn());
@@ -111,7 +111,7 @@ it('correctly detects if the default Quality Gate was explicitly selected', asyn
mockQualityGate({ id: 'gate3', isDefault: true })
);
(searchProjects as jest.Mock).mockResolvedValueOnce({
- results: [{ key: 'foo', selected: true }]
+ results: [{ key: 'foo', selected: true }],
});
const wrapper = shallowRender();
await waitAndUpdate(wrapper);
@@ -131,7 +131,7 @@ it('correctly associates a selected Quality Gate', async () => {
expect(associateGateWithProject).toHaveBeenCalledWith({
gateId: 'gate3',
- projectKey: 'foo'
+ projectKey: 'foo',
});
});
@@ -141,13 +141,13 @@ it('correctly associates a project with the system default Quality Gate', async
wrapper.setState({
currentQualityGate: mockQualityGate({ id: 'gate1' }),
- selectedQualityGateId: USE_SYSTEM_DEFAULT
+ selectedQualityGateId: USE_SYSTEM_DEFAULT,
});
wrapper.instance().handleSubmit();
expect(dissociateGateWithProject).toHaveBeenCalledWith({
gateId: 'gate1',
- projectKey: 'foo'
+ projectKey: 'foo',
});
});
diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateAppRenderer-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateAppRenderer-test.tsx
index 5833f2e2006..eaf99f0add8 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateAppRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityGate/__tests__/ProjectQualityGateAppRenderer-test.tsx
@@ -27,7 +27,7 @@ import { submit } from '../../../helpers/testUtils';
import { MetricKey } from '../../../types/metrics';
import { USE_SYSTEM_DEFAULT } from '../constants';
import ProjectQualityGateAppRenderer, {
- ProjectQualityGateAppRendererProps
+ ProjectQualityGateAppRendererProps,
} from '../ProjectQualityGateAppRenderer';
it('should render correctly', () => {
@@ -37,25 +37,25 @@ it('should render correctly', () => {
expect(
shallowRender({
currentQualityGate: mockQualityGate({ id: '2', isDefault: true }),
- selectedQualityGateId: USE_SYSTEM_DEFAULT
+ selectedQualityGateId: USE_SYSTEM_DEFAULT,
})
).toMatchSnapshot('always use system default');
expect(shallowRender({ selectedQualityGateId: '3' })).toMatchSnapshot('show new code warning');
expect(
shallowRender({
- selectedQualityGateId: '5'
+ selectedQualityGateId: '5',
})
).toMatchSnapshot('show warning');
expect(
shallowRender({
- selectedQualityGateId: USE_SYSTEM_DEFAULT
+ selectedQualityGateId: USE_SYSTEM_DEFAULT,
})
).toMatchSnapshot('show warning if not using default');
expect(shallowRender({ allQualityGates: undefined }).type()).toBeNull(); // no quality gates
});
it('should render select options correctly', () => {
- return new Promise<void>(resolve => {
+ return new Promise<void>((resolve) => {
const wrapper = shallowRender();
const render = wrapper.find(Select).props().components.Option;
@@ -68,23 +68,15 @@ it('should render select options correctly', () => {
it('should correctly handle changes', () => {
const wrapper = shallowRender();
- const onSelect = jest.fn(selectedQualityGateId => {
+ const onSelect = jest.fn((selectedQualityGateId) => {
wrapper.setProps({ selectedQualityGateId });
});
wrapper.setProps({ onSelect });
- wrapper
- .find(Radio)
- .at(0)
- .props()
- .onCheck(USE_SYSTEM_DEFAULT);
+ wrapper.find(Radio).at(0).props().onCheck(USE_SYSTEM_DEFAULT);
expect(onSelect).toHaveBeenLastCalledWith(USE_SYSTEM_DEFAULT);
- wrapper
- .find(Radio)
- .at(1)
- .props()
- .onCheck('1');
+ wrapper.find(Radio).at(1).props().onCheck('1');
expect(onSelect).toHaveBeenLastCalledWith('1');
wrapper.find(Select).props().onChange!({ value: '2' });
@@ -106,7 +98,7 @@ function shallowRender(props: Partial<ProjectQualityGateAppRendererProps> = {})
allQualityGates={[
mockQualityGate({ conditions }),
mockQualityGate({ id: '2', isDefault: true, conditions }),
- mockQualityGate({ id: '3', isDefault: true, conditions: conditionsEmptyOnNew })
+ mockQualityGate({ id: '3', isDefault: true, conditions: conditionsEmptyOnNew }),
]}
currentQualityGate={mockQualityGate({ id: '1' })}
loading={false}
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesApp.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesApp.tsx
index 03aa8b8a692..c38b46dfacc 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesApp.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesApp.tsx
@@ -24,7 +24,7 @@ import {
dissociateProject,
getProfileProjects,
Profile,
- searchQualityProfiles
+ searchQualityProfiles,
} from '../../api/quality-profiles';
import withComponentContext from '../../app/components/componentContext/withComponentContext';
import handleRequiredAuthorization from '../../app/utils/handleRequiredAuthorization';
@@ -82,15 +82,15 @@ export class ProjectQualityProfilesApp extends React.PureComponent<Props, State>
// for each existing profile. We only keep those that were effectively
// selected, and discard the rest.
const projectProfiles = await Promise.all(
- allProfiles.map(profile =>
+ allProfiles.map((profile) =>
getProfileProjects({
key: profile.key,
q: component.name,
- selected: 'selected'
+ selected: 'selected',
})
.then(({ results }) => ({
- selected: Boolean(results.find(p => p.key === component.key)?.selected),
- profile
+ selected: Boolean(results.find((p) => p.key === component.key)?.selected),
+ profile,
}))
.catch(() => ({ selected: false, profile }))
)
@@ -100,7 +100,7 @@ export class ProjectQualityProfilesApp extends React.PureComponent<Props, State>
.filter(({ selected }) => selected)
.map(({ profile }) => ({
profile,
- selected: true
+ selected: true,
}));
// Finally, the project uses some profiles implicitly, either inheriting
@@ -108,13 +108,15 @@ export class ProjectQualityProfilesApp extends React.PureComponent<Props, State>
// yet (in which case the info is outdated). We also need this information.
const componentProfiles = differenceBy(
component.qualityProfiles,
- selectedProjectProfiles.map(p => p.profile),
+ selectedProjectProfiles.map((p) => p.profile),
'key'
)
// Discard languages we already have up-to-date info for.
- .filter(({ language }) => !selectedProjectProfiles.some(p => p.profile.language === language))
+ .filter(
+ ({ language }) => !selectedProjectProfiles.some((p) => p.profile.language === language)
+ )
.map(({ key }) => {
- const profile = allProfiles.find(p => p.key === key);
+ const profile = allProfiles.find((p) => p.key === key);
if (profile) {
// If the profile is the default profile, all is good.
if (profile.isDefault) {
@@ -126,12 +128,12 @@ export class ProjectQualityProfilesApp extends React.PureComponent<Props, State>
// be taken into account after a new analysis. Fetch the
// default profile.
const defaultProfile = allProfiles.find(
- p => p.isDefault && p.language === profile.language
+ (p) => p.isDefault && p.language === profile.language
);
return (
defaultProfile && {
profile: defaultProfile,
- selected: false
+ selected: false,
}
);
}
@@ -145,7 +147,7 @@ export class ProjectQualityProfilesApp extends React.PureComponent<Props, State>
this.setState({
allProfiles,
projectProfiles: [...selectedProjectProfiles, ...componentProfiles],
- loading: false
+ loading: false,
});
}
};
@@ -165,7 +167,7 @@ export class ProjectQualityProfilesApp extends React.PureComponent<Props, State>
handleAddLanguage = async (key: string) => {
const { component } = this.props;
const { allProfiles = [] } = this.state;
- const newProfile = allProfiles.find(p => p.key === key);
+ const newProfile = allProfiles.find((p) => p.key === key);
if (newProfile) {
try {
@@ -177,8 +179,8 @@ export class ProjectQualityProfilesApp extends React.PureComponent<Props, State>
...projectProfiles,
{
profile: newProfile,
- selected: true
- }
+ selected: true,
+ },
];
return { projectProfiles: newProjectProfiles, showAddLanguageModal: false };
@@ -203,10 +205,10 @@ export class ProjectQualityProfilesApp extends React.PureComponent<Props, State>
const { component } = this.props;
const { allProfiles = [], projectProfiles = [] } = this.state;
- const newProfile = newKey && allProfiles.find(p => p.key === newKey);
- const oldProjectProfile = projectProfiles.find(p => p.profile.key === oldKey);
+ const newProfile = newKey && allProfiles.find((p) => p.key === newKey);
+ const oldProjectProfile = projectProfiles.find((p) => p.profile.key === oldKey);
const defaultProfile = allProfiles.find(
- p => p.isDefault && p.language === oldProjectProfile?.profile.language
+ (p) => p.isDefault && p.language === oldProjectProfile?.profile.language
);
if (defaultProfile === undefined || oldProjectProfile === undefined) {
@@ -243,12 +245,12 @@ export class ProjectQualityProfilesApp extends React.PureComponent<Props, State>
if (this.mounted) {
const newProjectProfiles = [
// Remove the old profile.
- ...projectProfiles.filter(p => p.profile.key !== oldKey),
+ ...projectProfiles.filter((p) => p.profile.key !== oldKey),
// Replace with the "new" profile.
replaceProfile && {
profile: replaceProfile,
- selected: newKey !== undefined
- }
+ selected: newKey !== undefined,
+ },
].filter(isDefined);
this.setState({ projectProfiles: newProjectProfiles, showProjectProfileInModal: undefined });
@@ -272,7 +274,7 @@ export class ProjectQualityProfilesApp extends React.PureComponent<Props, State>
loading,
showProjectProfileInModal,
projectProfiles,
- showAddLanguageModal
+ showAddLanguageModal,
} = this.state;
return (
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx
index 2a8e33b2671..21cb2544414 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx
@@ -59,11 +59,11 @@ export default function ProjectQualityProfilesAppRenderer(
loading,
showProjectProfileInModal,
projectProfiles,
- showAddLanguageModal
+ showAddLanguageModal,
} = props;
const profilesByLanguage = groupBy(allProfiles, 'language');
- const orderedProfiles = orderBy(projectProfiles, p => p.profile.languageName);
+ const orderedProfiles = orderBy(projectProfiles, (p) => p.profile.languageName);
return (
<div className="page page-limited" id="project-quality-profiles">
@@ -108,7 +108,7 @@ export default function ProjectQualityProfilesAppRenderer(
</tr>
</thead>
<tbody>
- {orderedProfiles.map(projectProfile => {
+ {orderedProfiles.map((projectProfile) => {
const { profile, selected } = projectProfile;
return (
<tr key={profile.language}>
@@ -136,7 +136,8 @@ export default function ProjectQualityProfilesAppRenderer(
<Button
onClick={() => {
props.onOpenSetProfileModal(projectProfile);
- }}>
+ }}
+ >
<EditIcon className="spacer-right" />
{translate('project_quality_profile.change_profile')}
</Button>
@@ -177,7 +178,7 @@ export default function ProjectQualityProfilesAppRenderer(
profilesByLanguage={profilesByLanguage}
onClose={props.onCloseModal}
onSubmit={props.onAddLanguage}
- unavailableLanguages={projectProfiles.map(p => p.profile.language)}
+ unavailableLanguages={projectProfiles.map((p) => p.profile.language)}
/>
)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesApp-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesApp-test.tsx
index 61780787bd0..480120dee44 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesApp-test.tsx
@@ -24,7 +24,7 @@ import {
dissociateProject,
getProfileProjects,
ProfileProject,
- searchQualityProfiles
+ searchQualityProfiles,
} from '../../../api/quality-profiles';
import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization';
import { mockComponent } from '../../../helpers/mocks/component';
@@ -48,8 +48,8 @@ jest.mock('../../../api/quality-profiles', () => {
mockQualityProfile({ key: 'js_default', language: 'js', isDefault: true }),
mockQualityProfile({ key: 'ts_default', language: 'ts', isDefault: true }),
mockQualityProfile({ key: 'html', language: 'html' }),
- mockQualityProfile({ key: 'html_default', language: 'html', isDefault: true })
- ]
+ mockQualityProfile({ key: 'html_default', language: 'html', isDefault: true }),
+ ],
}),
getProfileProjects: jest.fn(({ key }) => {
const results: ProfileProject[] = [];
@@ -57,22 +57,22 @@ jest.mock('../../../api/quality-profiles', () => {
results.push({
key: 'foo',
name: 'Foo',
- selected: true
+ selected: true,
});
} else if (key === 'html') {
results.push({
key: 'foobar',
name: 'FooBar',
- selected: true
+ selected: true,
});
}
return Promise.resolve({ results });
- })
+ }),
};
});
jest.mock('../../../helpers/globalMessages', () => ({
- addGlobalSuccessMessage: jest.fn()
+ addGlobalSuccessMessage: jest.fn(),
}));
jest.mock('../../../app/utils/handleRequiredAuthorization', () => jest.fn());
@@ -85,7 +85,7 @@ it('renders correctly', () => {
it('correctly checks permissions', () => {
const wrapper = shallowRender({
- component: mockComponent({ configuration: { showQualityProfiles: false } })
+ component: mockComponent({ configuration: { showQualityProfiles: false } }),
});
expect(wrapper.type()).toBeNull();
expect(handleRequiredAuthorization).toHaveBeenCalled();
@@ -101,20 +101,20 @@ it('correctly fetches and treats profile data', async () => {
expect(wrapper.state().projectProfiles).toEqual([
expect.objectContaining({
profile: expect.objectContaining({ key: 'css' }),
- selected: true
+ selected: true,
}),
expect.objectContaining({
profile: expect.objectContaining({ key: 'js' }),
- selected: true
+ selected: true,
}),
expect.objectContaining({
profile: expect.objectContaining({ key: 'html_default' }),
- selected: true
+ selected: true,
}),
expect.objectContaining({
profile: expect.objectContaining({ key: 'ts_default' }),
- selected: false
- })
+ selected: false,
+ }),
]);
});
@@ -135,8 +135,8 @@ it('correctly sets a profile', async () => {
{
profile: expect.objectContaining({ key: 'css_default' }),
// It's not explicitly selected, as we're inheriting the default.
- selected: false
- }
+ selected: false,
+ },
])
);
@@ -152,8 +152,8 @@ it('correctly sets a profile', async () => {
{
profile: expect.objectContaining({ key: 'css2' }),
// It's explicitly selected.
- selected: true
- }
+ selected: true,
+ },
])
);
@@ -175,8 +175,8 @@ it('correctly sets a profile', async () => {
{
profile: expect.objectContaining({ key: 'ts_default' }),
// It's explicitly selected, even though it is the default profile.
- selected: true
- }
+ selected: true,
+ },
])
);
});
@@ -198,8 +198,8 @@ it('correctly adds a new language', async () => {
profile: expect.objectContaining({ key: 'java' }),
// It must be explicitly selected. Adding an unanalyzed language can
// only happen by explicitly choosing a profile.
- selected: true
- }
+ selected: true,
+ },
])
);
});
@@ -226,8 +226,8 @@ function shallowRender(props: Partial<ProjectQualityProfilesApp['props']> = {})
{ key: 'css2', name: 'CSS 2', language: 'css' },
{ key: 'js', name: 'JS', language: 'js' },
{ key: 'ts_default', name: 'TS (default)', language: 'ts' },
- { key: 'html', name: 'HTML', language: 'html' }
- ]
+ { key: 'html', name: 'HTML', language: 'html' },
+ ],
})}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesAppRenderer-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesAppRenderer-test.tsx
index bccbc33855b..095decf9e27 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesAppRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/__tests__/ProjectQualityProfilesAppRenderer-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { mockComponent } from '../../../helpers/mocks/component';
import { mockQualityProfile } from '../../../helpers/testMocks';
import ProjectQualityProfilesAppRenderer, {
- ProjectQualityProfilesAppRendererProps
+ ProjectQualityProfilesAppRendererProps,
} from '../ProjectQualityProfilesAppRenderer';
it('should render correctly', () => {
@@ -32,8 +32,8 @@ it('should render correctly', () => {
shallowRender({
showProjectProfileInModal: {
profile: mockQualityProfile({ key: 'foo', language: 'js' }),
- selected: false
- }
+ selected: false,
+ },
})
).toMatchSnapshot('open profile');
expect(shallowRender({ showAddLanguageModal: true })).toMatchSnapshot('add language');
@@ -45,7 +45,7 @@ function shallowRender(props: Partial<ProjectQualityProfilesAppRendererProps> =
allProfiles={[
mockQualityProfile({ key: 'foo', language: 'js' }),
mockQualityProfile({ key: 'bar', language: 'css' }),
- mockQualityProfile({ key: 'baz', language: 'html' })
+ mockQualityProfile({ key: 'baz', language: 'html' }),
]}
component={mockComponent()}
loading={false}
@@ -61,9 +61,9 @@ function shallowRender(props: Partial<ProjectQualityProfilesAppRendererProps> =
name: 'Foo',
isDefault: true,
language: 'js',
- languageName: 'JS'
+ languageName: 'JS',
}),
- selected: false
+ selected: false,
},
{
profile: mockQualityProfile({
@@ -71,19 +71,19 @@ function shallowRender(props: Partial<ProjectQualityProfilesAppRendererProps> =
name: 'Bar',
isDefault: true,
language: 'css',
- languageName: 'CSS'
+ languageName: 'CSS',
}),
- selected: false
+ selected: false,
},
{
profile: mockQualityProfile({
key: 'baz',
name: 'Baz',
language: 'html',
- languageName: 'HTML'
+ languageName: 'HTML',
}),
- selected: true
- }
+ selected: true,
+ },
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/AddLanguageModal.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/AddLanguageModal.tsx
index dea0dea7923..6a54658d41a 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/AddLanguageModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/AddLanguageModal.tsx
@@ -42,7 +42,7 @@ export function AddLanguageModal(props: AddLanguageModalProps) {
const [{ language, key }, setSelected] = React.useState<{ language?: string; key?: string }>({
language: undefined,
- key: undefined
+ key: undefined,
});
const header = translate('project_quality_profile.add_language_modal.title');
@@ -50,15 +50,15 @@ export function AddLanguageModal(props: AddLanguageModalProps) {
const languageOptions: BasicSelectOption[] = difference(
Object.keys(profilesByLanguage),
unavailableLanguages
- ).map(l => ({ value: l, label: languages[l].name }));
+ ).map((l) => ({ value: l, label: languages[l].name }));
const profileOptions: ProfileOption[] =
language !== undefined
- ? profilesByLanguage[language].map(p => ({
+ ? profilesByLanguage[language].map((p) => ({
value: p.key,
label: p.name,
language,
- isDisabled: p.activeRuleCount === 0
+ isDisabled: p.activeRuleCount === 0,
}))
: [];
@@ -70,7 +70,8 @@ export function AddLanguageModal(props: AddLanguageModalProps) {
if (language && key) {
props.onSubmit(key);
}
- }}>
+ }}
+ >
{({ onCloseClick, onFormSubmit, submitting }) => (
<>
<div className="modal-head">
@@ -109,9 +110,9 @@ export function AddLanguageModal(props: AddLanguageModalProps) {
onChange={({ value }: ProfileOption) => setSelected({ language, key: value })}
options={profileOptions}
components={{
- Option: LanguageProfileSelectOption
+ Option: LanguageProfileSelectOption,
}}
- value={profileOptions.find(o => o.value === key) ?? null}
+ value={profileOptions.find((o) => o.value === key) ?? null}
/>
</div>
</div>
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/SetQualityProfileModal.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/SetQualityProfileModal.tsx
index fd3b857abcd..567c62fa926 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/SetQualityProfileModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/SetQualityProfileModal.tsx
@@ -45,7 +45,7 @@ export default function SetQualityProfileModal(props: SetQualityProfileModalProp
usesDefault ? USE_SYSTEM_DEFAULT : currentProfile.key
);
- const defaultProfile = availableProfiles.find(p => p.isDefault);
+ const defaultProfile = availableProfiles.find((p) => p.isDefault);
if (defaultProfile === undefined) {
// Cannot be undefined
@@ -56,15 +56,15 @@ export default function SetQualityProfileModal(props: SetQualityProfileModalProp
'project_quality_profile.change_lang_X_profile',
currentProfile.languageName
);
- const profileOptions: ProfileOption[] = availableProfiles.map(p => ({
+ const profileOptions: ProfileOption[] = availableProfiles.map((p) => ({
value: p.key,
label: p.name,
language: currentProfile.language,
- isDisabled: p.activeRuleCount === 0
+ isDisabled: p.activeRuleCount === 0,
}));
const hasSelectedSysDefault = selected === USE_SYSTEM_DEFAULT;
const hasChanged = usesDefault ? !hasSelectedSysDefault : selected !== currentProfile.key;
- const needsReanalysis = !component.qualityProfiles?.some(p =>
+ const needsReanalysis = !component.qualityProfiles?.some((p) =>
hasSelectedSysDefault ? p.key === defaultProfile.key : p.key === selected
);
@@ -74,7 +74,8 @@ export default function SetQualityProfileModal(props: SetQualityProfileModalProp
onClose={props.onClose}
onSubmit={() =>
props.onSubmit(hasSelectedSysDefault ? undefined : selected, currentProfile.key)
- }>
+ }
+ >
{({ onCloseClick, onFormSubmit, submitting }) => (
<>
<div className="modal-head">
@@ -89,7 +90,8 @@ export default function SetQualityProfileModal(props: SetQualityProfileModalProp
checked={hasSelectedSysDefault}
disabled={submitting}
onCheck={() => setSelected(USE_SYSTEM_DEFAULT)}
- value={USE_SYSTEM_DEFAULT}>
+ value={USE_SYSTEM_DEFAULT}
+ >
<div className="spacer-left">
<div className="little-spacer-bottom">
{translate('project_quality_profile.always_use_default')}
@@ -110,12 +112,13 @@ export default function SetQualityProfileModal(props: SetQualityProfileModalProp
className="display-flex-start"
checked={!hasSelectedSysDefault}
disabled={submitting}
- onCheck={value => {
+ onCheck={(value) => {
if (hasSelectedSysDefault) {
setSelected(value);
}
}}
- value={currentProfile.key}>
+ value={currentProfile.key}
+ >
<div className="spacer-left">
<div className="little-spacer-bottom">
{translate('project_quality_profile.always_use_specific')}
@@ -127,10 +130,10 @@ export default function SetQualityProfileModal(props: SetQualityProfileModalProp
onChange={({ value }: ProfileOption) => setSelected(value)}
options={profileOptions}
components={{
- Option: LanguageProfileSelectOption
+ Option: LanguageProfileSelectOption,
}}
value={profileOptions.find(
- option =>
+ (option) =>
option.value ===
(!hasSelectedSysDefault ? selected : currentProfile.key)
)}
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/AddLanguageModal-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/AddLanguageModal-test.tsx
index f22c24be7ee..caee581d4b9 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/AddLanguageModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/AddLanguageModal-test.tsx
@@ -66,29 +66,19 @@ it('should correctly handle changes', () => {
});
function diveIntoSimpleModal(wrapper: ShallowWrapper) {
- return wrapper
- .find(SimpleModal)
- .dive()
- .children();
+ return wrapper.find(SimpleModal).dive().children();
}
function getLanguageSelect(wrapper: ShallowWrapper) {
- return diveIntoSimpleModal(wrapper)
- .find(Select)
- .at(0);
+ return diveIntoSimpleModal(wrapper).find(Select).at(0);
}
function getProfileSelect(wrapper: ShallowWrapper) {
- return diveIntoSimpleModal(wrapper)
- .find(Select)
- .at(1);
+ return diveIntoSimpleModal(wrapper).find(Select).at(1);
}
function submitSimpleModal(wrapper: ShallowWrapper) {
- wrapper
- .find(SimpleModal)
- .props()
- .onSubmit();
+ wrapper.find(SimpleModal).props().onSubmit();
}
function shallowRender(props: Partial<AddLanguageModalProps> = {}) {
@@ -97,17 +87,17 @@ function shallowRender(props: Partial<AddLanguageModalProps> = {}) {
languages={{
css: { key: 'css', name: 'CSS' },
ts: { key: 'ts', name: 'TS' },
- js: { key: 'js', name: 'JS' }
+ js: { key: 'js', name: 'JS' },
}}
onClose={jest.fn()}
onSubmit={jest.fn()}
profilesByLanguage={{
css: [
mockQualityProfile({ key: 'css', name: 'CSS', activeRuleCount: 0 }),
- mockQualityProfile({ key: 'css2', name: 'CSS 2' })
+ mockQualityProfile({ key: 'css2', name: 'CSS 2' }),
],
ts: [mockQualityProfile({ key: 'ts', name: 'TS' })],
- js: [mockQualityProfile({ key: 'js', name: 'JS' })]
+ js: [mockQualityProfile({ key: 'js', name: 'JS' })],
}}
unavailableLanguages={['js']}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/LanguageProfileSelectOption-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/LanguageProfileSelectOption-test.tsx
index 06289c3613b..b3e8de07c57 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/LanguageProfileSelectOption-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/LanguageProfileSelectOption-test.tsx
@@ -23,7 +23,7 @@ import DisableableSelectOption from '../../../../components/common/DisableableSe
import { mockProfileOption } from '../../../../helpers/mocks/quality-profiles';
import LanguageProfileSelectOption, {
LanguageProfileSelectOptionProps,
- ProfileOption
+ ProfileOption,
} from '../LanguageProfileSelectOption';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/SetQualityProfileModal-test.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/SetQualityProfileModal-test.tsx
index c385172b720..18990729d0c 100644
--- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/SetQualityProfileModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/components/__tests__/SetQualityProfileModal-test.tsx
@@ -36,29 +36,16 @@ it('should correctly handle changes', () => {
const onSubmit = jest.fn();
const wrapper = shallowRender({ onSubmit }, false);
- diveIntoSimpleModal(wrapper)
- .find(Radio)
- .at(0)
- .props()
- .onCheck('');
+ diveIntoSimpleModal(wrapper).find(Radio).at(0).props().onCheck('');
submitSimpleModal(wrapper);
expect(onSubmit).toHaveBeenLastCalledWith(undefined, 'foo');
- diveIntoSimpleModal(wrapper)
- .find(Radio)
- .at(1)
- .props()
- .onCheck('');
- diveIntoSimpleModal(wrapper)
- .find(Select)
- .props()
- .onChange({ value: 'bar' });
+ diveIntoSimpleModal(wrapper).find(Radio).at(1).props().onCheck('');
+ diveIntoSimpleModal(wrapper).find(Select).props().onChange({ value: 'bar' });
submitSimpleModal(wrapper);
expect(onSubmit).toHaveBeenLastCalledWith('bar', 'foo');
- const change = diveIntoSimpleModal(wrapper)
- .find(Select)
- .props().onChange;
+ const change = diveIntoSimpleModal(wrapper).find(Select).props().onChange;
expect(change).toBeDefined();
@@ -68,17 +55,11 @@ it('should correctly handle changes', () => {
});
function diveIntoSimpleModal(wrapper: ShallowWrapper) {
- return wrapper
- .find(SimpleModal)
- .dive()
- .children();
+ return wrapper.find(SimpleModal).dive().children();
}
function submitSimpleModal(wrapper: ShallowWrapper) {
- wrapper
- .find(SimpleModal)
- .props()
- .onSubmit();
+ wrapper.find(SimpleModal).props().onSubmit();
}
function shallowRender(props: Partial<SetQualityProfileModalProps> = {}, dive = true) {
@@ -86,7 +67,7 @@ function shallowRender(props: Partial<SetQualityProfileModalProps> = {}, dive =
<SetQualityProfileModal
availableProfiles={[
mockQualityProfile({ key: 'foo', isDefault: true, language: 'js' }),
- mockQualityProfile({ key: 'bar', language: 'js', activeRuleCount: 0 })
+ mockQualityProfile({ key: 'bar', language: 'js', activeRuleCount: 0 }),
]}
component={mockComponent({ qualityProfiles: [{ key: 'foo', name: 'Foo', language: 'js' }] })}
currentProfile={mockQualityProfile({ key: 'foo', language: 'js' })}
diff --git a/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts
index 95d48eedcf6..87d4152c9ab 100644
--- a/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts
@@ -22,14 +22,16 @@ import { mockComponent } from '../../../helpers/mocks/component';
import * as utils from '../utils';
jest.mock('../../../api/components', () => ({
- searchProjects: jest.fn().mockResolvedValue({ components: [], facets: [], paging: { total: 10 } })
+ searchProjects: jest
+ .fn()
+ .mockResolvedValue({ components: [], facets: [], paging: { total: 10 } }),
}));
jest.mock('../../../api/measures', () => ({
getMeasuresForProjects: jest.fn().mockResolvedValue([
{ component: 'foo', metric: 'new_coverage', period: { index: 1, value: '10' } },
- { component: 'bar', metric: 'languages', value: '20' }
- ])
+ { component: 'bar', metric: 'languages', value: '20' },
+ ]),
}));
describe('localizeSorting', () => {
@@ -91,7 +93,7 @@ describe('fetchProjects', () => {
facets: utils.FACETS.join(),
filter: 'isFavorite',
p: undefined,
- ps: 50
+ ps: 50,
});
await utils.fetchProjects({ view: 'leak' }, false, 3);
@@ -99,7 +101,7 @@ describe('fetchProjects', () => {
f: 'analysisDate,leakPeriodDate',
facets: utils.LEAK_FACETS.join(),
p: 3,
- ps: 50
+ ps: 50,
});
});
@@ -113,17 +115,17 @@ describe('fetchProjects', () => {
property: 'languages',
values: [
{ val: 'css', count: 10 },
- { val: 'js', count: 2 }
- ]
- }
+ { val: 'js', count: 2 },
+ ],
+ },
],
- paging: { total: 2 }
+ paging: { total: 2 },
});
- await utils.fetchProjects({}, true).then(r => {
+ await utils.fetchProjects({}, true).then((r) => {
expect(r).toEqual({
facets: {
new_coverage: { NO_DATA: 0 },
- languages: { css: 10, js: 2 }
+ languages: { css: 10, js: 2 },
},
projects: components.map((component: any) => {
if (component.key === 'foo') {
@@ -133,7 +135,7 @@ describe('fetchProjects', () => {
}
return component;
}),
- total: 2
+ total: 2,
});
});
});
diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx
index b2a000ba1b2..a688235bbb6 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx
@@ -98,14 +98,14 @@ export class AllProjects extends React.PureComponent<Props, State> {
fetchProjects = (query: Query) => {
this.setState({ loading: true, query });
- fetchProjects(query, this.props.isFavorite).then(response => {
+ fetchProjects(query, this.props.isFavorite).then((response) => {
if (this.mounted) {
this.setState({
facets: response.facets,
loading: false,
pageIndex: 1,
projects: response.projects,
- total: response.total
+ total: response.total,
});
}
}, this.stopLoading);
@@ -115,12 +115,12 @@ export class AllProjects extends React.PureComponent<Props, State> {
const { pageIndex, projects, query } = this.state;
if (pageIndex && projects && query) {
this.setState({ loading: true });
- fetchProjects(query, this.props.isFavorite, pageIndex + 1).then(response => {
+ fetchProjects(query, this.props.isFavorite, pageIndex + 1).then((response) => {
if (this.mounted) {
this.setState({
loading: false,
pageIndex: pageIndex + 1,
- projects: [...projects, ...response.projects]
+ projects: [...projects, ...response.projects],
});
}
}, this.stopLoading);
@@ -142,7 +142,7 @@ export class AllProjects extends React.PureComponent<Props, State> {
}
return {
- projects: projects.map(p => (p.key === key ? { ...p, isFavorite } : p))
+ projects: projects.map((p) => (p.key === key ? { ...p, isFavorite } : p)),
};
});
};
@@ -152,7 +152,7 @@ export class AllProjects extends React.PureComponent<Props, State> {
view: string | undefined;
sort?: string | undefined;
} = {
- view: view === 'overall' ? undefined : view
+ view: view === 'overall' ? undefined : view,
};
if (this.state.query.view === 'leak' || view === 'leak') {
@@ -190,7 +190,7 @@ export class AllProjects extends React.PureComponent<Props, State> {
};
updateLocationQuery = (newQuery: RawQuery) => {
- const query = omitBy({ ...this.props.location.query, ...newQuery }, x => !x);
+ const query = omitBy({ ...this.props.location.query, ...newQuery }, (x) => !x);
this.props.router.push({ pathname: this.props.location.pathname, query });
};
@@ -200,7 +200,8 @@ export class AllProjects extends React.PureComponent<Props, State> {
<section
aria-label={translate('filters')}
className="layout-page-side projects-page-side"
- style={{ top }}>
+ style={{ top }}
+ >
<div className="layout-page-side-inner">
<div className="layout-page-filters">
<A11ySkipTarget
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ApplicationCreation.tsx b/server/sonar-web/src/main/js/apps/projects/components/ApplicationCreation.tsx
index 11bf1c33434..faf1a7a52c5 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ApplicationCreation.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ApplicationCreation.tsx
@@ -54,7 +54,7 @@ export function ApplicationCreation(props: ApplicationCreationProps) {
const handleComponentCreate = ({
key,
- qualifier
+ qualifier,
}: {
key: string;
qualifier: ComponentQualifier;
diff --git a/server/sonar-web/src/main/js/apps/projects/components/EmptyFavoriteSearch.tsx b/server/sonar-web/src/main/js/apps/projects/components/EmptyFavoriteSearch.tsx
index f6007a6681f..defc6df8f95 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/EmptyFavoriteSearch.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/EmptyFavoriteSearch.tsx
@@ -39,11 +39,12 @@ export default function EmptyFavoriteSearch({ query }: { query: Query }) {
<Link
to={{
pathname: '/projects',
- search: queryToSearch(query as Dict<string | undefined | number>)
- }}>
+ search: queryToSearch(query as Dict<string | undefined | number>),
+ }}
+ >
{translate('all')}
</Link>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.tsx b/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.tsx
index fe09b641a15..2903764cfb0 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/EmptyInstance.tsx
@@ -51,7 +51,8 @@ export function EmptyInstance(props: EmptyInstanceProps) {
<Button
onClick={() => {
router.push('/projects/create');
- }}>
+ }}
+ >
{translate('my_account.create_new.TRK')}
</Button>
</p>
diff --git a/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilter.tsx b/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilter.tsx
index 6657f1388eb..b980650315b 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilter.tsx
@@ -54,7 +54,7 @@ export class FavoriteFilter extends React.PureComponent<Props> {
render() {
const {
- location: { pathname }
+ location: { pathname },
} = this.props;
if (!isLoggedIn(this.props.currentUser)) {
@@ -66,7 +66,7 @@ export class FavoriteFilter extends React.PureComponent<Props> {
<ButtonToggle
options={[
{ value: true, label: translate('my_favorites') },
- { value: false, label: translate('all') }
+ { value: false, label: translate('all') },
]}
onCheck={this.onFavoriteChange}
value={pathname === FAVORITE_PATHNAME}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/PageHeader.tsx b/server/sonar-web/src/main/js/apps/projects/components/PageHeader.tsx
index 95ba5a19496..f386e18af16 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/PageHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/PageHeader.tsx
@@ -61,8 +61,9 @@ export default function PageHeader(props: Props) {
<div className="big-spacer-top display-flex-space-between">
<div
className={classNames('display-flex-center', {
- 'is-loading': loading
- })}>
+ 'is-loading': loading,
+ })}
+ >
{total != null && (
<span className="projects-total-label">
<strong id="projects-total">{total}</strong> {translate('projects_')}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.tsx b/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.tsx
index 1d95d1ad5c6..33251f16d8d 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/PageSidebar.tsx
@@ -186,5 +186,5 @@ function getFacet(facets: Facets | undefined, name: string) {
}
function getMaxFacetValue(facets?: Facets) {
- return facets && Math.max(...flatMap(Object.values(facets), facet => Object.values(facet)));
+ return facets && Math.max(...flatMap(Object.values(facets), (facet) => Object.values(facet)));
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx b/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx
index a9a39b06aa4..5c52cbb9b08 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx
@@ -46,7 +46,8 @@ export default class PerspectiveSelect extends React.PureComponent<Props> {
return (
<components.Option
{...omit(props, ['children', 'className'])}
- className={`it__projects-perspective-option-${data.value} ${className}`}>
+ className={`it__projects-perspective-option-${data.value} ${className}`}
+ >
<ListIcon className="little-spacer-right" />
{props.children}
</components.Option>
@@ -56,10 +57,10 @@ export default class PerspectiveSelect extends React.PureComponent<Props> {
render() {
const { view } = this.props;
const options: PerspectiveOption[] = [
- ...VIEWS.map(opt => ({
+ ...VIEWS.map((opt) => ({
value: opt.value,
- label: translate('projects.view', opt.label)
- }))
+ label: translate('projects.view', opt.label),
+ })),
];
return (
<div className={this.props.className}>
@@ -70,11 +71,11 @@ export default class PerspectiveSelect extends React.PureComponent<Props> {
isClearable={false}
onChange={this.handleChange}
components={{
- Option: this.perspectiveOptionRender
+ Option: this.perspectiveOptionRender,
}}
options={options}
isSearchable={false}
- value={options.find(option => option.value === view)}
+ value={options.find((option) => option.value === view)}
/>
</div>
);
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx
index 2b3db1c30bb..1204ca8ae50 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx
@@ -47,7 +47,7 @@ const almSettingsValidators = {
[AlmKeys.BitbucketServer]: (_: AlmSettingsInstance) => true,
[AlmKeys.BitbucketCloud]: (_: AlmSettingsInstance) => true,
[AlmKeys.GitHub]: (_: AlmSettingsInstance) => true,
- [AlmKeys.GitLab]: (settings: AlmSettingsInstance) => !!settings.url
+ [AlmKeys.GitLab]: (settings: AlmSettingsInstance) => !!settings.url,
};
export class ProjectCreationMenu extends React.PureComponent<Props, State> {
@@ -80,14 +80,14 @@ export class ProjectCreationMenu extends React.PureComponent<Props, State> {
const almSettings: AlmSettingsInstance[] = await getAlmSettings().catch(() => []);
// Import is only available if exactly one binding is configured
- const boundAlms = IMPORT_COMPATIBLE_ALMS.filter(key => {
+ const boundAlms = IMPORT_COMPATIBLE_ALMS.filter((key) => {
let currentAlmSettings: AlmSettingsInstance[];
if (key === AlmKeys.BitbucketServer || key === AlmKeys.BitbucketCloud) {
currentAlmSettings = almSettings.filter(
- s => s.alm === AlmKeys.BitbucketCloud || s.alm === AlmKeys.BitbucketServer
+ (s) => s.alm === AlmKeys.BitbucketCloud || s.alm === AlmKeys.BitbucketServer
);
} else {
- currentAlmSettings = almSettings.filter(s => s.alm === key);
+ currentAlmSettings = almSettings.filter((s) => s.alm === key);
}
return (
currentAlmSettings.length === 1 &&
@@ -98,7 +98,7 @@ export class ProjectCreationMenu extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
- boundAlms
+ boundAlms,
});
}
};
@@ -119,7 +119,7 @@ export class ProjectCreationMenu extends React.PureComponent<Props, State> {
onOpen={this.fetchAlmBindings}
overlay={
<ul className="menu">
- {[...boundAlms, 'manual'].map(alm => (
+ {[...boundAlms, 'manual'].map((alm) => (
<li className="little-spacer-bottom" key={alm}>
<ProjectCreationMenuItem alm={alm} />
</li>
@@ -133,7 +133,8 @@ export class ProjectCreationMenu extends React.PureComponent<Props, State> {
</li>
)}
</ul>
- }>
+ }
+ >
<Button className="button-primary">
{translate('projects.add')}
<DropdownIcon className="spacer-left " />
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenuItem.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenuItem.tsx
index f53122f6ab0..11c425127b4 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenuItem.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenuItem.tsx
@@ -38,7 +38,8 @@ export default function ProjectCreationMenuItem(props: ProjectCreationMenuItemPr
return (
<Link
className="display-flex-center"
- to={{ pathname: '/projects/create', search: queryToSearch({ mode: alm }) }}>
+ to={{ pathname: '/projects/create', search: queryToSearch({ mode: alm }) }}
+ >
{alm === 'manual' ? (
<ChevronsIcon className="spacer-right" />
) : (
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.tsx
index 3c2bfbeea08..6cd80a1512e 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectsSortingSelect.tsx
@@ -50,16 +50,16 @@ export default class ProjectsSortingSelect extends React.PureComponent<Props> {
getSorting = () => {
const options = this.getOptions();
const { sortDesc, sortValue } = parseSorting(this.props.selectedSort);
- return { sortDesc, value: options.find(o => o.value === sortValue) };
+ return { sortDesc, value: options.find((o) => o.value === sortValue) };
};
getOptions = () => {
const sortMetrics = this.props.view === 'leak' ? SORTING_LEAK_METRICS : SORTING_METRICS;
- return sortBy(sortMetrics, option => (option.value === this.props.defaultOption ? 0 : 1)).map(
- option => ({
+ return sortBy(sortMetrics, (option) => (option.value === this.props.defaultOption ? 0 : 1)).map(
+ (option) => ({
value: option.value,
label: translate('projects.sorting', option.value),
- className: option.class
+ className: option.class,
})
);
};
@@ -81,7 +81,8 @@ export default class ProjectsSortingSelect extends React.PureComponent<Props> {
return (
<components.Option
{...omit(props, ['children'])}
- className={`it__project-sort-option-${data.value} ${data.className}`}>
+ className={`it__project-sort-option-${data.value} ${data.className}`}
+ >
{data.short ? data.short : children}
</components.Option>
);
@@ -99,7 +100,7 @@ export default class ProjectsSortingSelect extends React.PureComponent<Props> {
isClearable={false}
onChange={this.handleSortChange}
components={{
- Option: this.projectsSortingSelectOption
+ Option: this.projectsSortingSelectOption,
}}
options={this.getOptions()}
isSearchable={false}
@@ -109,7 +110,8 @@ export default class ProjectsSortingSelect extends React.PureComponent<Props> {
mouseLeaveDelay={1}
overlay={
sortDesc ? translate('projects.sort_descending') : translate('projects.sort_ascending')
- }>
+ }
+ >
<ButtonIcon
aria-label={
sortDesc
@@ -119,9 +121,10 @@ export default class ProjectsSortingSelect extends React.PureComponent<Props> {
className="js-projects-sorting-invert spacer-left"
color={colors.gray52}
onClick={this.handleDescToggle}
- innerRef={sortButtonRef => {
+ innerRef={(sortButtonRef) => {
this.sortOrderButtonNode = sortButtonRef;
- }}>
+ }}
+ >
{sortDesc ? <SortDescIcon className="" /> : <SortAscIcon className="" />}
</ButtonIcon>
</Tooltip>
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx
index d421dcd7250..b6178008f8f 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx
@@ -53,12 +53,12 @@ jest.mock(
jest.mock('../../utils', () => ({
...jest.requireActual('../../utils'),
- fetchProjects: jest.fn(() => Promise.resolve({ projects: [] }))
+ fetchProjects: jest.fn(() => Promise.resolve({ projects: [] })),
}));
jest.mock('../../../../helpers/storage', () => ({
get: jest.fn(() => null),
- save: jest.fn()
+ save: jest.fn(),
}));
const fetchProjects = require('../../utils').fetchProjects as jest.Mock;
@@ -95,7 +95,7 @@ it('fetches projects', () => {
size: undefined,
sort: undefined,
tags: undefined,
- view: undefined
+ view: undefined,
},
false
);
@@ -115,7 +115,7 @@ it('changes perspective to leak', () => {
wrapper.find('PageHeader').prop<Function>('onPerspectiveChange')({ view: 'leak' });
expect(push).toHaveBeenLastCalledWith({
pathname: '/projects',
- query: { view: 'leak' }
+ query: { view: 'leak' },
});
expect(save).toHaveBeenCalledWith(LS_PROJECTS_SORT, undefined);
expect(save).toHaveBeenCalledWith(LS_PROJECTS_VIEW, 'leak');
@@ -126,11 +126,11 @@ it('updates sorting when changing perspective from leak', () => {
const wrapper = shallowRender({}, push);
wrapper.setState({ query: { sort: 'new_coverage', view: 'leak' } });
wrapper.find('PageHeader').prop<Function>('onPerspectiveChange')({
- view: undefined
+ view: undefined,
});
expect(push).toHaveBeenLastCalledWith({
pathname: '/projects',
- query: { sort: 'coverage', view: undefined }
+ query: { sort: 'coverage', view: undefined },
});
expect(save).toHaveBeenCalledWith(LS_PROJECTS_SORT, 'coverage');
expect(save).toHaveBeenCalledWith(LS_PROJECTS_VIEW, undefined);
@@ -155,7 +155,7 @@ function shallowRender(
isFavorite={false}
location={mockLocation({ pathname: '/projects', query: {} })}
appState={mockAppState({
- qualifiers: [ComponentQualifier.Project, ComponentQualifier.Application]
+ qualifiers: [ComponentQualifier.Project, ComponentQualifier.Application],
})}
router={{ push, replace }}
{...props}
@@ -170,10 +170,10 @@ function shallowRender(
name: 'Foo',
qualifier: ComponentQualifier.Project,
tags: [],
- visibility: 'public'
- }
+ visibility: 'public',
+ },
],
- total: 0
+ total: 0,
});
return wrapper;
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ApplicationCreation-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ApplicationCreation-test.tsx
index 5b18c72b5f1..cb1921184d9 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ApplicationCreation-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ApplicationCreation-test.tsx
@@ -28,7 +28,7 @@ import { ComponentQualifier } from '../../../../types/component';
import { ApplicationCreation, ApplicationCreationProps } from '../ApplicationCreation';
jest.mock('../../../../api/navigation', () => ({
- getComponentNavigation: jest.fn().mockResolvedValue({})
+ getComponentNavigation: jest.fn().mockResolvedValue({}),
}));
it('should render correctly', () => {
@@ -43,7 +43,7 @@ it('should render correctly', () => {
it('should show form and callback when submitted - admin', async () => {
(getComponentNavigation as jest.Mock).mockResolvedValueOnce({
- configuration: { showSettings: true }
+ configuration: { showSettings: true },
});
const routerPush = jest.fn();
const wrapper = shallowRender({ router: mockRouter({ push: routerPush }) });
@@ -53,14 +53,14 @@ it('should show form and callback when submitted - admin', async () => {
expect(routerPush).toHaveBeenCalledWith({
pathname: '/project/admin/extension/developer-server/application-console',
search: queryToSearch({
- id: 'new app'
- })
+ id: 'new app',
+ }),
});
});
it('should show form and callback when submitted - user', async () => {
(getComponentNavigation as jest.Mock).mockResolvedValueOnce({
- configuration: { showSettings: false }
+ configuration: { showSettings: false },
});
const routerPush = jest.fn();
const wrapper = shallowRender({ router: mockRouter({ push: routerPush }) });
@@ -70,8 +70,8 @@ it('should show form and callback when submitted - user', async () => {
expect(routerPush).toHaveBeenCalledWith({
pathname: '/dashboard',
search: queryToSearch({
- id: 'new app'
- })
+ id: 'new app',
+ }),
});
});
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx
index 8f1a8f5533d..99f59a2c6af 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/DefaultPageSelector-test.tsx
@@ -38,16 +38,16 @@ jest.mock(
);
jest.mock('../../../../helpers/storage', () => ({
- get: jest.fn().mockReturnValue(undefined)
+ get: jest.fn().mockReturnValue(undefined),
}));
jest.mock('../../../../helpers/users', () => ({
hasGlobalPermission: jest.fn().mockReturnValue(false),
- isLoggedIn: jest.fn((u: CurrentUser) => u.isLoggedIn)
+ isLoggedIn: jest.fn((u: CurrentUser) => u.isLoggedIn),
}));
jest.mock('../../../../api/components', () => ({
- searchProjects: jest.fn().mockResolvedValue({ paging: { total: 0 } })
+ searchProjects: jest.fn().mockResolvedValue({ paging: { total: 0 } }),
}));
beforeEach(jest.clearAllMocks);
@@ -115,7 +115,7 @@ function RouteDisplayer() {
function renderDefaultPageSelector({
path = '/projects',
- currentUser = mockLoggedInUser()
+ currentUser = mockLoggedInUser(),
}: {
path?: string;
currentUser?: CurrentUser;
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/EmptyInstance-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/EmptyInstance-test.tsx
index 5264e1c064e..4b9ad6702c6 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/EmptyInstance-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/EmptyInstance-test.tsx
@@ -37,7 +37,7 @@ it('renders correctly for SQ', () => {
currentUser={{
isLoggedIn: true,
permissions: { global: ['provisioning'] },
- dismissedNotices: {}
+ dismissedNotices: {},
}}
router={mockRouter()}
/>
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/FavoriteFilter-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/FavoriteFilter-test.tsx
index e73d336070b..d5e00cafbcf 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/FavoriteFilter-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/FavoriteFilter-test.tsx
@@ -25,13 +25,13 @@ import {
mockCurrentUser,
mockLocation,
mockLoggedInUser,
- mockRouter
+ mockRouter,
} from '../../../../helpers/testMocks';
import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import { ALL_PATHNAME, FavoriteFilter, FAVORITE_PATHNAME } from '../FavoriteFilter';
jest.mock('../../../../helpers/storage', () => ({
- save: jest.fn()
+ save: jest.fn(),
}));
beforeEach(() => {
@@ -46,7 +46,7 @@ it('renders for logged in user', () => {
it.each([
['my_favorites', 'favorite', ALL_PATHNAME],
- ['all', 'all', FAVORITE_PATHNAME]
+ ['all', 'all', FAVORITE_PATHNAME],
])(
'saves last selection',
async (optionTranslationId: string, localStorageValue: string, initialPathName: string) => {
@@ -66,7 +66,7 @@ it('does not render for anonymous', () => {
function renderFavoriteFilter({
currentUser = mockLoggedInUser(),
- location = mockLocation()
+ location = mockLocation(),
}: Partial<FavoriteFilter['props']> = {}) {
renderComponent(
<FavoriteFilter
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageHeader-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageHeader-test.tsx
index afff1343f10..dcb2fd59a7a 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageHeader-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageHeader-test.tsx
@@ -30,18 +30,14 @@ it('should render correctly while loading', () => {
});
it('should not render projects total', () => {
- expect(
- shallowRender({ total: undefined })
- .find('#projects-total')
- .exists()
- ).toBe(false);
+ expect(shallowRender({ total: undefined }).find('#projects-total').exists()).toBe(false);
});
it('should render switch the default sorting option for anonymous users', () => {
expect(
shallowRender({
currentUser: { isLoggedIn: true },
- open: true
+ open: true,
}).find('ProjectsSortingSelect')
).toMatchSnapshot();
@@ -49,7 +45,7 @@ it('should render switch the default sorting option for anonymous users', () =>
shallowRender({
currentUser: { isLoggedIn: false },
open: true,
- view: 'leak'
+ view: 'leak',
}).find('ProjectsSortingSelect')
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageSidebar-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageSidebar-test.tsx
index 99527aabf64..5ed7122c6e1 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageSidebar-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/PageSidebar-test.tsx
@@ -28,7 +28,7 @@ import PageSidebar, { PageSidebarProps } from '../PageSidebar';
it('should render the right facets for overview', () => {
renderPageSidebar({
- query: { size: '3' }
+ query: { size: '3' },
});
expect(screen.getByRole('heading', { level: 3, name: 'metric_domain.Size' })).toBeInTheDocument();
@@ -45,7 +45,7 @@ it('should render the right facets for overview', () => {
it('should not show the qualifier facet with no applications', () => {
renderPageSidebar({
applicationsEnabled: false,
- query: { size: '3' }
+ query: { size: '3' },
});
expect(
@@ -56,7 +56,7 @@ it('should not show the qualifier facet with no applications', () => {
it('should show "new lines" instead of "size" when in `leak` view', () => {
renderPageSidebar({
query: { view: 'leak' },
- view: 'leak'
+ view: 'leak',
});
expect(
@@ -74,7 +74,7 @@ it('should allow to clear all filters', async () => {
renderPageSidebar({
onClearAll,
applicationsEnabled: false,
- query: { size: '3', reliability: '2' }
+ query: { size: '3', reliability: '2' },
});
const clearAllButton = screen.getByRole('button', { name: 'clear_all_filters' });
@@ -93,8 +93,9 @@ function renderPageSidebar(overrides: Partial<PageSidebarProps> = {}, currentUse
value={{
currentUser: currentUser ?? mockCurrentUser(),
updateCurrentUserHomepage: jest.fn(),
- updateDismissedNotices: jest.fn()
- }}>
+ updateDismissedNotices: jest.fn(),
+ }}
+ >
<PageSidebar
applicationsEnabled={true}
onClearAll={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCreationMenu-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCreationMenu-test.tsx
index dcec3a7f924..e3f2908bf9b 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCreationMenu-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCreationMenu-test.tsx
@@ -26,7 +26,7 @@ import { AlmKeys } from '../../../../types/alm-settings';
import { ProjectCreationMenu } from '../ProjectCreationMenu';
jest.mock('../../../../api/alm-settings', () => ({
- getAlmSettings: jest.fn().mockResolvedValue([])
+ getAlmSettings: jest.fn().mockResolvedValue([]),
}));
beforeEach(() => {
@@ -57,21 +57,21 @@ it('should filter alm bindings appropriately', async () => {
.mockResolvedValueOnce([
// Only faulty configs.
{ alm: AlmKeys.Azure }, // Missing some configuration; will be ignored.
- { alm: AlmKeys.GitLab } // Missing some configuration; will be ignored.
+ { alm: AlmKeys.GitLab }, // Missing some configuration; will be ignored.
])
.mockResolvedValueOnce([
// All correct configs.
{ alm: AlmKeys.Azure, url: 'http://ado.example.com' },
{ alm: AlmKeys.BitbucketServer, url: 'b1' },
{ alm: AlmKeys.GitHub },
- { alm: AlmKeys.GitLab, url: 'gitlab.com' }
+ { alm: AlmKeys.GitLab, url: 'gitlab.com' },
])
.mockResolvedValueOnce([
// All correct configs.
{ alm: AlmKeys.Azure, url: 'http://ado.example.com' },
{ alm: AlmKeys.BitbucketCloud },
{ alm: AlmKeys.GitHub },
- { alm: AlmKeys.GitLab, url: 'gitlab.com' }
+ { alm: AlmKeys.GitLab, url: 'gitlab.com' },
])
.mockResolvedValueOnce([
// Special case for BBS with BBC
@@ -79,7 +79,7 @@ it('should filter alm bindings appropriately', async () => {
{ alm: AlmKeys.BitbucketServer, url: 'b1' },
{ alm: AlmKeys.BitbucketCloud },
{ alm: AlmKeys.GitHub },
- { alm: AlmKeys.GitLab, url: 'gitlab.com' }
+ { alm: AlmKeys.GitLab, url: 'gitlab.com' },
])
.mockResolvedValueOnce([
// Only duplicate ALMs; should all be ignored.
@@ -90,7 +90,7 @@ it('should filter alm bindings appropriately', async () => {
{ alm: AlmKeys.GitHub },
{ alm: AlmKeys.GitHub },
{ alm: AlmKeys.GitLab, url: 'gitlab.com' },
- { alm: AlmKeys.GitLab, url: 'gitlab.com' }
+ { alm: AlmKeys.GitLab, url: 'gitlab.com' },
]);
let wrapper = shallowRender();
@@ -103,7 +103,7 @@ it('should filter alm bindings appropriately', async () => {
AlmKeys.Azure,
AlmKeys.BitbucketServer,
AlmKeys.GitHub,
- AlmKeys.GitLab
+ AlmKeys.GitLab,
]);
wrapper = shallowRender();
@@ -112,7 +112,7 @@ it('should filter alm bindings appropriately', async () => {
AlmKeys.Azure,
AlmKeys.BitbucketCloud,
AlmKeys.GitHub,
- AlmKeys.GitLab
+ AlmKeys.GitLab,
]);
wrapper = shallowRender();
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectsList-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectsList-test.tsx
index 5e54bccd198..fa8ffff33e3 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectsList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectsList-test.tsx
@@ -29,13 +29,9 @@ jest.mock('react-virtualized/dist/commonjs/WindowScroller');
it('renders correctly', () => {
const wrapper = shallowRender();
- expect(
- wrapper
- .find(WindowScroller)
- .dive()
- .find(AutoSizer)
- .dive()
- ).toMatchSnapshot('list element');
+ expect(wrapper.find(WindowScroller).dive().find(AutoSizer).dive()).toMatchSnapshot(
+ 'list element'
+ );
expect(
wrapper.instance().renderRow({ index: 0, key: 'foo-key', style: {} } as ListRowProps)
@@ -57,7 +53,7 @@ function shallowRender(props?: any) {
isFiltered={false}
projects={[
{ key: 'foo', name: 'Foo' },
- { key: 'bar', name: 'Bar' }
+ { key: 'bar', name: 'Bar' },
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectsSortingSelect-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectsSortingSelect-test.tsx
index 59265f71882..c719e20f3a0 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectsSortingSelect-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectsSortingSelect-test.tsx
@@ -47,7 +47,7 @@ it('should render option correctly', () => {
{...mockReactSelectOptionProps<Option, false, GroupTypeBase<Option>>({
label: 'foo',
value: 'foo',
- short: 'fo'
+ short: 'fo',
})}
/>
)
@@ -57,7 +57,7 @@ it('should render option correctly', () => {
<SortOption
{...mockReactSelectOptionProps<Option, false, GroupTypeBase<Option>>({
label: 'foo',
- value: 'foo'
+ value: 'foo',
})}
/>
)
@@ -68,7 +68,7 @@ it('changes sorting', () => {
const onChange = jest.fn();
const instance = shallowRender({
selectedSort: '-vulnerability',
- onChange
+ onChange,
}).instance() as ProjectsSortingSelect;
instance.handleSortChange({ label: 'size', value: 'size' });
expect(onChange).toHaveBeenCalledWith('size', true);
diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx
index 6a1f90701d9..c2738602233 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx
@@ -60,7 +60,7 @@ function renderFirstLine(project: Props['project'], handleFavorite: Props['handl
name,
measures,
needIssueSync,
- visibility
+ visibility,
} = project;
return (
@@ -89,7 +89,8 @@ function renderFirstLine(project: Props['project'], handleFavorite: Props['handl
</span>
)}
</span>
- }>
+ }
+ >
<span className="spacer-right">
<QualifierIcon qualifier={qualifier} />
</span>
@@ -104,13 +105,13 @@ function renderFirstLine(project: Props['project'], handleFavorite: Props['handl
<ProjectCardQualityGate status={measures[MetricKey.alert_status]} />
<span className="flex-grow" />
<DateTimeFormatter date={analysisDate}>
- {formattedAnalysisDate => (
+ {(formattedAnalysisDate) => (
<span className="note big-spacer-left text-ellipsis" title={formattedAnalysisDate}>
<FormattedMessage
id="projects.last_analysis_on_x"
defaultMessage={translate('projects.last_analysis_on_x')}
values={{
- date: <DateFromNow date={analysisDate} />
+ date: <DateFromNow date={analysisDate} />,
}}
/>
</span>
@@ -143,8 +144,9 @@ function renderSecondLine(
return (
<div
className={classNames('display-flex-end flex-grow', {
- 'project-card-leak': isNewCode
- })}>
+ 'project-card-leak': isNewCode,
+ })}
+ >
<div className="project-card-main big-padded-left big-padded-right big-padded-bottom">
{renderMeasures(currentUser, project, isNewCode)}
</div>
@@ -153,7 +155,8 @@ function renderSecondLine(
? measures[MetricKey.new_lines] != null && (
<ProjectCardMeasure
metricKey={MetricKey.new_lines}
- label={translate('metric.lines.name')}>
+ label={translate('metric.lines.name')}
+ >
<Measure
className="big"
metricKey={MetricKey.new_lines}
@@ -165,7 +168,8 @@ function renderSecondLine(
: measures[MetricKey.ncloc] != null && (
<ProjectCardMeasure
metricKey={MetricKey.ncloc}
- label={translate('metric.lines.name')}>
+ label={translate('metric.lines.name')}
+ >
<div className="display-flex-center">
<Measure
className="big"
@@ -232,10 +236,11 @@ export default function ProjectCard(props: Props) {
return (
<div
className={classNames('display-flex-column boxed-group it_project_card', {
- 'project-card-disabled': project.needIssueSync
+ 'project-card-disabled': project.needIssueSync,
})}
data-key={project.key}
- style={{ height }}>
+ style={{ height }}
+ >
{renderFirstLine(project, props.handleFavorite)}
{renderSecondLine(currentUser, project, isNewCode)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardLanguages.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardLanguages.tsx
index 295aa1cbecc..30f65efb91e 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardLanguages.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardLanguages.tsx
@@ -34,8 +34,8 @@ export function ProjectCardLanguages({ className, distribution, languages }: Pro
return null;
}
- const parsedLanguages = distribution.split(';').map(item => item.split('='));
- const finalLanguages = sortBy(parsedLanguages, l => -1 * Number(l[1])).map(l =>
+ const parsedLanguages = distribution.split(';').map((item) => item.split('='));
+ const finalLanguages = sortBy(parsedLanguages, (l) => -1 * Number(l[1])).map((l) =>
getLanguageName(languages, l[0])
);
diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasure.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasure.tsx
index 2a033172dd0..3cb75e5e08c 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasure.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasure.tsx
@@ -41,7 +41,8 @@ export default function ProjectCardMeasure(
className={classNames(
'display-flex-column overflow-hidden it__project_card_measure',
className
- )}>
+ )}
+ >
<div className="spacer-bottom display-flex-center" title={label}>
{icon}
<span className="text-ellipsis">{label}</span>
diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx
index fb54325b30c..fa2cee13426 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx
@@ -73,7 +73,8 @@ function renderDuplication(props: ProjectCardMeasuresProps) {
return (
<ProjectCardMeasure
metricKey={duplicationMetric}
- label={translate('metric.duplicated_lines_density.short_name')}>
+ label={translate('metric.duplicated_lines_density.short_name')}
+ >
<div className="display-flex-center">
<Measure
className="big"
@@ -100,13 +101,13 @@ function renderRatings(props: ProjectCardMeasuresProps) {
noShrink: true,
metricKey: isNewCode ? MetricKey.new_bugs : MetricKey.bugs,
metricRatingKey: isNewCode ? MetricKey.new_reliability_rating : MetricKey.reliability_rating,
- metricType: 'SHORT_INT'
+ metricType: 'SHORT_INT',
},
{
iconLabel: translate('metric.vulnerabilities.name'),
metricKey: isNewCode ? MetricKey.new_vulnerabilities : MetricKey.vulnerabilities,
metricRatingKey: isNewCode ? MetricKey.new_security_rating : MetricKey.security_rating,
- metricType: 'SHORT_INT'
+ metricType: 'SHORT_INT',
},
{
iconKey: 'security_hotspots',
@@ -117,17 +118,17 @@ function renderRatings(props: ProjectCardMeasuresProps) {
metricRatingKey: isNewCode
? MetricKey.new_security_review_rating
: MetricKey.security_review_rating,
- metricType: 'PERCENT'
+ metricType: 'PERCENT',
},
{
iconLabel: translate('metric.code_smells.name'),
metricKey: isNewCode ? MetricKey.new_code_smells : MetricKey.code_smells,
metricRatingKey: isNewCode ? MetricKey.new_maintainability_rating : MetricKey.sqale_rating,
- metricType: 'SHORT_INT'
- }
+ metricType: 'SHORT_INT',
+ },
];
- return measureList.map(measure => {
+ return measureList.map((measure) => {
const { iconKey, iconLabel, metricKey, metricRatingKey, metricType, noShrink } = measure;
return (
@@ -136,7 +137,8 @@ function renderRatings(props: ProjectCardMeasuresProps) {
key={metricKey}
metricKey={metricKey}
iconKey={iconKey}
- label={iconLabel}>
+ label={iconLabel}
+ >
<Measure
className="spacer-right big project-card-measure-secondary-info"
metricKey={metricKey}
@@ -173,14 +175,14 @@ export default function ProjectCardMeasures(props: ProjectCardMeasuresProps) {
const measureList = [
...renderRatings(props),
renderCoverage(props),
- renderDuplication(props)
+ renderDuplication(props),
].filter(isDefined);
return (
<>
{isNewCode && newCodeTimespan !== undefined && newCodeStartingDate && (
<DateTimeFormatter date={newCodeStartingDate}>
- {formattedNewCodeStartingDate => (
+ {(formattedNewCodeStartingDate) => (
<p className="spacer-top spacer-bottom" title={formattedNewCodeStartingDate}>
{translateWithParameters(
'projects.new_code_period_x',
diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCard-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCard-test.tsx
index 11e5941ac64..0c197de82ab 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCard-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCard-test.tsx
@@ -32,7 +32,7 @@ const MEASURES = {
alert_status: 'OK',
reliability_rating: '1.0',
sqale_rating: '1.0',
- new_bugs: '12'
+ new_bugs: '12',
};
const PROJECT: Project = {
@@ -42,7 +42,7 @@ const PROJECT: Project = {
name: 'Foo',
qualifier: ComponentQualifier.Project,
tags: [],
- visibility: 'public'
+ visibility: 'public',
};
const USER_LOGGED_OUT = mockCurrentUser();
@@ -54,29 +54,17 @@ it('should display correclty when project need issue synch', () => {
it('should not display the quality gate', () => {
const project = { ...PROJECT, analysisDate: undefined };
- expect(
- shallowRender(project)
- .find(ProjectCardQualityGate)
- .exists()
- ).toBe(false);
+ expect(shallowRender(project).find(ProjectCardQualityGate).exists()).toBe(false);
});
it('should display tags', () => {
const project = { ...PROJECT, tags: ['foo', 'bar'] };
- expect(
- shallowRender(project)
- .find(TagsList)
- .exists()
- ).toBe(true);
+ expect(shallowRender(project).find(TagsList).exists()).toBe(true);
});
it('should display private badge', () => {
const project: Project = { ...PROJECT, visibility: 'private' };
- expect(
- shallowRender(project)
- .find(PrivacyBadgeContainer)
- .exists()
- ).toBe(true);
+ expect(shallowRender(project).find(PrivacyBadgeContainer).exists()).toBe(true);
});
it('should display the overall measures and quality gate', () => {
@@ -104,7 +92,7 @@ it('should display applications', () => {
shallowRender({
...PROJECT,
qualifier: ComponentQualifier.Application,
- measures: { ...MEASURES, projects: '3' }
+ measures: { ...MEASURES, projects: '3' },
})
).toMatchSnapshot('with project count');
});
diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCardLanguages-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCardLanguages-test.tsx
index 4e0e927f18b..c78e8340e62 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCardLanguages-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCardLanguages-test.tsx
@@ -23,7 +23,7 @@ import { ProjectCardLanguages } from '../ProjectCardLanguages';
const languages = {
java: { key: 'java', name: 'Java' },
- js: { key: 'js', name: 'JavaScript' }
+ js: { key: 'js', name: 'JavaScript' },
};
it('renders', () => {
diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCardMeasures-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCardMeasures-test.tsx
index e9d8e6f35c8..035b02a9279 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCardMeasures-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCardMeasures-test.tsx
@@ -26,7 +26,7 @@ import { Dict } from '../../../../../types/types';
import ProjectCardMeasures, { ProjectCardMeasuresProps } from '../ProjectCardMeasures';
jest.mock('date-fns', () => ({
- differenceInMilliseconds: () => 1000 * 60 * 60 * 24 * 30 * 8 // ~ 8 months
+ differenceInMilliseconds: () => 1000 * 60 * 60 * 24 * 30 * 8, // ~ 8 months
}));
describe('Overall measures', () => {
@@ -83,7 +83,7 @@ function shallowRender(
[MetricKey.new_coverage]: '26.55',
[MetricKey.new_duplicated_lines_density]: '0.55',
[MetricKey.new_lines]: '87',
- ...measuresOverride
+ ...measuresOverride,
};
return shallow<ProjectCardMeasuresProps>(
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.tsx
index 0520515fa44..c26c5e08545 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.tsx
@@ -22,7 +22,7 @@ import DuplicationsRating from '../../../components/ui/DuplicationsRating';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import {
getDuplicationsRatingAverageValue,
- getDuplicationsRatingLabel
+ getDuplicationsRatingLabel,
} from '../../../helpers/ratings';
import { RawQuery } from '../../../types/types';
import { Facet } from '../types';
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx
index 7db00ac9c10..57d8f6ad5ce 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx
@@ -77,7 +77,7 @@ export default class Filter extends React.PureComponent<Props> {
) => {
if (event.ctrlKey || event.metaKey) {
if (this.isSelected(option)) {
- return value.length > 1 ? value.filter(val => val !== option).join(',') : null;
+ return value.length > 1 ? value.filter((val) => val !== option).join(',') : null;
}
return value.concat(option).join(',');
@@ -125,7 +125,7 @@ export default class Filter extends React.PureComponent<Props> {
'button-link',
{
active,
- 'search-navigator-facet-half': this.props.halfWidth
+ 'search-navigator-facet-half': this.props.halfWidth,
},
this.props.optionClassName
);
@@ -145,8 +145,9 @@ export default class Filter extends React.PureComponent<Props> {
className={classNames({
'search-navigator-facet-worse-than-highlight': highlightable,
last: lastHighlightable,
- active
- })}>
+ active,
+ })}
+ >
<button
aria-label={this.props.renderAccessibleLabel(option)}
className={className}
@@ -155,7 +156,8 @@ export default class Filter extends React.PureComponent<Props> {
tabIndex={0}
onClick={this.handleClick}
role="checkbox"
- aria-checked={this.isSelected(option) || isUnderSelectedOption}>
+ aria-checked={this.isSelected(option) || isUnderSelectedOption}
+ >
<span className="facet-name">
{this.props.renderOption(option, this.isSelected(option) || isUnderSelectedOption)}
</span>
@@ -180,17 +182,17 @@ export default class Filter extends React.PureComponent<Props> {
const afterHighlight = options.slice(max);
return (
<ul className="search-navigator-facet-list projects-facet-list">
- {beforeHighlight.map(option => this.renderOption(option))}
+ {beforeHighlight.map((option) => this.renderOption(option))}
{insideHighlight.map((option, i) =>
this.renderOption(option, true, i === insideHighlight.length - 1)
)}
- {afterHighlight.map(option => this.renderOption(option))}
+ {afterHighlight.map((option) => this.renderOption(option))}
</ul>
);
}
return (
<ul className="search-navigator-facet-list projects-facet-list">
- {options.map(option => this.renderOption(option))}
+ {options.map((option) => this.renderOption(option))}
</ul>
);
}
@@ -205,7 +207,8 @@ export default class Filter extends React.PureComponent<Props> {
return (
<div
className={classNames('search-navigator-facet-box', this.props.className)}
- data-key={this.props.property}>
+ data-key={this.props.property}
+ >
{this.props.header}
{this.renderOptions()}
{this.props.footer}
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx
index 4967425be1b..2f0d8735fcd 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx
@@ -46,7 +46,7 @@ export class LanguagesFilter extends React.Component<Props> {
if (facet) {
languageKeys = difference(languageKeys, Object.keys(facet));
}
- return languageKeys.map(key => ({ label: languages[key].name, value: key }));
+ return languageKeys.map((key) => ({ label: languages[key].name, value: key }));
};
getSortedOptions = (facet: Facet = {}) =>
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/SecurityReviewFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/SecurityReviewFilter.tsx
index dfe0491984c..d67bd63b0ea 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/SecurityReviewFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/SecurityReviewFilter.tsx
@@ -41,7 +41,7 @@ const labels: Dict<string> = {
2: '70% - 80%',
3: '50% - 70%',
4: '30% - 50%',
- 5: '< 30%'
+ 5: '< 30%',
};
export default function SecurityReviewFilter(props: Props) {
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.tsx
index ea0e9da5dc0..766235e9ce1 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.tsx
@@ -61,7 +61,7 @@ export default class TagsFilter extends React.PureComponent<Props, State> {
this.state = {
isLoading: false,
search: '',
- tags: []
+ tags: [],
};
this.handleSearch = debounce(this.handleSearch, 250);
}
@@ -79,7 +79,7 @@ export default class TagsFilter extends React.PureComponent<Props, State> {
if (this.props.facet) {
tagsCopy = difference(tagsCopy, Object.keys(this.props.facet));
}
- return tagsCopy.slice(0, LIST_SIZE).map(tag => ({ label: tag, value: tag }));
+ return tagsCopy.slice(0, LIST_SIZE).map((tag) => ({ label: tag, value: tag }));
};
handleSearch = (search?: string) => {
@@ -88,9 +88,9 @@ export default class TagsFilter extends React.PureComponent<Props, State> {
this.setState({ search, isLoading: true });
searchProjectTags({
q: search,
- ps: size(this.props.facet || {}) + LIST_SIZE
+ ps: size(this.props.facet || {}) + LIST_SIZE,
}).then(
- result => {
+ (result) => {
if (this.mounted) {
this.setState({ isLoading: false, tags: result.tags });
}
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/Filter-test.tsx b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/Filter-test.tsx
index 55e27e8b196..443f0fc6452 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/Filter-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/Filter-test.tsx
@@ -56,7 +56,7 @@ it('renders facet bar chart', () => {
getFacetValueForOption: (facet: any, option: any) => facet[option],
facet: { a: 17, b: 15, c: 24 },
maxFacetValue: 24,
- options: ['a', 'b', 'c']
+ options: ['a', 'b', 'c'],
})
).toMatchSnapshot();
});
@@ -130,8 +130,8 @@ function shallowRender(overrides: Partial<Filter['props']> = {}) {
onQueryChange={jest.fn()}
options={[1, 2, 3]}
property="foo"
- renderOption={option => option}
- renderAccessibleLabel={option => option.toString()}
+ renderOption={(option) => option}
+ renderAccessibleLabel={(option) => option.toString()}
{...overrides}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/LanguagesFilter-test.tsx b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/LanguagesFilter-test.tsx
index 04cfb1e88db..dc6ceecd877 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/LanguagesFilter-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/LanguagesFilter-test.tsx
@@ -27,7 +27,7 @@ const languages = {
js: { key: 'js', name: 'JavaScript' },
flex: { key: 'flex', name: 'Flex' },
php: { key: 'php', name: 'PHP' },
- py: { key: 'py', name: 'Python' }
+ py: { key: 'py', name: 'Python' },
};
const languagesFacet = { java: 39, cs: 4, js: 1 };
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/NewLinesFilter-test.tsx b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/NewLinesFilter-test.tsx
index edafb539fc2..fe0e7e28093 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/NewLinesFilter-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/NewLinesFilter-test.tsx
@@ -36,7 +36,7 @@ it('renders', () => {
'1000.0-10000.0': 2,
'10000.0-100000.0': 3,
'100000.0-500000.0': 4,
- '500000.0-*': 5
+ '500000.0-*': 5,
},
2
)
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SearchableFilterFooter-test.tsx b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SearchableFilterFooter-test.tsx
index 5f72037d3a5..074b5d9213d 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SearchableFilterFooter-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SearchableFilterFooter-test.tsx
@@ -26,7 +26,7 @@ import SearchableFilterFooter from '../SearchableFilterFooter';
const options = [
{ label: 'java', value: 'java' },
{ label: 'js', value: 'js' },
- { label: 'csharp', value: 'csharp' }
+ { label: 'csharp', value: 'csharp' },
];
it('should render items without the ones in the facet', () => {
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SizeFilter-test.tsx b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SizeFilter-test.tsx
index 01748e405c7..fa64c843027 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SizeFilter-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SizeFilter-test.tsx
@@ -36,7 +36,7 @@ it('renders', () => {
'1000.0-10000.0': 42,
'10000.0-100000.0': 14,
'100000.0-500000.0': 13,
- '500000.0-*': 8
+ '500000.0-*': 8,
},
2
)
diff --git a/server/sonar-web/src/main/js/apps/projects/query.ts b/server/sonar-web/src/main/js/apps/projects/query.ts
index 888c45841fb..1a9245cebbd 100644
--- a/server/sonar-web/src/main/js/apps/projects/query.ts
+++ b/server/sonar-web/src/main/js/apps/projects/query.ts
@@ -69,7 +69,7 @@ export function parseUrlQuery(urlQuery: RawQuery): Query {
qualifier: getAsQualifier(urlQuery['qualifier']),
search: getAsString(urlQuery['search']),
sort: getAsString(urlQuery['sort']),
- view: getView(urlQuery['view'])
+ view: getView(urlQuery['view']),
};
}
@@ -84,15 +84,15 @@ export function convertToFilter(query: Query, isFavorite: boolean): string {
conditions.push(mapPropertyToMetric('gate') + ' = ' + query['gate']);
}
- ['coverage', 'new_coverage'].forEach(property =>
+ ['coverage', 'new_coverage'].forEach((property) =>
pushMetricToArray(query, property, conditions, convertCoverage)
);
- ['duplications', 'new_duplications'].forEach(property =>
+ ['duplications', 'new_duplications'].forEach((property) =>
pushMetricToArray(query, property, conditions, convertDuplications)
);
- ['size', 'new_lines'].forEach(property =>
+ ['size', 'new_lines'].forEach((property) =>
pushMetricToArray(query, property, conditions, convertSize)
);
@@ -104,10 +104,10 @@ export function convertToFilter(query: Query, isFavorite: boolean): string {
'new_reliability',
'new_security',
'new_security_review_rating',
- 'new_maintainability'
- ].forEach(property => pushMetricToArray(query, property, conditions, convertIssuesRating));
+ 'new_maintainability',
+ ].forEach((property) => pushMetricToArray(query, property, conditions, convertIssuesRating));
- ['languages', 'tags', 'qualifier'].forEach(property =>
+ ['languages', 'tags', 'qualifier'].forEach((property) =>
pushMetricToArray(query, property, conditions, convertArrayMetric)
);
@@ -122,14 +122,14 @@ const viewParems = ['sort', 'view'];
export function hasFilterParams(query: Query) {
return Object.keys(query)
- .filter(key => !viewParems.includes(key))
- .some(key => query[key] !== undefined);
+ .filter((key) => !viewParems.includes(key))
+ .some((key) => query[key] !== undefined);
}
export function hasViewParams(query: Query) {
return Object.keys(query)
- .filter(key => viewParems.includes(key))
- .some(key => query[key] !== undefined);
+ .filter((key) => viewParems.includes(key))
+ .some((key) => query[key] !== undefined);
}
function getAsNumericRating(value: any): number | undefined {
@@ -253,7 +253,7 @@ function mapPropertyToMetric(property?: string): string | undefined {
languages: 'languages',
tags: 'tags',
search: 'query',
- qualifier: 'qualifier'
+ qualifier: 'qualifier',
};
return property && map[property];
}
diff --git a/server/sonar-web/src/main/js/apps/projects/utils.ts b/server/sonar-web/src/main/js/apps/projects/utils.ts
index b0142611e10..8d70706688a 100644
--- a/server/sonar-web/src/main/js/apps/projects/utils.ts
+++ b/server/sonar-web/src/main/js/apps/projects/utils.ts
@@ -45,7 +45,7 @@ export const SORTING_METRICS: SortingOption[] = [
{ value: 'maintainability' },
{ value: 'coverage' },
{ value: 'duplications' },
- { value: 'size' }
+ { value: 'size' },
];
export const SORTING_LEAK_METRICS: SortingOption[] = [
@@ -57,7 +57,7 @@ export const SORTING_LEAK_METRICS: SortingOption[] = [
{ value: 'new_maintainability', class: 'projects-leak-sorting-option' },
{ value: 'new_coverage', class: 'projects-leak-sorting-option' },
{ value: 'new_duplications', class: 'projects-leak-sorting-option' },
- { value: 'new_lines', class: 'projects-leak-sorting-option' }
+ { value: 'new_lines', class: 'projects-leak-sorting-option' },
];
export const SORTING_SWITCH: Dict<string> = {
@@ -76,12 +76,12 @@ export const SORTING_SWITCH: Dict<string> = {
new_maintainability: 'maintainability',
new_coverage: 'coverage',
new_duplications: 'duplications',
- new_lines: 'size'
+ new_lines: 'size',
};
export const VIEWS = [
{ value: 'overall', label: 'overall' },
- { value: 'leak', label: 'new_code' }
+ { value: 'leak', label: 'new_code' },
];
const PAGE_SIZE = 50;
@@ -100,7 +100,7 @@ export const METRICS = [
MetricKey.coverage,
MetricKey.ncloc,
MetricKey.ncloc_language_distribution,
- MetricKey.projects
+ MetricKey.projects,
];
export const LEAK_METRICS = [
@@ -116,7 +116,7 @@ export const LEAK_METRICS = [
MetricKey.new_coverage,
MetricKey.new_duplicated_lines_density,
MetricKey.new_lines,
- MetricKey.projects
+ MetricKey.projects,
];
export const FACETS = [
@@ -130,7 +130,7 @@ export const FACETS = [
'alert_status',
'languages',
'tags',
- 'qualifier'
+ 'qualifier',
];
export const LEAK_FACETS = [
@@ -144,7 +144,7 @@ export const LEAK_FACETS = [
'alert_status',
'languages',
'tags',
- 'qualifier'
+ 'qualifier',
];
const REVERSED_FACETS = ['coverage', 'new_coverage'];
@@ -164,20 +164,20 @@ export function fetchProjects(query: Query, isFavorite: boolean, pageIndex = 1)
p: pageIndex > 1 ? pageIndex : undefined,
ps,
facets: defineFacets(query).join(),
- f: 'analysisDate,leakPeriodDate'
+ f: 'analysisDate,leakPeriodDate',
});
return searchProjects(data)
- .then(response =>
+ .then((response) =>
Promise.all([fetchProjectMeasures(response.components, query), Promise.resolve(response)])
)
.then(([measures, { components, facets, paging }]) => {
return {
facets: getFacetsMap(facets),
- projects: components.map(component => {
+ projects: components.map((component) => {
const componentMeasures: Dict<string> = {};
measures
- .filter(measure => measure.component === component.key)
- .forEach(measure => {
+ .filter((measure) => measure.component === component.key)
+ .forEach((measure) => {
const value = isDiffMetric(measure.metric) ? measure.period?.value : measure.value;
if (value !== undefined) {
componentMeasures[measure.metric] = value;
@@ -185,7 +185,7 @@ export function fetchProjects(query: Query, isFavorite: boolean, pageIndex = 1)
});
return { ...component, measures: componentMeasures };
}),
- total: paging.total
+ total: paging.total,
};
});
}
@@ -226,14 +226,14 @@ export function fetchProjectMeasures(projects: Array<{ key: string }>, query: Qu
return Promise.resolve([]);
}
- const projectKeys = projects.map(project => project.key);
+ const projectKeys = projects.map((project) => project.key);
const metrics = defineMetrics(query);
return getMeasuresForProjects(projectKeys, metrics);
}
function mapFacetValues(values: Array<{ val: string; count: number }>) {
const map: Dict<number> = {};
- values.forEach(value => {
+ values.forEach((value) => {
map[value.val] = value.count;
});
return map;
@@ -259,14 +259,14 @@ const propertyToMetricMap: Dict<string | undefined> = {
languages: 'languages',
tags: 'tags',
search: 'query',
- qualifier: 'qualifier'
+ qualifier: 'qualifier',
};
const metricToPropertyMap = invert(propertyToMetricMap);
function getFacetsMap(facets: Facet[]) {
const map: Dict<Dict<number>> = {};
- facets.forEach(facet => {
+ facets.forEach((facet) => {
const property = metricToPropertyMap[facet.property];
const { values } = facet;
if (REVERSED_FACETS.includes(property)) {
@@ -324,6 +324,6 @@ export function formatDuration(ms: number) {
{ value: months, label: 'duration.months' },
{ value: days, label: 'duration.days' },
{ value: hours, label: 'duration.hours' },
- { value: minutes, label: 'duration.minutes' }
+ { value: minutes, label: 'duration.minutes' },
]);
}
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx
index 00a6e848cd7..f57f74aaee8 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx
@@ -70,7 +70,7 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S
loading: false,
permissionTemplate:
permissionTemplates.length > 0 ? permissionTemplates[0].id : undefined,
- permissionTemplates
+ permissionTemplates,
});
}
},
@@ -91,14 +91,14 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S
? {
projects: this.props.selection.join(),
qualifiers: this.props.qualifier,
- templateId: permissionTemplate
+ templateId: permissionTemplate,
}
: {
analyzedBefore: analyzedBefore && toNotSoISOString(analyzedBefore),
onProvisionedOnly: this.props.provisioned || undefined,
qualifiers: this.props.qualifier,
q: this.props.query || undefined,
- templateId: permissionTemplate
+ templateId: permissionTemplate,
};
bulkApplyTemplate(parameters).then(
() => {
@@ -106,7 +106,7 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S
this.setState({ done: true, submitting: false });
}
},
- error => {
+ (error) => {
addGlobalErrorMessageFromAPI(error);
if (this.mounted) {
this.setState({ submitting: false });
@@ -137,7 +137,7 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S
renderSelect = () => {
const options =
this.state.permissionTemplates !== undefined
- ? this.state.permissionTemplates.map(t => ({ label: t.name, value: t.id }))
+ ? this.state.permissionTemplates.map((t) => ({ label: t.name, value: t.id }))
: [];
return (
<div className="modal-field">
@@ -151,7 +151,7 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S
isDisabled={this.state.submitting}
onChange={this.handlePermissionTemplateChange}
options={options}
- value={options.find(option => option.value === this.state.permissionTemplate)}
+ value={options.find((option) => option.value === this.state.permissionTemplate)}
/>
</div>
);
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ChangeDefaultVisibilityForm.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ChangeDefaultVisibilityForm.tsx
index 0f4589693ed..925ea9e1965 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/ChangeDefaultVisibilityForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/ChangeDefaultVisibilityForm.tsx
@@ -58,12 +58,13 @@ export default class ChangeDefaultVisibilityForm extends React.PureComponent<Pro
</header>
<div className="modal-body">
- {['public', 'private'].map(visibility => (
+ {['public', 'private'].map((visibility) => (
<div className="big-spacer-bottom" key={visibility}>
<Radio
value={visibility}
checked={this.state.visibility === visibility}
- onCheck={this.handleVisibilityChange}>
+ onCheck={this.handleVisibilityChange}
+ >
<div>
{translate('visibility', visibility)}
<p className="text-muted spacer-top">
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx
index 2471f9e93ea..95c38676a4e 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/CreateProjectForm.tsx
@@ -61,7 +61,7 @@ export default class CreateProjectForm extends React.PureComponent<Props, State>
loading: false,
name: '',
visibility: props.defaultProjectVisibility,
- mainBranchName: 'main'
+ mainBranchName: 'main',
};
}
@@ -108,12 +108,12 @@ export default class CreateProjectForm extends React.PureComponent<Props, State>
name,
project: key,
mainBranch: mainBranchName,
- visibility
+ visibility,
};
this.setState({ loading: true });
createProject(data).then(
- response => {
+ (response) => {
if (this.mounted) {
this.setState({ createdProject: response.project, loading: false });
this.props.onProjectCreated();
@@ -149,7 +149,7 @@ export default class CreateProjectForm extends React.PureComponent<Props, State>
values={{
project: (
<Link to={getProjectUrl(createdProject.key)}>{createdProject.name}</Link>
- )
+ ),
}}
/>
</Alert>
@@ -158,8 +158,9 @@ export default class CreateProjectForm extends React.PureComponent<Props, State>
<footer className="modal-foot">
<ResetButtonLink
id="create-project-close"
- innerRef={node => (this.closeButton = node)}
- onClick={this.props.onClose}>
+ innerRef={(node) => (this.closeButton = node)}
+ onClick={this.props.onClose}
+ >
{translate('close')}
</ResetButtonLink>
</footer>
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/DeleteModal.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/DeleteModal.tsx
index 8185cd97f88..19d55b55600 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/DeleteModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/DeleteModal.tsx
@@ -57,13 +57,13 @@ export default class DeleteModal extends React.PureComponent<Props, State> {
const { analyzedBefore } = this.props;
const parameters = this.props.selection.length
? {
- projects: this.props.selection.join()
+ projects: this.props.selection.join(),
}
: {
analyzedBefore: analyzedBefore && toNotSoISOString(analyzedBefore),
onProvisionedOnly: this.props.provisioned || undefined,
qualifiers: this.props.qualifier,
- q: this.props.query || undefined
+ q: this.props.query || undefined,
};
bulkDeleteProjects(parameters).then(
() => {
@@ -109,7 +109,8 @@ export default class DeleteModal extends React.PureComponent<Props, State> {
<SubmitButton
className="button-red"
disabled={this.state.loading}
- onClick={this.handleConfirmClick}>
+ onClick={this.handleConfirmClick}
+ >
{translate('delete')}
</SubmitButton>
<ResetButtonLink onClick={this.props.onClose}>{translate('cancel')}</ResetButtonLink>
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx
index c333b036058..ec74d1ed84a 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx
@@ -74,7 +74,7 @@ export class ProjectManagementApp extends React.PureComponent<Props, State> {
page: 1,
query: '',
qualifiers: 'TRK',
- selection: []
+ selection: [],
};
this.requestProjects = debounce(this.requestProjects, DEBOUNCE_DELAY);
}
@@ -114,9 +114,9 @@ export class ProjectManagementApp extends React.PureComponent<Props, State> {
ps: PAGE_SIZE,
q: this.state.query || undefined,
qualifiers: this.state.qualifiers,
- visibility: this.state.visibility
+ visibility: this.state.visibility,
};
- return getComponents(parameters).then(r => {
+ return getComponents(parameters).then((r) => {
if (this.mounted) {
let projects: Project[] = r.components;
if (this.state.page > 1) {
@@ -150,7 +150,7 @@ export class ProjectManagementApp extends React.PureComponent<Props, State> {
provisioned: false,
query: '',
qualifiers: newQualifier,
- selection: []
+ selection: [],
},
this.requestProjects
);
@@ -164,7 +164,7 @@ export class ProjectManagementApp extends React.PureComponent<Props, State> {
provisioned: false,
query: '',
visibility: newVisibility === 'all' ? undefined : newVisibility,
- selection: []
+ selection: [],
},
this.requestProjects
);
@@ -182,7 +182,7 @@ export class ProjectManagementApp extends React.PureComponent<Props, State> {
};
onAllSelected = () => {
- this.setState(({ projects }) => ({ selection: projects.map(project => project.key) }));
+ this.setState(({ projects }) => ({ selection: projects.map((project) => project.key) }));
};
onAllDeselected = () => {
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx
index 0c0752f811d..1b447ff3944 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx
@@ -54,7 +54,8 @@ export default class ProjectRow extends React.PureComponent<Props> {
<td className="nowrap hide-overflow project-row-text-cell">
<Link
className="link-no-underline"
- to={getComponentOverviewUrl(project.key, project.qualifier)}>
+ to={getComponentOverviewUrl(project.key, project.qualifier)}
+ >
<QualifierIcon className="little-spacer-right" qualifier={project.qualifier} />
<Tooltip overlay={project.name} placement="left">
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRowActions.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRowActions.tsx
index 64f0274f234..bf3d72a52a5 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRowActions.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRowActions.tsx
@@ -112,7 +112,8 @@ export default class ProjectRowActions extends React.PureComponent<Props, State>
{hasAccess === true && (
<ActionsDropdownItem
className="js-edit-permissions"
- to={getComponentPermissionsUrl(this.props.project.key)}>
+ to={getComponentPermissionsUrl(this.props.project.key)}
+ >
{translate('edit_permissions')}
</ActionsDropdownItem>
)}
@@ -120,7 +121,8 @@ export default class ProjectRowActions extends React.PureComponent<Props, State>
{hasAccess === false && (
<ActionsDropdownItem
className="js-restore-access"
- onClick={this.handleRestoreAccessClick}>
+ onClick={this.handleRestoreAccessClick}
+ >
{translate('global_permissions.restore_access')}
</ActionsDropdownItem>
)}
@@ -129,7 +131,8 @@ export default class ProjectRowActions extends React.PureComponent<Props, State>
<ActionsDropdownItem
className="js-apply-template"
- onClick={this.handleApplyTemplateClick}>
+ onClick={this.handleApplyTemplateClick}
+ >
{translate('projects_role.apply_template')}
</ActionsDropdownItem>
</ActionsDropdown>
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx
index 577ae936ddd..1a9daf2eef0 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/Projects.tsx
@@ -47,7 +47,8 @@ export default class Projects extends React.PureComponent<Props> {
<div className="boxed-group boxed-group-inner">
<table
className={classNames('data', 'zebra', { 'new-loading': !this.props.ready })}
- id="projects-management-page-projects">
+ id="projects-management-page-projects"
+ >
<thead>
<tr>
<th />
@@ -59,7 +60,7 @@ export default class Projects extends React.PureComponent<Props> {
</tr>
</thead>
<tbody>
- {this.props.projects.map(project => (
+ {this.props.projects.map((project) => (
<ProjectRow
currentUser={this.props.currentUser}
key={project.key}
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/RestoreAccessModal.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/RestoreAccessModal.tsx
index 7c19085d7b9..f1cd08b290a 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/RestoreAccessModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/RestoreAccessModal.tsx
@@ -66,7 +66,7 @@ export default class RestoreAccessModal extends React.PureComponent<Props, State
grantPermissionToUser({
projectKey: this.props.project.key,
login: this.props.currentUser.login,
- permission
+ permission,
});
render() {
@@ -85,7 +85,7 @@ export default class RestoreAccessModal extends React.PureComponent<Props, State
id="global_permissions.restore_access.message"
values={{
browse: <strong>{translate('projects_role.user')}</strong>,
- administer: <strong>{translate('projects_role.admin')}</strong>
+ administer: <strong>{translate('projects_role.admin')}</strong>,
}}
/>
</div>
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
index 9a51ec49016..3f965deed92 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx
@@ -68,11 +68,11 @@ export class Search extends React.PureComponent<Props, State> {
state: State = { bulkApplyTemplateModal: false, deleteModal: false };
getQualifierOptions = () => {
- const options = this.props.appState.qualifiers.map(q => ({
+ const options = this.props.appState.qualifiers.map((q) => ({
label: translate('qualifiers', q),
- value: q
+ value: q,
}));
- return sortBy(options, option => QUALIFIERS_ORDER.indexOf(option.value));
+ return sortBy(options, (option) => QUALIFIERS_ORDER.indexOf(option.value));
};
onCheck = (checked: boolean) => {
@@ -159,10 +159,10 @@ export class Search extends React.PureComponent<Props, State> {
isSearchable={false}
components={{
Option: this.optionRenderer,
- SingleValue: this.singleValueRenderer
+ SingleValue: this.singleValueRenderer,
}}
options={this.getQualifierOptions()}
- value={options.find(option => option.value === this.props.qualifiers)}
+ value={options.find((option) => option.value === this.props.qualifiers)}
/>
</td>
);
@@ -172,7 +172,7 @@ export class Search extends React.PureComponent<Props, State> {
const options = [
{ value: 'all', label: translate('visibility.both') },
{ value: 'public', label: translate('visibility.public') },
- { value: 'private', label: translate('visibility.private') }
+ { value: 'private', label: translate('visibility.private') },
];
return (
<td className="thin nowrap text-middle">
@@ -183,7 +183,7 @@ export class Search extends React.PureComponent<Props, State> {
onChange={this.handleVisibilityChange}
options={options}
isSearchable={false}
- value={options.find(option => option.value === (this.props.visibility || 'all'))}
+ value={options.find((option) => option.value === (this.props.visibility || 'all'))}
/>
</td>
);
@@ -196,7 +196,8 @@ export class Search extends React.PureComponent<Props, State> {
checked={this.props.provisioned}
className="link-checkbox-control"
id="projects-provisioned"
- onCheck={this.props.onProvisionedChanged}>
+ onCheck={this.props.onProvisionedChanged}
+ >
<span className="text-middle little-spacer-left">
{translate('provisioning.only_provisioned')}
</span>
@@ -247,7 +248,8 @@ export class Search extends React.PureComponent<Props, State> {
<Button
className="js-bulk-apply-permission-template"
disabled={this.props.selection.length === 0}
- onClick={this.handleBulkApplyTemplateClick}>
+ onClick={this.handleBulkApplyTemplateClick}
+ >
{translate('permission_templates.bulk_apply_permission_template')}
</Button>
{this.props.qualifiers === 'TRK' && (
@@ -259,7 +261,8 @@ export class Search extends React.PureComponent<Props, State> {
this.props.selection.length === 0
? translate('permission_templates.select_to_delete')
: translate('permission_templates.delete_selected')
- }>
+ }
+ >
{translate('delete')}
</Button>
)}
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/BulkApplyTemplateModal-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/BulkApplyTemplateModal-test.tsx
index 82cefd7049a..029dc46a035 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/BulkApplyTemplateModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/BulkApplyTemplateModal-test.tsx
@@ -25,7 +25,7 @@ import BulkApplyTemplateModal, { Props } from '../BulkApplyTemplateModal';
jest.mock('../../../api/permissions', () => ({
bulkApplyTemplate: jest.fn(() => Promise.resolve()),
- getPermissionTemplates: jest.fn(() => Promise.resolve({ permissionTemplates: [] }))
+ getPermissionTemplates: jest.fn(() => Promise.resolve({ permissionTemplates: [] })),
}));
const bulkApplyTemplate = require('../../../api/permissions').bulkApplyTemplate as jest.Mock<any>;
@@ -52,8 +52,8 @@ it('bulk applies template to all results', async () => {
permissionTemplate: 'foo',
permissionTemplates: [
{ id: 'foo', name: 'Foo' },
- { id: 'bar', name: 'Bar' }
- ]
+ { id: 'bar', name: 'Bar' },
+ ],
});
expect(wrapper).toMatchSnapshot();
@@ -63,7 +63,7 @@ it('bulk applies template to all results', async () => {
onProvisionedOnly: true,
q: 'bla',
qualifiers: 'TRK',
- templateId: 'foo'
+ templateId: 'foo',
});
expect(wrapper).toMatchSnapshot();
@@ -81,8 +81,8 @@ it('bulk applies template to selected results', async () => {
permissionTemplate: 'foo',
permissionTemplates: [
{ id: 'foo', name: 'Foo' },
- { id: 'bar', name: 'Bar' }
- ]
+ { id: 'bar', name: 'Bar' },
+ ],
});
expect(wrapper).toMatchSnapshot();
@@ -92,7 +92,7 @@ it('bulk applies template to selected results', async () => {
expect(bulkApplyTemplate).toHaveBeenCalledWith({
projects: 'proj1,proj2',
qualifiers: 'VW',
- templateId: 'foo'
+ templateId: 'foo',
});
wrapper.update();
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ChangeDefaultVisibilityForm-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ChangeDefaultVisibilityForm-test.tsx
index 1b0f82333ae..7fb255fbedd 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ChangeDefaultVisibilityForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ChangeDefaultVisibilityForm-test.tsx
@@ -35,11 +35,7 @@ it('changes visibility', () => {
const wrapper = shallowRender({ onConfirm });
expect(wrapper).toMatchSnapshot();
- wrapper
- .find(Radio)
- .first()
- .props()
- .onCheck('private');
+ wrapper.find(Radio).first().props().onCheck('private');
expect(wrapper).toMatchSnapshot();
click(wrapper.find('.js-confirm'));
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx
index 328a10ee46d..f010ce6db46 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/CreateProjectForm-test.tsx
@@ -28,11 +28,11 @@ jest.mock('../../../api/components', () => ({
createProject: jest.fn().mockResolvedValue({}),
doesComponentExists: jest
.fn()
- .mockImplementation(({ component }) => Promise.resolve(component === 'exists'))
+ .mockImplementation(({ component }) => Promise.resolve(component === 'exists')),
}));
jest.mock('../../../api/settings', () => ({
- getValue: jest.fn().mockResolvedValue({ value: 'main' })
+ getValue: jest.fn().mockResolvedValue({ value: 'main' }),
}));
beforeEach(() => {
@@ -45,27 +45,27 @@ it('should render all inputs and create a project', async () => {
await user.type(
screen.getByRole('textbox', {
- name: 'onboarding.create_project.display_name field_required'
+ name: 'onboarding.create_project.display_name field_required',
}),
'ProjectName'
);
await user.type(
screen.getByRole('textbox', {
- name: 'onboarding.create_project.project_key field_required'
+ name: 'onboarding.create_project.project_key field_required',
}),
'ProjectKey'
);
expect(
screen.getByRole('textbox', {
- name: 'onboarding.create_project.main_branch_name field_required'
+ name: 'onboarding.create_project.main_branch_name field_required',
})
).toHaveValue('main');
await user.type(
screen.getByRole('textbox', {
- name: 'onboarding.create_project.main_branch_name field_required'
+ name: 'onboarding.create_project.main_branch_name field_required',
}),
'{Control>}a{/Control}{Backspace}ProjectMainBranch'
);
@@ -74,7 +74,7 @@ it('should render all inputs and create a project', async () => {
expect(createProject).toHaveBeenCalledWith({
name: 'ProjectName',
project: 'ProjectKey',
- mainBranch: 'ProjectMainBranch'
+ mainBranch: 'ProjectMainBranch',
});
});
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/DeleteModal-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/DeleteModal-test.tsx
index 56ce100aa29..86688d69a7b 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/DeleteModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/DeleteModal-test.tsx
@@ -19,7 +19,7 @@
*/
/* eslint-disable import/first */
jest.mock('../../../api/components', () => ({
- bulkDeleteProjects: jest.fn(() => Promise.resolve())
+ bulkDeleteProjects: jest.fn(() => Promise.resolve()),
}));
import { shallow } from 'enzyme';
@@ -46,7 +46,7 @@ it('deletes all projects', async () => {
analyzedBefore: '2017-04-08T00:00:00+0000',
onProvisionedOnly: undefined,
q: 'bla',
- qualifiers: 'TRK'
+ qualifiers: 'TRK',
});
await new Promise(setImmediate);
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Header-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Header-test.tsx
index e75d1f6192a..b7fa2547584 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Header-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Header-test.tsx
@@ -23,7 +23,7 @@ import { click } from '../../../helpers/testUtils';
import Header, { Props } from '../Header';
jest.mock('../../../helpers/system', () => ({
- getReactDomContainerSelector: jest.fn(() => '#content')
+ getReactDomContainerSelector: jest.fn(() => '#content'),
}));
it('renders', () => {
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-it.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-it.tsx
index 941d42cad6f..4255f24f0af 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-it.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-it.tsx
@@ -31,12 +31,12 @@ jest.mock('../../../api/permissions');
jest.mock('../../../api/components', () => ({
getComponents: jest.fn().mockResolvedValue({
paging: { total: 0 },
- components: []
- })
+ components: [],
+ }),
}));
jest.mock('../../../api/settings', () => ({
- getValue: jest.fn().mockResolvedValue({ value: 'public' })
+ getValue: jest.fn().mockResolvedValue({ value: 'public' }),
}));
const components = mockComponents(11);
@@ -59,7 +59,7 @@ describe('Bulk Apply', () => {
renderGlobalBackgroundTasksApp();
const bulkApplyButton = await screen.findByRole('button', {
- name: 'permission_templates.bulk_apply_permission_template'
+ name: 'permission_templates.bulk_apply_permission_template',
});
expect(bulkApplyButton).toBeDisabled();
@@ -131,9 +131,9 @@ function getComponentsImplementation(overridePageSize?: number) {
const startIndex = ((params.p ?? 1) - 1) * pageSize; // artifically bump the page size to 500
return Promise.resolve({
paging: {
- total: 1001
+ total: 1001,
},
- components: components.slice(startIndex, startIndex + pageSize)
+ components: components.slice(startIndex, startIndex + pageSize),
});
};
}
@@ -146,7 +146,7 @@ function mockComponents(n: number) {
key: `project-${i + 1}`,
name: `Project ${i + 1}`,
qualifier: ComponentQualifier.Project,
- visibility: Visibility.Private
+ visibility: Visibility.Private,
});
}
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-test.tsx
index f429ee2b454..987f47fd0a0 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectManagementApp-test.tsx
@@ -28,26 +28,29 @@ import { ProjectManagementApp, Props } from '../ProjectManagementApp';
jest.mock('lodash', () => {
const lodash = jest.requireActual('lodash');
- lodash.debounce = (fn: Function) => (...args: any[]) => fn(args);
+ lodash.debounce =
+ (fn: Function) =>
+ (...args: any[]) =>
+ fn(args);
return lodash;
});
jest.mock('../../../api/components', () => ({
- getComponents: jest.fn().mockResolvedValue({ paging: { total: 0 }, components: [] })
+ getComponents: jest.fn().mockResolvedValue({ paging: { total: 0 }, components: [] }),
}));
jest.mock('../../../api/permissions', () => ({
- changeProjectDefaultVisibility: jest.fn().mockResolvedValue({})
+ changeProjectDefaultVisibility: jest.fn().mockResolvedValue({}),
}));
jest.mock('../../../api/settings', () => ({
- getValue: jest.fn().mockResolvedValue({ value: 'public' })
+ getValue: jest.fn().mockResolvedValue({ value: 'public' }),
}));
const defaultSearchParameters = {
p: undefined,
ps: 50,
- q: undefined
+ q: undefined,
};
beforeEach(() => {
@@ -68,7 +71,7 @@ it('selects provisioned', () => {
expect(getComponents).toHaveBeenLastCalledWith({
...defaultSearchParameters,
onProvisionedOnly: true,
- qualifiers: 'TRK'
+ qualifiers: 'TRK',
});
});
@@ -85,7 +88,7 @@ it('searches', () => {
expect(getComponents).toHaveBeenLastCalledWith({
...defaultSearchParameters,
q: 'foo',
- qualifiers: 'TRK'
+ qualifiers: 'TRK',
});
});
@@ -97,7 +100,7 @@ it('should handle date filtering', () => {
expect(getComponents).toHaveBeenCalledWith({
...defaultSearchParameters,
qualifiers: 'TRK',
- analyzedBefore: '2019-11-14'
+ analyzedBefore: '2019-11-14',
});
});
@@ -120,7 +123,7 @@ it('loads more', () => {
expect(getComponents).toHaveBeenLastCalledWith({
...defaultSearchParameters,
p: 2,
- qualifiers: 'TRK'
+ qualifiers: 'TRK',
});
});
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRow-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRow-test.tsx
index 49d9a68c23d..39fe29af5b6 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRow-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRow-test.tsx
@@ -26,7 +26,7 @@ const project = {
key: 'project',
name: 'Project',
qualifier: ComponentQualifier.Project,
- visibility: Visibility.Private
+ visibility: Visibility.Private,
};
it('renders', () => {
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRowActions-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRowActions-test.tsx
index fbd7d650ca0..994c21dc58a 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRowActions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/ProjectRowActions-test.tsx
@@ -25,7 +25,7 @@ import { click, waitAndUpdate } from '../../../helpers/testUtils';
import ProjectRowActions, { Props } from '../ProjectRowActions';
jest.mock('../../../api/navigation', () => ({
- getComponentNavigation: jest.fn().mockResolvedValue({})
+ getComponentNavigation: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
@@ -42,8 +42,8 @@ describe('restore access', () => {
(getComponentNavigation as jest.Mock).mockResolvedValue({
configuration: {
canBrowseProject: false,
- showPermissions: false
- }
+ showPermissions: false,
+ },
});
});
@@ -72,7 +72,7 @@ describe('restore access', () => {
it('also shows the restore access when browse permission is missing', async () => {
(getComponentNavigation as jest.Mock).mockResolvedValueOnce({
- configuration: { canBrowseProject: false, showPermissions: true }
+ configuration: { canBrowseProject: false, showPermissions: true },
});
const wrapper = shallowRender();
@@ -89,8 +89,8 @@ describe('permissions', () => {
(getComponentNavigation as jest.Mock).mockResolvedValue({
configuration: {
canBrowseProject: true,
- showPermissions: true
- }
+ showPermissions: true,
+ },
});
});
@@ -124,7 +124,7 @@ function shallowRender(props: Partial<Props> = {}) {
key: 'foo',
name: 'Foo',
qualifier: 'TRK',
- visibility: 'private'
+ visibility: 'private',
}}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx
index c68940fd71e..719ee461766 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Projects-test.tsx
@@ -23,7 +23,7 @@ import Projects from '../Projects';
const projects = [
{ key: 'a', name: 'A', qualifier: 'TRK', visibility: 'public' },
- { key: 'b', name: 'B', qualifier: 'TRK', visibility: 'public' }
+ { key: 'b', name: 'B', qualifier: 'TRK', visibility: 'public' },
];
const selection = ['a'];
@@ -36,16 +36,10 @@ it('selects and deselects project', () => {
const onProjectSelected = jest.fn();
const wrapper = shallowRender({ onProjectDeselected, onProjectSelected, projects });
- wrapper
- .find('ProjectRow')
- .first()
- .prop<Function>('onProjectCheck')(projects[0], true);
+ wrapper.find('ProjectRow').first().prop<Function>('onProjectCheck')(projects[0], true);
expect(onProjectSelected).toHaveBeenCalledWith('a');
- wrapper
- .find('ProjectRow')
- .first()
- .prop<Function>('onProjectCheck')(projects[0], false);
+ wrapper.find('ProjectRow').first().prop<Function>('onProjectCheck')(projects[0], false);
expect(onProjectDeselected).toHaveBeenCalledWith('a');
});
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Search-test.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Search-test.tsx
index 55aae869581..207739529ae 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Search-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/Search-test.tsx
@@ -48,17 +48,17 @@ it('updates qualifier', () => {
const onQualifierChanged = jest.fn();
const wrapper = shallowRender({
onQualifierChanged,
- appState: mockAppState({ qualifiers: ['TRK', 'VW', 'APP'] })
+ appState: mockAppState({ qualifiers: ['TRK', 'VW', 'APP'] }),
});
wrapper.find('Select[name="projects-qualifier"]').simulate('change', {
- value: 'VW'
+ value: 'VW',
});
expect(onQualifierChanged).toHaveBeenCalledWith('VW');
});
it('renders optionrenderer and singlevaluerenderer', () => {
const wrapper = shallowRender({
- appState: mockAppState({ qualifiers: ['TRK', 'VW', 'APP'] })
+ appState: mockAppState({ qualifiers: ['TRK', 'VW', 'APP'] }),
});
const OptionRendererer = wrapper.instance().optionRenderer;
const SingleValueRendererer = wrapper.instance().singleValueRenderer;
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/quality-gates/__tests__/utils-test.ts
index 9e22b6392dd..dac08137708 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/quality-gates/__tests__/utils-test.ts
@@ -24,7 +24,7 @@ const METRICS = {
bugs: mockMetric({ key: 'bugs', name: 'Bugs' }),
existing_metric: mockMetric(),
new_maintainability_rating: mockMetric(),
- sqale_rating: mockMetric({ key: 'sqale_rating', name: 'Maintainability Rating' })
+ sqale_rating: mockMetric({ key: 'sqale_rating', name: 'Maintainability Rating' }),
};
describe('getLocalizedMetricNameNoDiffMetric', () => {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/App.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/App.tsx
index 2922b7371c1..a5114b70047 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/App.tsx
@@ -30,7 +30,7 @@ import {
addSideBarClass,
addWhitePageClass,
removeSideBarClass,
- removeWhitePageClass
+ removeWhitePageClass,
} from '../../../helpers/pages';
import { getQualityGateUrl } from '../../../helpers/urls';
import { QualityGate } from '../../../types/types';
@@ -93,19 +93,19 @@ class App extends React.PureComponent<Props, State> {
};
openDefault(qualityGates: QualityGate[]) {
- const defaultQualityGate = qualityGates.find(gate => Boolean(gate.isDefault))!;
+ const defaultQualityGate = qualityGates.find((gate) => Boolean(gate.isDefault))!;
this.props.navigate(getQualityGateUrl(String(defaultQualityGate.id)), { replace: true });
}
handleSetDefault = (qualityGate: QualityGate) => {
this.setState(({ qualityGates }) => {
return {
- qualityGates: qualityGates.map(candidate => {
+ qualityGates: qualityGates.map((candidate) => {
if (candidate.isDefault || candidate.id === qualityGate.id) {
return { ...candidate, isDefault: candidate.id === qualityGate.id };
}
return candidate;
- })
+ }),
};
});
};
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx
index 97d3834a76b..598f53188ac 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.tsx
@@ -50,7 +50,7 @@ export class ConditionComponent extends React.PureComponent<Props, State> {
super(props);
this.state = {
deleteFormOpen: false,
- modal: false
+ modal: false,
};
}
@@ -137,7 +137,8 @@ export class ConditionComponent extends React.PureComponent<Props, State> {
header={translate('quality_gates.delete_condition')}
isDestructive={true}
onClose={this.closeDeleteForm}
- onConfirm={this.removeCondition}>
+ onConfirm={this.removeCondition}
+ >
{translateWithParameters(
'quality_gates.delete_condition.confirm.message',
getLocalizedMetricName(this.props.metric)
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx
index be2a2129959..1668b82cddb 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionModal.tsx
@@ -55,7 +55,7 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
error: props.condition ? props.condition.error : '',
scope: 'new',
metric: props.metric ? props.metric : undefined,
- op: props.condition ? props.condition.op : undefined
+ op: props.condition ? props.condition.op : undefined,
};
}
@@ -69,7 +69,7 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
const newCondition: Omit<Condition, 'id'> = {
metric: this.state.metric!.key,
op: this.getSinglePossibleOperator(this.state.metric!) || this.state.op,
- error: this.state.error
+ error: this.state.error,
};
const submitPromise = condition
? updateCondition({ id: condition.id, ...newCondition })
@@ -85,7 +85,7 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
if (metric && metrics) {
const correspondingMetricKey =
scope === 'new' ? `new_${metric.key}` : metric.key.replace(/^new_/, '');
- correspondingMetric = metrics.find(m => m.key === correspondingMetricKey);
+ correspondingMetric = metrics.find((m) => m.key === correspondingMetricKey);
}
return { scope, metric: correspondingMetric };
@@ -114,7 +114,8 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
header={header}
onClose={onClose}
onConfirm={this.handleFormSubmit}
- size="small">
+ size="small"
+ >
{this.state.errorMessage && <Alert variant="error">{this.state.errorMessage}</Alert>}
{this.props.metric === undefined && (
@@ -128,7 +129,8 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
checked={scope === 'overall'}
className="big-spacer-left"
onCheck={this.handleScopeChange}
- value="overall">
+ value="overall"
+ >
<span data-test="quality-gates__condition-scope-overall">
{translate('quality_gates.conditions.overall_code')}
</span>
@@ -143,7 +145,7 @@ export default class ConditionModal extends React.PureComponent<Props, State> {
{metrics && (
<MetricSelect
metric={metric}
- metricsArray={metrics.filter(m =>
+ metricsArray={metrics.filter((m) =>
scope === 'new' ? isDiffMetric(m.key) : !isDiffMetric(m.key)
)}
onMetricChange={this.handleMetricChange}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionOperator.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionOperator.tsx
index ebad2b9038c..c51b3bdb8e8 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionOperator.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ConditionOperator.tsx
@@ -44,7 +44,7 @@ export default class ConditionOperator extends React.PureComponent<Props> {
const operators = getPossibleOperators(this.props.metric);
if (Array.isArray(operators)) {
- const operatorOptions = operators.map(op => {
+ const operatorOptions = operators.map((op) => {
const label = this.getLabel(op, this.props.metric);
return { label, value: op };
});
@@ -60,7 +60,7 @@ export default class ConditionOperator extends React.PureComponent<Props> {
onChange={this.handleChange}
options={operatorOptions}
isSearchable={false}
- value={operatorOptions.filter(o => o.value === this.props.op)}
+ value={operatorOptions.filter((o) => o.value === this.props.op)}
/>
);
} else {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx
index 4a09610dcbd..7bc848271c0 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Conditions.tsx
@@ -20,7 +20,7 @@
import { differenceWith, map, sortBy, uniqBy } from 'lodash';
import * as React from 'react';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import withMetricsContext from '../../../app/components/metrics/withMetricsContext';
import DocumentationTooltip from '../../../components/common/DocumentationTooltip';
@@ -51,7 +51,7 @@ const FORBIDDEN_METRICS: string[] = [
MetricKey.alert_status,
MetricKey.releasability_rating,
MetricKey.security_hotspots,
- MetricKey.new_security_hotspots
+ MetricKey.new_security_hotspots,
];
export class Conditions extends React.PureComponent<Props> {
@@ -62,7 +62,7 @@ export class Conditions extends React.PureComponent<Props> {
canEdit,
onRemoveCondition,
onSaveCondition,
- updatedConditionId
+ updatedConditionId,
} = this.props;
const captionTranslationId =
@@ -96,7 +96,7 @@ export class Conditions extends React.PureComponent<Props> {
</tr>
</thead>
<tbody>
- {conditions.map(condition => (
+ {conditions.map((condition) => (
<Condition
canEdit={canEdit}
condition={condition}
@@ -116,36 +116,38 @@ export class Conditions extends React.PureComponent<Props> {
render() {
const { conditions, metrics, canEdit } = this.props;
- const existingConditions = conditions.filter(condition => metrics[condition.metric]);
+ const existingConditions = conditions.filter((condition) => metrics[condition.metric]);
const sortedConditions = sortBy(
existingConditions,
- condition => metrics[condition.metric] && metrics[condition.metric].name
+ (condition) => metrics[condition.metric] && metrics[condition.metric].name
);
const sortedConditionsOnOverallMetrics = sortedConditions.filter(
- condition => !isDiffMetric(condition.metric)
+ (condition) => !isDiffMetric(condition.metric)
);
- const sortedConditionsOnNewMetrics = sortedConditions.filter(condition =>
+ const sortedConditionsOnNewMetrics = sortedConditions.filter((condition) =>
isDiffMetric(condition.metric)
);
const duplicates: ConditionType[] = [];
- const savedConditions = existingConditions.filter(condition => condition.id != null);
- savedConditions.forEach(condition => {
- const sameCount = savedConditions.filter(sample => sample.metric === condition.metric).length;
+ const savedConditions = existingConditions.filter((condition) => condition.id != null);
+ savedConditions.forEach((condition) => {
+ const sameCount = savedConditions.filter(
+ (sample) => sample.metric === condition.metric
+ ).length;
if (sameCount > 1) {
duplicates.push(condition);
}
});
- const uniqDuplicates = uniqBy(duplicates, d => d.metric).map(condition => ({
+ const uniqDuplicates = uniqBy(duplicates, (d) => d.metric).map((condition) => ({
...condition,
- metric: metrics[condition.metric]
+ metric: metrics[condition.metric],
}));
const availableMetrics = differenceWith(
- map(metrics, metric => metric).filter(
- metric =>
+ map(metrics, (metric) => metric).filter(
+ (metric) =>
!metric.hidden &&
!FORBIDDEN_METRIC_TYPES.includes(metric.type) &&
!FORBIDDEN_METRICS.includes(metric.key)
@@ -167,7 +169,8 @@ export class Conditions extends React.PureComponent<Props> {
onClose={onClose}
qualityGate={this.props.qualityGate}
/>
- )}>
+ )}
+ >
{({ onClick }) => (
<Button data-test="quality-gates__add-condition" onClick={onClick}>
{translate('quality_gates.add_condition')}
@@ -185,8 +188,8 @@ export class Conditions extends React.PureComponent<Props> {
links={[
{
href: '/user-guide/clean-as-you-code/',
- label: translate('quality_gates.conditions.help.link')
- }
+ label: translate('quality_gates.conditions.help.link'),
+ },
]}
/>
</header>
@@ -195,7 +198,7 @@ export class Conditions extends React.PureComponent<Props> {
<Alert variant="warning">
<p>{translate('quality_gates.duplicated_conditions')}</p>
<ul className="list-styled spacer-top">
- {uniqDuplicates.map(d => (
+ {uniqDuplicates.map((d) => (
<li key={d.metric.key}>{getLocalizedMetricName(d.metric)}</li>
))}
</ul>
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/CopyQualityGateForm.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/CopyQualityGateForm.tsx
index d65b53ca2a7..322de9e9505 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/CopyQualityGateForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/CopyQualityGateForm.tsx
@@ -52,7 +52,7 @@ export class CopyQualityGateForm extends React.PureComponent<Props, State> {
const { qualityGate } = this.props;
const { name } = this.state;
- return copyQualityGate({ id: qualityGate.id, name }).then(newQualityGate => {
+ return copyQualityGate({ id: qualityGate.id, name }).then((newQualityGate) => {
this.props.onCopy();
this.props.router.push(getQualityGateUrl(String(newQualityGate.id)));
});
@@ -70,7 +70,8 @@ export class CopyQualityGateForm extends React.PureComponent<Props, State> {
header={translate('quality_gates.copy')}
onClose={this.props.onClose}
onConfirm={this.handleCopy}
- size="small">
+ size="small"
+ >
<MandatoryFieldsExplanation className="modal-field" />
<div className="modal-field">
<label htmlFor="quality-gate-form-name">
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/CreateQualityGateForm.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/CreateQualityGateForm.tsx
index 1dab545b08e..79c18b00322 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/CreateQualityGateForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/CreateQualityGateForm.tsx
@@ -64,7 +64,8 @@ export class CreateQualityGateForm extends React.PureComponent<Props, State> {
header={translate('quality_gates.create')}
onClose={this.props.onClose}
onConfirm={this.handleCreate}
- size="small">
+ size="small"
+ >
<MandatoryFieldsExplanation className="modal-field" />
<div className="modal-field">
<label htmlFor="quality-gate-form-name">
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DeleteQualityGateForm.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/DeleteQualityGateForm.tsx
index dba0240f8de..f0267629a58 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/DeleteQualityGateForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DeleteQualityGateForm.tsx
@@ -54,12 +54,14 @@ export class DeleteQualityGateForm extends React.PureComponent<Props> {
qualityGate.name
)}
modalHeader={translate('quality_gates.delete')}
- onConfirm={this.onDelete}>
+ onConfirm={this.onDelete}
+ >
{({ onClick }) => (
<Button
className="little-spacer-left button-red"
id="quality-gate-delete"
- onClick={onClick}>
+ onClick={onClick}
+ >
{translate('delete')}
</Button>
)}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Details.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Details.tsx
index ca292d3d870..9253be9e433 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/Details.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Details.tsx
@@ -64,7 +64,7 @@ export default class Details extends React.PureComponent<Props, State> {
const { id } = this.props;
this.setState({ loading: true });
return fetchQualityGate({ id }).then(
- qualityGate => {
+ (qualityGate) => {
if (this.mounted) {
this.setState({ loading: false, qualityGate, updatedConditionId: undefined });
}
@@ -85,7 +85,7 @@ export default class Details extends React.PureComponent<Props, State> {
addGlobalSuccessMessage(translate('quality_gates.condition_added'));
return {
qualityGate: addCondition(qualityGate, condition),
- updatedConditionId: condition.id
+ updatedConditionId: condition.id,
};
});
};
@@ -98,7 +98,7 @@ export default class Details extends React.PureComponent<Props, State> {
addGlobalSuccessMessage(translate('quality_gates.condition_updated'));
return {
qualityGate: replaceCondition(qualityGate, newCondition, oldCondition),
- updatedConditionId: newCondition.id
+ updatedConditionId: newCondition.id,
};
});
};
@@ -111,7 +111,7 @@ export default class Details extends React.PureComponent<Props, State> {
addGlobalSuccessMessage(translate('quality_gates.condition_deleted'));
return {
qualityGate: deleteCondition(qualityGate, condition),
- updatedConditionId: undefined
+ updatedConditionId: undefined,
};
});
};
@@ -124,7 +124,7 @@ export default class Details extends React.PureComponent<Props, State> {
this.props.onSetDefault(qualityGate);
const newQualityGate: QualityGate = {
...qualityGate,
- actions: { ...qualityGate.actions, delete: false, setAsDefault: false }
+ actions: { ...qualityGate.actions, delete: false, setAsDefault: false },
};
return { qualityGate: newQualityGate };
});
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx
index 8081c414a0d..0d4c0dcbe22 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx
@@ -80,7 +80,8 @@ export default class DetailsHeader extends React.PureComponent<Props> {
onRename={this.handleActionRefresh}
qualityGate={qualityGate}
/>
- )}>
+ )}
+ >
{({ onClick }) => (
<Button id="quality-gate-rename" onClick={onClick}>
{translate('rename')}
@@ -96,7 +97,8 @@ export default class DetailsHeader extends React.PureComponent<Props> {
onCopy={this.handleActionRefresh}
qualityGate={qualityGate}
/>
- )}>
+ )}
+ >
{({ onClick }) => (
<Button className="little-spacer-left" id="quality-gate-copy" onClick={onClick}>
{translate('copy')}
@@ -110,12 +112,14 @@ export default class DetailsHeader extends React.PureComponent<Props> {
hasNoConditions
? translate('quality_gates.cannot_set_default_no_conditions')
: null
- }>
+ }
+ >
<Button
className="little-spacer-left"
disabled={hasNoConditions}
id="quality-gate-toggle-default"
- onClick={this.handleSetAsDefaultClick}>
+ onClick={this.handleSetAsDefaultClick}
+ >
{translate('set_as_default')}
</Button>
</Tooltip>
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx
index e2fdcd567ab..ecb9089d0b6 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/List.tsx
@@ -31,13 +31,14 @@ interface Props {
export default function List({ qualityGates }: Props) {
return (
<div className="list-group" role="menu">
- {qualityGates.map(qualityGate => (
+ {qualityGates.map((qualityGate) => (
<NavLink
className="list-group-item display-flex-center"
role="menuitem"
data-id={qualityGate.id}
key={qualityGate.id}
- to={getQualityGateUrl(String(qualityGate.id))}>
+ to={getQualityGateUrl(String(qualityGate.id))}
+ >
<span className="flex-1">{qualityGate.name}</span>
{qualityGate.isDefault && (
<span className="badge little-spacer-left">{translate('default')}</span>
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.tsx
index 8704f5bdaad..2b82928314c 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ListHeader.tsx
@@ -37,7 +37,8 @@ export default function ListHeader({ canCreate, refreshQualityGates }: Props) {
<ModalButton
modal={({ onClose }) => (
<CreateQualityGateForm onClose={onClose} onCreate={refreshQualityGates} />
- )}>
+ )}
+ >
{({ onClick }) => (
<Button data-test="quality-gates__add" onClick={onClick}>
{translate('create')}
@@ -55,8 +56,8 @@ export default function ListHeader({ canCreate, refreshQualityGates }: Props) {
links={[
{
href: '/user-guide/quality-gates/',
- label: translate('learn_more')
- }
+ label: translate('learn_more'),
+ },
]}
/>
</div>
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/MetricSelect.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/MetricSelect.tsx
index 5f9a6d21390..b561557d027 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/MetricSelect.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/MetricSelect.tsx
@@ -42,7 +42,7 @@ export class MetricSelect extends React.PureComponent<Props> {
handleChange = (option: Option | null) => {
if (option) {
const { metricsArray: metrics } = this.props;
- const selectedMetric = metrics.find(metric => metric.key === option.value);
+ const selectedMetric = metrics.find((metric) => metric.key === option.value);
if (selectedMetric) {
this.props.onMetricChange(selectedMetric);
}
@@ -53,10 +53,10 @@ export class MetricSelect extends React.PureComponent<Props> {
const { metric, metricsArray, metrics } = this.props;
const options: Array<Option & { domain?: string }> = sortBy(
- metricsArray.map(m => ({
+ metricsArray.map((m) => ({
value: m.key,
label: getLocalizedMetricNameNoDiffMetric(m, metrics),
- domain: m.domain
+ domain: m.domain,
})),
'domain'
);
@@ -69,7 +69,7 @@ export class MetricSelect extends React.PureComponent<Props> {
optionsWithDomains.push({
value: '<domain>',
label: getLocalizedMetricDomain(option.domain),
- isDisabled: true
+ isDisabled: true,
});
}
optionsWithDomains.push(option);
@@ -82,7 +82,7 @@ export class MetricSelect extends React.PureComponent<Props> {
onChange={this.handleChange}
options={optionsWithDomains}
placeholder={translate('search.search_for_metrics')}
- value={optionsWithDomains.find(o => o.value === metric?.key)}
+ value={optionsWithDomains.find((o) => o.value === metric?.key)}
/>
);
}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Projects.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/Projects.tsx
index 62e8171d9d7..33071c469e2 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/Projects.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Projects.tsx
@@ -22,11 +22,11 @@ import * as React from 'react';
import {
associateGateWithProject,
dissociateGateWithProject,
- searchProjects
+ searchProjects,
} from '../../../api/quality-gates';
import SelectList, {
SelectListFilter,
- SelectListSearchParams
+ SelectListSearchParams,
} from '../../../components/controls/SelectList';
import { translate } from '../../../helpers/l10n';
import { QualityGate } from '../../../types/types';
@@ -60,7 +60,7 @@ export default class Projects extends React.PureComponent<Props, State> {
this.state = {
needToReload: false,
projects: [],
- selectedProjects: []
+ selectedProjects: [],
};
}
@@ -78,16 +78,16 @@ export default class Projects extends React.PureComponent<Props, State> {
page: searchParams.page,
pageSize: searchParams.pageSize,
query: searchParams.query !== '' ? searchParams.query : undefined,
- selected: searchParams.filter
- }).then(data => {
+ selected: searchParams.filter,
+ }).then((data) => {
if (this.mounted) {
- this.setState(prevState => {
+ this.setState((prevState) => {
const more = searchParams.page != null && searchParams.page > 1;
const projects = more ? [...prevState.projects, ...data.results] : data.results;
const newSelectedProjects = data.results
- .filter(project => project.selected)
- .map(project => project.key);
+ .filter((project) => project.selected)
+ .map((project) => project.key);
const selectedProjects = more
? [...prevState.selectedProjects, ...newSelectedProjects]
: newSelectedProjects;
@@ -97,7 +97,7 @@ export default class Projects extends React.PureComponent<Props, State> {
needToReload: false,
projects,
projectsTotalCount: data.paging.total,
- selectedProjects
+ selectedProjects,
};
});
}
@@ -106,12 +106,12 @@ export default class Projects extends React.PureComponent<Props, State> {
handleSelect = (key: string) =>
associateGateWithProject({
gateId: this.props.qualityGate.id,
- projectKey: key
+ projectKey: key,
}).then(() => {
if (this.mounted) {
- this.setState(prevState => ({
+ this.setState((prevState) => ({
needToReload: true,
- selectedProjects: [...prevState.selectedProjects, key]
+ selectedProjects: [...prevState.selectedProjects, key],
}));
}
});
@@ -119,12 +119,12 @@ export default class Projects extends React.PureComponent<Props, State> {
handleUnselect = (key: string) =>
dissociateGateWithProject({
gateId: this.props.qualityGate.id,
- projectKey: key
+ projectKey: key,
}).then(() => {
if (this.mounted) {
- this.setState(prevState => ({
+ this.setState((prevState) => ({
needToReload: true,
- selectedProjects: without(prevState.selectedProjects, key)
+ selectedProjects: without(prevState.selectedProjects, key),
}));
}
});
@@ -157,7 +157,7 @@ export default class Projects extends React.PureComponent<Props, State> {
return (
<SelectList
- elements={this.state.projects.map(project => project.key)}
+ elements={this.state.projects.map((project) => project.key)}
elementsTotalCount={this.state.projectsTotalCount}
labelAll={translate('quality_gates.projects.all')}
labelSelected={translate('quality_gates.projects.with')}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissions.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissions.tsx
index 3a9c7e0cc1b..9ba6d86500b 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissions.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissions.tsx
@@ -25,7 +25,7 @@ import {
removeGroup,
removeUser,
searchGroups,
- searchUsers
+ searchUsers,
} from '../../../api/quality-gates';
import { Group, isUser, SearchPermissionsParameters } from '../../../types/quality-gates';
import { QualityGate } from '../../../types/types';
@@ -52,7 +52,7 @@ export default class QualityGatePermissions extends React.Component<Props, State
submitting: false,
loading: true,
showAddModal: false,
- users: []
+ users: [],
};
componentDidMount() {
@@ -77,11 +77,11 @@ export default class QualityGatePermissions extends React.Component<Props, State
const params: SearchPermissionsParameters = {
gateName: qualityGate.name,
- selected: 'selected'
+ selected: 'selected',
};
const [{ users }, { groups }] = await Promise.all([
searchUsers(params).catch(() => ({ users: [] })),
- searchGroups(params).catch(() => ({ groups: [] }))
+ searchGroups(params).catch(() => ({ groups: [] })),
]);
if (this.mounted) {
@@ -116,19 +116,19 @@ export default class QualityGatePermissions extends React.Component<Props, State
if (isUser(item)) {
this.setState(({ users }) => ({
showAddModal: false,
- users: sortBy(users.concat(item), u => u.name)
+ users: sortBy(users.concat(item), (u) => u.name),
}));
} else {
this.setState(({ groups }) => ({
showAddModal: false,
- groups: sortBy(groups.concat(item), g => g.name)
+ groups: sortBy(groups.concat(item), (g) => g.name),
}));
}
}
if (this.mounted) {
this.setState({
- submitting: false
+ submitting: false,
});
}
};
@@ -158,11 +158,11 @@ export default class QualityGatePermissions extends React.Component<Props, State
if (this.mounted && !error) {
if (isUser(item)) {
this.setState(({ users }) => ({
- users: users.filter(u => u.login !== item.login)
+ users: users.filter((u) => u.login !== item.login),
}));
} else {
this.setState(({ groups }) => ({
- groups: groups.filter(g => g.name !== item.name)
+ groups: groups.filter((g) => g.name !== item.name),
}));
}
}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModal.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModal.tsx
index 741798c85a6..7959a3c3b08 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModal.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModal.tsx
@@ -64,7 +64,7 @@ export default class QualityGatePermissionsAddModal extends React.Component<Prop
const queryParams: SearchPermissionsParameters = {
gateName: qualityGate.name,
q,
- selected: 'deselected'
+ selected: 'deselected',
};
Promise.all([searchUsers(queryParams), searchGroups(queryParams)])
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModalRenderer.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModalRenderer.tsx
index c230b7aac19..b726be88ab5 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModalRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModalRenderer.tsx
@@ -65,12 +65,12 @@ export default function QualityGatePermissionsAddModalRenderer(
noOptionsMessage={() => noResultsText}
onChange={props.onSelection}
loadOptions={props.handleSearch}
- getOptionValue={opt => (isUser(opt) ? opt.login : opt.name)}
+ getOptionValue={(opt) => (isUser(opt) ? opt.login : opt.name)}
large={true}
components={{
Option: optionRenderer,
SingleValue: singleValueRenderer,
- Control: controlRenderer
+ Control: controlRenderer,
}}
/>
</div>
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsRenderer.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsRenderer.tsx
index 708c24269de..347fc11a126 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsRenderer.tsx
@@ -46,15 +46,8 @@ export interface QualityGatePermissionsRendererProps {
}
export default function QualityGatePermissionsRenderer(props: QualityGatePermissionsRendererProps) {
- const {
- groups,
- loading,
- permissionToDelete,
- qualityGate,
- showAddModal,
- submitting,
- users
- } = props;
+ const { groups, loading, permissionToDelete, qualityGate, showAddModal, submitting, users } =
+ props;
return (
<div className="quality-gate-permissions">
@@ -63,12 +56,12 @@ export default function QualityGatePermissionsRenderer(props: QualityGatePermiss
<div>
<DeferredSpinner loading={loading}>
<ul>
- {users.map(user => (
+ {users.map((user) => (
<li key={user.login}>
<PermissionItem onClickDelete={props.onClickDeletePermission} item={user} />
</li>
))}
- {groups.map(group => (
+ {groups.map((group) => (
<li key={group.name}>
<PermissionItem onClickDelete={props.onClickDeletePermission} item={group} />
</li>
@@ -101,7 +94,8 @@ export default function QualityGatePermissionsRenderer(props: QualityGatePermiss
isDestructive={true}
confirmData={permissionToDelete}
onClose={props.onCloseDeletePermission}
- onConfirm={props.onConfirmDeletePermission}>
+ onConfirm={props.onConfirmDeletePermission}
+ >
<FormattedMessage
defaultMessage={
isUser(permissionToDelete)
@@ -110,7 +104,7 @@ export default function QualityGatePermissionsRenderer(props: QualityGatePermiss
}
id="remove.confirmation"
values={{
- user: <strong>{permissionToDelete.name}</strong>
+ user: <strong>{permissionToDelete.name}</strong>,
}}
/>
</ConfirmModal>
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/RenameQualityGateForm.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/RenameQualityGateForm.tsx
index aae7c62b03c..04882444a02 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/RenameQualityGateForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/RenameQualityGateForm.tsx
@@ -64,7 +64,8 @@ export default class RenameQualityGateForm extends React.PureComponent<Props, St
header={translate('quality_gates.rename')}
onClose={this.props.onClose}
onConfirm={this.handleRename}
- size="small">
+ size="small"
+ >
<MandatoryFieldsExplanation className="modal-field" />
<div className="modal-field">
<label htmlFor="quality-gate-form-name">
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/ThresholdInput.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/ThresholdInput.tsx
index 58c69ce43bd..53c067a51ef 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/ThresholdInput.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/ThresholdInput.tsx
@@ -44,7 +44,7 @@ export default class ThresholdInput extends React.PureComponent<Props> {
{ label: 'A', value: '1' },
{ label: 'B', value: '2' },
{ label: 'C', value: '3' },
- { label: 'D', value: '4' }
+ { label: 'D', value: '4' },
];
return (
@@ -58,7 +58,7 @@ export default class ThresholdInput extends React.PureComponent<Props> {
options={options}
placeholder=""
isSearchable={false}
- value={options.find(o => o.value === value)}
+ value={options.find((o) => o.value === value)}
/>
);
}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/App-it.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/App-it.tsx
index 76c998fc6b3..d9550498dbc 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/App-it.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/App-it.tsx
@@ -50,12 +50,12 @@ it('should list all quality gates', async () => {
expect(
await screen.findByRole('menuitem', {
- name: `${handler.getDefaultQualityGate().name} default`
+ name: `${handler.getDefaultQualityGate().name} default`,
})
).toBeInTheDocument();
expect(
await screen.findByRole('menuitem', {
- name: `${handler.getBuiltInQualityGate().name} quality_gates.built_in`
+ name: `${handler.getBuiltInQualityGate().name} quality_gates.built_in`,
})
).toBeInTheDocument();
});
@@ -212,7 +212,7 @@ it('should be able to edit a condition', async () => {
const newConditions = within(
await screen.findByRole('table', {
- name: 'quality_gates.conditions.new_code.long'
+ name: 'quality_gates.conditions.new_code.long',
})
);
@@ -248,7 +248,7 @@ it('should be able to handle delete condition', async () => {
const newConditions = within(
await screen.findByRole('table', {
- name: 'quality_gates.conditions.new_code.long'
+ name: 'quality_gates.conditions.new_code.long',
})
);
@@ -357,7 +357,7 @@ describe('The Project section', () => {
it('should display show more button if there are multiple pages of data', async () => {
(searchProjects as jest.Mock).mockResolvedValueOnce({
paging: { pageIndex: 2, pageSize: 3, total: 55 },
- results: []
+ results: [],
});
const user = userEvent.setup();
@@ -378,7 +378,7 @@ describe('The Permissions section', () => {
// await just to make sure we've loaded the page
expect(
await screen.findByRole('menuitem', {
- name: `${handler.getDefaultQualityGate().name} default`
+ name: `${handler.getDefaultQualityGate().name} default`,
})
).toBeInTheDocument();
@@ -389,7 +389,7 @@ describe('The Permissions section', () => {
renderQualityGateApp();
const grantPermissionButton = await screen.findByRole('button', {
- name: 'quality_gates.permissions.grant'
+ name: 'quality_gates.permissions.grant',
});
expect(screen.getByText('quality_gates.permissions')).toBeInTheDocument();
expect(grantPermissionButton).toBeInTheDocument();
@@ -404,14 +404,14 @@ describe('The Permissions section', () => {
// Granting permission to a user
const grantPermissionButton = await screen.findByRole('button', {
- name: 'quality_gates.permissions.grant'
+ name: 'quality_gates.permissions.grant',
});
await user.click(grantPermissionButton);
const popup = screen.getByRole('dialog');
const searchUserInput = within(popup).getByRole('textbox');
expect(searchUserInput).toBeInTheDocument();
const addUserButton = screen.getByRole('button', {
- name: 'add_verb'
+ name: 'add_verb',
});
expect(addUserButton).toBeDisabled();
await user.click(searchUserInput);
@@ -427,7 +427,7 @@ describe('The Permissions section', () => {
await user.keyboard('test{Enter}');
const cancelButton = screen.getByRole('button', {
- name: 'cancel'
+ name: 'cancel',
});
await user.click(cancelButton);
@@ -453,13 +453,13 @@ describe('The Permissions section', () => {
// Granting permission to a group
const grantPermissionButton = await screen.findByRole('button', {
- name: 'quality_gates.permissions.grant'
+ name: 'quality_gates.permissions.grant',
});
await user.click(grantPermissionButton);
const popup = screen.getByRole('dialog');
const searchUserInput = within(popup).getByRole('textbox');
const addUserButton = screen.getByRole('button', {
- name: 'add_verb'
+ name: 'add_verb',
});
await user.click(searchUserInput);
expect(screen.getAllByTestId('qg-add-permission-option')).toHaveLength(2);
@@ -484,7 +484,7 @@ describe('The Permissions section', () => {
renderQualityGateApp();
const grantPermissionButton = await screen.findByRole('button', {
- name: 'quality_gates.permissions.grant'
+ name: 'quality_gates.permissions.grant',
});
await user.click(grantPermissionButton);
const popup = screen.getByRole('dialog');
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/utils.ts b/server/sonar-web/src/main/js/apps/quality-gates/utils.ts
index 9da8421c861..1529fb8b5fd 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/utils.ts
+++ b/server/sonar-web/src/main/js/apps/quality-gates/utils.ts
@@ -22,7 +22,7 @@ import { isDiffMetric } from '../../helpers/measures';
import { Condition, Dict, Metric, QualityGate } from '../../types/types';
export function checkIfDefault(qualityGate: QualityGate, list: QualityGate[]): boolean {
- const finding = list.find(candidate => candidate.id === qualityGate.id);
+ const finding = list.find((candidate) => candidate.id === qualityGate.id);
return (finding && finding.isDefault) || false;
}
@@ -34,7 +34,7 @@ export function addCondition(qualityGate: QualityGate, condition: Condition): Qu
export function deleteCondition(qualityGate: QualityGate, condition: Condition): QualityGate {
const conditions =
- qualityGate.conditions && qualityGate.conditions.filter(candidate => candidate !== condition);
+ qualityGate.conditions && qualityGate.conditions.filter((candidate) => candidate !== condition);
return { ...qualityGate, conditions };
}
@@ -45,7 +45,7 @@ export function replaceCondition(
): QualityGate {
const conditions =
qualityGate.conditions &&
- qualityGate.conditions.map(candidate => {
+ qualityGate.conditions.map((candidate) => {
return candidate === oldCondition ? newCondition : candidate;
});
return { ...qualityGate, conditions };
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx
index da8a8f24414..86b257d77f9 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx
@@ -37,8 +37,8 @@ export default function Changelog(props: Props) {
const sortedRows = sortBy(
props.events,
// sort events by date, rounded to a minute, recent events first
- e => -Number(parseDate(e.date)),
- e => e.action
+ (e) => -Number(parseDate(e.date)),
+ (e) => e.action
);
const rows = sortedRows.map((event, index) => {
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx
index 8b4956b25d9..8523187ff76 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.tsx
@@ -71,7 +71,7 @@ export class ChangelogContainer extends React.PureComponent<Props, State> {
this.setState({ loading: true });
const {
location: { query },
- profile
+ profile,
} = this.props;
getProfileChangelog(query.since, query.to, profile)
@@ -81,7 +81,7 @@ export class ChangelogContainer extends React.PureComponent<Props, State> {
events: r.events,
total: r.total,
page: r.p,
- loading: false
+ loading: false,
});
}
})
@@ -96,7 +96,7 @@ export class ChangelogContainer extends React.PureComponent<Props, State> {
this.setState({ loading: true });
const {
location: { query },
- profile
+ profile,
} = this.props;
getProfileChangelog(query.since, query.to, profile, this.state.page + 1)
@@ -106,7 +106,7 @@ export class ChangelogContainer extends React.PureComponent<Props, State> {
events: [...events, ...r.events],
total: r.total,
page: r.p,
- loading: false
+ loading: false,
}));
}
})
@@ -117,7 +117,7 @@ export class ChangelogContainer extends React.PureComponent<Props, State> {
handleDateRangeChange = ({ from, to }: { from?: Date; to?: Date }) => {
const path = getProfileChangelogPath(this.props.profile.name, this.props.profile.language, {
since: from && toShortNotSoISOString(from),
- to: to && toShortNotSoISOString(to)
+ to: to && toShortNotSoISOString(to),
});
this.props.router.push(path);
};
@@ -141,7 +141,7 @@ export class ChangelogContainer extends React.PureComponent<Props, State> {
<ChangelogSearch
dateRange={{
from: query.since ? parseDate(query.since) : undefined,
- to: query.to ? parseDate(query.to) : undefined
+ to: query.to ? parseDate(query.to) : undefined,
}}
onDateRangeChange={this.handleDateRangeChange}
onReset={this.handleReset}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx
index c70cbdf3e02..6d6fc54e423 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangesList.tsx
@@ -34,7 +34,7 @@ export default function ChangesList({ changes }: Props) {
return (
<ul>
- {Object.keys(changes).map(key => (
+ {Object.keys(changes).map((key) => (
<li key={key}>
{key === 'severity' ? (
renderSeverity(key)
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx
index 3e6999ecc14..f826742ef7d 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx
@@ -32,7 +32,7 @@ function createEvent(overrides?: Partial<ProfileChangelogEvent>): ProfileChangel
ruleKey: 'squid1234',
ruleName: 'Do not do this',
params: {},
- ...overrides
+ ...overrides,
};
}
@@ -86,17 +86,12 @@ it('should render events sorted by time and action', () => {
createEvent({ date: '2019-02-07T14:03:45', action: 'DEACTIVATED' }),
createEvent({ date: '2019-02-07T14:03:14', action: 'DEACTIVATED' }),
createEvent({ date: '2019-02-07T14:03:14', action: 'ACTIVATED' }),
- createEvent({ date: '2019-02-07T14:03:07', action: 'ACTIVATED' })
+ createEvent({ date: '2019-02-07T14:03:07', action: 'ACTIVATED' }),
];
const changelog = shallow(<Changelog events={events} />);
const rows = changelog.find('tbody').find('tr');
- const getAction = (index: number) =>
- rows
- .at(index)
- .childAt(2)
- .childAt(0)
- .text();
+ const getAction = (index: number) => rows.at(index).childAt(2).childAt(0).text();
expect(getAction(0)).toBe('quality_profiles.changelog.DEACTIVATED');
expect(getAction(1)).toBe('quality_profiles.changelog.ACTIVATED');
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-test.tsx
index 5dbbca09e6c..d01609efb72 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogContainer-test.tsx
@@ -33,11 +33,11 @@ jest.mock('../../../../api/quality-profiles', () => {
events: [
mockQualityProfileChangelogEvent(),
mockQualityProfileChangelogEvent(),
- mockQualityProfileChangelogEvent()
+ mockQualityProfileChangelogEvent(),
],
total: 6,
- p: 1
- })
+ p: 1,
+ }),
};
});
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogSearch-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogSearch-test.tsx
index 0c41ffa2862..c04b69b7574 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogSearch-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/ChangelogSearch-test.tsx
@@ -28,7 +28,7 @@ it('should render', () => {
<ChangelogSearch
dateRange={{
from: parseDate('2016-01-01T00:00:00.000Z'),
- to: parseDate('2016-05-05T00:00:00.000Z')
+ to: parseDate('2016-05-05T00:00:00.000Z'),
}}
onDateRangeChange={jest.fn()}
onReset={jest.fn()}
@@ -43,7 +43,7 @@ it('should reset', () => {
<ChangelogSearch
dateRange={{
from: parseDate('2016-01-01T00:00:00.000Z'),
- to: parseDate('2016-05-05T00:00:00.000Z')
+ to: parseDate('2016-05-05T00:00:00.000Z'),
}}
onDateRangeChange={jest.fn()}
onReset={onReset}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx
index ee9d0ce8e91..211ae33c658 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx
@@ -117,7 +117,7 @@ class ComparisonContainer extends React.PureComponent<Props, State> {
modified={this.state.modified}
refresh={this.loadResults}
right={this.state.right}
- rightProfile={profiles.find(p => p.key === withKey)}
+ rightProfile={profiles.find((p) => p.key === withKey)}
/>
</div>
)}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx
index 66951094fee..3503044bc75 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx
@@ -59,8 +59,8 @@ export default class ComparisonForm extends React.PureComponent<Props> {
render() {
const { profile, profiles, withKey } = this.props;
const options = profiles
- .filter(p => p.language === profile.language && p !== profile)
- .map(p => ({ value: p.key, label: p.name, isDefault: p.isDefault }));
+ .filter((p) => p.language === profile.language && p !== profile)
+ .map((p) => ({ value: p.key, label: p.name, isDefault: p.isDefault }));
return (
<div className="display-inline-block">
@@ -78,9 +78,9 @@ export default class ComparisonForm extends React.PureComponent<Props> {
isSearchable={true}
components={{
Option: this.optionRenderer.bind(this, options),
- SingleValue: this.singleValueRenderer.bind(null, options)
+ SingleValue: this.singleValueRenderer.bind(null, options),
}}
- value={options.filter(o => o.value === withKey)}
+ value={options.filter((o) => o.value === withKey)}
/>
</div>
);
@@ -88,7 +88,7 @@ export default class ComparisonForm extends React.PureComponent<Props> {
}
function renderValue(p: Omit<Option, 'label' | 'isDefault'>, options: Option[]) {
- const selectedOption = options.find(o => o.value === p.value);
+ const selectedOption = options.find((o) => o.value === p.value);
if (selectedOption !== undefined) {
return (
<div>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx
index 538e9b08741..d8d0c30a7b5 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx
@@ -53,7 +53,7 @@ export default class ComparisonResults extends React.PureComponent<Props> {
}
return (
<ul>
- {Object.keys(params).map(key => (
+ {Object.keys(params).map((key) => (
<li className="spacer-top break-word" key={key}>
<code>
{key}
@@ -84,7 +84,7 @@ export default class ComparisonResults extends React.PureComponent<Props> {
</td>
<td>&nbsp;</td>
</tr>
- {this.props.inLeft.map(rule => (
+ {this.props.inLeft.map((rule) => (
<tr className="js-comparison-in-left" key={`left-${rule.key}`}>
<td>{this.renderRule(rule, rule.severity)}</td>
<td>
@@ -93,7 +93,8 @@ export default class ComparisonResults extends React.PureComponent<Props> {
key={rule.key}
onDone={this.props.refresh}
profile={this.props.rightProfile}
- ruleKey={rule.key}>
+ ruleKey={rule.key}
+ >
<ChevronRightIcon />
</ComparisonResultActivation>
)}
@@ -122,14 +123,15 @@ export default class ComparisonResults extends React.PureComponent<Props> {
</h6>
</td>
</tr>
- {this.props.inRight.map(rule => (
+ {this.props.inRight.map((rule) => (
<tr className="js-comparison-in-right" key={`right-${rule.key}`}>
<td className="text-right">
<ComparisonResultActivation
key={rule.key}
onDone={this.props.refresh}
profile={this.props.leftProfile}
- ruleKey={rule.key}>
+ ruleKey={rule.key}
+ >
<ChevronLeftIcon />
</ComparisonResultActivation>
</td>
@@ -164,7 +166,7 @@ export default class ComparisonResults extends React.PureComponent<Props> {
<h6>{this.props.right.name}</h6>
</td>
</tr>
- {this.props.modified.map(rule => (
+ {this.props.modified.map((rule) => (
<tr className="js-comparison-modified" key={`modified-${rule.key}`}>
<td>
{this.renderRule(rule, rule.left.severity)}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonForm-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonForm-test.tsx
index 6d55832dfd3..3694ed2ed33 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonForm-test.tsx
@@ -29,10 +29,10 @@ it('should render Select with right options', () => {
expect(output.length).toBe(1);
expect(output.prop('value')).toEqual([
- { isDefault: true, value: 'another', label: 'another name' }
+ { isDefault: true, value: 'another', label: 'another name' },
]);
expect(output.prop('options')).toEqual([
- { isDefault: true, value: 'another', label: 'another name' }
+ { isDefault: true, value: 'another', label: 'another name' },
]);
});
@@ -42,8 +42,8 @@ it('should render option correctly', () => {
{
value: 'val',
label: 'label',
- isDefault: undefined
- }
+ isDefault: undefined,
+ },
];
const OptionRenderer = wrapper.instance().optionRenderer.bind(null, mockOptions);
expect(
@@ -57,8 +57,8 @@ it('should render value correctly', () => {
{
value: 'val',
label: 'label',
- isDefault: true
- }
+ isDefault: true,
+ },
];
const ValueRenderer = wrapper.instance().singleValueRenderer.bind(null, mockOptions);
expect(
@@ -71,7 +71,7 @@ function shallowRender(overrides: Partial<ComparisonForm['props']> = {}) {
const profiles = [
profile,
mockQualityProfile({ key: 'another', name: 'another name', isDefault: true }),
- mockQualityProfile({ key: 'java', name: 'java', language: 'java' })
+ mockQualityProfile({ key: 'java', name: 'java', language: 'java' }),
];
return shallow<ComparisonForm>(
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResultActivation-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResultActivation-test.tsx
index 29af4bbda99..faa6e4101e8 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResultActivation-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResultActivation-test.tsx
@@ -24,7 +24,7 @@ import { click, waitAndUpdate } from '../../../../helpers/testUtils';
import ComparisonResultActivation from '../ComparisonResultActivation';
jest.mock('../../../../api/rules', () => ({
- getRuleDetails: jest.fn().mockResolvedValue({ key: 'foo' })
+ getRuleDetails: jest.fn().mockResolvedValue({ key: 'foo' }),
}));
it('should activate', async () => {
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx
index 8a477b618e1..3c4922760e1 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx
@@ -43,7 +43,7 @@ it('should compare', () => {
const inLeft = [{ key: 'rule1', name: 'rule1', severity: 'BLOCKER' }];
const inRight = [
{ key: 'rule2', name: 'rule2', severity: 'CRITICAL' },
- { key: 'rule3', name: 'rule3', severity: 'MAJOR' }
+ { key: 'rule3', name: 'rule3', severity: 'MAJOR' },
];
const modified = [
{
@@ -51,13 +51,13 @@ it('should compare', () => {
name: 'rule4',
left: {
severity: 'BLOCKER',
- params: { foo: 'bar' }
+ params: { foo: 'bar' },
},
right: {
severity: 'INFO',
- params: { foo: 'qwe' }
- }
- }
+ params: { foo: 'qwe' },
+ },
+ },
];
const output = shallow(
@@ -83,40 +83,21 @@ it('should compare', () => {
const rightDiffs = output.find('.js-comparison-in-right');
expect(rightDiffs.length).toBe(2);
expect(rightDiffs.at(0).find(Link).length).toBe(1);
- expect(
- rightDiffs
- .at(0)
- .find(Link)
- .prop('to')
- ).toHaveProperty('search', '?rule_key=rule2&open=rule2');
- expect(
- rightDiffs
- .at(0)
- .find(Link)
- .prop('children')
- ).toContain('rule2');
+ expect(rightDiffs.at(0).find(Link).prop('to')).toHaveProperty(
+ 'search',
+ '?rule_key=rule2&open=rule2'
+ );
+ expect(rightDiffs.at(0).find(Link).prop('children')).toContain('rule2');
expect(rightDiffs.at(0).find('SeverityIcon').length).toBe(1);
- expect(
- rightDiffs
- .at(0)
- .find('SeverityIcon')
- .prop('severity')
- ).toBe('CRITICAL');
+ expect(rightDiffs.at(0).find('SeverityIcon').prop('severity')).toBe('CRITICAL');
const modifiedDiffs = output.find('.js-comparison-modified');
expect(modifiedDiffs.length).toBe(1);
- expect(
- modifiedDiffs
- .find(Link)
- .at(0)
- .prop('to')
- ).toHaveProperty('search', '?rule_key=rule4&open=rule4');
- expect(
- modifiedDiffs
- .find(Link)
- .at(0)
- .prop('children')
- ).toContain('rule4');
+ expect(modifiedDiffs.find(Link).at(0).prop('to')).toHaveProperty(
+ 'search',
+ '?rule_key=rule4&open=rule4'
+ );
+ expect(modifiedDiffs.find(Link).at(0).prop('children')).toContain('rule4');
expect(modifiedDiffs.find('SeverityIcon').length).toBe(2);
expect(modifiedDiffs.text()).toContain('bar');
expect(modifiedDiffs.text()).toContain('qwe');
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx
index 683f3f753a2..25ebe6dba98 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/DeleteProfileForm.tsx
@@ -41,7 +41,8 @@ export default function DeleteProfileForm(props: DeleteProfileFormProps) {
onSubmit={(e: React.SyntheticEvent<HTMLFormElement>) => {
e.preventDefault();
props.onDelete();
- }}>
+ }}
+ >
<div className="modal-head">
<h2>{header}</h2>
</div>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx
index e3c36f91310..10c8f340f34 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.tsx
@@ -25,11 +25,11 @@ import {
deleteProfile,
getQualityProfileBackupUrl,
renameProfile,
- setDefaultProfile
+ setDefaultProfile,
} from '../../../api/quality-profiles';
import ActionsDropdown, {
ActionsDropdownDivider,
- ActionsDropdownItem
+ ActionsDropdownItem,
} from '../../../components/controls/ActionsDropdown';
import Tooltip from '../../../components/controls/Tooltip';
import { Router, withRouter } from '../../../components/hoc/withRouter';
@@ -56,7 +56,7 @@ interface State {
export class ProfileActions extends React.PureComponent<Props, State> {
mounted = false;
state: State = {
- loading: false
+ loading: false,
};
componentDidMount() {
@@ -103,7 +103,7 @@ export class ProfileActions extends React.PureComponent<Props, State> {
const data = {
language: parentProfile.language,
- name
+ name,
};
this.setState({ loading: true });
@@ -183,7 +183,7 @@ export class ProfileActions extends React.PureComponent<Props, State> {
const activateMoreUrl = getRulesUrl({
qprofile: profile.key,
- activation: 'false'
+ activation: 'false',
});
const hasNoActiveRules = profile.activeRuleCount === 0;
@@ -194,7 +194,8 @@ export class ProfileActions extends React.PureComponent<Props, State> {
{actions.edit && (
<ActionsDropdownItem
className="it__quality-profiles__activate-more-rules"
- to={activateMoreUrl}>
+ to={activateMoreUrl}
+ >
{translate('quality_profiles.activate_more_rules')}
</ActionsDropdownItem>
)}
@@ -203,14 +204,16 @@ export class ProfileActions extends React.PureComponent<Props, State> {
<ActionsDropdownItem
className="it__quality-profiles__backup"
download={`${profile.key}.xml`}
- to={backupUrl}>
+ to={backupUrl}
+ >
{translate('backup_verb')}
</ActionsDropdownItem>
)}
<ActionsDropdownItem
className="it__quality-profiles__compare"
- to={getProfileComparePath(profile.name, profile.language)}>
+ to={getProfileComparePath(profile.name, profile.language)}
+ >
{translate('compare')}
</ActionsDropdownItem>
@@ -218,13 +221,15 @@ export class ProfileActions extends React.PureComponent<Props, State> {
<>
<ActionsDropdownItem
className="it__quality-profiles__copy"
- onClick={this.handleCopyClick}>
+ onClick={this.handleCopyClick}
+ >
{translate('copy')}
</ActionsDropdownItem>
<ActionsDropdownItem
className="it__quality-profiles__extend"
- onClick={this.handleExtendClick}>
+ onClick={this.handleExtendClick}
+ >
{translate('extend')}
</ActionsDropdownItem>
</>
@@ -233,7 +238,8 @@ export class ProfileActions extends React.PureComponent<Props, State> {
{actions.edit && (
<ActionsDropdownItem
className="it__quality-profiles__rename"
- onClick={this.handleRenameClick}>
+ onClick={this.handleRenameClick}
+ >
{translate('rename')}
</ActionsDropdownItem>
)}
@@ -243,7 +249,8 @@ export class ProfileActions extends React.PureComponent<Props, State> {
<li>
<Tooltip
placement="left"
- overlay={translate('quality_profiles.cannot_set_default_no_rules')}>
+ overlay={translate('quality_profiles.cannot_set_default_no_rules')}
+ >
<span className="it__quality-profiles__set-as-default text-muted-2">
{translate('set_as_default')}
</span>
@@ -252,7 +259,8 @@ export class ProfileActions extends React.PureComponent<Props, State> {
) : (
<ActionsDropdownItem
className="it__quality-profiles__set-as-default"
- onClick={this.handleSetDefaultClick}>
+ onClick={this.handleSetDefaultClick}
+ >
{translate('set_as_default')}
</ActionsDropdownItem>
))}
@@ -263,7 +271,8 @@ export class ProfileActions extends React.PureComponent<Props, State> {
<ActionsDropdownItem
className="it__quality-profiles__delete"
destructive={true}
- onClick={this.handleDeleteClick}>
+ onClick={this.handleDeleteClick}
+ >
{translate('delete')}
</ActionsDropdownItem>
)}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx
index a2a4be95c85..5e18a430888 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.tsx
@@ -36,7 +36,7 @@ export function ProfileContainer(props: QualityProfilesContextProps) {
// try to find a quality profile with the given key
// if managed to find one, redirect to a new version
// otherwise show not found page
- const profileForKey = key && profiles.find(p => p.key === location.query.key);
+ const profileForKey = key && profiles.find((p) => p.key === location.query.key);
React.useEffect(() => {
if (profileForKey) {
@@ -48,7 +48,7 @@ export function ProfileContainer(props: QualityProfilesContextProps) {
return profileForKey ? null : <ProfileNotFound />;
}
- const profile = profiles.find(p => p.language === language && p.name === name);
+ const profile = profiles.find((p) => p.language === language && p.name === name);
if (!profile) {
return <ProfileNotFound />;
@@ -56,7 +56,7 @@ export function ProfileContainer(props: QualityProfilesContextProps) {
const context: QualityProfilesContextProps = {
profile,
- ...props
+ ...props,
};
return (
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileLink.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileLink.tsx
index f9bacdde9b5..355e3c35949 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileLink.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileLink.tsx
@@ -33,7 +33,8 @@ export default function ProfileLink({ name, language, children, ...other }: Prop
<NavLink
className={({ isActive }) => (isActive ? 'link-no-underline' : '')}
to={getProfilePath(name, language)}
- {...other}>
+ {...other}
+ >
{children}
</NavLink>
);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileModalForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileModalForm.tsx
index 8efe380f9ab..e3bf1c76517 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileModalForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileModalForm.tsx
@@ -49,7 +49,8 @@ export default function ProfileModalForm(props: ProfileModalFormProps) {
if (name) {
props.onSubmit(name);
}
- }}>
+ }}
+ >
<div className="modal-head">
<h2>{header}</h2>
</div>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/QualityProfilesApp.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/QualityProfilesApp.tsx
index 1603ff9e0f5..009b79ec439 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/QualityProfilesApp.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/QualityProfilesApp.tsx
@@ -67,7 +67,7 @@ export class QualityProfilesApp extends React.PureComponent<Props, State> {
actions: profilesResponse.actions,
exporters,
profiles: sortProfiles(profilesResponse.profiles),
- loading: false
+ loading: false,
});
}
},
@@ -80,7 +80,7 @@ export class QualityProfilesApp extends React.PureComponent<Props, State> {
}
updateProfiles = () => {
- return this.fetchProfiles().then(r => {
+ return this.fetchProfiles().then((r) => {
if (this.mounted) {
this.setState({ profiles: sortProfiles(r.profiles) });
}
@@ -100,7 +100,7 @@ export class QualityProfilesApp extends React.PureComponent<Props, State> {
profiles: profiles || [],
languages: finalLanguages,
exporters: exporters || [],
- updateProfiles: this.updateProfiles
+ updateProfiles: this.updateProfiles,
};
return <Outlet context={context} />;
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/ProfileActions-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/ProfileActions-test.tsx
index 6c72b8a87a7..1b74b4165c0 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/ProfileActions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/ProfileActions-test.tsx
@@ -25,7 +25,7 @@ import {
createQualityProfile,
deleteProfile,
renameProfile,
- setDefaultProfile
+ setDefaultProfile,
} from '../../../../api/quality-profiles';
import { mockQualityProfile, mockRouter } from '../../../../helpers/testMocks';
import { click, waitAndUpdate } from '../../../../helpers/testUtils';
@@ -48,7 +48,7 @@ jest.mock('../../../../api/quality-profiles', () => {
.mockResolvedValue({ profile: mockQualityProfile({ key: 'newProfile' }) }),
deleteProfile: jest.fn().mockResolvedValue(null),
setDefaultProfile: jest.fn().mockResolvedValue(null),
- renameProfile: jest.fn().mockResolvedValue(null)
+ renameProfile: jest.fn().mockResolvedValue(null),
};
});
@@ -57,7 +57,7 @@ const PROFILE = mockQualityProfile({
activeDeprecatedRuleCount: 0,
depth: 0,
language: 'js',
- rulesUpdatedAt: '2017-06-28T12:58:44+0000'
+ rulesUpdatedAt: '2017-06-28T12:58:44+0000',
});
beforeEach(() => jest.clearAllMocks());
@@ -76,9 +76,9 @@ it('renders correctly', () => {
edit: true,
delete: true,
setAsDefault: true,
- associateProjects: true
- }
- }
+ associateProjects: true,
+ },
+ },
})
).toMatchSnapshot('all permissions');
@@ -104,23 +104,20 @@ describe('copy a profile', () => {
const wrapper = shallowRender({
profile: { ...PROFILE, actions: { copy: true } },
router: mockRouter({ push }),
- updateProfiles
+ updateProfiles,
});
click(wrapper.find('.it__quality-profiles__copy'));
expect(wrapper.find(ProfileModalForm).exists()).toBe(true);
- wrapper
- .find(ProfileModalForm)
- .props()
- .onSubmit(name);
+ wrapper.find(ProfileModalForm).props().onSubmit(name);
expect(copyProfile).toHaveBeenCalledWith(PROFILE.key, name);
await waitAndUpdate(wrapper);
expect(updateProfiles).toHaveBeenCalled();
expect(push).toHaveBeenCalledWith({
pathname: '/profiles/show',
- search: queryToSearch({ name, language: 'js' })
+ search: queryToSearch({ name, language: 'js' }),
});
expect(wrapper.find(ProfileModalForm).exists()).toBe(false);
});
@@ -134,7 +131,7 @@ describe('copy a profile', () => {
const wrapper = shallowRender({
profile: { ...PROFILE, actions: { copy: true } },
router: mockRouter({ push }),
- updateProfiles
+ updateProfiles,
});
wrapper.setState({ openModal: ProfileActionModals.Copy });
@@ -158,21 +155,18 @@ describe('extend a profile', () => {
const wrapper = shallowRender({
profile,
router: mockRouter({ push }),
- updateProfiles
+ updateProfiles,
});
click(wrapper.find('.it__quality-profiles__extend'));
expect(wrapper.find(ProfileModalForm).exists()).toBe(true);
- wrapper
- .find(ProfileModalForm)
- .props()
- .onSubmit(name);
+ wrapper.find(ProfileModalForm).props().onSubmit(name);
expect(createQualityProfile).toHaveBeenCalledWith({ language: profile.language, name });
await waitAndUpdate(wrapper);
expect(changeProfileParent).toHaveBeenCalledWith(
expect.objectContaining({
- key: 'newProfile'
+ key: 'newProfile',
}),
profile
);
@@ -183,7 +177,7 @@ describe('extend a profile', () => {
expect(push).toHaveBeenCalledWith({
pathname: '/profiles/show',
- search: queryToSearch({ name, language: 'js' })
+ search: queryToSearch({ name, language: 'js' }),
});
expect(wrapper.find(ProfileModalForm).exists()).toBe(false);
});
@@ -197,7 +191,7 @@ describe('extend a profile', () => {
const wrapper = shallowRender({
profile: { ...PROFILE, actions: { copy: true } },
router: mockRouter({ push }),
- updateProfiles
+ updateProfiles,
});
wrapper.setState({ openModal: ProfileActionModals.Extend });
@@ -219,23 +213,20 @@ describe('rename a profile', () => {
const wrapper = shallowRender({
profile: { ...PROFILE, actions: { edit: true } },
router: mockRouter({ push }),
- updateProfiles
+ updateProfiles,
});
click(wrapper.find('.it__quality-profiles__rename'));
expect(wrapper.find(ProfileModalForm).exists()).toBe(true);
- wrapper
- .find(ProfileModalForm)
- .props()
- .onSubmit(name);
+ wrapper.find(ProfileModalForm).props().onSubmit(name);
expect(renameProfile).toHaveBeenCalledWith(PROFILE.key, name);
await waitAndUpdate(wrapper);
expect(updateProfiles).toHaveBeenCalled();
expect(push).toHaveBeenCalledWith({
pathname: '/profiles/show',
- search: queryToSearch({ name, language: 'js' })
+ search: queryToSearch({ name, language: 'js' }),
});
expect(wrapper.find(ProfileModalForm).exists()).toBe(false);
});
@@ -249,7 +240,7 @@ describe('rename a profile', () => {
const wrapper = shallowRender({
profile: { ...PROFILE, actions: { copy: true } },
router: mockRouter({ push }),
- updateProfiles
+ updateProfiles,
});
wrapper.setState({ openModal: ProfileActionModals.Rename });
@@ -272,16 +263,13 @@ describe('delete a profile', () => {
const wrapper = shallowRender({
profile,
router: mockRouter({ replace }),
- updateProfiles
+ updateProfiles,
});
click(wrapper.find('.it__quality-profiles__delete'));
expect(wrapper.find(DeleteProfileForm).exists()).toBe(true);
- wrapper
- .find(DeleteProfileForm)
- .props()
- .onDelete();
+ wrapper.find(DeleteProfileForm).props().onDelete();
expect(deleteProfile).toHaveBeenCalledWith(profile);
await waitAndUpdate(wrapper);
@@ -298,7 +286,7 @@ describe('delete a profile', () => {
const wrapper = shallowRender({
profile: { ...PROFILE, actions: { copy: true } },
router: mockRouter({ replace }),
- updateProfiles
+ updateProfiles,
});
wrapper.setState({ openModal: ProfileActionModals.Delete });
@@ -328,8 +316,8 @@ it('should not allow to set a profile as the default if the profile has no activ
const profile = mockQualityProfile({
activeRuleCount: 0,
actions: {
- setAsDefault: true
- }
+ setAsDefault: true,
+ },
});
const wrapper = shallowRender({ profile });
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/ProfileContainer-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/ProfileContainer-test.tsx
index 48886252019..ee5055d99a5 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/ProfileContainer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/ProfileContainer-test.tsx
@@ -24,7 +24,7 @@ import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { mockQualityProfile } from '../../../../helpers/testMocks';
import {
QualityProfilesContextProps,
- withQualityProfilesContext
+ withQualityProfilesContext,
} from '../../qualityProfilesContext';
import { Profile } from '../../types';
import { ProfileContainer } from '../ProfileContainer';
@@ -32,7 +32,7 @@ import { ProfileContainer } from '../ProfileContainer';
it('should render the header and child', () => {
const targetProfile = mockQualityProfile({ name: 'profile1' });
renderProfileContainer('/?language=js&name=profile1', {
- profiles: [mockQualityProfile({ language: 'Java', name: 'profile1' }), targetProfile]
+ profiles: [mockQualityProfile({ language: 'Java', name: 'profile1' }), targetProfile],
});
expect(screen.getByText('profile1')).toBeInTheDocument();
@@ -40,7 +40,7 @@ it('should render the header and child', () => {
it('should render "not found"', () => {
renderProfileContainer('/?language=java&name=profile2', {
- profiles: [mockQualityProfile({ name: 'profile1' }), mockQualityProfile({ name: 'profile2' })]
+ profiles: [mockQualityProfile({ name: 'profile1' }), mockQualityProfile({ name: 'profile2' })],
});
expect(screen.getByText('quality_profiles.not_found')).toBeInTheDocument();
@@ -48,7 +48,7 @@ it('should render "not found"', () => {
it('should render "not found" for wrong key', () => {
renderProfileContainer('/?key=wrongKey', {
- profiles: [mockQualityProfile({ key: 'profileKey' })]
+ profiles: [mockQualityProfile({ key: 'profileKey' })],
});
expect(screen.getByText('quality_profiles.not_found')).toBeInTheDocument();
@@ -56,7 +56,7 @@ it('should render "not found" for wrong key', () => {
it('should handle getting profile by key', () => {
renderProfileContainer('/?key=profileKey', {
- profiles: [mockQualityProfile({ key: 'profileKey', name: 'found the profile' })]
+ profiles: [mockQualityProfile({ key: 'profileKey', name: 'found the profile' })],
});
expect(screen.getByText('found the profile')).toBeInTheDocument();
@@ -83,7 +83,8 @@ function renderProfileContainer(path: string, overrides: Partial<QualityProfiles
updateProfiles={jest.fn()}
{...overrides}
/>
- }>
+ }
+ >
<Route path="*" element={<WrappedChild />} />
</Route>
</Routes>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/QualityProfilesApp-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/QualityProfilesApp-test.tsx
index f1d6fb52311..25c38b1fb1d 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/QualityProfilesApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/__tests__/QualityProfilesApp-test.tsx
@@ -23,14 +23,14 @@ import { Actions, getExporters, searchQualityProfiles } from '../../../../api/qu
import {
mockLanguage,
mockQualityProfile,
- mockQualityProfileExporter
+ mockQualityProfileExporter,
} from '../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../helpers/testUtils';
import { QualityProfilesApp } from '../QualityProfilesApp';
jest.mock('../../../../api/quality-profiles', () => ({
getExporters: jest.fn().mockResolvedValue([]),
- searchQualityProfiles: jest.fn().mockResolvedValue({ profiles: [] })
+ searchQualityProfiles: jest.fn().mockResolvedValue({ profiles: [] }),
}));
it('should render correctly', async () => {
@@ -60,8 +60,8 @@ it('should render child with additional props', () => {
profiles,
languages: [language],
exporters,
- updateProfiles: wrapper.instance().updateProfiles
- }
+ updateProfiles: wrapper.instance().updateProfiles,
+ },
});
});
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx
index ddca5097076..581625933a4 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeParentForm.tsx
@@ -44,7 +44,7 @@ export default class ChangeParentForm extends React.PureComponent<Props, State>
mounted = false;
state: State = {
loading: false,
- selected: null
+ selected: null,
};
componentDidMount() {
@@ -62,7 +62,7 @@ export default class ChangeParentForm extends React.PureComponent<Props, State>
handleFormSubmit = (event: React.SyntheticEvent<HTMLFormElement>) => {
event.preventDefault();
- const parent = this.props.profiles.find(p => p.key === this.state.selected);
+ const parent = this.props.profiles.find((p) => p.key === this.state.selected);
this.setState({ loading: true });
changeProfileParent(this.props.profile, parent)
@@ -79,12 +79,12 @@ export default class ChangeParentForm extends React.PureComponent<Props, State>
const options = [
{ label: translate('none'), value: '' },
- ...sortBy(profiles, 'name').map(profile => ({
+ ...sortBy(profiles, 'name').map((profile) => ({
label: profile.isBuiltIn
? `${profile.name} (${translate('quality_profiles.built_in')})`
: profile.name,
- value: profile.key
- }))
+ value: profile.key,
+ })),
];
const submitDisabled =
@@ -98,7 +98,8 @@ export default class ChangeParentForm extends React.PureComponent<Props, State>
<Modal
contentLabel={translate('quality_profiles.change_parent')}
onRequestClose={this.props.onClose}
- size="small">
+ size="small"
+ >
<form id="change-profile-parent-form" onSubmit={this.handleFormSubmit}>
<div className="modal-head">
<h2>{translate('quality_profiles.change_parent')}</h2>
@@ -120,7 +121,7 @@ export default class ChangeParentForm extends React.PureComponent<Props, State>
onChange={this.handleSelectChange}
options={options}
isSearchable={true}
- value={options.filter(o => o.value === selectedValue)}
+ value={options.filter((o) => o.value === selectedValue)}
/>
</div>
</div>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx
index a9439074e1f..e235924c028 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ChangeProjectsForm.tsx
@@ -23,12 +23,12 @@ import {
associateProject,
dissociateProject,
getProfileProjects,
- ProfileProject
+ ProfileProject,
} from '../../../api/quality-profiles';
import Modal from '../../../components/controls/Modal';
import SelectList, {
SelectListFilter,
- SelectListSearchParams
+ SelectListSearchParams,
} from '../../../components/controls/SelectList';
import { translate } from '../../../helpers/l10n';
import { Profile } from '../types';
@@ -55,7 +55,7 @@ export default class ChangeProjectsForm extends React.PureComponent<Props, State
this.state = {
needToReload: false,
projects: [],
- selectedProjects: []
+ selectedProjects: [],
};
}
@@ -73,16 +73,16 @@ export default class ChangeProjectsForm extends React.PureComponent<Props, State
p: searchParams.page,
ps: searchParams.pageSize,
q: searchParams.query !== '' ? searchParams.query : undefined,
- selected: searchParams.filter
- }).then(data => {
+ selected: searchParams.filter,
+ }).then((data) => {
if (this.mounted) {
- this.setState(prevState => {
+ this.setState((prevState) => {
const more = searchParams.page != null && searchParams.page > 1;
const projects = more ? [...prevState.projects, ...data.results] : data.results;
const newSeletedProjects = data.results
- .filter(project => project.selected)
- .map(project => project.key);
+ .filter((project) => project.selected)
+ .map((project) => project.key);
const selectedProjects = more
? [...prevState.selectedProjects, ...newSeletedProjects]
: newSeletedProjects;
@@ -92,7 +92,7 @@ export default class ChangeProjectsForm extends React.PureComponent<Props, State
needToReload: false,
projects,
projectsTotalCount: data.paging.total,
- selectedProjects
+ selectedProjects,
};
});
}
@@ -103,7 +103,7 @@ export default class ChangeProjectsForm extends React.PureComponent<Props, State
if (this.mounted) {
this.setState((state: State) => ({
needToReload: true,
- selectedProjects: [...state.selectedProjects, key]
+ selectedProjects: [...state.selectedProjects, key],
}));
}
});
@@ -113,7 +113,7 @@ export default class ChangeProjectsForm extends React.PureComponent<Props, State
if (this.mounted) {
this.setState((state: State) => ({
needToReload: true,
- selectedProjects: without(state.selectedProjects, key)
+ selectedProjects: without(state.selectedProjects, key),
}));
}
});
@@ -152,7 +152,7 @@ export default class ChangeProjectsForm extends React.PureComponent<Props, State
<div className="modal-body modal-container" id="profile-projects">
<SelectList
allowBulkSelection={true}
- elements={this.state.projects.map(project => project.key)}
+ elements={this.state.projects.map((project) => project.key)}
elementsTotalCount={this.state.projectsTotalCount}
labelAll={translate('quality_gates.projects.all')}
labelSelected={translate('quality_gates.projects.with')}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx
index 782747c0451..302ef528add 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileExporters.tsx
@@ -38,7 +38,7 @@ export default class ProfileExporters extends React.PureComponent<Props> {
render() {
const { exporters, profile } = this.props;
- const exportersForLanguage = exporters.filter(e => e.languages.includes(profile.language));
+ const exportersForLanguage = exporters.filter((e) => e.languages.includes(profile.language));
if (exportersForLanguage.length === 0) {
return null;
@@ -56,7 +56,8 @@ export default class ProfileExporters extends React.PureComponent<Props> {
<li
className={index > 0 ? 'spacer-top' : undefined}
data-key={exporter.key}
- key={exporter.key}>
+ key={exporter.key}
+ >
<Link to={this.getExportUrl(exporter)} target="_blank">
{exporter.name}
</Link>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx
index 0fe23a07c82..3590f49c20c 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritance.tsx
@@ -46,7 +46,7 @@ export default class ProfileInheritance extends React.PureComponent<Props, State
state: State = {
formOpen: false,
- loading: true
+ loading: true,
};
componentDidMount() {
@@ -66,7 +66,7 @@ export default class ProfileInheritance extends React.PureComponent<Props, State
loadData() {
getProfileInheritance(this.props.profile).then(
- r => {
+ (r) => {
if (this.mounted) {
const { ancestors, children } = r;
ancestors.reverse();
@@ -75,7 +75,7 @@ export default class ProfileInheritance extends React.PureComponent<Props, State
children,
ancestors,
profile: r.profile,
- loading: false
+ loading: false,
});
}
},
@@ -115,7 +115,7 @@ export default class ProfileInheritance extends React.PureComponent<Props, State
this.state.children != null &&
(ancestors.length > 0 || this.state.children.length > 0);
- const extendsBuiltIn = ancestors != null && ancestors.some(profile => profile.isBuiltIn);
+ const extendsBuiltIn = ancestors != null && ancestors.some((profile) => profile.isBuiltIn);
return (
<div className="boxed-group quality-profile-inheritance">
@@ -151,7 +151,7 @@ export default class ProfileInheritance extends React.PureComponent<Props, State
{this.state.profile != null && (
<ProfileInheritanceBox
className={classNames({
- selected: highlightCurrent
+ selected: highlightCurrent,
})}
depth={ancestors ? ancestors.length : 0}
displayLink={false}
@@ -162,7 +162,7 @@ export default class ProfileInheritance extends React.PureComponent<Props, State
)}
{this.state.children != null &&
- this.state.children.map(child => (
+ this.state.children.map((child) => (
<ProfileInheritanceBox
depth={ancestors ? ancestors.length + 1 : 0}
key={child.key}
@@ -181,7 +181,7 @@ export default class ProfileInheritance extends React.PureComponent<Props, State
onChange={this.handleParentChange}
onClose={this.closeForm}
profile={profile}
- profiles={profiles.filter(p => p !== profile && p.language === profile.language)}
+ profiles={profiles.filter((p) => p !== profile && p.language === profile.language)}
/>
)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritanceBox.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritanceBox.tsx
index f0632b24889..9cae8d45881 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritanceBox.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileInheritanceBox.tsx
@@ -43,7 +43,7 @@ export default function ProfileInheritanceBox(props: Props) {
language,
profile,
displayLink = true,
- type = 'current'
+ type = 'current',
} = props;
const offset = 25 * depth;
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissions.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissions.tsx
index 82c2378ef90..acb0b5fff5a 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissions.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissions.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import {
searchGroups,
searchUsers,
- SearchUsersGroupsParameters
+ SearchUsersGroupsParameters,
} from '../../../api/quality-profiles';
import { Button } from '../../../components/controls/buttons';
import { translate } from '../../../helpers/l10n';
@@ -72,7 +72,7 @@ export default class ProfilePermissions extends React.PureComponent<Props, State
const parameters: SearchUsersGroupsParameters = {
language: profile.language,
qualityProfile: profile.name,
- selected: 'selected'
+ selected: 'selected',
};
Promise.all([searchUsers(parameters), searchGroups(parameters)]).then(
([usersResponse, groupsResponse]) => {
@@ -80,7 +80,7 @@ export default class ProfilePermissions extends React.PureComponent<Props, State
this.setState({
groups: groupsResponse.groups,
loading: false,
- users: usersResponse.users
+ users: usersResponse.users,
});
}
},
@@ -106,7 +106,7 @@ export default class ProfilePermissions extends React.PureComponent<Props, State
if (this.mounted) {
this.setState((state: State) => ({
addUserForm: false,
- users: state.users && uniqBy([...state.users, addedUser], user => user.login)
+ users: state.users && uniqBy([...state.users, addedUser], (user) => user.login),
}));
}
};
@@ -114,7 +114,7 @@ export default class ProfilePermissions extends React.PureComponent<Props, State
handleUserDelete = (removedUser: UserSelected) => {
if (this.mounted) {
this.setState((state: State) => ({
- users: state.users && state.users.filter(user => user !== removedUser)
+ users: state.users && state.users.filter((user) => user !== removedUser),
}));
}
};
@@ -123,7 +123,7 @@ export default class ProfilePermissions extends React.PureComponent<Props, State
if (this.mounted) {
this.setState((state: State) => ({
addUserForm: false,
- groups: state.groups && uniqBy([...state.groups, addedGroup], group => group.name)
+ groups: state.groups && uniqBy([...state.groups, addedGroup], (group) => group.name),
}));
}
};
@@ -131,7 +131,7 @@ export default class ProfilePermissions extends React.PureComponent<Props, State
handleGroupDelete = (removedGroup: Group) => {
if (this.mounted) {
this.setState((state: State) => ({
- groups: state.groups && state.groups.filter(group => group !== removedGroup)
+ groups: state.groups && state.groups.filter((group) => group !== removedGroup),
}));
}
};
@@ -150,7 +150,7 @@ export default class ProfilePermissions extends React.PureComponent<Props, State
) : (
<div className="big-spacer-top">
{this.state.users &&
- sortBy(this.state.users, 'name').map(user => (
+ sortBy(this.state.users, 'name').map((user) => (
<ProfilePermissionsUser
key={user.login}
onDelete={this.handleUserDelete}
@@ -159,7 +159,7 @@ export default class ProfilePermissions extends React.PureComponent<Props, State
/>
))}
{this.state.groups &&
- sortBy(this.state.groups, 'name').map(group => (
+ sortBy(this.state.groups, 'name').map((group) => (
<ProfilePermissionsGroup
group={group}
key={group.name}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx
index 420a235e587..13796060312 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsForm.tsx
@@ -58,23 +58,23 @@ export default class ProfilePermissionsForm extends React.PureComponent<Props, S
handleUserAdd = (user: UserSelected) => {
const {
- profile: { language, name }
+ profile: { language, name },
} = this.props;
addUser({
language,
login: user.login,
- qualityProfile: name
+ qualityProfile: name,
}).then(() => this.props.onUserAdd(user), this.stopSubmitting);
};
handleGroupAdd = (group: Group) => {
const {
- profile: { language, name }
+ profile: { language, name },
} = this.props;
addGroup({
group: group.name,
language,
- qualityProfile: name
+ qualityProfile: name,
}).then(() => this.props.onGroupAdd(group), this.stopSubmitting);
};
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx
index 902b39bec96..e9afcfaa57d 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsFormSelect.tsx
@@ -23,7 +23,7 @@ import { components, ControlProps, OptionProps, SingleValueProps } from 'react-s
import {
searchGroups,
searchUsers,
- SearchUsersGroupsParameters
+ SearchUsersGroupsParameters,
} from '../../../api/quality-profiles';
import { SearchSelect } from '../../../components/controls/Select';
import GroupIcon from '../../../components/icons/GroupIcon';
@@ -69,11 +69,11 @@ export default class ProfilePermissionsFormSelect extends React.PureComponent<Pr
language: profile.language,
q,
qualityProfile: profile.name,
- selected: 'deselected'
+ selected: 'deselected',
};
Promise.all([searchUsers(parameters), searchGroups(parameters)])
.then(([usersResponse, groupsResponse]) => [...usersResponse.users, ...groupsResponse.groups])
- .then((options: Option[]) => options.map(opt => ({ ...opt, value: getStringValue(opt) })))
+ .then((options: Option[]) => options.map((opt) => ({ ...opt, value: getStringValue(opt) })))
.then(resolve)
.catch(() => resolve([]));
};
@@ -97,7 +97,7 @@ export default class ProfilePermissionsFormSelect extends React.PureComponent<Pr
components={{
Option: this.optionRenderer,
SingleValue: this.singleValueRenderer,
- Control: this.controlRenderer
+ Control: this.controlRenderer,
}}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsGroup.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsGroup.tsx
index 63903aa5493..68ddaeb38fd 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsGroup.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsGroup.tsx
@@ -64,7 +64,7 @@ export default class ProfilePermissionsGroup extends React.PureComponent<Props,
return removeGroup({
group: group.name,
language: profile.language,
- qualityProfile: profile.name
+ qualityProfile: profile.name,
}).then(() => {
this.handleDeleteModalClose();
this.props.onDelete(group);
@@ -82,7 +82,7 @@ export default class ProfilePermissionsGroup extends React.PureComponent<Props,
defaultMessage={translate('quality_profiles.permissions.remove.group.confirmation')}
id="quality_profiles.permissions.remove.group.confirmation"
values={{
- user: <strong>{this.props.group.name}</strong>
+ user: <strong>{this.props.group.name}</strong>,
}}
/>
</div>
@@ -115,7 +115,8 @@ export default class ProfilePermissionsGroup extends React.PureComponent<Props,
<SimpleModal
header={translate('quality_profiles.permissions.remove.group')}
onClose={this.handleDeleteModalClose}
- onSubmit={this.handleDelete}>
+ onSubmit={this.handleDelete}
+ >
{this.renderDeleteModal}
</SimpleModal>
)}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsUser.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsUser.tsx
index 6bf4fe96931..05bf47dca8a 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsUser.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfilePermissionsUser.tsx
@@ -64,7 +64,7 @@ export default class ProfilePermissionsUser extends React.PureComponent<Props, S
return removeUser({
language: profile.language,
login: user.login,
- qualityProfile: profile.name
+ qualityProfile: profile.name,
}).then(() => {
this.handleDeleteModalClose();
this.props.onDelete(user);
@@ -82,7 +82,7 @@ export default class ProfilePermissionsUser extends React.PureComponent<Props, S
defaultMessage={translate('quality_profiles.permissions.remove.user.confirmation')}
id="quality_profiles.permissions.remove.user.confirmation"
values={{
- user: <strong>{this.props.user.name}</strong>
+ user: <strong>{this.props.user.name}</strong>,
}}
/>
</div>
@@ -92,7 +92,8 @@ export default class ProfilePermissionsUser extends React.PureComponent<Props, S
<SubmitButton
className="button-red"
disabled={props.submitting}
- onClick={props.onSubmitClick}>
+ onClick={props.onSubmitClick}
+ >
{translate('remove')}
</SubmitButton>
<ResetButtonLink onClick={props.onCloseClick}>{translate('cancel')}</ResetButtonLink>
@@ -119,7 +120,8 @@ export default class ProfilePermissionsUser extends React.PureComponent<Props, S
<SimpleModal
header={translate('quality_profiles.permissions.remove.user')}
onClose={this.handleDeleteModalClose}
- onSubmit={this.handleDelete}>
+ onSubmit={this.handleDelete}
+ >
{this.renderDeleteModal}
</SimpleModal>
)}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx
index bf9bc63f3f3..5b7f797cb52 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileProjects.tsx
@@ -51,7 +51,7 @@ export default class ProfileProjects extends React.PureComponent<Props, State> {
loadingMore: false,
page: 1,
projects: [],
- total: 0
+ total: 0,
};
componentDidMount() {
@@ -88,7 +88,7 @@ export default class ProfileProjects extends React.PureComponent<Props, State> {
this.setState({
projects: results,
total: paging.total,
- loading: false
+ loading: false,
});
}
}, this.stopLoading);
@@ -99,10 +99,10 @@ export default class ProfileProjects extends React.PureComponent<Props, State> {
const data = { key: this.props.profile.key, page: this.state.page + 1 };
getProfileProjects(data).then(({ paging, results }) => {
if (this.mounted) {
- this.setState(state => ({
+ this.setState((state) => ({
projects: [...state.projects, ...results],
total: paging.total,
- loadingMore: false
+ loadingMore: false,
}));
}
}, this.stopLoading);
@@ -145,7 +145,7 @@ export default class ProfileProjects extends React.PureComponent<Props, State> {
return (
<>
<ul>
- {projects.map(project => (
+ {projects.map((project) => (
<li className="spacer-top js-profile-project" data-key={project.key} key={project.key}>
<Link to={getProjectUrl(project.key)}>
<QualifierIcon qualifier="TRK" /> <span>{project.name}</span>
@@ -175,11 +175,13 @@ export default class ProfileProjects extends React.PureComponent<Props, State> {
hasNoActiveRules
? translate('quality_profiles.cannot_associate_projects_no_rules')
: null
- }>
+ }
+ >
<Button
className="js-change-projects"
onClick={this.handleChangeClick}
- disabled={hasNoActiveRules}>
+ disabled={hasNoActiveRules}
+ >
{translate('quality_profiles.change_projects')}
</Button>
</Tooltip>
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 9e60f069a5b..b37b9bfaf7f 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
@@ -58,15 +58,15 @@ export default class ProfileRules extends React.PureComponent<Props, State> {
state: State = {
activatedTotal: null,
activatedByType: keyBy(
- TYPES.map(t => ({ val: t, count: null })),
+ TYPES.map((t) => ({ val: t, count: null })),
'val'
),
allByType: keyBy(
- TYPES.map(t => ({ val: t, count: null })),
+ TYPES.map((t) => ({ val: t, count: null })),
'val'
),
compareToSonarWay: null,
- total: null
+ total: null,
};
componentDidMount() {
@@ -90,7 +90,7 @@ export default class ProfileRules extends React.PureComponent<Props, State> {
}
return getQualityProfile({
compareToSonarWay: true,
- profile: this.props.profile
+ profile: this.props.profile,
});
}
@@ -98,7 +98,7 @@ export default class ProfileRules extends React.PureComponent<Props, State> {
return searchRules({
languages: this.props.profile.language,
facets: 'types',
- ps: 1
+ ps: 1,
});
}
@@ -107,13 +107,13 @@ export default class ProfileRules extends React.PureComponent<Props, State> {
activation: 'true',
facets: 'types',
ps: 1,
- qprofile: this.props.profile.key
+ qprofile: this.props.profile.key,
});
}
loadRules() {
return Promise.all([this.loadAllRules(), this.loadActivatedRules(), this.loadProfile()]).then(
- responses => {
+ (responses) => {
if (this.mounted) {
const [allRules, activatedRules, showProfile] = responses;
this.setState({
@@ -121,7 +121,7 @@ export default class ProfileRules extends React.PureComponent<Props, State> {
allByType: keyBy<ByType>(takeFacet(allRules, 'types'), 'val'),
activatedByType: keyBy<ByType>(takeFacet(activatedRules, 'types'), 'val'),
compareToSonarWay: showProfile && showProfile.compareToSonarWay,
- total: allRules.total
+ total: allRules.total,
});
}
}
@@ -165,7 +165,7 @@ export default class ProfileRules extends React.PureComponent<Props, State> {
qprofile={profile.key}
total={this.state.total}
/>
- {TYPES.map(type => (
+ {TYPES.map((type) => (
<ProfileRulesRowOfType
count={this.getRulesCountForType(type)}
key={type}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx
index f4c69eaee6f..c375e7baa3c 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesRowOfType.tsx
@@ -35,12 +35,12 @@ export default function ProfileRulesRowOfType(props: Props) {
const activeRulesUrl = getRulesUrl({
qprofile: props.qprofile,
activation: 'true',
- types: props.type
+ types: props.type,
});
const inactiveRulesUrl = getRulesUrl({
qprofile: props.qprofile,
activation: 'false',
- types: props.type
+ types: props.type,
});
let inactiveCount = null;
if (props.count != null && props.total != null) {
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.tsx
index ff96db6669e..5795c6d1ea5 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRulesSonarWayComparison.tsx
@@ -35,7 +35,7 @@ export default function ProfileRulesSonarWayComparison(props: Props) {
qprofile: props.profile,
activation: 'false',
compareToProfile: props.sonarway,
- languages: props.language
+ languages: props.language,
});
return (
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ChangeParentForm-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ChangeParentForm-test.tsx
index 10f195e901b..cf60c3cc74e 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ChangeParentForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ChangeParentForm-test.tsx
@@ -26,7 +26,7 @@ import ChangeParentForm from '../ChangeParentForm';
beforeEach(() => jest.clearAllMocks());
jest.mock('../../../../api/quality-profiles', () => ({
- changeProfileParent: jest.fn().mockResolvedValue({})
+ changeProfileParent: jest.fn().mockResolvedValue({}),
}));
it('should render correctly', () => {
@@ -61,7 +61,7 @@ function shallowRender(props?: Partial<ChangeParentForm['props']>) {
mockQualityProfile(),
mockQualityProfile(),
mockQualityProfile(),
- mockQualityProfile()
+ mockQualityProfile(),
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ChangeProjectsForm-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ChangeProjectsForm-test.tsx
index 09973c00bf7..96181a84d61 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ChangeProjectsForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ChangeProjectsForm-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import {
associateProject,
dissociateProject,
- getProfileProjects
+ getProfileProjects,
} from '../../../../api/quality-profiles';
import SelectList, { SelectListFilter } from '../../../../components/controls/SelectList';
import { click, waitAndUpdate } from '../../../../helpers/testUtils';
@@ -36,11 +36,11 @@ jest.mock('../../../../api/quality-profiles', () => ({
results: [
{ id: 'test1', key: 'test1', name: 'test1', selected: false },
{ id: 'test2', key: 'test2', name: 'test2', selected: false },
- { id: 'test3', key: 'test3', name: 'test3', selected: true }
- ]
+ { id: 'test3', key: 'test3', name: 'test3', selected: true },
+ ],
}),
associateProject: jest.fn().mockResolvedValue({}),
- dissociateProject: jest.fn().mockResolvedValue({})
+ dissociateProject: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
@@ -49,15 +49,12 @@ beforeEach(() => {
it('should render correctly', async () => {
const wrapper = shallowRender();
- wrapper
- .find(SelectList)
- .props()
- .onSearch({
- query: '',
- filter: SelectListFilter.Selected,
- page: 1,
- pageSize: 100
- });
+ wrapper.find(SelectList).props().onSearch({
+ query: '',
+ filter: SelectListFilter.Selected,
+ page: 1,
+ pageSize: 100,
+ });
await waitAndUpdate(wrapper);
expect(wrapper.instance().mounted).toBe(true);
@@ -71,7 +68,7 @@ it('should render correctly', async () => {
p: 1,
ps: 100,
q: undefined,
- selected: SelectListFilter.Selected
+ selected: SelectListFilter.Selected,
})
);
expect(wrapper.state().needToReload).toBe(false);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileDetails-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileDetails-test.tsx
index 6d6b9d8eebf..fe52dd96b38 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileDetails-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileDetails-test.tsx
@@ -29,12 +29,12 @@ it('should render correctly', () => {
).toMatchSnapshot('edit permissions');
expect(
shallowRender({
- profile: mockQualityProfile({ activeRuleCount: 0, projectCount: 0 })
+ profile: mockQualityProfile({ activeRuleCount: 0, projectCount: 0 }),
})
).toMatchSnapshot('no active rules (same as default)');
expect(
shallowRender({
- profile: mockQualityProfile({ projectCount: 0, isDefault: true, activeRuleCount: 0 })
+ profile: mockQualityProfile({ projectCount: 0, isDefault: true, activeRuleCount: 0 }),
})
).toMatchSnapshot('is default profile, no active rules');
expect(
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileInheritance-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileInheritance-test.tsx
index 5b1f4d678f6..1aca41ef3b3 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileInheritance-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileInheritance-test.tsx
@@ -28,8 +28,8 @@ beforeEach(() => jest.clearAllMocks());
jest.mock('../../../../api/quality-profiles', () => ({
getProfileInheritance: jest.fn().mockResolvedValue({
children: [mockQualityProfileInheritance()],
- ancestors: [mockQualityProfileInheritance()]
- })
+ ancestors: [mockQualityProfileInheritance()],
+ }),
}));
it('should render correctly', async () => {
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileInheritanceBox-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileInheritanceBox-test.tsx
index da6a6e9f46c..9689558540d 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileInheritanceBox-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileInheritanceBox-test.tsx
@@ -28,7 +28,7 @@ it('should render correctly', () => {
shallowRender({
depth: 3,
displayLink: true,
- profile: mockQualityProfileInheritance({ isBuiltIn: true })
+ profile: mockQualityProfileInheritance({ isBuiltIn: true }),
})
).toMatchSnapshot();
expect(shallowRender({ extendsBuiltIn: true })).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissions-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissions-test.tsx
index 5b8dee2a8d7..bd596b3d917 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissions-test.tsx
@@ -25,7 +25,7 @@ import ProfilePermissions from '../ProfilePermissions';
jest.mock('../../../../api/quality-profiles', () => ({
searchUsers: jest.fn(() => Promise.resolve([])),
- searchGroups: jest.fn(() => Promise.resolve([]))
+ searchGroups: jest.fn(() => Promise.resolve([])),
}));
beforeEach(() => {
@@ -39,7 +39,7 @@ it('renders', () => {
wrapper.setState({
groups: [{ name: 'Lambda' }],
loading: false,
- users: [{ login: 'luke', name: 'Luke Skywalker', selected: false }]
+ users: [{ login: 'luke', name: 'Luke Skywalker', selected: false }],
});
expect(wrapper).toMatchSnapshot();
});
@@ -77,14 +77,11 @@ it('removes user', () => {
const joda = { login: 'joda', name: 'Joda', selected: false };
wrapper.setState({
loading: false,
- users: [{ login: 'luke', name: 'Luke Skywalker', selected: false }, joda]
+ users: [{ login: 'luke', name: 'Luke Skywalker', selected: false }, joda],
});
expect(wrapper.find('ProfilePermissionsUser')).toHaveLength(2);
- wrapper
- .find('ProfilePermissionsUser')
- .first()
- .prop<Function>('onDelete')(joda);
+ wrapper.find('ProfilePermissionsUser').first().prop<Function>('onDelete')(joda);
wrapper.update();
expect(wrapper.find('ProfilePermissionsUser')).toHaveLength(1);
});
@@ -97,10 +94,7 @@ it('removes group', () => {
wrapper.setState({ loading: false, groups: [{ name: 'Atlas' }, lambda] });
expect(wrapper.find('ProfilePermissionsGroup')).toHaveLength(2);
- wrapper
- .find('ProfilePermissionsGroup')
- .first()
- .prop<Function>('onDelete')(lambda);
+ wrapper.find('ProfilePermissionsGroup').first().prop<Function>('onDelete')(lambda);
wrapper.update();
expect(wrapper.find('ProfilePermissionsGroup')).toHaveLength(1);
});
@@ -110,12 +104,12 @@ it('fetches users and groups on mount', () => {
expect(searchUsers).toHaveBeenCalledWith({
language: 'js',
qualityProfile: 'Sonar way',
- selected: 'selected'
+ selected: 'selected',
});
expect(searchGroups).toHaveBeenCalledWith({
language: 'js',
qualityProfile: 'Sonar way',
- selected: 'selected'
+ selected: 'selected',
});
});
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsForm-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsForm-test.tsx
index 2d278d412f3..4ee8da8bcd6 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsForm-test.tsx
@@ -29,7 +29,7 @@ jest.mock('../../../../api/quality-profiles', () => ({
addUser: jest.fn().mockResolvedValue(null),
addGroup: jest.fn().mockResolvedValue(null),
searchGroups: jest.fn().mockResolvedValue({ groups: [] }),
- searchUsers: jest.fn().mockResolvedValue({ users: [] })
+ searchUsers: jest.fn().mockResolvedValue({ users: [] }),
}));
const PROFILE = { language: 'js', name: 'Sonar way' };
@@ -53,7 +53,7 @@ it('correctly adds users', async () => {
expect.objectContaining({
language: PROFILE.language,
qualityProfile: PROFILE.name,
- login: user.login
+ login: user.login,
})
);
@@ -75,7 +75,7 @@ it('correctly adds groups', async () => {
expect.objectContaining({
language: PROFILE.language,
qualityProfile: PROFILE.name,
- group: group.name
+ group: group.name,
})
);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsFormSelect-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsFormSelect-test.tsx
index 43e0ced05fe..0c52a1e5e91 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsFormSelect-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsFormSelect-test.tsx
@@ -22,20 +22,23 @@ import * as React from 'react';
import { searchGroups, searchUsers } from '../../../../api/quality-profiles';
import {
mockReactSelectControlProps,
- mockReactSelectOptionProps
+ mockReactSelectOptionProps,
} from '../../../../helpers/mocks/react-select';
import { mockUser } from '../../../../helpers/testMocks';
import ProfilePermissionsFormSelect from '../ProfilePermissionsFormSelect';
jest.mock('lodash', () => {
const lodash = jest.requireActual('lodash');
- lodash.debounce = (fn: Function) => (...args: any[]) => fn(...args);
+ lodash.debounce =
+ (fn: Function) =>
+ (...args: any[]) =>
+ fn(...args);
return lodash;
});
jest.mock('../../../../api/quality-profiles', () => ({
searchGroups: jest.fn().mockResolvedValue([]),
- searchUsers: jest.fn().mockResolvedValue([])
+ searchUsers: jest.fn().mockResolvedValue([]),
}));
it('should render correctly', () => {
@@ -48,7 +51,7 @@ it('should handle search', async () => {
const wrapper = shallowRender();
const query = 'Waldo';
- const results = await new Promise(resolve => {
+ const results = await new Promise((resolve) => {
wrapper.instance().handleSearch(query, resolve);
});
expect(searchUsers).toHaveBeenCalledWith(expect.objectContaining({ q: query }));
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsGroup-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsGroup-test.tsx
index a0d843eed8f..7bf4c3ac6b1 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsGroup-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsGroup-test.tsx
@@ -19,7 +19,7 @@
*/
/* eslint-disable import/first */
jest.mock('../../../../api/quality-profiles', () => ({
- removeGroup: jest.fn(() => Promise.resolve())
+ removeGroup: jest.fn(() => Promise.resolve()),
}));
import { shallow } from 'enzyme';
@@ -57,7 +57,7 @@ it('removes user', async () => {
expect(removeGroup).toHaveBeenCalledWith({
group: 'lambda',
language: 'js',
- qualityProfile: 'Sonar way'
+ qualityProfile: 'Sonar way',
});
await new Promise(setImmediate);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsUser-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsUser-test.tsx
index 2de87095b8d..79a2d43b762 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsUser-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfilePermissionsUser-test.tsx
@@ -25,7 +25,7 @@ import { UserSelected } from '../../../../types/types';
import ProfilePermissionsUser from '../ProfilePermissionsUser';
jest.mock('../../../../api/quality-profiles', () => ({
- removeUser: jest.fn(() => Promise.resolve())
+ removeUser: jest.fn(() => Promise.resolve()),
}));
const profile = { language: 'js', name: 'Sonar way' };
@@ -56,7 +56,7 @@ it('removes user', async () => {
expect(removeUser).toHaveBeenCalledWith({
language: 'js',
login: 'luke',
- qualityProfile: 'Sonar way'
+ qualityProfile: 'Sonar way',
});
await new Promise(setImmediate);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileProjects-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileProjects-test.tsx
index deb0daa941f..f07cea79e40 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileProjects-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileProjects-test.tsx
@@ -31,12 +31,12 @@ jest.mock('../../../../api/quality-profiles', () => ({
id: '633a5180-1ad7-4008-a5cb-e1d3cec4c816',
key: 'org.sonarsource.xml:xml',
name: 'SonarXML',
- selected: true
- }
+ selected: true,
+ },
],
paging: { pageIndex: 1, pageSize: 2, total: 10 },
- more: true
- })
+ more: true,
+ }),
}));
it('should render correctly', async () => {
@@ -45,19 +45,19 @@ it('should render correctly', async () => {
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot('default');
wrapper.setProps({
- profile: mockQualityProfile({ actions: { associateProjects: false } })
+ profile: mockQualityProfile({ actions: { associateProjects: false } }),
});
expect(wrapper).toMatchSnapshot('no rights');
wrapper.setProps({
profile: mockQualityProfile({
projectCount: 0,
activeRuleCount: 0,
- actions: { associateProjects: true }
- })
+ actions: { associateProjects: true },
+ }),
});
expect(wrapper).toMatchSnapshot('no active rules, but associated projects');
wrapper.setProps({
- profile: mockQualityProfile({ activeRuleCount: 0, actions: { associateProjects: true } })
+ profile: mockQualityProfile({ activeRuleCount: 0, actions: { associateProjects: true } }),
});
wrapper.setState({ projects: [] });
expect(wrapper).toMatchSnapshot('no active rules, no associated projects');
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 fee7bd3c13e..0751a753082 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
@@ -29,7 +29,7 @@ const PROFILE = mockQualityProfile({
activeDeprecatedRuleCount: 0,
depth: 0,
language: 'js',
- rulesUpdatedAt: '2017-06-28T12:58:44+0000'
+ rulesUpdatedAt: '2017-06-28T12:58:44+0000',
});
const EDITABLE_PROFILE = { ...PROFILE, actions: { edit: true } };
@@ -43,10 +43,10 @@ const apiResponseAll = {
{ val: 'CODE_SMELL', count: 168 },
{ val: 'BUG', count: 68 },
{ val: 'VULNERABILITY', count: 7 },
- { val: 'SECURITY_HOTSPOT', count: 10 }
- ]
- }
- ]
+ { val: 'SECURITY_HOTSPOT', count: 10 },
+ ],
+ },
+ ],
};
const apiResponseActive = {
@@ -58,10 +58,10 @@ const apiResponseActive = {
{ val: 'BUG', count: 68 },
{ val: 'CODE_SMELL', count: 0 },
{ val: 'VULNERABILITY', count: 0 },
- { val: 'SECURITY_HOTSPOT', count: 0 }
- ]
- }
- ]
+ { val: 'SECURITY_HOTSPOT', count: 0 },
+ ],
+ },
+ ],
};
jest.mock('../../../../api/rules', () => ({
@@ -70,7 +70,7 @@ jest.mock('../../../../api/rules', () => ({
.fn()
.mockImplementation((data: any) =>
Promise.resolve(data.activation === 'true' ? apiResponseActive : apiResponseAll)
- )
+ ),
}));
jest.mock('../../../../api/quality-profiles', () => ({
@@ -80,10 +80,10 @@ jest.mock('../../../../api/quality-profiles', () => ({
compareToSonarWay: {
profile: 'sonarway',
profileName: 'Sonar way',
- missingRuleCount: 4
- }
+ missingRuleCount: 4,
+ },
})
- )
+ ),
}));
beforeEach(jest.clearAllMocks);
@@ -136,8 +136,8 @@ it('should not show sonarway comparison if there is no missing rules', async ()
compareToSonarWay: {
profile: 'sonarway',
profileName: 'Sonar way',
- missingRuleCount: 0
- }
+ missingRuleCount: 0,
+ },
});
const wrapper = shallow(<ProfileRules profile={PROFILE} />);
await waitAndUpdate(wrapper);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx
index db3d439ec0c..167fe97cb1a 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/CreateProfileForm.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import {
changeProfileParent,
createQualityProfile,
- getImporters
+ getImporters,
} from '../../../api/quality-profiles';
import { ResetButtonLink, SubmitButton } from '../../../components/controls/buttons';
import Modal from '../../../components/controls/Modal';
@@ -66,7 +66,7 @@ export default class CreateProfileForm extends React.PureComponent<Props, State>
fetchImporters() {
getImporters().then(
- importers => {
+ (importers) => {
if (this.mounted) {
this.setState({ importers, preloading: false });
}
@@ -101,7 +101,7 @@ export default class CreateProfileForm extends React.PureComponent<Props, State>
try {
const { profile } = await createQualityProfile(data);
- const parentProfile = this.props.profiles.find(p => p.key === this.state.parent);
+ const parentProfile = this.props.profiles.find((p) => p.key === this.state.parent);
if (parentProfile) {
await changeProfileParent(profile, parentProfile);
}
@@ -121,25 +121,25 @@ export default class CreateProfileForm extends React.PureComponent<Props, State>
let profiles: Array<{ label: string; value: string }> = [];
const selectedLanguage = this.state.language || languageQueryFilter || languages[0].key;
- const importers = this.state.importers.filter(importer =>
+ const importers = this.state.importers.filter((importer) =>
importer.languages.includes(selectedLanguage)
);
if (selectedLanguage) {
- const languageProfiles = this.props.profiles.filter(p => p.language === selectedLanguage);
+ const languageProfiles = this.props.profiles.filter((p) => p.language === selectedLanguage);
profiles = [
{ label: translate('none'), value: '' },
- ...sortBy(languageProfiles, 'name').map(profile => ({
+ ...sortBy(languageProfiles, 'name').map((profile) => ({
label: profile.isBuiltIn
? `${profile.name} (${translate('quality_profiles.built_in')})`
: profile.name,
- value: profile.key
- }))
+ value: profile.key,
+ })),
];
}
- const languagesOptions = languages.map(l => ({
+ const languagesOptions = languages.map((l) => ({
label: l.name,
- value: l.key
+ value: l.key,
}));
const isParentProfileClearable = () => {
@@ -195,7 +195,7 @@ export default class CreateProfileForm extends React.PureComponent<Props, State>
onChange={this.handleLanguageChange}
options={languagesOptions}
isSearchable={true}
- value={languagesOptions.filter(o => o.value === selectedLanguage)}
+ value={languagesOptions.filter((o) => o.value === selectedLanguage)}
/>
</div>
{selectedLanguage && profiles.length > 0 && (
@@ -213,15 +213,16 @@ export default class CreateProfileForm extends React.PureComponent<Props, State>
onChange={this.handleParentChange}
options={profiles}
isSearchable={true}
- value={profiles.filter(o => o.value === (this.state.parent || ''))}
+ value={profiles.filter((o) => o.value === (this.state.parent || ''))}
/>
</div>
)}
- {importers.map(importer => (
+ {importers.map((importer) => (
<div
className="modal-field spacer-bottom js-importer"
data-key={importer.key}
- key={importer.key}>
+ key={importer.key}
+ >
<label htmlFor={'create-profile-form-backup-' + importer.key}>
{importer.name}
</label>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx
index 74052a2e3f5..b32bd859b9e 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionDeprecated.tsx
@@ -44,7 +44,7 @@ export default class EvolutionDeprecated extends React.PureComponent<Props> {
}
if (profile.parentKey) {
- const parentProfile = profilesWithDeprecations.find(p => p.key === profile.parentKey);
+ const parentProfile = profilesWithDeprecations.find((p) => p.key === profile.parentKey);
if (parentProfile) {
const parentRules = this.getDeprecatedRulesInheritanceChain(
parentProfile,
@@ -60,7 +60,7 @@ export default class EvolutionDeprecated extends React.PureComponent<Props> {
if (count > 0) {
rules.push({
count,
- from: profile
+ from: profile,
});
}
@@ -72,7 +72,7 @@ export default class EvolutionDeprecated extends React.PureComponent<Props> {
if (rules.length) {
return (
<>
- {rules.map(rule => {
+ {rules.map((rule) => {
if (rule.from.key === profile.key) {
return null;
}
@@ -96,14 +96,14 @@ export default class EvolutionDeprecated extends React.PureComponent<Props> {
render() {
const profilesWithDeprecations = this.props.profiles.filter(
- profile => profile.activeDeprecatedRuleCount > 0
+ (profile) => profile.activeDeprecatedRuleCount > 0
);
if (profilesWithDeprecations.length === 0) {
return null;
}
- const sortedProfiles = sortBy(profilesWithDeprecations, p => -p.activeDeprecatedRuleCount);
+ const sortedProfiles = sortBy(profilesWithDeprecations, (p) => -p.activeDeprecatedRuleCount);
return (
<div className="boxed-group boxed-group-inner quality-profiles-evolution-deprecated">
@@ -117,7 +117,7 @@ export default class EvolutionDeprecated extends React.PureComponent<Props> {
)}
</div>
<ul>
- {sortedProfiles.map(profile => (
+ {sortedProfiles.map((profile) => (
<li className="spacer-top" key={profile.key}>
<div className="text-ellipsis little-spacer-bottom">
<ProfileLink language={profile.language} name={profile.name}>
@@ -129,7 +129,8 @@ export default class EvolutionDeprecated extends React.PureComponent<Props> {
{', '}
<Link
className="link-no-underline"
- to={getDeprecatedActiveRulesUrl({ qprofile: profile.key })}>
+ to={getDeprecatedActiveRulesUrl({ qprofile: profile.key })}
+ >
{translateWithParameters(
'quality_profile.x_rules',
profile.activeDeprecatedRuleCount
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx
index 0d7c300fdce..d0b4a8e2f09 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionRules.tsx
@@ -30,7 +30,7 @@ import { Dict, Rule, RuleActivation } from '../../../types/types';
const RULES_LIMIT = 10;
function parseRules(rules: Rule[], actives?: Dict<RuleActivation[]>): ExtendedRule[] {
- return rules.map(rule => {
+ return rules.map((rule) => {
const activations = actives && actives[rule.key];
return { ...rule, activations: activations ? activations.length : 0 };
});
@@ -72,7 +72,7 @@ export default class EvolutionRules extends React.PureComponent<{}, State> {
available_since: this.periodStartDate,
f: 'name,langName,actives',
ps: RULES_LIMIT,
- s: 'createdAt'
+ s: 'createdAt',
};
searchRules(data).then(
@@ -80,7 +80,7 @@ export default class EvolutionRules extends React.PureComponent<{}, State> {
if (this.mounted) {
this.setState({
latestRules: sortBy(parseRules(rules, actives), 'langName'),
- latestRulesTotal: total
+ latestRulesTotal: total,
});
}
},
@@ -103,7 +103,7 @@ export default class EvolutionRules extends React.PureComponent<{}, State> {
<strong className="pull-left">{translate('quality_profiles.latest_new_rules')}</strong>
</div>
<ul>
- {this.state.latestRules.map(rule => (
+ {this.state.latestRules.map((rule) => (
<li className="spacer-top" key={rule.key}>
<div className="text-ellipsis">
<Link className="link-no-underline" to={getRulesUrl({ rule_key: rule.key })}>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx
index c46dbd41544..af104d2eb5f 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.tsx
@@ -29,7 +29,7 @@ interface Props {
}
export default function EvolutionStagnant(props: Props) {
- const outdated = props.profiles.filter(profile => !profile.isBuiltIn && isStagnant(profile));
+ const outdated = props.profiles.filter((profile) => !profile.isBuiltIn && isStagnant(profile));
if (outdated.length === 0) {
return null;
@@ -44,19 +44,20 @@ export default function EvolutionStagnant(props: Props) {
{translate('quality_profiles.not_updated_more_than_year')}
</div>
<ul>
- {outdated.map(profile => (
+ {outdated.map((profile) => (
<li className="spacer-top" key={profile.key}>
<div className="text-ellipsis">
<ProfileLink
className="link-no-underline"
language={profile.language}
- name={profile.name}>
+ name={profile.name}
+ >
{profile.name}
</ProfileLink>
</div>
{profile.rulesUpdatedAt && (
<DateFormatter date={profile.rulesUpdatedAt} long={true}>
- {formattedDate => (
+ {(formattedDate) => (
<div className="note">
{translateWithParameters(
'quality_profiles.x_updated_on_y',
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx
index d9811232f4c..6755607e84b 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.tsx
@@ -46,7 +46,7 @@ interface State {
export class PageHeader extends React.PureComponent<Props, State> {
state: State = {
createFormOpen: false,
- restoreFormOpen: false
+ restoreFormOpen: false,
};
handleCreateClick = () => {
@@ -85,13 +85,15 @@ export class PageHeader extends React.PureComponent<Props, State> {
<Button
disabled={languages.length === 0}
id="quality-profiles-create"
- onClick={this.handleCreateClick}>
+ onClick={this.handleCreateClick}
+ >
{translate('create')}
</Button>
<Button
className="little-spacer-left"
id="quality-profiles-restore"
- onClick={this.handleRestoreClick}>
+ onClick={this.handleRestoreClick}
+ >
{translate('restore')}
</Button>
{languages.length === 0 && (
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx
index e749dcc9e12..c54cc79976c 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.tsx
@@ -37,7 +37,7 @@ interface Props {
export default class ProfilesList extends React.PureComponent<Props> {
renderProfiles(profiles: Profile[]) {
- return profiles.map(profile => (
+ return profiles.map((profile) => (
<ProfilesListRow
key={profile.key}
profile={profile}
@@ -47,7 +47,7 @@ export default class ProfilesList extends React.PureComponent<Props> {
}
renderHeader(languageKey: string, profilesCount: number) {
- const language = this.props.languages.find(l => l.key === languageKey);
+ const language = this.props.languages.find((l) => l.key === languageKey);
if (!language) {
return null;
@@ -95,7 +95,10 @@ export default class ProfilesList extends React.PureComponent<Props> {
render() {
const { profiles, languages, language } = this.props;
- const profilesIndex: Dict<Profile[]> = groupBy<Profile>(profiles, profile => profile.language);
+ const profilesIndex: Dict<Profile[]> = groupBy<Profile>(
+ profiles,
+ (profile) => profile.language
+ );
const profilesToShow = language ? pick(profilesIndex, language) : profilesIndex;
@@ -116,7 +119,7 @@ export default class ProfilesList extends React.PureComponent<Props> {
</Alert>
)}
- {languagesToShow.map(languageKey =>
+ {languagesToShow.map((languageKey) =>
this.renderLanguage(languageKey, profilesToShow[languageKey])
)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListHeader.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListHeader.tsx
index fe2bf6d96ff..ab015cac395 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListHeader.tsx
@@ -42,9 +42,9 @@ export class ProfilesListHeader extends React.PureComponent<Props> {
return null;
}
- const options = languages.map(language => ({
+ const options = languages.map((language) => ({
label: language.name,
- value: language.key
+ value: language.key,
}));
return (
@@ -61,7 +61,7 @@ export class ProfilesListHeader extends React.PureComponent<Props> {
onChange={this.handleChange}
options={options}
isSearchable={true}
- value={options.filter(o => o.value === currentFilter)}
+ value={options.filter((o) => o.value === currentFilter)}
/>
</header>
);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx
index 094bc9ef4b8..274e6d96ec1 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx
@@ -39,19 +39,20 @@ export function ProfilesListRow(props: ProfilesListRowProps) {
const offset = 25 * (profile.depth - 1);
const activeRulesUrl = getRulesUrl({
qprofile: profile.key,
- activation: 'true'
+ activation: 'true',
});
const deprecatedRulesUrl = getRulesUrl({
qprofile: profile.key,
activation: 'true',
- statuses: 'DEPRECATED'
+ statuses: 'DEPRECATED',
});
return (
<tr
className="quality-profiles-table-row text-middle"
data-key={profile.key}
- data-name={profile.name}>
+ data-name={profile.name}
+ >
<td className="quality-profiles-table-name text-middle">
<div className="display-flex-center" style={{ paddingLeft: offset }}>
<div>
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx
index 4ef2361db0a..b9fdb4a1848 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/RestoreProfileForm.tsx
@@ -64,7 +64,7 @@ export default class RestoreProfileForm extends React.PureComponent<Props, State
loading: false,
profile: response.profile,
ruleFailures: response.ruleFailures,
- ruleSuccesses: response.ruleSuccesses
+ ruleSuccesses: response.ruleSuccesses,
});
}
this.props.onRestore();
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/CreateProfileForm-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/CreateProfileForm-test.tsx
index 9255033df82..000dd0ba71c 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/CreateProfileForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/CreateProfileForm-test.tsx
@@ -33,9 +33,9 @@ jest.mock('../../../../api/quality-profiles', () => ({
{
key: 'key_importer',
languages: ['lang1_importer', 'lang2_importer', 'js'],
- name: 'name_importer'
- }
- ])
+ name: 'name_importer',
+ },
+ ]),
}));
it('should render correctly', async () => {
@@ -78,7 +78,7 @@ function shallowRender(props?: Partial<CreateProfileForm['props']>) {
<CreateProfileForm
languages={[
{ key: 'js', name: 'JavaScript' },
- { key: 'css', name: 'CSS' }
+ { key: 'css', name: 'CSS' },
]}
location={mockLocation()}
onClose={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/EvolutionDeprecated-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/EvolutionDeprecated-test.tsx
index 9967e3d3043..71487d037fd 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/EvolutionDeprecated-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/EvolutionDeprecated-test.tsx
@@ -29,35 +29,35 @@ it('should render correctly', () => {
mockQualityProfile({
key: 'qp-1',
name: 'Quality Profile 1',
- activeDeprecatedRuleCount: 0
+ activeDeprecatedRuleCount: 0,
}),
mockQualityProfile({
key: 'qp-2',
name: 'Quality Profile 2',
childrenCount: 1,
- activeDeprecatedRuleCount: 2
+ activeDeprecatedRuleCount: 2,
}),
mockQualityProfile({
key: 'qp-3',
name: 'Quality Profile 3',
depth: 2,
activeDeprecatedRuleCount: 2,
- parentKey: 'qp-2'
+ parentKey: 'qp-2',
}),
mockQualityProfile({
key: 'qp-4',
name: 'Quality Profile 4',
depth: 3,
activeDeprecatedRuleCount: 3,
- parentKey: 'qp-3'
+ parentKey: 'qp-3',
}),
mockQualityProfile({
key: 'qp-5',
name: 'Quality Profile 5',
depth: 4,
activeDeprecatedRuleCount: 4,
- parentKey: 'qp-4'
- })
+ parentKey: 'qp-4',
+ }),
]}
/>
);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/PageHeader-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/PageHeader-test.tsx
index 88bf94708cd..43b23e9ce8d 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/PageHeader-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/PageHeader-test.tsx
@@ -23,7 +23,7 @@ import {
mockLanguage,
mockLocation,
mockQualityProfile,
- mockRouter
+ mockRouter,
} from '../../../../helpers/testMocks';
import { click } from '../../../../helpers/testUtils';
import { PageHeader } from '../PageHeader';
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/ProfilesList-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/ProfilesList-test.tsx
index 3061318eac0..deda1b4c523 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/ProfilesList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/ProfilesList-test.tsx
@@ -36,7 +36,7 @@ function shallowRender(props: Partial<ProfilesList['props']> = {}) {
languages={[mockLanguage(), mockLanguage({ key: 'js', name: 'JS' })]}
profiles={[
mockQualityProfile(),
- mockQualityProfile({ language: 'css', languageName: 'CSS' })
+ mockQualityProfile({ language: 'css', languageName: 'CSS' }),
]}
updateProfiles={jest.fn()}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/ProfilesListHeader-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/ProfilesListHeader-test.tsx
index dcebe81d551..353896558d9 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/ProfilesListHeader-test.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/__tests__/ProfilesListHeader-test.tsx
@@ -32,7 +32,7 @@ function shallowRender(props: Partial<ProfilesListHeader['props']> = {}) {
<ProfilesListHeader
languages={[
{ key: 'js', name: 'JavaScript' },
- { key: 'java', name: 'Java' }
+ { key: 'java', name: 'Java' },
]}
router={mockRouter()}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/types.ts b/server/sonar-web/src/main/js/apps/quality-profiles/types.ts
index 9553fba91a4..e393bdf148b 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/types.ts
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/types.ts
@@ -44,5 +44,5 @@ export enum ProfileActionModals {
Copy,
Extend,
Rename,
- Delete
+ Delete,
}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts b/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts
index 5bed7860f04..326de09028f 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/utils.ts
@@ -30,7 +30,8 @@ export function sortProfiles(profiles: BaseProfile[]): Profile[] {
function retrieveChildren(parent: BaseProfile | null) {
return sorted.filter(
- p => (parent == null && p.parentKey == null) || (parent != null && p.parentKey === parent.key)
+ (p) =>
+ (parent == null && p.parentKey == null) || (parent != null && p.parentKey === parent.key)
);
}
@@ -41,14 +42,15 @@ export function sortProfiles(profiles: BaseProfile[]): Profile[] {
result.push({ ...profile, childrenCount: children.length, depth });
}
- children.forEach(child => putProfile(child, depth + 1));
+ children.forEach((child) => putProfile(child, depth + 1));
}
sorted
.filter(
- profile => profile.parentKey == null || sorted.find(p => p.key === profile.parentKey) == null
+ (profile) =>
+ profile.parentKey == null || sorted.find((p) => p.key === profile.parentKey) == null
)
- .forEach(profile => putProfile(profile));
+ .forEach((profile) => putProfile(profile));
return result;
}
@@ -67,12 +69,12 @@ export const PROFILE_PATH = '/profiles';
export const getProfilesForLanguagePath = (language: string) => ({
pathname: PROFILE_PATH,
- search: queryToSearch({ language })
+ search: queryToSearch({ language }),
});
export const getProfilePath = (name: string, language: string) => ({
pathname: `${PROFILE_PATH}/show`,
- search: queryToSearch({ name, language })
+ search: queryToSearch({ name, language }),
});
export const getProfileComparePath = (name: string, language: string, withKey?: string) => {
@@ -82,7 +84,7 @@ export const getProfileComparePath = (name: string, language: string, withKey?:
}
return {
pathname: `${PROFILE_PATH}/compare`,
- search: queryToSearch(query)
+ search: queryToSearch(query),
};
};
@@ -102,6 +104,6 @@ export const getProfileChangelogPath = (
}
return {
pathname: `${PROFILE_PATH}/changelog`,
- search: queryToSearch(query)
+ search: queryToSearch(query),
};
};
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
index 3854bc3e60d..beaccb76e96 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
@@ -36,7 +36,7 @@ import {
HotspotResolution,
HotspotStatus,
HotspotStatusFilter,
- RawHotspot
+ RawHotspot,
} from '../../types/security-hotspots';
import { Component, Dict } from '../../types/types';
import { CurrentUser, isLoggedIn } from '../../types/users';
@@ -100,12 +100,12 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
[SecurityStandard.CWE]: {},
[SecurityStandard.PCI_DSS_3_2]: {},
[SecurityStandard.PCI_DSS_4_0]: {},
- [SecurityStandard.OWASP_ASVS_4_0]: {}
+ [SecurityStandard.OWASP_ASVS_4_0]: {},
},
filters: {
...this.constructFiltersFromProps(props),
- status: HotspotStatusFilter.TO_REVIEW
- }
+ status: HotspotStatusFilter.TO_REVIEW,
+ },
};
}
@@ -119,7 +119,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
if (
this.props.component.key !== previous.component.key ||
this.props.location.query.hotspots !== previous.location.query.hotspots ||
- SECURITY_STANDARDS.some(s => this.props.location.query[s] !== previous.location.query[s]) ||
+ SECURITY_STANDARDS.some((s) => this.props.location.query[s] !== previous.location.query[s]) ||
this.props.location.query.files !== previous.location.query.files
) {
this.fetchInitialData();
@@ -132,7 +132,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
this.props.location.query.inNewCodePeriod !== previous.location.query.inNewCodePeriod
) {
this.setState(({ filters }) => ({
- filters: { ...this.constructFiltersFromProps, ...filters }
+ filters: { ...this.constructFiltersFromProps, ...filters },
}));
}
}
@@ -211,12 +211,12 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
selectNeighboringHotspot = (shift: number) => {
this.setState({ selectedHotspotLocationIndex: undefined });
this.setState(({ hotspots, selectedHotspot }) => {
- const index = selectedHotspot && hotspots.findIndex(h => h.key === selectedHotspot.key);
+ const index = selectedHotspot && hotspots.findIndex((h) => h.key === selectedHotspot.key);
if (index !== undefined && index > -1) {
const newIndex = Math.max(0, Math.min(hotspots.length - 1, index + shift));
return {
- selectedHotspot: hotspots[newIndex]
+ selectedHotspot: hotspots[newIndex],
};
}
@@ -234,7 +234,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
return {
assignedToMe: props.location.query.assignedToMe === 'true' && isLoggedIn(props.currentUser),
inNewCodePeriod:
- isPullRequest(props.branchLike) || props.location.query.inNewCodePeriod === 'true'
+ isPullRequest(props.branchLike) || props.location.query.inNewCodePeriod === 'true',
};
}
@@ -248,7 +248,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
return Promise.all([
getStandards(),
this.fetchSecurityHotspots(),
- this.fetchSecurityHotspotsReviewed()
+ this.fetchSecurityHotspotsReviewed(),
])
.then(([standards, { hotspots, paging }]) => {
if (!this.mounted) {
@@ -262,7 +262,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
hotspotsTotal: paging.total,
loading: false,
selectedHotspot,
- standards
+ standards,
});
})
.catch(this.handleCallFailure);
@@ -280,9 +280,9 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
return getMeasures({
component: component.key,
metricKeys: reviewedHotspotsMetricKey,
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
})
- .then(measures => {
+ .then((measures) => {
if (!this.mounted) {
return;
}
@@ -309,7 +309,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
: undefined;
const standard = SECURITY_STANDARDS.find(
- stnd => stnd !== SecurityStandard.CWE && location.query[stnd] !== undefined
+ (stnd) => stnd !== SecurityStandard.CWE && location.query[stnd] !== undefined
);
const filterByCategory = standard
? { standard, category: location.query[standard] }
@@ -324,7 +324,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
if (hotspotKeys && hotspotKeys.length > 0) {
return getSecurityHotspotList(hotspotKeys, {
projectKey: component.key,
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
});
}
@@ -350,7 +350,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
ps: PAGE_SIZE,
status: HotspotStatus.TO_REVIEW, // we're only interested in unresolved hotspots
inNewCodePeriod: filters.inNewCodePeriod && Boolean(filterByFile), // only add leak period when filtering by file
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
});
}
@@ -372,7 +372,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
resolution,
onlyMine: filters.assignedToMe,
inNewCodePeriod: filters.inNewCodePeriod,
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
});
}
@@ -390,7 +390,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
hotspotsPageIndex: 1,
hotspotsTotal: paging.total,
loading: false,
- selectedHotspot: hotspots.length > 0 ? hotspots[0] : undefined
+ selectedHotspot: hotspots.length > 0 ? hotspots[0] : undefined,
});
})
.catch(this.handleCallFailure);
@@ -418,16 +418,18 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
handleHotspotUpdate = (hotspotKey: string) => {
const { hotspots, hotspotsPageIndex } = this.state;
const { branchLike, component } = this.props;
- const index = hotspots.findIndex(h => h.key === hotspotKey);
+ const index = hotspots.findIndex((h) => h.key === hotspotKey);
if (isPullRequest(branchLike)) {
this.props.fetchBranchStatus(branchLike, component.key);
}
return Promise.all(
- range(hotspotsPageIndex).map(p => this.fetchSecurityHotspots(p + 1 /* pages are 1-indexed */))
+ range(hotspotsPageIndex).map((p) =>
+ this.fetchSecurityHotspots(p + 1 /* pages are 1-indexed */)
+ )
)
- .then(hotspotPages => {
+ .then((hotspotPages) => {
const allHotspots = flatMap(hotspotPages, 'hotspots');
const { paging } = hotspotPages[hotspotPages.length - 1];
@@ -438,7 +440,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
hotspots: allHotspots,
hotspotsPageIndex: paging.pageIndex,
hotspotsTotal: paging.total,
- selectedHotspot: selectedHotspot?.key === hotspotKey ? nextHotspot : selectedHotspot
+ selectedHotspot: selectedHotspot?.key === hotspotKey ? nextHotspot : selectedHotspot,
}));
})
.then(this.fetchSecurityHotspotsReviewed);
@@ -458,8 +460,8 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
[SecurityStandard.PCI_DSS_3_2]: undefined,
[SecurityStandard.PCI_DSS_4_0]: undefined,
[SecurityStandard.OWASP_ASVS_4_0]: undefined,
- file: undefined
- }
+ file: undefined,
+ },
});
};
@@ -477,7 +479,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
this.setState({
hotspots: [...hotspots, ...additionalHotspots],
hotspotsPageIndex: hotspotPages + 1,
- loadingMore: false
+ loadingMore: false,
});
})
.catch(this.handleCallFailure);
@@ -488,11 +490,11 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
if (locationIndex === undefined || locationIndex === selectedHotspotLocationIndex) {
this.setState({
- selectedHotspotLocationIndex: undefined
+ selectedHotspotLocationIndex: undefined,
});
} else {
this.setState({
- selectedHotspotLocationIndex: locationIndex
+ selectedHotspotLocationIndex: locationIndex,
});
}
};
@@ -513,7 +515,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> {
loadingMore,
selectedHotspot,
selectedHotspotLocationIndex,
- standards
+ standards,
} = this.state;
return (
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx
index 5de54085163..fc27424a6b6 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx
@@ -85,7 +85,7 @@ export default function SecurityHotspotsAppRenderer(props: SecurityHotspotsAppRe
securityCategories,
selectedHotspot,
selectedHotspotLocation,
- standards
+ standards,
} = props;
const scrollableRef = React.useRef(null);
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx
index 9bff505526e..922b3deb7f7 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-it.tsx
@@ -35,9 +35,9 @@ jest.mock('../../../api/components');
const ui = {
selectStatusButton: byRole('button', {
- name: 'hotspots.status.select_status'
+ name: 'hotspots.status.select_status',
}),
- panel: byTestId('security-hotspot-test')
+ panel: byTestId('security-hotspot-test'),
};
let handler: SecurityHotspotServiceMock;
@@ -80,8 +80,8 @@ function renderSecurityHotspotsApp(navigateTo?: string) {
navigateTo,
currentUser: mockLoggedInUser({
login: 'foo',
- name: 'foo'
- })
+ name: 'foo',
+ }),
},
{
branchLikes: [],
@@ -89,8 +89,8 @@ function renderSecurityHotspotsApp(navigateTo?: string) {
onComponentChange: jest.fn(),
component: mockComponent({
key: 'guillaume-peoch-sonarsource_benflix_AYGpXq2bd8qy4i0eO9ed',
- name: 'benflix'
- })
+ name: 'benflix',
+ }),
}
);
}
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-test.tsx
index b22b3c6b1d5..1a3b82c8a98 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsApp-test.tsx
@@ -31,14 +31,14 @@ import {
mockFlowLocation,
mockLocation,
mockLoggedInUser,
- mockRouter
+ mockRouter,
} from '../../../helpers/testMocks';
import { mockEvent, waitAndUpdate } from '../../../helpers/testUtils';
import { SecurityStandard } from '../../../types/security';
import {
HotspotResolution,
HotspotStatus,
- HotspotStatusFilter
+ HotspotStatusFilter,
} from '../../../types/security-hotspots';
import { SecurityHotspotsApp } from '../SecurityHotspotsApp';
import SecurityHotspotsAppRenderer from '../SecurityHotspotsAppRenderer';
@@ -48,20 +48,20 @@ beforeEach(() => {
});
jest.mock('../../../api/measures', () => ({
- getMeasures: jest.fn().mockResolvedValue([])
+ getMeasures: jest.fn().mockResolvedValue([]),
}));
jest.mock('../../../api/security-hotspots', () => ({
getSecurityHotspots: jest.fn().mockResolvedValue({ hotspots: [], paging: { total: 0 } }),
- getSecurityHotspotList: jest.fn().mockResolvedValue({ hotspots: [], rules: [] })
+ getSecurityHotspotList: jest.fn().mockResolvedValue({ hotspots: [], rules: [] }),
}));
jest.mock('../../../helpers/security-standard', () => ({
- getStandards: jest.fn().mockResolvedValue({ sonarsourceSecurity: { cat1: { title: 'cat 1' } } })
+ getStandards: jest.fn().mockResolvedValue({ sonarsourceSecurity: { cat1: { title: 'cat 1' } } }),
}));
jest.mock('../../../helpers/scrolling', () => ({
- scrollToElement: jest.fn()
+ scrollToElement: jest.fn(),
}));
const branch = mockBranch();
@@ -75,8 +75,8 @@ it('should load data correctly', async () => {
(getSecurityHotspots as jest.Mock).mockResolvedValue({
hotspots,
paging: {
- total: 1
- }
+ total: 1,
+ },
});
(getMeasures as jest.Mock).mockResolvedValue([{ value: '86.6' }]);
@@ -88,12 +88,12 @@ it('should load data correctly', async () => {
expect(getStandards).toHaveBeenCalled();
expect(getSecurityHotspots).toHaveBeenCalledWith(
expect.objectContaining({
- branch: branch.name
+ branch: branch.name,
})
);
expect(getMeasures).toHaveBeenCalledWith(
expect.objectContaining({
- branch: branch.name
+ branch: branch.name,
})
);
@@ -104,8 +104,8 @@ it('should load data correctly', async () => {
expect(wrapper.state().selectedHotspot).toBe(hotspots[0]);
expect(wrapper.state().standards).toEqual({
sonarsourceSecurity: {
- cat1: { title: 'cat 1' }
- }
+ cat1: { title: 'cat 1' },
+ },
});
expect(wrapper.state().loadingMeasure).toBe(false);
expect(wrapper.state().hotspotsReviewedMeasure).toBe('86.6');
@@ -116,7 +116,7 @@ it('should handle category request', () => {
(getMeasures as jest.Mock).mockResolvedValue([{ value: '86.6' }]);
shallowRender({
- location: mockLocation({ query: { [SecurityStandard.OWASP_TOP10]: 'a1' } })
+ location: mockLocation({ query: { [SecurityStandard.OWASP_TOP10]: 'a1' } }),
});
expect(getSecurityHotspots).toHaveBeenCalledWith(
@@ -129,7 +129,7 @@ it('should handle cwe request', () => {
(getMeasures as jest.Mock).mockResolvedValue([{ value: '86.6' }]);
shallowRender({
- location: mockLocation({ query: { [SecurityStandard.CWE]: '1004' } })
+ location: mockLocation({ query: { [SecurityStandard.CWE]: '1004' } }),
});
expect(getSecurityHotspots).toHaveBeenCalledWith(
@@ -144,7 +144,7 @@ it('should handle file request', () => {
const filepath = 'src/path/to/file.java';
shallowRender({
- location: mockLocation({ query: { files: filepath } })
+ location: mockLocation({ query: { files: filepath } }),
});
expect(getSecurityHotspots).toHaveBeenCalledWith(expect.objectContaining({ files: filepath }));
@@ -154,24 +154,24 @@ it('should load data correctly when hotspot key list is forced', async () => {
const hotspots = [
mockRawHotspot({ key: 'test1' }),
mockRawHotspot({ key: 'test2' }),
- mockRawHotspot({ key: 'test3' })
+ mockRawHotspot({ key: 'test3' }),
];
- const hotspotKeys = hotspots.map(h => h.key);
+ const hotspotKeys = hotspots.map((h) => h.key);
(getSecurityHotspotList as jest.Mock).mockResolvedValueOnce({
- hotspots
+ hotspots,
});
const location = mockLocation({ query: { hotspots: hotspotKeys.join() } });
const router = mockRouter();
const wrapper = shallowRender({
location,
- router
+ router,
});
await waitAndUpdate(wrapper);
expect(getSecurityHotspotList).toHaveBeenCalledWith(hotspotKeys, {
projectKey: 'my-project',
- branch: 'branch-6.7'
+ branch: 'branch-6.7',
});
expect(wrapper.state().hotspotKeys).toEqual(hotspotKeys);
expect(wrapper.find(SecurityHotspotsAppRenderer).props().isStaticListOfHotspots).toBe(true);
@@ -179,18 +179,15 @@ it('should load data correctly when hotspot key list is forced', async () => {
// Reset
(getSecurityHotspots as jest.Mock).mockClear();
(getSecurityHotspotList as jest.Mock).mockClear();
- wrapper
- .find(SecurityHotspotsAppRenderer)
- .props()
- .onShowAllHotspots();
+ wrapper.find(SecurityHotspotsAppRenderer).props().onShowAllHotspots();
expect(router.push).toHaveBeenCalledWith({
...location,
- query: { ...location.query, hotspots: undefined }
+ query: { ...location.query, hotspots: undefined },
});
// Simulate a new location
wrapper.setProps({
- location: { ...location, query: { ...location.query, hotspots: undefined } }
+ location: { ...location, query: { ...location.query, hotspots: undefined } },
});
await waitAndUpdate(wrapper);
expect(wrapper.state().hotspotKeys).toBeUndefined();
@@ -222,7 +219,7 @@ it('should set "assigned to me" filter according to context (logged in & explici
expect(
shallowRender({
location: mockLocation({ query: { assignedToMe: 'true' } }),
- currentUser: mockLoggedInUser()
+ currentUser: mockLoggedInUser(),
}).state().filters.assignedToMe
).toBe(true);
});
@@ -233,11 +230,11 @@ it('should handle loading more', async () => {
(getSecurityHotspots as jest.Mock)
.mockResolvedValueOnce({
hotspots,
- paging: { total: 5 }
+ paging: { total: 5 },
})
.mockResolvedValueOnce({
hotspots: hotspots2,
- paging: { total: 5 }
+ paging: { total: 5 },
});
const wrapper = shallowRender();
@@ -266,7 +263,7 @@ it('should handle hotspot update', async () => {
(getSecurityHotspots as jest.Mock).mockResolvedValueOnce({
hotspots,
- paging: { pageIndex: 1, total: 1252 }
+ paging: { pageIndex: 1, total: 1252 },
});
let wrapper = shallowRender();
@@ -277,21 +274,18 @@ it('should handle hotspot update', async () => {
(getSecurityHotspots as jest.Mock)
.mockResolvedValueOnce({
hotspots: [mockRawHotspot()],
- paging: { pageIndex: 1, total: 1251 }
+ paging: { pageIndex: 1, total: 1251 },
})
.mockResolvedValueOnce({
hotspots: [mockRawHotspot()],
- paging: { pageIndex: 2, total: 1251 }
+ paging: { pageIndex: 2, total: 1251 },
});
const selectedHotspotIndex = wrapper
.state()
- .hotspots.findIndex(h => h.key === wrapper.state().selectedHotspot?.key);
+ .hotspots.findIndex((h) => h.key === wrapper.state().selectedHotspot?.key);
- await wrapper
- .find(SecurityHotspotsAppRenderer)
- .props()
- .onUpdateHotspot(key);
+ await wrapper.find(SecurityHotspotsAppRenderer).props().onUpdateHotspot(key);
expect(getSecurityHotspots).toHaveBeenCalledTimes(2);
@@ -299,25 +293,22 @@ it('should handle hotspot update', async () => {
expect(wrapper.state().hotspotsPageIndex).toBe(2);
expect(wrapper.state().hotspotsTotal).toBe(1251);
expect(
- wrapper.state().hotspots.findIndex(h => h.key === wrapper.state().selectedHotspot?.key)
+ wrapper.state().hotspots.findIndex((h) => h.key === wrapper.state().selectedHotspot?.key)
).toBe(selectedHotspotIndex);
expect(getMeasures).toHaveBeenCalled();
(getSecurityHotspots as jest.Mock).mockResolvedValueOnce({
hotspots,
- paging: { pageIndex: 1, total: 1252 }
+ paging: { pageIndex: 1, total: 1252 },
});
wrapper = shallowRender({
branchLike,
fetchBranchStatus: fetchBranchStatusMock,
- component: mockComponent({ key: componentKey })
+ component: mockComponent({ key: componentKey }),
});
- await wrapper
- .find(SecurityHotspotsAppRenderer)
- .props()
- .onUpdateHotspot(key);
+ await wrapper.find(SecurityHotspotsAppRenderer).props().onUpdateHotspot(key);
expect(fetchBranchStatusMock).toHaveBeenCalledWith(branchLike, componentKey);
});
@@ -418,10 +409,10 @@ describe('keyboard navigation', () => {
const hotspots = [
mockRawHotspot({ key: 'k1' }),
mockRawHotspot({ key: 'k2' }),
- mockRawHotspot({ key: 'k3' })
+ mockRawHotspot({ key: 'k3' }),
];
const flowsData = {
- flows: [{ locations: [mockFlowLocation(), mockFlowLocation(), mockFlowLocation()] }]
+ flows: [{ locations: [mockFlowLocation(), mockFlowLocation(), mockFlowLocation()] }],
};
const hotspotsForLocation = mockRawHotspot(flowsData);
@@ -436,7 +427,7 @@ describe('keyboard navigation', () => {
['selecting next, non-existent', 2, 1, 2],
['jumping down', 0, 18, 2],
['jumping up', 2, -18, 0],
- ['none selected', 4, -2, 4]
+ ['none selected', 4, -2, 4],
])('should work when %s', (_, start, shift, expected) => {
wrapper.setState({ selectedHotspot: hotspots[start] });
wrapper.instance().selectNeighboringHotspot(shift);
@@ -447,7 +438,7 @@ describe('keyboard navigation', () => {
it.each([
['selecting next locations when nothing is selected', undefined, 0],
['selecting next locations', 0, 1],
- ['selecting next locations, non-existent', 2, undefined]
+ ['selecting next locations, non-existent', 2, undefined],
])('should work when %s', (_, start, expected) => {
wrapper.setState({ selectedHotspotLocationIndex: start, selectedHotspot: hotspotsForLocation });
wrapper.instance().handleKeyDown(mockEvent({ altKey: true, key: KeyboardKeys.DownArrow }));
@@ -458,7 +449,7 @@ describe('keyboard navigation', () => {
it.each([
['selecting previous locations when nothing is selected', undefined, undefined],
['selecting previous locations', 1, 0],
- ['selecting previous locations, non-existent', 0, undefined]
+ ['selecting previous locations, non-existent', 0, undefined],
])('should work when %s', (_, start, expected) => {
wrapper.setState({ selectedHotspotLocationIndex: start, selectedHotspot: hotspotsForLocation });
wrapper.instance().handleKeyDown(mockEvent({ altKey: true, key: KeyboardKeys.UpArrow }));
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx
index e0e592c6f63..d5484ee24ee 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/SecurityHotspotsAppRenderer-test.tsx
@@ -27,11 +27,11 @@ import { SecurityStandard } from '../../../types/security';
import { HotspotStatusFilter } from '../../../types/security-hotspots';
import FilterBar from '../components/FilterBar';
import SecurityHotspotsAppRenderer, {
- SecurityHotspotsAppRendererProps
+ SecurityHotspotsAppRendererProps,
} from '../SecurityHotspotsAppRenderer';
jest.mock('../../../helpers/scrolling', () => ({
- scrollToElement: jest.fn()
+ scrollToElement: jest.fn(),
}));
jest.mock('../../../components/common/ScreenPositionHelper');
@@ -44,7 +44,7 @@ jest.mock('react', () => {
return {
...jest.requireActual('react'),
useRef: jest.fn(),
- useEffect: jest.fn()
+ useEffect: jest.fn(),
};
});
@@ -52,7 +52,11 @@ it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot();
expect(
shallowRender({
- filters: { assignedToMe: true, inNewCodePeriod: false, status: HotspotStatusFilter.TO_REVIEW }
+ filters: {
+ assignedToMe: true,
+ inNewCodePeriod: false,
+ status: HotspotStatusFilter.TO_REVIEW,
+ },
})
).toMatchSnapshot('no hotspots with filters');
expect(shallowRender({ loading: true })).toMatchSnapshot('loading');
@@ -81,7 +85,7 @@ it('should render correctly when filtered by category or cwe', () => {
filterByCategory: { category: 'a1', standard: SecurityStandard.OWASP_TOP10 },
hotspots,
hotspotsTotal: 2,
- selectedHotspot: hotspots[0]
+ selectedHotspot: hotspots[0],
})
.find(ScreenPositionHelper)
.dive()
@@ -92,10 +96,7 @@ it('should properly propagate the "show all" call', () => {
const onShowAllHotspots = jest.fn();
const wrapper = shallowRender({ onShowAllHotspots });
- wrapper
- .find(FilterBar)
- .props()
- .onShowAllHotspots();
+ wrapper.find(FilterBar).props().onShowAllHotspots();
expect(onShowAllHotspots).toHaveBeenCalled();
});
@@ -105,7 +106,7 @@ describe('side effect', () => {
const fakeParent = document.createElement('div');
beforeEach(() => {
- (React.useEffect as jest.Mock).mockImplementationOnce(f => f());
+ (React.useEffect as jest.Mock).mockImplementationOnce((f) => f());
jest.spyOn(document, 'querySelector').mockImplementationOnce(() => fakeElement);
(React.useRef as jest.Mock).mockImplementationOnce(() => ({ current: fakeParent }));
});
@@ -140,7 +141,7 @@ function shallowRender(props: Partial<SecurityHotspotsAppRendererProps> = {}) {
filters={{
assignedToMe: false,
inNewCodePeriod: false,
- status: HotspotStatusFilter.TO_REVIEW
+ status: HotspotStatusFilter.TO_REVIEW,
}}
hotspots={[]}
hotspotsTotal={0}
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/utils-test.ts
index 12856d774dd..2090d30ea9d 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/__tests__/utils-test.ts
@@ -26,7 +26,7 @@ import {
HotspotStatusOption,
RawHotspot,
ReviewHistoryType,
- RiskExposure
+ RiskExposure,
} from '../../../types/security-hotspots';
import { FlowLocation, IssueChangelog } from '../../../types/types';
import {
@@ -37,7 +37,7 @@ import {
getStatusOptionFromStatusAndResolution,
groupByCategory,
mapRules,
- sortHotspots
+ sortHotspots,
} from '../utils';
const hotspots = [
@@ -45,87 +45,87 @@ const hotspots = [
key: '3',
vulnerabilityProbability: RiskExposure.HIGH,
securityCategory: 'object-injection',
- message: 'tfdh'
+ message: 'tfdh',
}),
mockRawHotspot({
key: '5',
vulnerabilityProbability: RiskExposure.MEDIUM,
securityCategory: 'xpath-injection',
- message: 'asdf'
+ message: 'asdf',
}),
mockRawHotspot({
key: '1',
vulnerabilityProbability: RiskExposure.HIGH,
securityCategory: 'dos',
- message: 'a'
+ message: 'a',
}),
mockRawHotspot({
key: '7',
vulnerabilityProbability: RiskExposure.LOW,
securityCategory: 'ssrf',
- message: 'rrrr'
+ message: 'rrrr',
}),
mockRawHotspot({
key: '2',
vulnerabilityProbability: RiskExposure.HIGH,
securityCategory: 'dos',
- message: 'b'
+ message: 'b',
}),
mockRawHotspot({
key: '8',
vulnerabilityProbability: RiskExposure.LOW,
securityCategory: 'ssrf',
- message: 'sssss'
+ message: 'sssss',
}),
mockRawHotspot({
key: '4',
vulnerabilityProbability: RiskExposure.MEDIUM,
securityCategory: 'log-injection',
- message: 'asdf'
+ message: 'asdf',
}),
mockRawHotspot({
key: '9',
vulnerabilityProbability: RiskExposure.LOW,
securityCategory: 'xxe',
- message: 'aaa'
+ message: 'aaa',
}),
mockRawHotspot({
key: '6',
vulnerabilityProbability: RiskExposure.LOW,
securityCategory: 'xss',
- message: 'zzz'
- })
+ message: 'zzz',
+ }),
];
const categories = {
'object-injection': {
- title: 'Object Injection'
+ title: 'Object Injection',
},
'xpath-injection': {
- title: 'XPath Injection'
+ title: 'XPath Injection',
},
'log-injection': {
- title: 'Log Injection'
+ title: 'Log Injection',
},
dos: {
- title: 'Denial of Service (DoS)'
+ title: 'Denial of Service (DoS)',
},
ssrf: {
- title: 'Server-Side Request Forgery (SSRF)'
+ title: 'Server-Side Request Forgery (SSRF)',
},
xxe: {
- title: 'XML External Entity (XXE)'
+ title: 'XML External Entity (XXE)',
},
xss: {
- title: 'Cross-Site Scripting (XSS)'
- }
+ title: 'Cross-Site Scripting (XSS)',
+ },
};
describe('sortHotspots', () => {
it('should sort properly', () => {
const result = sortHotspots(hotspots, categories);
- expect(result.map(h => h.key)).toEqual(['1', '2', '3', '4', '5', '6', '7', '8', '9']);
+ expect(result.map((h) => h.key)).toEqual(['1', '2', '3', '4', '5', '6', '7', '8', '9']);
});
});
@@ -142,13 +142,13 @@ describe('mapRules', () => {
const rules = [
{ key: 'a', name: 'A rule' },
{ key: 'b', name: 'B rule' },
- { key: 'c', name: 'C rule' }
+ { key: 'c', name: 'C rule' },
];
expect(mapRules(rules)).toEqual({
a: 'A rule',
b: 'B rule',
- c: 'C rule'
+ c: 'C rule',
});
});
});
@@ -164,9 +164,9 @@ describe('getHotspotReviewHistory', () => {
{
key: 'assign',
newValue: 'me',
- oldValue: 'him'
- }
- ]
+ oldValue: 'him',
+ },
+ ],
};
const commentElement = {
key: 'comment-1',
@@ -175,7 +175,7 @@ describe('getHotspotReviewHistory', () => {
markdown: '*TEST*',
updatable: true,
login: 'dude-1',
- user: mockUser({ login: 'dude-1' })
+ user: mockUser({ login: 'dude-1' }),
};
const commentElement1 = {
key: 'comment-2',
@@ -184,12 +184,12 @@ describe('getHotspotReviewHistory', () => {
markdown: '*TEST*',
updatable: true,
login: 'dude-2',
- user: mockUser({ login: 'dude-2' })
+ user: mockUser({ login: 'dude-2' }),
};
const hotspot = mockHotspot({
creationDate: '2018-09-01',
changelog: [changelogElement],
- comment: [commentElement, commentElement1]
+ comment: [commentElement, commentElement1],
});
const reviewHistory = getHotspotReviewHistory(hotspot);
@@ -198,7 +198,7 @@ describe('getHotspotReviewHistory', () => {
expect.objectContaining({
type: ReviewHistoryType.Creation,
date: hotspot.creationDate,
- user: hotspot.authorUser
+ user: hotspot.authorUser,
})
);
expect(reviewHistory[2]).toEqual(
@@ -206,7 +206,7 @@ describe('getHotspotReviewHistory', () => {
type: ReviewHistoryType.Comment,
date: commentElement.createdAt,
user: commentElement.user,
- html: commentElement.htmlText
+ html: commentElement.htmlText,
})
);
expect(reviewHistory[1]).toEqual(
@@ -214,7 +214,7 @@ describe('getHotspotReviewHistory', () => {
type: ReviewHistoryType.Comment,
date: commentElement1.createdAt,
user: commentElement1.user,
- html: commentElement1.htmlText
+ html: commentElement1.htmlText,
})
);
expect(reviewHistory[0]).toEqual(
@@ -224,9 +224,9 @@ describe('getHotspotReviewHistory', () => {
user: {
avatar: changelogElement.avatar,
name: changelogElement.userName,
- active: changelogElement.isUserActive
+ active: changelogElement.isUserActive,
},
- diffs: changelogElement.diffs
+ diffs: changelogElement.diffs,
})
);
});
@@ -253,15 +253,15 @@ describe('getStatusAndResolutionFromStatusOption', () => {
it('should return the correct values', () => {
expect(getStatusAndResolutionFromStatusOption(HotspotStatusOption.TO_REVIEW)).toEqual({
status: HotspotStatus.TO_REVIEW,
- resolution: undefined
+ resolution: undefined,
});
expect(getStatusAndResolutionFromStatusOption(HotspotStatusOption.FIXED)).toEqual({
status: HotspotStatus.REVIEWED,
- resolution: HotspotResolution.FIXED
+ resolution: HotspotResolution.FIXED,
});
expect(getStatusAndResolutionFromStatusOption(HotspotStatusOption.SAFE)).toEqual({
status: HotspotStatus.REVIEWED,
- resolution: HotspotResolution.SAFE
+ resolution: HotspotResolution.SAFE,
});
});
});
@@ -285,36 +285,36 @@ describe('getLocations', () => {
const location1: FlowLocation = {
component: 'foo',
msg: 'Do not use foo',
- textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 }
+ textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 },
};
const location2: FlowLocation = {
component: 'foo2',
msg: 'Do not use foo2',
- textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 }
+ textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 },
};
let rawFlows: RawHotspot['flows'] = [
{
- locations: [location1]
- }
+ locations: [location1],
+ },
];
expect(getLocations(rawFlows, undefined)).toEqual([location1]);
rawFlows = [
{
- locations: [location1, location2]
- }
+ locations: [location1, location2],
+ },
];
expect(getLocations(rawFlows, undefined)).toEqual([location2, location1]);
rawFlows = [
{
- locations: [location1, location2]
+ locations: [location1, location2],
},
{
- locations: []
- }
+ locations: [],
+ },
];
expect(getLocations(rawFlows, 0)).toEqual([location2, location1]);
});
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx
index 91409b6441a..40ff52e37c2 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx
@@ -47,25 +47,25 @@ const statusOptions: Array<{ label: string; value: HotspotStatusFilter }> = [
{ value: HotspotStatusFilter.TO_REVIEW, label: translate('hotspot.filters.status.to_review') },
{
value: HotspotStatusFilter.ACKNOWLEDGED,
- label: translate('hotspot.filters.status.acknowledged')
+ label: translate('hotspot.filters.status.acknowledged'),
},
{ value: HotspotStatusFilter.FIXED, label: translate('hotspot.filters.status.fixed') },
- { value: HotspotStatusFilter.SAFE, label: translate('hotspot.filters.status.safe') }
+ { value: HotspotStatusFilter.SAFE, label: translate('hotspot.filters.status.safe') },
];
const periodOptions = [
{ value: true, label: translate('hotspot.filters.period.since_leak_period') },
- { value: false, label: translate('hotspot.filters.period.overall') }
+ { value: false, label: translate('hotspot.filters.period.overall') },
];
export enum AssigneeFilterOption {
ALL = 'all',
- ME = 'me'
+ ME = 'me',
}
const assigneeFilterOptions = [
{ value: AssigneeFilterOption.ME, label: translate('hotspot.filters.assignee.assigned_to_me') },
- { value: AssigneeFilterOption.ALL, label: translate('hotspot.filters.assignee.all') }
+ { value: AssigneeFilterOption.ALL, label: translate('hotspot.filters.assignee.all') },
];
export function FilterBar(props: FilterBarProps) {
@@ -76,7 +76,7 @@ export function FilterBar(props: FilterBarProps) {
hotspotsReviewedMeasure,
isStaticListOfHotspots,
loadingMeasure,
- onBranch
+ onBranch,
} = props;
const isProject = component.qualifier === ComponentQualifier.Project;
@@ -89,7 +89,8 @@ export function FilterBar(props: FilterBarProps) {
id="show_all_hotspot"
onClick={() => props.onShowAllHotspots()}
role="link"
- tabIndex={0}>
+ tabIndex={0}
+ >
{translate('hotspot.filters.show_all')}
</a>
) : (
@@ -120,7 +121,7 @@ export function FilterBar(props: FilterBarProps) {
}
options={statusOptions}
isSearchable={false}
- value={statusOptions.find(status => status.value === filters.status)}
+ value={statusOptions.find((status) => status.value === filters.status)}
/>
{onBranch && (
@@ -132,7 +133,7 @@ export function FilterBar(props: FilterBarProps) {
}
options={periodOptions}
isSearchable={false}
- value={periodOptions.find(period => period.value === filters.inNewCodePeriod)}
+ value={periodOptions.find((period) => period.value === filters.inNewCodePeriod)}
/>
)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotCategory.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotCategory.tsx
index 8197e305607..3a475d06c48 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotCategory.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotCategory.tsx
@@ -46,7 +46,7 @@ export default function HotspotCategory(props: HotspotCategoryProps) {
selectedHotspot,
title,
isLastAndIncomplete,
- selectedHotspotLocation
+ selectedHotspotLocation,
} = props;
if (hotspots.length < 1) {
@@ -64,7 +64,8 @@ export default function HotspotCategory(props: HotspotCategoryProps) {
{ 'contains-selected-hotspot': selectedHotspot.securityCategory === categoryKey }
)}
onClick={() => props.onToggleExpand && props.onToggleExpand(categoryKey, !expanded)}
- aria-expanded={expanded}>
+ aria-expanded={expanded}
+ >
<strong className="flex-1 spacer-right break-word">{title}</strong>
<span>
<span className="counter-badge">
@@ -85,7 +86,7 @@ export default function HotspotCategory(props: HotspotCategoryProps) {
)}
{expanded && (
<ul>
- {hotspots.map(h => (
+ {hotspots.map((h) => (
<li data-hotspot-key={h.key} key={h.key}>
<HotspotListItem
hotspot={h}
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotCommentPopup.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotCommentPopup.tsx
index eaaf49af299..bbc2e01417d 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotCommentPopup.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotCommentPopup.tsx
@@ -36,7 +36,7 @@ export default function HotspotCommentPopup(props: HotspotCommentPopupProps) {
<div className="issue-comment-form-text">
<textarea
autoFocus={true}
- onChange={event => setComment(event.target.value)}
+ onChange={(event) => setComment(event.target.value)}
rows={2}
value={comment}
/>
@@ -48,14 +48,16 @@ export default function HotspotCommentPopup(props: HotspotCommentPopupProps) {
<div className="">
<Button
className="little-spacer-right"
- onClick={() => props.onCommentEditSubmit(comment)}>
+ onClick={() => props.onCommentEditSubmit(comment)}
+ >
{translate('save')}
</Button>
<ResetButtonLink
onClick={() => {
setComment('');
props.onCancelEdit();
- }}>
+ }}
+ >
{translate('cancel')}
</ResetButtonLink>
</div>
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotHeader.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotHeader.tsx
index d9402440b4c..c35fa0359f9 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotHeader.tsx
@@ -48,7 +48,7 @@ export function HotspotHeader(props: HotspotHeaderProps) {
<div className="display-flex-space-between">
<Status
hotspot={hotspot}
- onStatusChange={statusOption => props.onUpdateHotspot(true, statusOption)}
+ onStatusChange={(statusOption) => props.onUpdateHotspot(true, statusOption)}
/>
<div className="display-flex-end">
<div className="display-inline-flex-center it__hs-assignee">
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.tsx
index a8d298b0d04..47ec65eef17 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.tsx
@@ -58,7 +58,7 @@ export default class HotspotList extends React.Component<Props, State> {
this.state = {
expandedCategories: { [props.selectedHotspot.securityCategory]: true },
- groupedHotspots: this.groupHotspots(props.hotspots, props.securityCategories)
+ groupedHotspots: this.groupHotspots(props.hotspots, props.securityCategories),
};
}
@@ -100,17 +100,17 @@ export default class HotspotList extends React.Component<Props, State> {
}
groupHotspots = (hotspots: RawHotspot[], securityCategories: StandardSecurityCategories) => {
- const risks = groupBy(hotspots, h => h.vulnerabilityProbability);
+ const risks = groupBy(hotspots, (h) => h.vulnerabilityProbability);
- return RISK_EXPOSURE_LEVELS.map(risk => ({
+ return RISK_EXPOSURE_LEVELS.map((risk) => ({
risk,
- categories: groupByCategory(risks[risk], securityCategories)
- })).filter(risk => risk.categories.length > 0);
+ categories: groupByCategory(risks[risk], securityCategories),
+ })).filter((risk) => risk.categories.length > 0);
};
handleToggleCategory = (categoryKey: string, value: boolean) => {
this.setState(({ expandedCategories }) => ({
- expandedCategories: { ...expandedCategories, [categoryKey]: value }
+ expandedCategories: { ...expandedCategories, [categoryKey]: value },
}));
};
@@ -122,7 +122,7 @@ export default class HotspotList extends React.Component<Props, State> {
loadingMore,
selectedHotspot,
selectedHotspotLocation,
- statusFilter
+ statusFilter,
} = this.props;
const { expandedCategories, groupedHotspots } = this.state;
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotListItem.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotListItem.tsx
index 81ed5460eda..df0e499d2e6 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotListItem.tsx
@@ -43,12 +43,14 @@ export default function HotspotListItem(props: HotspotListItemProps) {
<ButtonPlain
aria-current={selected}
className={classNames('hotspot-item', { highlight: selected })}
- onClick={() => !selected && props.onClick(hotspot)}>
+ onClick={() => !selected && props.onClick(hotspot)}
+ >
{/* This is not a real interaction it is only for scrolling */
/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
<div
className={classNames('little-spacer-left text-bold', { 'cursor-pointer': selected })}
- onClick={selected ? () => props.onLocationClick() : undefined}>
+ onClick={selected ? () => props.onLocationClick() : undefined}
+ >
{hotspot.message}
</div>
<div className="display-flex-center big-spacer-top">
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeButton.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeButton.tsx
index c7f5bfbe1b5..efae47c0da9 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeButton.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeButton.tsx
@@ -43,7 +43,7 @@ export default class HotspotOpenInIdeButton extends React.PureComponent<Props, S
state = {
loading: false,
- ides: []
+ ides: [],
};
componentDidMount() {
@@ -97,7 +97,8 @@ export default class HotspotOpenInIdeButton extends React.PureComponent<Props, S
<DropdownOverlay>
<HotspotOpenInIdeOverlay ides={this.state.ides} onIdeSelected={this.openHotspot} />
</DropdownOverlay>
- }>
+ }
+ >
<Button onClick={this.handleOnClick}>
{translate('hotspots.open_in_ide.open')}
<DeferredSpinner loading={this.state.loading} className="spacer-left" />
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeOverlay.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeOverlay.tsx
index de395abe329..d3511a7a8e8 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeOverlay.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeOverlay.tsx
@@ -22,14 +22,14 @@ import { Ide } from '../../../types/sonarlint';
export const HotspotOpenInIdeOverlay = ({
ides,
- onIdeSelected
+ onIdeSelected,
}: {
ides: Array<Ide>;
onIdeSelected: (ide: Ide) => Promise<void>;
}) =>
ides.length > 1 ? (
<ul className="menu">
- {ides.map(ide => {
+ {ides.map((ide) => {
const { ideName, description } = ide;
const label = ideName + (description ? ` - ${description}` : '');
return (
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotPrimaryLocationBox.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotPrimaryLocationBox.tsx
index 1720cd7d77e..bc297c01249 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotPrimaryLocationBox.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotPrimaryLocationBox.tsx
@@ -53,12 +53,14 @@ export function HotspotPrimaryLocationBox(props: HotspotPrimaryLocationBoxProps)
'display-flex-space-between display-flex-center padded-top padded-bottom big-padded-left big-padded-right',
`hotspot-risk-exposure-${hotspot.rule.vulnerabilityProbability}`
)}
- ref={locationRef}>
+ ref={locationRef}
+ >
<div className="text-bold">{hotspot.message}</div>
{isLoggedIn(currentUser) && (
<ButtonLink
className="nowrap big-spacer-left it__hs-add-comment"
- onClick={props.onCommentClick}>
+ onClick={props.onCommentClick}
+ >
{translate('hotspots.comment.open')}
</ButtonLink>
)}
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistory.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistory.tsx
index 4941f12ce08..87a55a8b372 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistory.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistory.tsx
@@ -59,9 +59,10 @@ export default function HotspotReviewHistory(props: HotspotReviewHistoryProps) {
return (
<li
className={classNames('padded-top padded-bottom', {
- 'bordered-top': historyIndex > 0
+ 'bordered-top': historyIndex > 0,
})}
- key={historyIndex}>
+ key={historyIndex}
+ >
<div className="display-flex-center">
{user.name && (
<>
@@ -120,13 +121,14 @@ export default function HotspotReviewHistory(props: HotspotReviewHistoryProps) {
<HotspotCommentPopup
markdownComment={markdown}
onCancelEdit={() => setEditedCommentKey('')}
- onCommentEditSubmit={comment => {
+ onCommentEditSubmit={(comment) => {
setEditedCommentKey('');
props.onEditComment(key, comment);
}}
/>
</DropdownOverlay>
- }>
+ }
+ >
<EditButton
className="button-small"
onClick={() => setEditedCommentKey(key)}
@@ -140,12 +142,14 @@ export default function HotspotReviewHistory(props: HotspotReviewHistoryProps) {
<p>{translate('issue.comment.delete_confirm_message')}</p>
<Button
className="button-red big-spacer-top pull-right"
- onClick={() => props.onDeleteComment(key)}>
+ onClick={() => props.onDeleteComment(key)}
+ >
{translate('delete')}
</Button>
</div>
}
- overlayPlacement={PopupPlacement.BottomRight}>
+ overlayPlacement={PopupPlacement.BottomRight}
+ >
<DeleteButton className="button-small" />
</Dropdown>
</div>
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistoryAndComments.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistoryAndComments.tsx
index 32e8ec99959..3f638901089 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistoryAndComments.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotReviewHistoryAndComments.tsx
@@ -21,7 +21,7 @@ import * as React from 'react';
import {
commentSecurityHotspot,
deleteSecurityHotspotComment,
- editSecurityHotspotComment
+ editSecurityHotspotComment,
} from '../../../api/security-hotspots';
import FormattingTips from '../../../components/common/FormattingTips';
import { Button } from '../../../components/controls/buttons';
@@ -47,7 +47,7 @@ export default class HotspotReviewHistoryAndComments extends React.PureComponent
super(props);
this.state = {
comment: '',
- showFullHistory: false
+ showFullHistory: false,
};
}
@@ -55,7 +55,7 @@ export default class HotspotReviewHistoryAndComments extends React.PureComponent
if (prevProps.hotspot.key !== this.props.hotspot.key) {
this.setState({
comment: '',
- showFullHistory: false
+ showFullHistory: false,
});
}
}
@@ -109,7 +109,8 @@ export default class HotspotReviewHistoryAndComments extends React.PureComponent
<Button
className="huge-spacer-bottom"
id="hotspot-comment-box-submit"
- onClick={this.handleSubmitComment}>
+ onClick={this.handleSubmitComment}
+ >
{translate('hotspots.comment.submit')}
</Button>
</div>
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSimpleList.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSimpleList.tsx
index 98128701214..ed432da965e 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSimpleList.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSimpleList.tsx
@@ -68,7 +68,7 @@ export default class HotspotSimpleList extends React.Component<HotspotSimpleList
loadingMore,
selectedHotspot,
selectedHotspotLocation,
- standards
+ standards,
} = this.props;
const categoryLabel =
@@ -108,7 +108,7 @@ export default class HotspotSimpleList extends React.Component<HotspotSimpleList
</strong>
</div>
<ul>
- {hotspots.map(h => (
+ {hotspots.map((h) => (
<li data-hotspot-key={h.key} key={h.key}>
<HotspotListItem
hotspot={h}
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainer.tsx
index 01f7f6821f5..8699d2c7de3 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainer.tsx
@@ -53,7 +53,7 @@ export default class HotspotSnippetContainer extends React.Component<Props, Stat
highlightedSymbols: [],
loading: true,
sourceLines: [],
- secondaryLocations: []
+ secondaryLocations: [],
};
async componentDidMount() {
@@ -87,7 +87,7 @@ export default class HotspotSnippetContainer extends React.Component<Props, Stat
async fetchSources() {
const {
branchLike,
- hotspot: { component, textRange }
+ hotspot: { component, textRange },
} = this.props;
const { secondaryLocations } = this.state;
@@ -102,16 +102,16 @@ export default class HotspotSnippetContainer extends React.Component<Props, Stat
const from = Math.max(
1,
Math.min(
- ...[textRange, ...secondaryLocations.map(l => l.textRange)].map(
- t => t.startLine - BUFFER_LINES
+ ...[textRange, ...secondaryLocations.map((l) => l.textRange)].map(
+ (t) => t.startLine - BUFFER_LINES
)
)
);
// Search for the max endLine within primary and secondary locations
const to = Math.max(
- ...[textRange, ...secondaryLocations.map(l => l.textRange)].map(
+ ...[textRange, ...secondaryLocations.map((l) => l.textRange)].map(
// Add 1 to check for end-of-file
- t => t.endLine + BUFFER_LINES + 1
+ (t) => t.endLine + BUFFER_LINES + 1
)
);
@@ -121,7 +121,7 @@ export default class HotspotSnippetContainer extends React.Component<Props, Stat
key: component.key,
from,
to,
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
}).catch(() => [] as SourceLine[]);
if (this.mounted) {
@@ -136,14 +136,14 @@ export default class HotspotSnippetContainer extends React.Component<Props, Stat
initializeSecondaryLocations() {
const { hotspot } = this.props;
- return new Promise(resolve => {
+ return new Promise((resolve) => {
this.setState(
{
secondaryLocations: getLocations(hotspot.flows, undefined).map((location, index) => ({
...location,
index,
- text: location.msg
- }))
+ text: location.msg,
+ })),
},
() => resolve(undefined)
);
@@ -158,19 +158,19 @@ export default class HotspotSnippetContainer extends React.Component<Props, Stat
direction === 'up'
? {
from: Math.max(1, sourceLines[0].line - EXPAND_BY_LINES),
- to: sourceLines[0].line - 1
+ to: sourceLines[0].line - 1,
}
: {
from: sourceLines[sourceLines.length - 1].line + 1,
// Add 1 to check for end-of-file:
- to: sourceLines[sourceLines.length - 1].line + EXPAND_BY_LINES + 1
+ to: sourceLines[sourceLines.length - 1].line + EXPAND_BY_LINES + 1,
};
return getSources({
key: hotspot.component.key,
...range,
- ...getBranchLikeQuery(branchLike)
- }).then(additionalLines => {
+ ...getBranchLikeQuery(branchLike),
+ }).then((additionalLines) => {
const { lastLine: previousLastLine } = this.state;
const lastLine =
@@ -188,7 +188,7 @@ export default class HotspotSnippetContainer extends React.Component<Props, Stat
this.setState({
lastLine,
- sourceLines: concatSourceLines
+ sourceLines: concatSourceLines,
});
});
};
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainerRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainerRenderer.tsx
index 3c8f12e0557..1d5b6485ce1 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainerRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetContainerRenderer.tsx
@@ -29,7 +29,7 @@ import {
FlowLocation,
LinearIssueLocation,
SourceLine,
- SourceViewerFile
+ SourceViewerFile,
} from '../../../types/types';
import SnippetViewer from '../../issues/crossComponentSourceViewer/SnippetViewer';
import HotspotPrimaryLocationBox from './HotspotPrimaryLocationBox';
@@ -70,7 +70,7 @@ export function getScrollHandler(scrollableRef: React.RefObject<HTMLDivElement>)
parent,
topOffset: offset ?? TOP_OFFSET,
bottomOffset: offset ?? BOTTOM_OFFSET,
- smooth
+ smooth,
});
}
}, SCROLL_DELAY);
@@ -141,7 +141,7 @@ export default function HotspotSnippetContainerRenderer(
sourceViewerFile,
secondaryLocations,
component,
- selectedHotspotLocation
+ selectedHotspotLocation,
} = props;
const scrollableRef = React.useRef<HTMLDivElement>(null);
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetHeader.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetHeader.tsx
index 1ed19a6a947..ab4a739a34f 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetHeader.tsx
@@ -47,7 +47,7 @@ export function HotspotSnippetHeader(props: HotspotSnippetHeaderProps) {
const { hotspot, currentUser, component, branchLike } = props;
const {
project,
- component: { qualifier, path }
+ component: { qualifier, path },
} = hotspot;
const displayProjectName = component.qualifier === ComponentQualifier.Application;
@@ -55,7 +55,7 @@ export function HotspotSnippetHeader(props: HotspotSnippetHeaderProps) {
const permalink = getPathUrlAsString(
getComponentSecurityHotspotsUrl(component.key, {
...getBranchLikeQuery(branchLike),
- hotspots: hotspot?.key
+ hotspots: hotspot?.key,
}),
false
);
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx
index 85763e86b7b..b2bcf81952c 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.tsx
@@ -24,7 +24,7 @@ import { scrollToElement } from '../../../helpers/scrolling';
import {
Hotspot,
HotspotStatusFilter,
- HotspotStatusOption
+ HotspotStatusOption,
} from '../../../types/security-hotspots';
import { Component } from '../../../types/types';
import { RuleDescriptionSection } from '../../coding-rules/rule';
@@ -81,13 +81,13 @@ export default class HotspotViewer extends React.PureComponent<Props, State> {
this.setState({ loading: true });
try {
const hotspot = await getSecurityHotspotDetails(this.props.hotspotKey);
- const ruleDetails = await getRuleDetails({ key: hotspot.rule.key }).then(r => r.rule);
+ const ruleDetails = await getRuleDetails({ key: hotspot.rule.key }).then((r) => r.rule);
if (this.mounted) {
this.setState({
hotspot,
loading: false,
- ruleDescriptionSections: ruleDetails.descriptionSections
+ ruleDescriptionSections: ruleDetails.descriptionSections,
});
}
} catch (error) {
@@ -112,7 +112,7 @@ export default class HotspotViewer extends React.PureComponent<Props, State> {
if (this.commentTextRef.current) {
this.commentTextRef.current.focus({ preventScroll: true });
scrollToElement(this.commentTextRef.current, {
- bottomOffset: SCROLL_TO_COMMENT_BOTTOM_OFFSET
+ bottomOffset: SCROLL_TO_COMMENT_BOTTOM_OFFSET,
});
}
};
@@ -135,7 +135,7 @@ export default class HotspotViewer extends React.PureComponent<Props, State> {
ruleDescriptionSections,
lastStatusChangedTo,
loading,
- showStatusUpdateSuccessModal
+ showStatusUpdateSuccessModal,
} = this.state;
return (
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx
index f4c1d8d06b3..0e46d5d5ded 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx
@@ -61,7 +61,7 @@ export function HotspotViewerRenderer(props: HotspotViewerRendererProps) {
showStatusUpdateSuccessModal,
commentTextRef,
selectedHotspotLocation,
- ruleDescriptionSections
+ ruleDescriptionSections,
} = props;
return (
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerTabs.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerTabs.tsx
index 5b0bd74fb42..fa63cc0a484 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerTabs.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerTabs.tsx
@@ -49,7 +49,7 @@ export enum TabKeys {
Code = 'code',
RiskDescription = 'risk',
VulnerabilityDescription = 'vulnerability',
- FixRecommendation = 'fix'
+ FixRecommendation = 'fix',
}
export default class HotspotViewerTabs extends React.PureComponent<Props, State> {
@@ -58,7 +58,7 @@ export default class HotspotViewerTabs extends React.PureComponent<Props, State>
const tabs = this.computeTabs();
this.state = {
currentTab: tabs[0],
- tabs
+ tabs,
};
}
@@ -74,7 +74,7 @@ export default class HotspotViewerTabs extends React.PureComponent<Props, State>
const tabs = this.computeTabs();
this.setState({
currentTab: tabs[0],
- tabs
+ tabs,
});
} else if (
this.props.selectedHotspotLocation !== undefined &&
@@ -82,7 +82,7 @@ export default class HotspotViewerTabs extends React.PureComponent<Props, State>
) {
const { tabs } = this.state;
this.setState({
- currentTab: tabs[0]
+ currentTab: tabs[0],
});
}
}
@@ -114,13 +114,13 @@ export default class HotspotViewerTabs extends React.PureComponent<Props, State>
handleSelectTabs = (tabKey: TabKeys) => {
const { tabs } = this.state;
- const currentTab = tabs.find(tab => tab.key === tabKey)!;
+ const currentTab = tabs.find((tab) => tab.key === tabKey)!;
this.setState({ currentTab });
};
computeTabs() {
const { ruleDescriptionSections, codeTabContent } = this.props;
- const descriptionSectionsByKey = groupBy(ruleDescriptionSections, section => section.key);
+ const descriptionSectionsByKey = groupBy(ruleDescriptionSections, (section) => section.key);
const rootCauseDescriptionSections =
descriptionSectionsByKey[RuleDescriptionSections.DEFAULT] ||
descriptionSectionsByKey[RuleDescriptionSections.ROOT_CAUSE];
@@ -129,7 +129,7 @@ export default class HotspotViewerTabs extends React.PureComponent<Props, State>
{
key: TabKeys.Code,
label: translate('hotspots.tabs.code'),
- content: <div className="padded">{codeTabContent}</div>
+ content: <div className="padded">{codeTabContent}</div>,
},
{
key: TabKeys.RiskDescription,
@@ -140,7 +140,7 @@ export default class HotspotViewerTabs extends React.PureComponent<Props, State>
sections={rootCauseDescriptionSections}
isDefault={true}
/>
- )
+ ),
},
{
key: TabKeys.VulnerabilityDescription,
@@ -151,7 +151,7 @@ export default class HotspotViewerTabs extends React.PureComponent<Props, State>
sections={descriptionSectionsByKey[RuleDescriptionSections.ASSESS_THE_PROBLEM]}
isDefault={true}
/>
- )
+ ),
},
{
key: TabKeys.FixRecommendation,
@@ -162,19 +162,19 @@ export default class HotspotViewerTabs extends React.PureComponent<Props, State>
sections={descriptionSectionsByKey[RuleDescriptionSections.HOW_TO_FIX]}
isDefault={true}
/>
- )
- }
- ].filter(tab => tab.content);
+ ),
+ },
+ ].filter((tab) => tab.content);
}
selectNeighboringTab(shift: number) {
this.setState(({ tabs, currentTab }) => {
- const index = currentTab && tabs.findIndex(tab => tab.key === currentTab.key);
+ const index = currentTab && tabs.findIndex((tab) => tab.key === currentTab.key);
if (index !== undefined && index > -1) {
const newIndex = Math.max(0, Math.min(tabs.length - 1, index + shift));
return {
- currentTab: tabs[newIndex]
+ currentTab: tabs[newIndex],
};
}
@@ -191,7 +191,8 @@ export default class HotspotViewerTabs extends React.PureComponent<Props, State>
className="bordered huge-spacer-bottom"
role="tabpanel"
aria-labelledby={getTabId(currentTab.key)}
- id={getTabPanelId(currentTab.key)}>
+ id={getTabPanelId(currentTab.key)}
+ >
{currentTab.content}
</div>
</>
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx
index 3cfd92e294d..6c8e3c9d932 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx
@@ -56,7 +56,7 @@ export default function StatusUpdateSuccessModal(props: StatusUpdateSuccessModal
id="hotspots.successfully_changed_to_x"
defaultMessage={translate('hotspots.find_in_status_filter_x')}
values={{
- status_label: <strong>{statusLabel}</strong>
+ status_label: <strong>{statusLabel}</strong>,
}}
/>
{closingHotspots && (
@@ -68,10 +68,10 @@ export default function StatusUpdateSuccessModal(props: StatusUpdateSuccessModal
percentage: (
<strong>
{formatMeasure(hotspotsReviewedMeasure, 'PERCENT', {
- omitExtraDecimalZeros: true
+ omitExtraDecimalZeros: true,
})}
</strong>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/FilterBar-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/FilterBar-test.tsx
index acaa4c993f6..4e1e145ad22 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/FilterBar-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/FilterBar-test.tsx
@@ -37,7 +37,7 @@ it('should render correctly', () => {
expect(
shallowRender({
currentUser: mockLoggedInUser(),
- component: mockComponent({ qualifier: ComponentQualifier.Application })
+ component: mockComponent({ qualifier: ComponentQualifier.Application }),
})
).toMatchSnapshot('non-project');
});
@@ -47,7 +47,7 @@ it('should render correctly when the list of hotspot is static', () => {
const wrapper = shallowRender({
isStaticListOfHotspots: true,
- onShowAllHotspots
+ onShowAllHotspots,
});
expect(wrapper).toMatchSnapshot();
@@ -59,10 +59,7 @@ it('should trigger onChange for status', () => {
const onChangeFilters = jest.fn();
const wrapper = shallowRender({ onChangeFilters });
- const { onChange } = wrapper
- .find(Select)
- .at(0)
- .props();
+ const { onChange } = wrapper.find(Select).at(0).props();
onChange({ value: HotspotStatusFilter.SAFE });
expect(onChangeFilters).toHaveBeenCalledWith({ status: HotspotStatusFilter.SAFE });
@@ -82,10 +79,7 @@ it('should trigger onChange for leak period', () => {
const onChangeFilters = jest.fn();
const wrapper = shallowRender({ onChangeFilters });
- const { onChange } = wrapper
- .find(Select)
- .at(1)
- .props();
+ const { onChange } = wrapper.find(Select).at(1).props();
onChange({ value: true });
expect(onChangeFilters).toHaveBeenCalledWith({ inNewCodePeriod: true });
@@ -99,7 +93,7 @@ function shallowRender(props: Partial<FilterBarProps> = {}) {
filters={{
assignedToMe: false,
inNewCodePeriod: false,
- status: HotspotStatusFilter.TO_REVIEW
+ status: HotspotStatusFilter.TO_REVIEW,
}}
isStaticListOfHotspots={false}
loadingMeasure={false}
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotCategory-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotCategory-test.tsx
index d06f2f67b8b..050f84dfee0 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotCategory-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotCategory-test.tsx
@@ -30,7 +30,7 @@ it('should render correctly with hotspots', () => {
const securityCategory = 'command-injection';
const hotspots = [
mockRawHotspot({ key: 'h1', securityCategory }),
- mockRawHotspot({ key: 'h2', securityCategory })
+ mockRawHotspot({ key: 'h2', securityCategory }),
];
expect(shallowRender({ hotspots })).toMatchSnapshot();
expect(shallowRender({ hotspots, expanded: false })).toMatchSnapshot('collapsed');
@@ -51,7 +51,7 @@ it('should handle collapse and expand', () => {
categoryKey,
expanded: true,
hotspots: [mockRawHotspot()],
- onToggleExpand
+ onToggleExpand,
});
wrapper.find('.hotspot-category-header').simulate('click');
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotCommentPopup-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotCommentPopup-test.tsx
index e04b4033888..666201b6bfc 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotCommentPopup-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotCommentPopup-test.tsx
@@ -29,7 +29,7 @@ it('should render correclty', () => {
it('should trigger update comment', () => {
const props = {
- onCommentEditSubmit: jest.fn()
+ onCommentEditSubmit: jest.fn(),
};
const wrapper = shallowRender(props);
wrapper.find('textarea').simulate('change', { target: { value: 'foo' } });
@@ -40,7 +40,7 @@ it('should trigger update comment', () => {
it('should trigger cancel update comment', () => {
const props = {
- onCancelEdit: jest.fn()
+ onCancelEdit: jest.fn(),
};
const wrapper = shallowRender(props);
wrapper.find(ResetButtonLink).simulate('click');
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotHeader-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotHeader-test.tsx
index b285f794897..42e19038993 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotHeader-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotHeader-test.tsx
@@ -33,10 +33,7 @@ it('correctly propagates the status change', () => {
const onUpdateHotspot = jest.fn();
const wrapper = shallowRender({ onUpdateHotspot });
- wrapper
- .find(Status)
- .props()
- .onStatusChange(HotspotStatusOption.FIXED);
+ wrapper.find(Status).props().onStatusChange(HotspotStatusOption.FIXED);
expect(onUpdateHotspot).toHaveBeenCalledWith(true, HotspotStatusOption.FIXED);
});
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotList-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotList-test.tsx
index 2876fa8dfa9..3094c3ea8b0 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotList-test.tsx
@@ -27,7 +27,7 @@ import HotspotList from '../HotspotList';
jest.mock('../../../../helpers/pages', () => ({
addSideBarClass: jest.fn(),
- removeSideBarClass: jest.fn()
+ removeSideBarClass: jest.fn(),
}));
it('should render correctly', () => {
@@ -57,18 +57,18 @@ const hotspots = [
mockRawHotspot({
key: 'h3',
securityCategory: 'cat1',
- vulnerabilityProbability: RiskExposure.MEDIUM
+ vulnerabilityProbability: RiskExposure.MEDIUM,
}),
mockRawHotspot({
key: 'h4',
securityCategory: 'cat1',
- vulnerabilityProbability: RiskExposure.MEDIUM
+ vulnerabilityProbability: RiskExposure.MEDIUM,
}),
mockRawHotspot({
key: 'h5',
securityCategory: 'cat2',
- vulnerabilityProbability: RiskExposure.MEDIUM
- })
+ vulnerabilityProbability: RiskExposure.MEDIUM,
+ }),
];
it('should render correctly with hotspots', () => {
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeButton-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeButton-test.tsx
index ef7dce2d793..6cabfb01a28 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeButton-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeButton-test.tsx
@@ -39,7 +39,7 @@ describe('HotspotOpenInIdeButton', () => {
expect(wrapper).toMatchSnapshot();
(sonarlint.probeSonarLintServers as jest.Mock).mockResolvedValue([
- { port, ideName: 'BlueJ IDE', description: 'Hello World' }
+ { port, ideName: 'BlueJ IDE', description: 'Hello World' },
]);
(sonarlint.openHotspot as jest.Mock).mockResolvedValue(null);
@@ -71,7 +71,7 @@ describe('HotspotOpenInIdeButton', () => {
(sonarlint.probeSonarLintServers as jest.Mock).mockResolvedValue([
{ port: port1, ideName: 'BlueJ IDE', description: 'Hello World' },
- { port: port2, ideName: 'Arduino IDE', description: 'Blink' }
+ { port: port2, ideName: 'Arduino IDE', description: 'Blink' },
]);
wrapper.find(Button).simulate('click');
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeOverlay-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeOverlay-test.tsx
index a81b6cee33e..da90459e72f 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeOverlay-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeOverlay-test.tsx
@@ -45,9 +45,6 @@ it('should render menu and select the right IDE', () => {
);
expect(wrapper).toMatchSnapshot();
- wrapper
- .find('a')
- .last()
- .simulate('click');
+ wrapper.find('a').last().simulate('click');
expect(onIdeSelected).toHaveBeenCalledWith(ide2);
});
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotPrimaryLocationBox-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotPrimaryLocationBox-test.tsx
index 8c05746529b..10099bd653a 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotPrimaryLocationBox-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotPrimaryLocationBox-test.tsx
@@ -25,14 +25,14 @@ import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks
import { RiskExposure } from '../../../../types/security-hotspots';
import {
HotspotPrimaryLocationBox,
- HotspotPrimaryLocationBoxProps
+ HotspotPrimaryLocationBoxProps,
} from '../HotspotPrimaryLocationBox';
jest.mock('react', () => {
return {
...jest.requireActual('react'),
useRef: jest.fn(),
- useEffect: jest.fn()
+ useEffect: jest.fn(),
};
});
@@ -43,9 +43,9 @@ it('should render correctly', () => {
it.each([[RiskExposure.HIGH], [RiskExposure.MEDIUM], [RiskExposure.LOW]])(
'should indicate risk exposure: %s',
- vulnerabilityProbability => {
+ (vulnerabilityProbability) => {
const wrapper = shallowRender({
- hotspot: mockHotspot({ rule: mockHotspotRule({ vulnerabilityProbability }) })
+ hotspot: mockHotspot({ rule: mockHotspotRule({ vulnerabilityProbability }) }),
});
expect(wrapper.hasClass(`hotspot-risk-exposure-${vulnerabilityProbability}`)).toBe(true);
@@ -64,7 +64,7 @@ it('should handle click', () => {
it('should scroll on load if no secondary locations selected', () => {
const node = document.createElement('div');
(React.useRef as jest.Mock).mockImplementationOnce(() => ({ current: node }));
- (React.useEffect as jest.Mock).mockImplementationOnce(f => f());
+ (React.useEffect as jest.Mock).mockImplementationOnce((f) => f());
const scroll = jest.fn();
shallowRender({ scroll });
@@ -75,7 +75,7 @@ it('should scroll on load if no secondary locations selected', () => {
it('should not scroll on load if a secondary location is selected', () => {
const node = document.createElement('div');
(React.useRef as jest.Mock).mockImplementationOnce(() => ({ current: node }));
- (React.useEffect as jest.Mock).mockImplementationOnce(f => f());
+ (React.useEffect as jest.Mock).mockImplementationOnce((f) => f());
const scroll = jest.fn();
shallowRender({ scroll, secondaryLocationSelected: true });
@@ -85,7 +85,7 @@ it('should not scroll on load if a secondary location is selected', () => {
it('should not scroll on load if node is not defined', () => {
(React.useRef as jest.Mock).mockImplementationOnce(() => ({ current: undefined }));
- (React.useEffect as jest.Mock).mockImplementationOnce(f => f());
+ (React.useEffect as jest.Mock).mockImplementationOnce((f) => f());
const scroll = jest.fn();
shallowRender({ scroll });
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotReviewHistory-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotReviewHistory-test.tsx
index 86b9fefe76d..b2b46b00547 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotReviewHistory-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotReviewHistory-test.tsx
@@ -31,23 +31,19 @@ import HotspotReviewHistory, { HotspotReviewHistoryProps } from '../HotspotRevie
jest.mock('react', () => {
return {
...jest.requireActual('react'),
- useState: jest.fn().mockImplementation(() => ['', jest.fn()])
+ useState: jest.fn().mockImplementation(() => ['', jest.fn()]),
};
});
it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot('default');
expect(shallowRender({ showFullHistory: true })).toMatchSnapshot('show full list');
- expect(
- shallowRender({ showFullHistory: true })
- .find(Toggler)
- .props().overlay
- ).toMatchSnapshot('edit comment overlay');
- expect(
- shallowRender({ showFullHistory: true })
- .find(Dropdown)
- .props().overlay
- ).toMatchSnapshot('delete comment overlay');
+ expect(shallowRender({ showFullHistory: true }).find(Toggler).props().overlay).toMatchSnapshot(
+ 'edit comment overlay'
+ );
+ expect(shallowRender({ showFullHistory: true }).find(Dropdown).props().overlay).toMatchSnapshot(
+ 'delete comment overlay'
+ );
});
it('should correctly handle comment updating', () => {
@@ -59,17 +55,10 @@ it('should correctly handle comment updating', () => {
const wrapper = shallowRender({ onEditComment, showFullHistory: true });
// Closing the Toggler sets the edited key back to an empty string.
- wrapper
- .find(Toggler)
- .at(0)
- .props()
- .onRequestClose();
+ wrapper.find(Toggler).at(0).props().onRequestClose();
expect(setEditedCommentKey).toHaveBeenCalledWith('');
- const editOnClick = wrapper
- .find(EditButton)
- .at(0)
- .props().onClick;
+ const editOnClick = wrapper.find(EditButton).at(0).props().onClick;
if (!editOnClick) {
reject();
return;
@@ -81,23 +70,14 @@ it('should correctly handle comment updating', () => {
// Cancelling an edit sets the edited key back to an empty string
const dropdownOverlay = shallow(
- wrapper
- .find(Toggler)
- .at(0)
- .props().overlay as React.ReactElement<DropdownOverlay>
+ wrapper.find(Toggler).at(0).props().overlay as React.ReactElement<DropdownOverlay>
);
- dropdownOverlay
- .find(HotspotCommentPopup)
- .props()
- .onCancelEdit();
+ dropdownOverlay.find(HotspotCommentPopup).props().onCancelEdit();
expect(setEditedCommentKey).toHaveBeenLastCalledWith('');
// Updating the comment sets the edited key back to an empty string, and calls the
// prop to update the comment value.
- dropdownOverlay
- .find(HotspotCommentPopup)
- .props()
- .onCommentEditSubmit('comment');
+ dropdownOverlay.find(HotspotCommentPopup).props().onCommentEditSubmit('comment');
expect(onEditComment).toHaveBeenLastCalledWith('comment-1', 'comment');
expect(setEditedCommentKey).toHaveBeenLastCalledWith('');
expect(setEditedCommentKey).toHaveBeenCalledTimes(4);
@@ -115,10 +95,7 @@ it('should correctly handle comment deleting', () => {
const wrapper = shallowRender({ onDeleteComment, showFullHistory: true });
// Opening the deletion Dropdown sets the edited key back to an empty string.
- const dropdownOnOpen = wrapper
- .find(Dropdown)
- .at(0)
- .props().onOpen;
+ const dropdownOnOpen = wrapper.find(Dropdown).at(0).props().onOpen;
if (!dropdownOnOpen) {
reject();
return;
@@ -128,10 +105,7 @@ it('should correctly handle comment deleting', () => {
// Confirming deletion calls the prop to delete the comment.
const dropdownOverlay = shallow(
- wrapper
- .find(Dropdown)
- .at(0)
- .props().overlay as React.ReactElement<HTMLDivElement>
+ wrapper.find(Dropdown).at(0).props().overlay as React.ReactElement<HTMLDivElement>
);
const deleteButtonOnClick = dropdownOverlay.find(Button).props().onClick;
if (!deleteButtonOnClick) {
@@ -154,19 +128,19 @@ function shallowRender(props?: Partial<HotspotReviewHistoryProps>) {
changelog: [
mockIssueChangelog(),
mockIssueChangelog({
- creationDate: '2018-10-12'
- })
+ creationDate: '2018-10-12',
+ }),
],
comment: [
mockHotspotComment({
key: 'comment-1',
- updatable: true
+ updatable: true,
}),
mockHotspotComment({ key: 'comment-2', user: mockUser({ name: undefined }) }),
mockHotspotComment({ key: 'comment-3', user: mockUser({ active: false }) }),
mockHotspotComment({ key: 'comment-4' }),
- mockHotspotComment({ key: 'comment-5' })
- ]
+ mockHotspotComment({ key: 'comment-5' }),
+ ],
})}
onDeleteComment={jest.fn()}
onEditComment={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotReviewHistoryAndComments-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotReviewHistoryAndComments-test.tsx
index 64ed9acdec8..efc48cb25ac 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotReviewHistoryAndComments-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotReviewHistoryAndComments-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import {
commentSecurityHotspot,
deleteSecurityHotspotComment,
- editSecurityHotspotComment
+ editSecurityHotspotComment,
} from '../../../../api/security-hotspots';
import { mockHotspot } from '../../../../helpers/mocks/security-hotspots';
import { mockCurrentUser } from '../../../../helpers/testMocks';
@@ -34,7 +34,7 @@ import HotspotReviewHistoryAndComments from '../HotspotReviewHistoryAndComments'
jest.mock('../../../../api/security-hotspots', () => ({
commentSecurityHotspot: jest.fn().mockResolvedValue({}),
deleteSecurityHotspotComment: jest.fn().mockResolvedValue({}),
- editSecurityHotspotComment: jest.fn().mockResolvedValue({})
+ editSecurityHotspotComment: jest.fn().mockResolvedValue({}),
}));
jest.mock('../../../../types/users', () => ({ isLoggedIn: jest.fn(() => true) }));
@@ -45,7 +45,7 @@ it('should render correctly', () => {
});
it('should render correctly without user', () => {
- ((isLoggedIn as any) as jest.Mock<boolean, [boolean]>).mockReturnValueOnce(false);
+ (isLoggedIn as any as jest.Mock<boolean, [boolean]>).mockReturnValueOnce(false);
const wrapper = shallowRender();
expect(wrapper).toMatchSnapshot();
});
@@ -104,10 +104,7 @@ it('should edit comment', async () => {
it('should correctly toggle the show full history state', () => {
const wrapper = shallowRender();
expect(wrapper.state().showFullHistory).toBe(false);
- wrapper
- .find(HotspotReviewHistory)
- .props()
- .onShowFullHistory();
+ wrapper.find(HotspotReviewHistory).props().onShowFullHistory();
expect(wrapper.state().showFullHistory).toBe(true);
});
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSimpleList-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSimpleList-test.tsx
index 29a57bf93fb..9f652d0fed3 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSimpleList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSimpleList-test.tsx
@@ -27,7 +27,7 @@ import HotspotSimpleList, { HotspotSimpleListProps } from '../HotspotSimpleList'
jest.mock('../../../../helpers/pages', () => ({
addSideBarClass: jest.fn(),
- removeSideBarClass: jest.fn()
+ removeSideBarClass: jest.fn(),
}));
it('should render correctly', () => {
@@ -70,17 +70,17 @@ function shallowRender(props: Partial<HotspotSimpleListProps> = {}) {
cwe: { 327: { title: 'Use of a Broken or Risky Cryptographic Algorithm' } },
owaspTop10: {
a1: { title: 'A1 - SQL Injection' },
- a3: { title: 'A3 - Sensitive Data Exposure' }
+ a3: { title: 'A3 - Sensitive Data Exposure' },
},
'owaspTop10-2021': {
a1: { title: 'A1 - SQL Injection' },
- a3: { title: 'A3 - Sensitive Data Exposure' }
+ a3: { title: 'A3 - Sensitive Data Exposure' },
},
sansTop25: {},
sonarsourceSecurity: {},
'pciDss-3.2': {},
'pciDss-4.0': {},
- 'owaspAsvs-4.0': {}
+ 'owaspAsvs-4.0': {},
}}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx
index a0207becc7d..331accc1d89 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainer-test.tsx
@@ -32,11 +32,11 @@ import HotspotSnippetContainer from '../HotspotSnippetContainer';
import HotspotSnippetContainerRenderer from '../HotspotSnippetContainerRenderer';
jest.mock('../../../../api/components', () => ({
- getSources: jest.fn().mockResolvedValue([])
+ getSources: jest.fn().mockResolvedValue([]),
}));
jest.mock('../../../../helpers/scrolling', () => ({
- scrollToElement: jest.fn()
+ scrollToElement: jest.fn(),
}));
beforeEach(() => jest.clearAllMocks());
@@ -49,7 +49,7 @@ it('should render correctly', () => {
it('should load sources on mount', async () => {
(getSources as jest.Mock).mockResolvedValueOnce(
- range(1, 25).map(line => mockSourceLine({ line }))
+ range(1, 25).map((line) => mockSourceLine({ line }))
);
const hotspot = mockHotspot({
@@ -59,14 +59,14 @@ it('should load sources on mount', async () => {
{
locations: [
mockFlowLocation({
- textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 1 }
+ textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 1 },
}),
mockFlowLocation({
- textRange: { startLine: 13, endLine: 13, startOffset: 0, endOffset: 1 }
- })
- ]
- }
- ]
+ textRange: { startLine: 13, endLine: 13, startOffset: 0, endOffset: 1 },
+ }),
+ ],
+ },
+ ],
});
const wrapper = shallowRender({ hotspot });
@@ -78,7 +78,7 @@ it('should load sources on mount', async () => {
key: hotspot.component.key,
branch: branch.name,
from: 1,
- to: 24
+ to: 24,
})
);
expect(wrapper.state().lastLine).toBeUndefined();
@@ -101,7 +101,7 @@ it('should handle load sources failure', async () => {
it('should not load sources on mount when the hotspot is not associated to any loc', async () => {
const hotspot = mockHotspot({
line: undefined,
- textRange: undefined
+ textRange: undefined,
});
const wrapper = shallowRender({ hotspot });
@@ -115,11 +115,11 @@ it('should not load sources on mount when the hotspot is not associated to any l
it('should handle end-of-file on mount', async () => {
(getSources as jest.Mock).mockResolvedValueOnce(
- range(5, 15).map(line => mockSourceLine({ line }))
+ range(5, 15).map((line) => mockSourceLine({ line }))
);
const hotspot = mockHotspot({
- textRange: { startLine: 10, endLine: 11, startOffset: 0, endOffset: 12 }
+ textRange: { startLine: 10, endLine: 11, startOffset: 0, endOffset: 12 },
});
const wrapper = shallowRender({ hotspot });
@@ -134,33 +134,30 @@ it('should handle end-of-file on mount', async () => {
describe('Expansion', () => {
beforeEach(() => {
(getSources as jest.Mock).mockResolvedValueOnce(
- range(10, 32).map(line => mockSourceLine({ line }))
+ range(10, 32).map((line) => mockSourceLine({ line }))
);
});
const hotspot = mockHotspot({
project: mockHotspotComponent({ branch: branch.name, qualifier: ComponentQualifier.Project }),
- textRange: { startLine: 20, endLine: 21, startOffset: 0, endOffset: 12 }
+ textRange: { startLine: 20, endLine: 21, startOffset: 0, endOffset: 12 },
});
it('up should work', async () => {
(getSources as jest.Mock).mockResolvedValueOnce(
- range(1, 10).map(line => mockSourceLine({ line }))
+ range(1, 10).map((line) => mockSourceLine({ line }))
);
const wrapper = shallowRender({ hotspot });
await waitAndUpdate(wrapper);
- wrapper
- .find(HotspotSnippetContainerRenderer)
- .props()
- .onExpandBlock('up');
+ wrapper.find(HotspotSnippetContainerRenderer).props().onExpandBlock('up');
await waitAndUpdate(wrapper);
expect(getSources).toHaveBeenCalledWith(
expect.objectContaining({
- branch: branch.name
+ branch: branch.name,
})
);
expect(wrapper.state().sourceLines).toHaveLength(31);
@@ -170,16 +167,13 @@ describe('Expansion', () => {
(getSources as jest.Mock).mockResolvedValueOnce(
// lastLine + expand + extra for EOF check + range end is excluded
// 31 + 50 + 1 + 1
- range(32, 83).map(line => mockSourceLine({ line }))
+ range(32, 83).map((line) => mockSourceLine({ line }))
);
const wrapper = shallowRender({ hotspot });
await waitAndUpdate(wrapper);
- wrapper
- .find(HotspotSnippetContainerRenderer)
- .props()
- .onExpandBlock('down');
+ wrapper.find(HotspotSnippetContainerRenderer).props().onExpandBlock('down');
await waitAndUpdate(wrapper);
@@ -191,16 +185,13 @@ describe('Expansion', () => {
(getSources as jest.Mock).mockResolvedValueOnce(
// lastLine + expand + extra for EOF check + range end is excluded - 1 to trigger end-of-file
// 26 + 50 + 1 + 1 - 1
- range(27, 77).map(line => mockSourceLine({ line }))
+ range(27, 77).map((line) => mockSourceLine({ line }))
);
const wrapper = shallowRender({ hotspot });
await waitAndUpdate(wrapper);
- wrapper
- .find(HotspotSnippetContainerRenderer)
- .props()
- .onExpandBlock('down');
+ wrapper.find(HotspotSnippetContainerRenderer).props().onExpandBlock('down');
await waitAndUpdate(wrapper);
@@ -212,10 +203,7 @@ describe('Expansion', () => {
it('should handle symbol click', () => {
const wrapper = shallowRender();
const symbols = ['symbol'];
- wrapper
- .find(HotspotSnippetContainerRenderer)
- .props()
- .onSymbolClick(symbols);
+ wrapper.find(HotspotSnippetContainerRenderer).props().onSymbolClick(symbols);
expect(wrapper.state().highlightedSymbols).toBe(symbols);
});
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainerRenderer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainerRenderer-test.tsx
index c062d19dda4..3764137be73 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainerRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetContainerRenderer-test.tsx
@@ -28,15 +28,15 @@ import SnippetViewer from '../../../issues/crossComponentSourceViewer/SnippetVie
import HotspotSnippetContainerRenderer, {
animateExpansion,
getScrollHandler,
- HotspotSnippetContainerRendererProps
+ HotspotSnippetContainerRendererProps,
} from '../HotspotSnippetContainerRenderer';
jest.mock('../../../../helpers/scrolling', () => ({
- scrollToElement: jest.fn()
+ scrollToElement: jest.fn(),
}));
beforeEach(() => {
- jest.spyOn(React, 'useMemo').mockImplementationOnce(f => f());
+ jest.spyOn(React, 'useMemo').mockImplementationOnce((f) => f());
});
it('should render correctly', () => {
@@ -47,7 +47,7 @@ it('should render correctly', () => {
it('should render a HotspotPrimaryLocationBox', () => {
const wrapper = shallowRender({
hotspot: mockHotspot({ line: 42 }),
- sourceLines: [mockSourceLine()]
+ sourceLines: [mockSourceLine()],
});
const { renderAdditionalChildInLine } = wrapper.find(SnippetViewer).props();
@@ -58,7 +58,7 @@ it('should render a HotspotPrimaryLocationBox', () => {
it('should render correctly when secondary location is selected', () => {
const wrapper = shallowRender({
- selectedHotspotLocation: 1
+ selectedHotspotLocation: 1,
});
expect(wrapper).toMatchSnapshot('with selected hotspot location');
});
@@ -78,7 +78,7 @@ describe('scrolling', () => {
it('should scroll to element if parent is defined', () => {
const ref: RefObject<HTMLDivElement> = {
- current: document.createElement('div')
+ current: document.createElement('div'),
};
const scrollHandler = getScrollHandler(ref);
@@ -93,7 +93,7 @@ describe('scrolling', () => {
it('should not scroll if parent is undefined', () => {
const ref: RefObject<HTMLDivElement> = {
- current: null
+ current: null,
};
const scrollHandler = getScrollHandler(ref);
@@ -115,7 +115,7 @@ describe('expand', () => {
const scrollableNode = document.createElement('div');
scrollableNode.scrollTo = jest.fn();
const ref: RefObject<HTMLDivElement> = {
- current: scrollableNode
+ current: scrollableNode,
};
jest.spyOn(React, 'useRef').mockReturnValue(ref);
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetHeader-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetHeader-test.tsx
index 1a99931e45b..41ec8c1a201 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetHeader-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotSnippetHeader-test.tsx
@@ -32,7 +32,7 @@ it('should render correctly', () => {
expect(
shallowRender({
currentUser: mockLoggedInUser(),
- component: mockComponent({ qualifier: ComponentQualifier.Application })
+ component: mockComponent({ qualifier: ComponentQualifier.Application }),
})
).toMatchSnapshot('user logged in with project Name');
});
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewer-test.tsx
index 47b69bf671c..03538f3bba0 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewer-test.tsx
@@ -36,15 +36,15 @@ const hotspotKey = 'hotspot-key';
jest.mock('../../../../api/security-hotspots', () => ({
getSecurityHotspotDetails: jest
.fn()
- .mockResolvedValue({ id: `I am a detailled hotspot`, rule: {} })
+ .mockResolvedValue({ id: `I am a detailled hotspot`, rule: {} }),
}));
jest.mock('../../../../api/rules', () => ({
- getRuleDetails: jest.fn().mockResolvedValue({ rule: { descriptionSections: [] } })
+ getRuleDetails: jest.fn().mockResolvedValue({ rule: { descriptionSections: [] } }),
}));
jest.mock('../../../../helpers/scrolling', () => ({
- scrollToElement: jest.fn()
+ scrollToElement: jest.fn(),
}));
it('should render correctly', async () => {
@@ -69,18 +69,18 @@ it('should render fetch rule details', async () => {
descriptionSections: [
{
key: RuleDescriptionSections.ASSESS_THE_PROBLEM,
- content: 'assess'
+ content: 'assess',
},
{
key: RuleDescriptionSections.ROOT_CAUSE,
- content: 'cause'
+ content: 'cause',
},
{
key: RuleDescriptionSections.HOW_TO_FIX,
- content: 'how'
- }
- ]
- })
+ content: 'how',
+ },
+ ],
+ }),
});
const wrapper = shallowRender();
await waitAndUpdate(wrapper);
@@ -88,26 +88,23 @@ it('should render fetch rule details', async () => {
expect(wrapper.state().ruleDescriptionSections).toStrictEqual([
{
key: RuleDescriptionSections.ASSESS_THE_PROBLEM,
- content: 'assess'
+ content: 'assess',
},
{
key: RuleDescriptionSections.ROOT_CAUSE,
- content: 'cause'
+ content: 'cause',
},
{
key: RuleDescriptionSections.HOW_TO_FIX,
- content: 'how'
- }
+ content: 'how',
+ },
]);
});
it('should refresh hotspot list on status update', () => {
const onUpdateHotspot = jest.fn();
const wrapper = shallowRender({ onUpdateHotspot });
- wrapper
- .find(HotspotViewerRenderer)
- .props()
- .onUpdateHotspot(true);
+ wrapper.find(HotspotViewerRenderer).props().onUpdateHotspot(true);
expect(onUpdateHotspot).toHaveBeenCalled();
});
@@ -115,10 +112,7 @@ it('should store last status selected when updating a hotspot status', () => {
const wrapper = shallowRender();
expect(wrapper.state().lastStatusChangedTo).toBeUndefined();
- wrapper
- .find(HotspotViewerRenderer)
- .props()
- .onUpdateHotspot(true, HotspotStatusOption.FIXED);
+ wrapper.find(HotspotViewerRenderer).props().onUpdateHotspot(true, HotspotStatusOption.FIXED);
expect(wrapper.state().lastStatusChangedTo).toBe(HotspotStatusOption.FIXED);
});
@@ -144,18 +138,15 @@ it('should correctly close the success modal', () => {
it('should NOT refresh hotspot list on assignee/comment updates', () => {
const onUpdateHotspot = jest.fn();
const wrapper = shallowRender({ onUpdateHotspot });
- wrapper
- .find(HotspotViewerRenderer)
- .props()
- .onUpdateHotspot();
+ wrapper.find(HotspotViewerRenderer).props().onUpdateHotspot();
expect(onUpdateHotspot).not.toHaveBeenCalled();
});
it('should scroll to comment form', () => {
const wrapper = shallowRender();
- const mockTextRef = ({ current: { focus: jest.fn() } } as any) as React.RefObject<
- HTMLTextAreaElement
- >;
+ const mockTextRef = {
+ current: { focus: jest.fn() },
+ } as any as React.RefObject<HTMLTextAreaElement>;
wrapper.instance().commentTextRef = mockTextRef;
wrapper.find(HotspotViewerRenderer).simulate('showCommentForm');
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerRenderer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerRenderer-test.tsx
index 391389ef308..b6abb00995d 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerRenderer-test.tsx
@@ -42,8 +42,8 @@ it('should render correctly', () => {
expect(
shallowRender({
hotspot: mockHotspot({
- assigneeUser: mockUser({ name: undefined, login: 'assignee_login' })
- })
+ assigneeUser: mockUser({ name: undefined, login: 'assignee_login' }),
+ }),
})
).toMatchSnapshot('assignee without name');
expect(shallowRender()).toMatchSnapshot('anonymous user');
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerTabs-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerTabs-test.tsx
index 80edf167c92..1675cfd4f05 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerTabs-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotViewerTabs-test.tsx
@@ -32,19 +32,19 @@ const originalRemoveEventListener = window.removeEventListener;
beforeEach(() => {
Object.defineProperty(window, 'addEventListener', {
- value: jest.fn()
+ value: jest.fn(),
});
Object.defineProperty(window, 'removeEventListener', {
- value: jest.fn()
+ value: jest.fn(),
});
});
afterEach(() => {
Object.defineProperty(window, 'addEventListener', {
- value: originalAddEventListener
+ value: originalAddEventListener,
});
Object.defineProperty(window, 'removeEventListener', {
- value: originalRemoveEventListener
+ value: originalRemoveEventListener,
});
});
@@ -63,9 +63,9 @@ it('should render correctly', () => {
expect(
shallowRender({
hotspot: mockHotspot({
- creationDate: undefined
+ creationDate: undefined,
}),
- ruleDescriptionSections: undefined
+ ruleDescriptionSections: undefined,
})
.find<BoxedTabsProps<string>>(BoxedTabs)
.props().tabs
@@ -82,17 +82,17 @@ it('should render correctly', () => {
login: 'me',
markdown: '*test*',
updatable: false,
- user: mockUser()
- }
- ]
- })
+ user: mockUser(),
+ },
+ ],
+ }),
})
).toMatchSnapshot('with comments or changelog element');
});
it('should filter empty tab', () => {
const count = shallowRender({
- hotspot: mockHotspot()
+ hotspot: mockHotspot(),
}).state().tabs.length;
expect(
@@ -100,13 +100,13 @@ it('should filter empty tab', () => {
ruleDescriptionSections: [
{
key: RuleDescriptionSections.ROOT_CAUSE,
- content: 'cause'
+ content: 'cause',
},
{
key: RuleDescriptionSections.HOW_TO_FIX,
- content: 'how'
- }
- ]
+ content: 'how',
+ },
+ ],
}).state().tabs.length
).toBe(count - 1);
});
@@ -143,7 +143,7 @@ describe('keyboard navigation', () => {
TabKeys.Code,
TabKeys.RiskDescription,
TabKeys.VulnerabilityDescription,
- TabKeys.FixRecommendation
+ TabKeys.FixRecommendation,
];
const wrapper = shallowRender();
@@ -151,7 +151,7 @@ describe('keyboard navigation', () => {
['selecting next', 0, KeyboardKeys.RightArrow, 1],
['selecting previous', 1, KeyboardKeys.LeftArrow, 0],
['selecting previous, non-existent', 0, KeyboardKeys.LeftArrow, 0],
- ['selecting next, non-existent', 3, KeyboardKeys.RightArrow, 3]
+ ['selecting next, non-existent', 3, KeyboardKeys.RightArrow, 3],
])('should work when %s', (_, start, key, expected) => {
wrapper.setState({ currentTab: wrapper.state().tabs[start] });
wrapper.instance().handleKeyboardNavigation(mockEvent({ key }));
@@ -193,16 +193,16 @@ function shallowRender(props?: Partial<HotspotViewerTabs['props']>) {
ruleDescriptionSections={[
{
key: RuleDescriptionSections.ASSESS_THE_PROBLEM,
- content: 'assess'
+ content: 'assess',
},
{
key: RuleDescriptionSections.ROOT_CAUSE,
- content: 'cause'
+ content: 'cause',
},
{
key: RuleDescriptionSections.HOW_TO_FIX,
- content: 'how'
- }
+ content: 'how',
+ },
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/StatusUpdateSuccessModal-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/StatusUpdateSuccessModal-test.tsx
index 883f25b1b21..c53b605b4a5 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/StatusUpdateSuccessModal-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/StatusUpdateSuccessModal-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import { HotspotStatusOption } from '../../../../types/security-hotspots';
import StatusUpdateSuccessModal, {
- StatusUpdateSuccessModalProps
+ StatusUpdateSuccessModalProps,
} from '../StatusUpdateSuccessModal';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/Assignee.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/Assignee.tsx
index 642e7a0ca2f..04b619a35d5 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/Assignee.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/Assignee.tsx
@@ -42,7 +42,7 @@ export class Assignee extends React.PureComponent<Props, State> {
mounted = false;
state = {
editing: false,
- loading: false
+ loading: false,
};
componentDidMount() {
@@ -64,7 +64,7 @@ export class Assignee extends React.PureComponent<Props, State> {
handleAssign = (newAssignee: UserActive) => {
this.setState({ loading: true });
assignSecurityHotspot(this.props.hotspot.key, {
- assignee: newAssignee?.login
+ assignee: newAssignee?.login,
})
.then(() => {
if (this.mounted) {
@@ -85,7 +85,7 @@ export class Assignee extends React.PureComponent<Props, State> {
render() {
const {
currentUser,
- hotspot: { assigneeUser, status, resolution }
+ hotspot: { assigneeUser, status, resolution },
} = this.props;
const { editing, loading } = this.state;
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelection.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelection.tsx
index 8aef280c182..60c2544539c 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelection.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelection.tsx
@@ -50,7 +50,7 @@ export default class AssigneeSelection extends React.PureComponent<Props, State>
loading: false,
suggestedUsers: props.allowCurrentUserSelection
? [props.loggedInUser, UNASSIGNED]
- : [UNASSIGNED]
+ : [UNASSIGNED],
};
this.handleSearch = debounce(this.handleSearch, 250);
@@ -80,19 +80,19 @@ export default class AssigneeSelection extends React.PureComponent<Props, State>
this.setState({
loading: false,
query,
- suggestedUsers: allowCurrentUserSelection ? [loggedInUser, UNASSIGNED] : [UNASSIGNED]
+ suggestedUsers: allowCurrentUserSelection ? [loggedInUser, UNASSIGNED] : [UNASSIGNED],
});
};
handleActualSearch = (query: string) => {
this.setState({ loading: true, query });
searchUsers({ q: query })
- .then(result => {
+ .then((result) => {
if (this.mounted) {
this.setState({
loading: false,
query,
- suggestedUsers: (result.users.filter(isUserActive) as UserActive[]).concat(UNASSIGNED)
+ suggestedUsers: (result.users.filter(isUserActive) as UserActive[]).concat(UNASSIGNED),
});
}
})
@@ -126,7 +126,7 @@ export default class AssigneeSelection extends React.PureComponent<Props, State>
const { highlighted, suggestedUsers } = this.state;
return highlighted
- ? suggestedUsers.findIndex(suggestion => suggestion.login === highlighted.login)
+ ? suggestedUsers.findIndex((suggestion) => suggestion.login === highlighted.login)
: -1;
};
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelectionRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelectionRenderer.tsx
index 3610cfdc376..6f20cecc9f5 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelectionRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelectionRenderer.tsx
@@ -58,13 +58,14 @@ export default function AssigneeSelectionRenderer(props: HotspotAssigneeSelectRe
<DropdownOverlay noPadding={true} placement={PopupPlacement.BottomLeft}>
<ul className="hotspot-assignee-search-results">
{suggestedUsers &&
- suggestedUsers.map(suggestion => (
+ suggestedUsers.map((suggestion) => (
<li
className={classNames('padded', {
- active: highlighted && highlighted.login === suggestion.login
+ active: highlighted && highlighted.login === suggestion.login,
})}
key={suggestion.login}
- onClick={() => props.onSelect(suggestion)}>
+ onClick={() => props.onSelect(suggestion)}
+ >
{suggestion.login && (
<Avatar
className="spacer-right"
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/Assignee-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/Assignee-test.tsx
index cc9839ef45d..03aa5ded385 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/Assignee-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/Assignee-test.tsx
@@ -30,11 +30,11 @@ import { Assignee } from '../Assignee';
import AssigneeRenderer from '../AssigneeRenderer';
jest.mock('../../../../../api/security-hotspots', () => ({
- assignSecurityHotspot: jest.fn()
+ assignSecurityHotspot: jest.fn(),
}));
jest.mock('../../../../../helpers/globalMessages', () => ({
- addGlobalSuccessMessage: jest.fn()
+ addGlobalSuccessMessage: jest.fn(),
}));
it('should render correctly', () => {
@@ -45,7 +45,7 @@ it.each([
[HotspotStatus.TO_REVIEW, undefined, true],
[HotspotStatus.REVIEWED, HotspotResolution.FIXED, false],
[HotspotStatus.REVIEWED, HotspotResolution.SAFE, false],
- [HotspotStatus.REVIEWED, HotspotResolution.ACKNOWLEDGED, true]
+ [HotspotStatus.REVIEWED, HotspotResolution.ACKNOWLEDGED, true],
])('should allow edition properly', (status, resolution, canEdit) => {
expect(
shallowRender({ hotspot: mockHotspot({ status, resolution }) })
@@ -57,22 +57,16 @@ it.each([
it('should handle edition event correctly', () => {
const wrapper = shallowRender();
- wrapper
- .find(AssigneeRenderer)
- .props()
- .onEnterEditionMode();
+ wrapper.find(AssigneeRenderer).props().onEnterEditionMode();
expect(wrapper.state().editing).toBe(true);
- wrapper
- .find(AssigneeRenderer)
- .props()
- .onExitEditionMode();
+ wrapper.find(AssigneeRenderer).props().onExitEditionMode();
expect(wrapper.state().editing).toBe(false);
});
it.each([
['assign to user', mockUser() as UserActive],
- ['unassign', { login: '', name: 'unassigned' } as UserActive]
+ ['unassign', { login: '', name: 'unassigned' } as UserActive],
])('should handle %s event', async (_, user: UserActive) => {
const hotspot = mockHotspot();
const onAssigneeChange = jest.fn();
@@ -80,10 +74,7 @@ it.each([
const wrapper = shallowRender({ hotspot, onAssigneeChange });
(assignSecurityHotspot as jest.Mock).mockResolvedValueOnce({});
- wrapper
- .find(AssigneeRenderer)
- .props()
- .onAssign(user);
+ wrapper.find(AssigneeRenderer).props().onAssign(user);
expect(wrapper.state().loading).toBe(true);
expect(assignSecurityHotspot).toHaveBeenCalledWith(hotspot.key, { assignee: user?.login });
@@ -92,7 +83,7 @@ it.each([
expect(wrapper.state()).toEqual({
editing: false,
- loading: false
+ loading: false,
});
expect(onAssigneeChange).toHaveBeenCalled();
expect(addGlobalSuccessMessage).toHaveBeenCalled();
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeRenderer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeRenderer-test.tsx
index 32e3de350ee..326d7cad18f 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeRenderer-test.tsx
@@ -38,9 +38,8 @@ it('should render correctly', () => {
expect(shallowRender({ loggedInUser: undefined }).find(EditButton).length).toBe(0);
expect(shallowRender({ canEdit: false }).find(EditButton).length).toBe(0);
expect(
- shallowRender({ editing: true, assignee: mockUser() })
- .find(AssigneeSelection)
- .props().allowCurrentUserSelection
+ shallowRender({ editing: true, assignee: mockUser() }).find(AssigneeSelection).props()
+ .allowCurrentUserSelection
).toBe(true);
});
@@ -61,10 +60,7 @@ it('should propagate calls correctly', () => {
.onSelect(newAssignee as UserActive);
expect(onAssign).toHaveBeenCalledWith(newAssignee);
- wrapper
- .find(OutsideClickHandler)
- .props()
- .onClickOutside();
+ wrapper.find(OutsideClickHandler).props().onClickOutside();
expect(onExitEditionMode).toHaveBeenCalled();
});
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeSelection-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeSelection-test.tsx
index cb412eb9dd6..d341a86271a 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeSelection-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeSelection-test.tsx
@@ -27,7 +27,7 @@ import { UserActive } from '../../../../../types/users';
import AssigneeSelection from '../AssigneeSelection';
jest.mock('../../../../../api/users', () => ({
- searchUsers: jest.fn().mockResolvedValue([])
+ searchUsers: jest.fn().mockResolvedValue([]),
}));
it('should render correctly', () => {
@@ -38,7 +38,7 @@ it('should handle keydown', () => {
const suggestedUsers = [
mockUser({ login: '1' }) as UserActive,
mockUser({ login: '2' }) as UserActive,
- mockUser({ login: '3' }) as UserActive
+ mockUser({ login: '3' }) as UserActive,
];
const onSelect = jest.fn();
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeSelectionRenderer-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeSelectionRenderer-test.tsx
index 044572d300b..c9d581af313 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeSelectionRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/AssigneeSelectionRenderer-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { mockUser } from '../../../../../helpers/testMocks';
import { UserActive } from '../../../../../types/users';
import AssigneeSelectionRenderer, {
- HotspotAssigneeSelectRendererProps
+ HotspotAssigneeSelectRendererProps,
} from '../AssigneeSelectionRenderer';
it('should render correctly', () => {
@@ -33,7 +33,7 @@ it('should render correctly', () => {
expect(
shallowRender({
highlighted: highlightedUser,
- suggestedUsers: [mockUser() as UserActive, highlightedUser]
+ suggestedUsers: [mockUser() as UserActive, highlightedUser],
})
).toMatchSnapshot('open with results');
});
@@ -43,13 +43,10 @@ it('should call onSelect when clicked', () => {
const onSelect = jest.fn();
const wrapper = shallowRender({
onSelect,
- suggestedUsers: [user]
+ suggestedUsers: [user],
});
- wrapper
- .find('li')
- .at(0)
- .simulate('click');
+ wrapper.find('li').at(0).simulate('click');
expect(onSelect).toHaveBeenCalledWith(user);
});
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.tsx
index 94465cdbcb8..49e6dd0b8e9 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.tsx
@@ -58,7 +58,8 @@ export function Status(props: StatusProps) {
<div className="spacer-top">
<Tooltip
overlay={readonly ? translate('hotspots.status.cannot_change_status') : null}
- placement="bottom">
+ placement="bottom"
+ >
<div className="dropdown">
<Toggler
closeOnClickOutside={true}
@@ -69,7 +70,7 @@ export function Status(props: StatusProps) {
<DropdownOverlay noPadding={true} placement={PopupPlacement.Bottom}>
<StatusSelection
hotspot={hotspot}
- onStatusOptionChange={async status => {
+ onStatusOptionChange={async (status) => {
await props.onStatusChange(status);
setIsOpen(false);
}}
@@ -77,12 +78,14 @@ export function Status(props: StatusProps) {
setComment={setComment}
/>
</DropdownOverlay>
- }>
+ }
+ >
<Button
className="dropdown-toggle big-spacer-left"
id="status-trigger"
onClick={() => setIsOpen(true)}
- disabled={readonly}>
+ disabled={readonly}
+ >
<span>{translate('hotspots.status.select_status')}</span>
<DropdownIcon className="little-spacer-left" />
</Button>
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelection.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelection.tsx
index 02835044110..9cdb58e63db 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelection.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelection.tsx
@@ -22,7 +22,7 @@ import { setSecurityHotspotStatus } from '../../../../api/security-hotspots';
import { Hotspot, HotspotStatusOption } from '../../../../types/security-hotspots';
import {
getStatusAndResolutionFromStatusOption,
- getStatusOptionFromStatusAndResolution
+ getStatusOptionFromStatusAndResolution,
} from '../../utils';
import StatusSelectionRenderer from './StatusSelectionRenderer';
@@ -53,7 +53,7 @@ export default class StatusSelection extends React.PureComponent<Props, State> {
this.state = {
loading: false,
initialStatus,
- selectedStatus: initialStatus
+ selectedStatus: initialStatus,
};
}
@@ -81,7 +81,7 @@ export default class StatusSelection extends React.PureComponent<Props, State> {
this.setState({ loading: true });
setSecurityHotspotStatus(hotspot.key, {
...getStatusAndResolutionFromStatusOption(selectedStatus),
- comment: comment || undefined
+ comment: comment || undefined,
})
.then(async () => {
await this.props.onStatusOptionChange(selectedStatus);
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelectionRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelectionRenderer.tsx
index 7db97ba0fdc..0b8ccf7ffb4 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelectionRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelectionRenderer.tsx
@@ -48,7 +48,8 @@ export default function StatusSelectionRenderer(props: StatusSelectionRendererPr
className="big-spacer-bottom status-radio"
alignLabel={true}
onCheck={props.onStatusChange}
- value={status}>
+ value={status}
+ >
<StatusDescription statusOption={status} statusInBadge={false} />
</Radio>
);
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/Status-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/Status-test.tsx
index 3274b16a9c9..73fc3f7a001 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/Status-test.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/Status-test.tsx
@@ -28,7 +28,7 @@ import { setSecurityHotspotStatus } from '../../../../../api/security-hotspots';
import { HotspotResolution, HotspotStatus } from '../../../../../types/security-hotspots';
jest.mock('../../../../../api/security-hotspots', () => ({
- setSecurityHotspotStatus: jest.fn().mockResolvedValue({})
+ setSecurityHotspotStatus: jest.fn().mockResolvedValue({}),
}));
it('should properly deal with comment/status/submit events', async () => {
@@ -41,7 +41,7 @@ it('should properly deal with comment/status/submit events', async () => {
await user.click(
screen.getByRole('radio', {
- name: 'hotspots.status_option.SAFE hotspots.status_option.SAFE.description'
+ name: 'hotspots.status_option.SAFE hotspots.status_option.SAFE.description',
})
);
@@ -53,7 +53,7 @@ it('should properly deal with comment/status/submit events', async () => {
expect(setSecurityHotspotStatus).toHaveBeenCalledWith(hotspot.key, {
status: HotspotStatus.REVIEWED,
resolution: HotspotResolution.SAFE,
- comment
+ comment,
});
});
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts b/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts
index e425b2e8d94..faa901cc33d 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/utils.ts
@@ -26,7 +26,7 @@ import {
renderPciDss32Category,
renderPciDss40Category,
renderSansTop25Category,
- renderSonarSourceSecurityCategory
+ renderSonarSourceSecurityCategory,
} from '../../helpers/security-standard';
import { SecurityStandard } from '../../types/security';
import {
@@ -38,13 +38,13 @@ import {
RawHotspot,
ReviewHistoryElement,
ReviewHistoryType,
- RiskExposure
+ RiskExposure,
} from '../../types/security-hotspots';
import {
Dict,
FlowLocation,
SourceViewerFile,
- StandardSecurityCategories
+ StandardSecurityCategories,
} from '../../types/types';
const OTHERS_SECURITY_CATEGORY = 'others';
@@ -58,7 +58,7 @@ export const SECURITY_STANDARDS = [
SecurityStandard.CWE,
SecurityStandard.PCI_DSS_3_2,
SecurityStandard.PCI_DSS_4_0,
- SecurityStandard.OWASP_ASVS_4_0
+ SecurityStandard.OWASP_ASVS_4_0,
];
export const SECURITY_STANDARD_RENDERER = {
@@ -69,7 +69,7 @@ export const SECURITY_STANDARD_RENDERER = {
[SecurityStandard.CWE]: renderCWECategory,
[SecurityStandard.PCI_DSS_3_2]: renderPciDss32Category,
[SecurityStandard.PCI_DSS_4_0]: renderPciDss40Category,
- [SecurityStandard.OWASP_ASVS_4_0]: renderOwaspAsvs40Category
+ [SecurityStandard.OWASP_ASVS_4_0]: renderOwaspAsvs40Category,
};
export function mapRules(rules: Array<{ key: string; name: string }>): Dict<string> {
@@ -83,28 +83,28 @@ export function groupByCategory(
hotspots: RawHotspot[] = [],
securityCategories: StandardSecurityCategories
) {
- const groups = groupBy(hotspots, h => h.securityCategory);
+ const groups = groupBy(hotspots, (h) => h.securityCategory);
- const groupList = Object.keys(groups).map(key => ({
+ const groupList = Object.keys(groups).map((key) => ({
key,
title: getCategoryTitle(key, securityCategories),
- hotspots: groups[key]
+ hotspots: groups[key],
}));
return [
...sortBy(
- groupList.filter(group => group.key !== OTHERS_SECURITY_CATEGORY),
- group => group.title
+ groupList.filter((group) => group.key !== OTHERS_SECURITY_CATEGORY),
+ (group) => group.title
),
- ...groupList.filter(({ key }) => key === OTHERS_SECURITY_CATEGORY)
+ ...groupList.filter(({ key }) => key === OTHERS_SECURITY_CATEGORY),
];
}
export function sortHotspots(hotspots: RawHotspot[], securityCategories: Dict<{ title: string }>) {
return sortBy(hotspots, [
- h => RISK_EXPOSURE_LEVELS.indexOf(h.vulnerabilityProbability),
- h => getCategoryTitle(h.securityCategory, securityCategories),
- h => h.message
+ (h) => RISK_EXPOSURE_LEVELS.indexOf(h.vulnerabilityProbability),
+ (h) => getCategoryTitle(h.securityCategory, securityCategories),
+ (h) => h.message,
]);
}
@@ -123,7 +123,7 @@ export function constructSourceViewerFile(
project: project.key,
projectName: project.name,
q: component.qualifier,
- uuid: ''
+ uuid: '',
};
}
@@ -136,44 +136,44 @@ export function getHotspotReviewHistory(hotspot: Hotspot): ReviewHistoryElement[
date: hotspot.creationDate,
user: {
...hotspot.authorUser,
- name: hotspot.authorUser.name || hotspot.authorUser.login
- }
+ name: hotspot.authorUser.name || hotspot.authorUser.login,
+ },
});
}
if (hotspot.changelog && hotspot.changelog.length > 0) {
history.push(
- ...hotspot.changelog.map(log => ({
+ ...hotspot.changelog.map((log) => ({
type: ReviewHistoryType.Diff,
date: log.creationDate,
user: {
active: log.isUserActive,
avatar: log.avatar,
- name: log.userName || log.user
+ name: log.userName || log.user,
},
- diffs: log.diffs
+ diffs: log.diffs,
}))
);
}
if (hotspot.comment && hotspot.comment.length > 0) {
history.push(
- ...hotspot.comment.map(comment => ({
+ ...hotspot.comment.map((comment) => ({
type: ReviewHistoryType.Comment,
date: comment.createdAt,
updatable: comment.updatable,
user: {
...comment.user,
- name: comment.user.name || comment.user.login
+ name: comment.user.name || comment.user.login,
},
html: comment.htmlText,
key: comment.key,
- markdown: comment.markdown
+ markdown: comment.markdown,
}))
);
}
- return sortBy(history, elt => elt.date).reverse();
+ return sortBy(history, (elt) => elt.date).reverse();
}
const STATUS_AND_RESOLUTION_TO_STATUS_OPTION = {
@@ -181,7 +181,7 @@ const STATUS_AND_RESOLUTION_TO_STATUS_OPTION = {
[HotspotStatus.REVIEWED]: HotspotStatusOption.FIXED,
[HotspotResolution.ACKNOWLEDGED]: HotspotStatusOption.ACKNOWLEDGED,
[HotspotResolution.FIXED]: HotspotStatusOption.FIXED,
- [HotspotResolution.SAFE]: HotspotStatusOption.SAFE
+ [HotspotResolution.SAFE]: HotspotStatusOption.SAFE,
};
export function getStatusOptionFromStatusAndResolution(
@@ -197,16 +197,16 @@ const STATUS_OPTION_TO_STATUS_AND_RESOLUTION_MAP = {
[HotspotStatusOption.TO_REVIEW]: { status: HotspotStatus.TO_REVIEW, resolution: undefined },
[HotspotStatusOption.ACKNOWLEDGED]: {
status: HotspotStatus.REVIEWED,
- resolution: HotspotResolution.ACKNOWLEDGED
+ resolution: HotspotResolution.ACKNOWLEDGED,
},
[HotspotStatusOption.FIXED]: {
status: HotspotStatus.REVIEWED,
- resolution: HotspotResolution.FIXED
+ resolution: HotspotResolution.FIXED,
},
[HotspotStatusOption.SAFE]: {
status: HotspotStatus.REVIEWED,
- resolution: HotspotResolution.SAFE
- }
+ resolution: HotspotResolution.SAFE,
+ },
};
export function getStatusAndResolutionFromStatusOption(statusOption: HotspotStatusOption) {
@@ -217,7 +217,7 @@ const STATUS_OPTION_TO_STATUS_FILTER = {
[HotspotStatusOption.TO_REVIEW]: HotspotStatusFilter.TO_REVIEW,
[HotspotStatusOption.ACKNOWLEDGED]: HotspotStatusFilter.ACKNOWLEDGED,
[HotspotStatusOption.FIXED]: HotspotStatusFilter.FIXED,
- [HotspotStatusOption.SAFE]: HotspotStatusFilter.SAFE
+ [HotspotStatusOption.SAFE]: HotspotStatusFilter.SAFE,
};
export function getStatusFilterFromStatusOption(statusOption: HotspotStatusOption) {
@@ -226,15 +226,15 @@ export function getStatusFilterFromStatusOption(statusOption: HotspotStatusOptio
function getSecondaryLocations(flows: RawHotspot['flows']) {
const parsedFlows: FlowLocation[][] = (flows || [])
- .filter(flow => flow.locations !== undefined)
- .map(flow => flow.locations!.filter(location => location.textRange != null))
- .map(flow =>
- flow.map(location => {
+ .filter((flow) => flow.locations !== undefined)
+ .map((flow) => flow.locations!.filter((location) => location.textRange != null))
+ .map((flow) =>
+ flow.map((location) => {
return { ...location };
})
);
- const onlySecondaryLocations = parsedFlows.every(flow => flow.length === 1);
+ const onlySecondaryLocations = parsedFlows.every((flow) => flow.length === 1);
return onlySecondaryLocations
? { secondaryLocations: orderLocations(flatten(parsedFlows)), flows: [] }
@@ -252,8 +252,8 @@ export function getLocations(rawFlows: RawHotspot['flows'], selectedFlowIndex: n
function orderLocations(locations: FlowLocation[]) {
return sortBy(
locations,
- location => location.textRange && location.textRange.startLine,
- location => location.textRange && location.textRange.startOffset
+ (location) => location.textRange && location.textRange.startLine,
+ (location) => location.textRange && location.textRange.startOffset
);
}
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx b/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx
index bd4d421f01b..6547ebfa361 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx
@@ -42,7 +42,7 @@ export class LoginContainer extends React.PureComponent<Props, State> {
state: State = {
identityProviders: [],
- loading: true
+ loading: true,
};
componentDidMount() {
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.tsx b/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.tsx
index 649efae5ecd..b6ff2c843a5 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/LoginForm.tsx
@@ -43,7 +43,7 @@ export default class LoginForm extends React.PureComponent<Props, State> {
collapsed: Boolean(props.collapsed),
loading: false,
login: '',
- password: ''
+ password: '',
};
}
@@ -76,7 +76,8 @@ export default class LoginForm extends React.PureComponent<Props, State> {
<ButtonLink
aria-expanded={false}
className="small js-more-options"
- onClick={this.handleMoreOptionsClick}>
+ onClick={this.handleMoreOptionsClick}
+ >
{translate('login.more_options')}
</ButtonLink>
</div>
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.tsx b/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.tsx
index 987d65843cc..81965779b4f 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/OAuthProviders.tsx
@@ -38,7 +38,7 @@ export default function OAuthProviders(props: Props) {
const formatFunction = props.formatLabel || defaultFormatLabel;
return (
<Container className={classNames('oauth-providers', props.className)}>
- {props.identityProviders.map(identityProvider => (
+ {props.identityProviders.map((identityProvider) => (
<OAuthProvider
format={formatFunction}
identityProvider={identityProvider}
@@ -66,7 +66,8 @@ function OAuthProvider({ format, identityProvider, returnTo }: ItemProps) {
url={
`${getBaseUrl()}/sessions/init/${identityProvider.key}` +
`?return_to=${encodeURIComponent(returnTo)}`
- }>
+ }
+ >
<span>{format(identityProvider.name)}</span>
</IdentityProviderLink>
{identityProvider.helpMessage && (
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Login-it.tsx b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Login-it.tsx
index 824efb902a6..2a2ec777c79 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Login-it.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Login-it.tsx
@@ -32,20 +32,20 @@ jest.mock('../../../../api/users', () => {
return {
getIdentityProviders: jest
.fn()
- .mockResolvedValue({ identityProviders: [mockIdentityProvider()] })
+ .mockResolvedValue({ identityProviders: [mockIdentityProvider()] }),
};
});
jest.mock('../../../../api/auth', () => ({
- logIn: jest.fn((_id, password) => (password === 'valid' ? Promise.resolve() : Promise.reject()))
+ logIn: jest.fn((_id, password) => (password === 'valid' ? Promise.resolve() : Promise.reject())),
}));
jest.mock('../../../../api/settings', () => ({
- getLoginMessage: jest.fn().mockResolvedValue({ message: '' })
+ getLoginMessage: jest.fn().mockResolvedValue({ message: '' }),
}));
jest.mock('../../../../helpers/globalMessages', () => ({
- addGlobalErrorMessage: jest.fn()
+ addGlobalErrorMessage: jest.fn(),
}));
const originalLocation = window.location;
@@ -54,18 +54,18 @@ const replace = jest.fn();
beforeAll(() => {
const location = {
...window.location,
- replace
+ replace,
};
Object.defineProperty(window, 'location', {
writable: true,
- value: location
+ value: location,
});
});
afterAll(() => {
Object.defineProperty(window, 'location', {
writable: true,
- value: originalLocation
+ value: originalLocation,
});
});
@@ -133,7 +133,7 @@ it('should not show any OAuth providers if none are configured', async () => {
it("should show a warning if there's an authorization error", async () => {
renderLoginContainer({
- location: mockLocation({ query: { authorizationError: 'true' } })
+ location: mockLocation({ query: { authorizationError: 'true' } }),
});
const heading = await screen.findByRole('heading', { name: 'login.login_to_sonarqube' });
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Logout-it.tsx b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Logout-it.tsx
index a211ec6e648..a95abc59dc3 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Logout-it.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Logout-it.tsx
@@ -26,22 +26,22 @@ import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import Logout from '../Logout';
jest.mock('../../../../api/auth', () => ({
- logOut: jest.fn().mockResolvedValue(true)
+ logOut: jest.fn().mockResolvedValue(true),
}));
jest.mock('../../../../helpers/globalMessages', () => ({
- addGlobalErrorMessage: jest.fn()
+ addGlobalErrorMessage: jest.fn(),
}));
jest.mock('../../../../helpers/system', () => ({
- getBaseUrl: jest.fn().mockReturnValue('/context')
+ getBaseUrl: jest.fn().mockReturnValue('/context'),
}));
jest.mock('../../../../app/components/RecentHistory', () => ({
__esModule: true,
default: {
- clear: jest.fn()
- }
+ clear: jest.fn(),
+ },
}));
const originalLocation = window.location;
@@ -50,18 +50,18 @@ const replace = jest.fn();
beforeAll(() => {
const location = {
...window.location,
- replace
+ replace,
};
Object.defineProperty(window, 'location', {
writable: true,
- value: location
+ value: location,
});
});
afterAll(() => {
Object.defineProperty(window, 'location', {
writable: true,
- value: originalLocation
+ value: originalLocation,
});
});
diff --git a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Unauthorized-it.tsx b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Unauthorized-it.tsx
index ddbf360f5b3..ebe8a99a9e1 100644
--- a/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Unauthorized-it.tsx
+++ b/server/sonar-web/src/main/js/apps/sessions/components/__tests__/Unauthorized-it.tsx
@@ -25,7 +25,7 @@ import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import Unauthorized from '../Unauthorized';
jest.mock('../../../../helpers/cookies', () => ({
- getCookie: jest.fn()
+ getCookie: jest.fn(),
}));
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/settings/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/settings/__tests__/utils-test.ts
index d6e164a01f4..912f68e9d35 100644
--- a/server/sonar-web/src/main/js/apps/settings/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/settings/__tests__/utils-test.ts
@@ -23,13 +23,13 @@ import {
ExtendedSettingDefinition,
Setting,
SettingFieldDefinition,
- SettingType
+ SettingType,
} from '../../../types/settings';
import { buildSettingLink, getDefaultValue, getEmptyValue, getSettingValue } from '../utils';
const fields = [
{ key: 'foo', type: 'STRING' } as SettingFieldDefinition,
- { key: 'bar', type: 'SINGLE_SELECT_LIST' } as SettingFieldDefinition
+ { key: 'bar', type: 'SINGLE_SELECT_LIST' } as SettingFieldDefinition,
];
const settingDefinition: ExtendedSettingDefinition = {
@@ -37,7 +37,7 @@ const settingDefinition: ExtendedSettingDefinition = {
fields: [],
key: 'test',
options: [],
- subCategory: 'subtest'
+ subCategory: 'subtest',
};
describe('#getEmptyValue()', () => {
@@ -45,7 +45,7 @@ describe('#getEmptyValue()', () => {
const setting: ExtendedSettingDefinition = {
...settingDefinition,
type: SettingType.PROPERTY_SET,
- fields
+ fields,
};
expect(getEmptyValue(setting)).toEqual([{ foo: '', bar: null }]);
});
@@ -54,7 +54,7 @@ describe('#getEmptyValue()', () => {
const setting: ExtendedSettingDefinition = {
...settingDefinition,
type: SettingType.STRING,
- multiValues: true
+ multiValues: true,
};
expect(getEmptyValue(setting)).toEqual(['']);
});
@@ -63,7 +63,7 @@ describe('#getEmptyValue()', () => {
const setting: ExtendedSettingDefinition = {
...settingDefinition,
type: SettingType.BOOLEAN,
- multiValues: true
+ multiValues: true,
};
expect(getEmptyValue(setting)).toEqual([null]);
});
@@ -74,7 +74,7 @@ describe('#getSettingValue()', () => {
const setting: ExtendedSettingDefinition = {
...settingDefinition,
type: SettingType.PROPERTY_SET,
- fields
+ fields,
};
const settingValue = mockSettingValue({ fieldValues: [{ foo: '' }] });
expect(getSettingValue(setting, settingValue)).toEqual([{ foo: '' }]);
@@ -85,7 +85,7 @@ describe('#getSettingValue()', () => {
...settingDefinition,
type: SettingType.FORMATTED_TEXT,
fields,
- multiValues: true
+ multiValues: true,
};
const settingValue = mockSettingValue({ values: ['*text*', 'text'] });
expect(getSettingValue(setting, settingValue)).toEqual(['*text*', 'text']);
@@ -95,7 +95,7 @@ describe('#getSettingValue()', () => {
const setting: ExtendedSettingDefinition = {
...settingDefinition,
type: SettingType.FORMATTED_TEXT,
- fields
+ fields,
};
const settingValue = mockSettingValue({ values: ['*text*', 'text'] });
expect(getSettingValue(setting, settingValue)).toEqual('*text*');
@@ -105,7 +105,7 @@ describe('#getSettingValue()', () => {
const setting: ExtendedSettingDefinition = {
...settingDefinition,
type: SettingType.FORMATTED_TEXT,
- fields
+ fields,
};
const settingValue = mockSettingValue({ values: undefined });
expect(getSettingValue(setting, settingValue)).toBeUndefined();
@@ -115,7 +115,7 @@ describe('#getSettingValue()', () => {
describe('#getDefaultValue()', () => {
it.each([
['true', 'settings.boolean.true'],
- ['false', 'settings.boolean.false']
+ ['false', 'settings.boolean.false'],
])(
'should work for boolean field when passing "%s"',
(parentValue?: string, expected?: string) => {
@@ -123,7 +123,7 @@ describe('#getDefaultValue()', () => {
hasValue: true,
definition: { key: 'test', options: [], type: SettingType.BOOLEAN },
parentValue,
- key: 'test'
+ key: 'test',
};
expect(getDefaultValue(setting)).toEqual(expected);
}
@@ -135,7 +135,7 @@ describe('buildSettingLink', () => {
[
mockDefinition({ key: 'anykey' }),
undefined,
- { hash: '#anykey', pathname: '/admin/settings', search: '?category=foo+category' }
+ { hash: '#anykey', pathname: '/admin/settings', search: '?category=foo+category' },
],
[
mockDefinition({ key: 'sonar.auth.gitlab.name' }),
@@ -143,8 +143,8 @@ describe('buildSettingLink', () => {
{
hash: '#sonar.auth.gitlab.name',
pathname: '/admin/settings',
- search: '?category=foo+category&tab=gitlab'
- }
+ search: '?category=foo+category&tab=gitlab',
+ },
],
[
mockDefinition({ key: 'sonar.auth.github.token' }),
@@ -152,8 +152,8 @@ describe('buildSettingLink', () => {
{
hash: '#sonar.auth.github.token',
pathname: '/admin/settings',
- search: '?category=foo+category&tab=github'
- }
+ search: '?category=foo+category&tab=github',
+ },
],
[
mockDefinition({ key: 'sonar.auth.bitbucket.token' }),
@@ -161,8 +161,8 @@ describe('buildSettingLink', () => {
{
hash: '#sonar.auth.bitbucket.token',
pathname: '/admin/settings',
- search: '?category=foo+category&tab=bitbucket'
- }
+ search: '?category=foo+category&tab=bitbucket',
+ },
],
[
mockDefinition({ key: 'sonar.almintegration.azure' }),
@@ -170,8 +170,8 @@ describe('buildSettingLink', () => {
{
hash: '#sonar.almintegration.azure',
pathname: '/admin/settings',
- search: '?category=foo+category&alm=azure'
- }
+ search: '?category=foo+category&alm=azure',
+ },
],
[
mockDefinition({ key: 'defKey' }),
@@ -179,9 +179,9 @@ describe('buildSettingLink', () => {
{
hash: '#defKey',
pathname: '/project/settings',
- search: '?id=componentKey&category=foo+category'
- }
- ]
+ search: '?id=componentKey&category=foo+category',
+ },
+ ],
])('should work as expected', (definition, component, expectedUrl) => {
expect(buildSettingLink(definition, component)).toEqual(expectedUrl);
});
diff --git a/server/sonar-web/src/main/js/apps/settings/components/AdditionalCategories.tsx b/server/sonar-web/src/main/js/apps/settings/components/AdditionalCategories.tsx
index b536a500624..94e05a0ab18 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/AdditionalCategories.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/AdditionalCategories.tsx
@@ -27,7 +27,7 @@ import {
AUTHENTICATION_CATEGORY,
LANGUAGES_CATEGORY,
NEW_CODE_PERIOD_CATEGORY,
- PULL_REQUEST_DECORATION_BINDING_CATEGORY
+ PULL_REQUEST_DECORATION_BINDING_CATEGORY,
} from '../constants';
import AlmIntegration from './almIntegration/AlmIntegration';
import { AnalysisScope } from './AnalysisScope';
@@ -60,7 +60,7 @@ export const ADDITIONAL_CATEGORIES: AdditionalCategory[] = [
renderComponent: getLanguagesComponent,
availableGlobally: true,
availableForProject: true,
- displayTab: true
+ displayTab: true,
},
{
key: NEW_CODE_PERIOD_CATEGORY,
@@ -68,7 +68,7 @@ export const ADDITIONAL_CATEGORIES: AdditionalCategory[] = [
renderComponent: getNewCodePeriodComponent,
availableGlobally: true,
availableForProject: false,
- displayTab: true
+ displayTab: true,
},
{
key: ANALYSIS_SCOPE_CATEGORY,
@@ -76,7 +76,7 @@ export const ADDITIONAL_CATEGORIES: AdditionalCategory[] = [
renderComponent: getAnalysisScopeComponent,
availableGlobally: true,
availableForProject: true,
- displayTab: false
+ displayTab: false,
},
{
key: ALM_INTEGRATION_CATEGORY,
@@ -84,7 +84,7 @@ export const ADDITIONAL_CATEGORIES: AdditionalCategory[] = [
renderComponent: getAlmIntegrationComponent,
availableGlobally: true,
availableForProject: false,
- displayTab: true
+ displayTab: true,
},
{
key: PULL_REQUEST_DECORATION_BINDING_CATEGORY,
@@ -93,7 +93,7 @@ export const ADDITIONAL_CATEGORIES: AdditionalCategory[] = [
availableGlobally: false,
availableForProject: true,
displayTab: true,
- requiresBranchSupport: true
+ requiresBranchSupport: true,
},
{
key: AUTHENTICATION_CATEGORY,
@@ -101,8 +101,8 @@ export const ADDITIONAL_CATEGORIES: AdditionalCategory[] = [
renderComponent: getAuthenticationComponent,
availableGlobally: true,
availableForProject: false,
- displayTab: false
- }
+ displayTab: false,
+ },
];
function getLanguagesComponent(props: AdditionalCategoryComponentProps) {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx b/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx
index cb32f4830db..5a0de4ad34a 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/AllCategoriesList.tsx
@@ -22,7 +22,7 @@ import { sortBy } from 'lodash';
import * as React from 'react';
import { NavLink } from 'react-router-dom';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import { getGlobalSettingsUrl, getProjectSettingsUrl } from '../../../helpers/urls';
import { Feature } from '../../../types/features';
@@ -42,35 +42,35 @@ export function CategoriesList(props: CategoriesListProps) {
const { categories, component, defaultCategory, selectedCategory } = props;
const categoriesWithName = categories
- .filter(key => !CATEGORY_OVERRIDES[key.toLowerCase()])
- .map(key => ({
+ .filter((key) => !CATEGORY_OVERRIDES[key.toLowerCase()])
+ .map((key) => ({
key,
- name: getCategoryName(key)
+ name: getCategoryName(key),
}))
.concat(
- ADDITIONAL_CATEGORIES.filter(c => c.displayTab)
- .filter(c =>
+ ADDITIONAL_CATEGORIES.filter((c) => c.displayTab)
+ .filter((c) =>
component
? // Project settings
c.availableForProject
: // Global settings
c.availableGlobally
)
- .filter(c => props.hasFeature(Feature.BranchSupport) || !c.requiresBranchSupport)
+ .filter((c) => props.hasFeature(Feature.BranchSupport) || !c.requiresBranchSupport)
);
- const sortedCategories = sortBy(categoriesWithName, category => category.name.toLowerCase());
+ const sortedCategories = sortBy(categoriesWithName, (category) => category.name.toLowerCase());
return (
<ul className="side-tabs-menu">
- {sortedCategories.map(c => {
+ {sortedCategories.map((c) => {
const category = c.key !== defaultCategory ? c.key.toLowerCase() : undefined;
return (
<li key={c.key}>
<NavLink
end={true}
- className={_ =>
+ className={(_) =>
classNames({
- active: c.key.toLowerCase() === selectedCategory.toLowerCase()
+ active: c.key.toLowerCase() === selectedCategory.toLowerCase(),
})
}
title={c.name}
@@ -78,7 +78,8 @@ export function CategoriesList(props: CategoriesListProps) {
component
? getProjectSettingsUrl(component.key, category)
: getGlobalSettingsUrl(category)
- }>
+ }
+ >
{c.name}
</NavLink>
</li>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.tsx b/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.tsx
index 107183e40b7..baf9ddac3d5 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.tsx
@@ -23,7 +23,7 @@ import { getValues } from '../../../api/settings';
import {
ExtendedSettingDefinition,
SettingDefinitionAndValue,
- SettingValue
+ SettingValue,
} from '../../../types/settings';
import { Component } from '../../../types/types';
import SubCategoryDefinitionsList from './SubCategoryDefinitionsList';
@@ -64,22 +64,22 @@ export default class CategoryDefinitionsList extends React.PureComponent<Props,
const { category, component, definitions } = this.props;
const categoryDefinitions = definitions.filter(
- definition => definition.category.toLowerCase() === category.toLowerCase()
+ (definition) => definition.category.toLowerCase() === category.toLowerCase()
);
- const keys = categoryDefinitions.map(definition => definition.key);
+ const keys = categoryDefinitions.map((definition) => definition.key);
const values: SettingValue[] = await getValues({
keys,
- component: component?.key
+ component: component?.key,
}).catch(() => []);
const valuesByDefinitionKey = keyBy(values, 'key');
- const settings: SettingDefinitionAndValue[] = categoryDefinitions.map(definition => {
+ const settings: SettingDefinitionAndValue[] = categoryDefinitions.map((definition) => {
const settingValue = valuesByDefinitionKey[definition.key];
return {
definition,
- settingValue
+ settingValue,
};
});
diff --git a/server/sonar-web/src/main/js/apps/settings/components/Definition.tsx b/server/sonar-web/src/main/js/apps/settings/components/Definition.tsx
index 1bf9c91506d..4ed9629b304 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/Definition.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/Definition.tsx
@@ -52,7 +52,7 @@ export default class Definition extends React.PureComponent<Props, State> {
this.state = {
loading: false,
success: false,
- settingValue: props.initialSettingValue
+ settingValue: props.initialSettingValue,
};
}
@@ -85,7 +85,7 @@ export default class Definition extends React.PureComponent<Props, State> {
loading: false,
success: true,
validationMessage: undefined,
- settingValue
+ settingValue,
});
this.timeout = window.setTimeout(
@@ -109,7 +109,7 @@ export default class Definition extends React.PureComponent<Props, State> {
if (isEmptyValue(definition, changedValue)) {
if (definition.defaultValue === undefined) {
this.setState({
- validationMessage: translate('settings.state.value_cant_be_empty_no_default')
+ validationMessage: translate('settings.state.value_cant_be_empty_no_default'),
});
} else {
this.setState({ validationMessage: translate('settings.state.value_cant_be_empty') });
@@ -126,7 +126,7 @@ export default class Definition extends React.PureComponent<Props, State> {
validationMessage: translateWithParameters(
'settings.state.url_not_valid',
changedValue ?? ''
- )
+ ),
});
return false;
}
@@ -169,7 +169,7 @@ export default class Definition extends React.PureComponent<Props, State> {
changedValue: undefined,
loading: false,
success: true,
- settingValue
+ settingValue,
});
this.timeout = window.setTimeout(
diff --git a/server/sonar-web/src/main/js/apps/settings/components/DefinitionActions.tsx b/server/sonar-web/src/main/js/apps/settings/components/DefinitionActions.tsx
index cc9eb8e328a..4c3acd22e5a 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/DefinitionActions.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/DefinitionActions.tsx
@@ -91,7 +91,8 @@ export default class DefinitionActions extends React.PureComponent<Props, State>
<Button
className="spacer-right button-success"
disabled={this.props.hasError}
- onClick={this.props.onSave}>
+ onClick={this.props.onSave}
+ >
{translate('save')}
</Button>
)}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/DefinitionRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/DefinitionRenderer.tsx
index 66ae9a55dcf..d68e95d8150 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/DefinitionRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/DefinitionRenderer.tsx
@@ -30,7 +30,7 @@ import {
getPropertyDescription,
getPropertyName,
getSettingValue,
- isDefaultOrInherited
+ isDefaultOrInherited,
} from '../utils';
import DefinitionActions from './DefinitionActions';
import Input from './inputs/Input';
@@ -65,9 +65,10 @@ export default function DefinitionRenderer(props: DefinitionRendererProps) {
return (
<div
className={classNames('settings-definition', {
- 'settings-definition-changed': hasValueChanged
+ 'settings-definition-changed': hasValueChanged,
})}
- data-key={definition.key}>
+ data-key={definition.key}
+ >
<div className="settings-definition-left">
<h3 className="settings-definition-name" title={propertyName}>
{propertyName}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.tsx b/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.tsx
index 9caf6c4ee9a..3a0cedc86b1 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/DefinitionsList.tsx
@@ -32,11 +32,12 @@ export default function DefinitionsList(props: Props) {
const { component, settings } = props;
return (
<ul className="settings-definitions-list">
- {settings.map(setting => (
+ {settings.map((setting) => (
<li
key={setting.definition.key}
data-key={setting.definition.key}
- ref={props.scrollToDefinition}>
+ ref={props.scrollToDefinition}
+ >
<Definition
component={component}
definition={setting.definition}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/EmailForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/EmailForm.tsx
index 2e9bfed908d..6497a120f06 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/EmailForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/EmailForm.tsx
@@ -51,7 +51,7 @@ export class EmailForm extends React.PureComponent<Props, State> {
recipient: this.props.currentUser.email || '',
subject: translate('email_configuration.test.subject'),
message: translate('email_configuration.test.message_text'),
- loading: false
+ loading: false,
};
}
@@ -64,7 +64,7 @@ export class EmailForm extends React.PureComponent<Props, State> {
}
handleError = (response: Response) => {
- return parseError(response).then(message => {
+ return parseError(response).then((message) => {
if (this.mounted) {
this.setState({ error: message, loading: false });
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/Languages.tsx b/server/sonar-web/src/main/js/apps/settings/components/Languages.tsx
index 46af2305a4e..daa34fd698b 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/Languages.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/Languages.tsx
@@ -44,7 +44,7 @@ export function Languages(props: LanguagesProps) {
const handleOnChange = (newOption: SelectOption) => {
router.push({
...location,
- query: { ...location.query, category: newOption.originalValue }
+ query: { ...location.query, category: newOption.originalValue },
});
};
@@ -60,7 +60,7 @@ export function Languages(props: LanguagesProps) {
onChange={handleOnChange}
options={availableLanguages}
placeholder={translate('settings.languages.select_a_language_placeholder')}
- value={availableLanguages.find(language => language.value === selectedLanguage)}
+ value={availableLanguages.find((language) => language.value === selectedLanguage)}
/>
</div>
{selectedLanguage && (
@@ -81,25 +81,25 @@ function getLanguages(categories: string[], selectedCategory: string) {
const lowerCasedSelectedCategory = selectedCategory.toLowerCase();
const availableLanguages = categories
- .filter(c => CATEGORY_OVERRIDES[c.toLowerCase()] === lowerCasedLanguagesCategory)
- .map(c => ({
+ .filter((c) => CATEGORY_OVERRIDES[c.toLowerCase()] === lowerCasedLanguagesCategory)
+ .map((c) => ({
label: getCategoryName(c),
value: c.toLowerCase(),
- originalValue: c
+ originalValue: c,
}));
let selectedLanguage = undefined;
if (
lowerCasedSelectedCategory !== lowerCasedLanguagesCategory &&
- availableLanguages.find(c => c.value === lowerCasedSelectedCategory)
+ availableLanguages.find((c) => c.value === lowerCasedSelectedCategory)
) {
selectedLanguage = lowerCasedSelectedCategory;
}
return {
availableLanguages,
- selectedLanguage
+ selectedLanguage,
};
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/NewCodePeriod.tsx b/server/sonar-web/src/main/js/apps/settings/components/NewCodePeriod.tsx
index c0cb640c133..1952ddcd4ff 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/NewCodePeriod.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/NewCodePeriod.tsx
@@ -48,7 +48,7 @@ export default class NewCodePeriod extends React.PureComponent<{}, State> {
loading: true,
days: '30',
saving: false,
- success: false
+ success: false,
};
componentDidMount() {
@@ -70,7 +70,7 @@ export default class NewCodePeriod extends React.PureComponent<{}, State> {
days: currentSetting === 'NUMBER_OF_DAYS' ? String(value) : days,
loading: false,
currentSettingValue: value,
- selected: currentSetting
+ selected: currentSetting,
}));
})
.catch(() => {
@@ -89,7 +89,7 @@ export default class NewCodePeriod extends React.PureComponent<{}, State> {
onCancel = () => {
this.setState(({ currentSetting, currentSettingValue, days }) => ({
selected: currentSetting,
- days: currentSetting === 'NUMBER_OF_DAYS' ? String(currentSettingValue) : days
+ days: currentSetting === 'NUMBER_OF_DAYS' ? String(currentSettingValue) : days,
}));
};
@@ -105,19 +105,19 @@ export default class NewCodePeriod extends React.PureComponent<{}, State> {
this.setState({ saving: true, success: false });
setNewCodePeriod({
type,
- value
+ value,
}).then(
() => {
this.setState({
saving: false,
currentSetting: type,
currentSettingValue: value || undefined,
- success: true
+ success: true,
});
},
() => {
this.setState({
- saving: false
+ saving: false,
});
}
);
@@ -125,15 +125,8 @@ export default class NewCodePeriod extends React.PureComponent<{}, State> {
};
render() {
- const {
- currentSetting,
- days,
- loading,
- currentSettingValue,
- saving,
- selected,
- success
- } = this.state;
+ const { currentSetting, days, loading, currentSettingValue, saving, selected, success } =
+ this.state;
const isChanged =
selected !== currentSetting ||
@@ -150,7 +143,8 @@ export default class NewCodePeriod extends React.PureComponent<{}, State> {
<div className="settings-definition-left">
<h3
className="settings-definition-name"
- title={translate('settings.new_code_period.title')}>
+ title={translate('settings.new_code_period.title')}
+ >
{translate('settings.new_code_period.title')}
</h3>
@@ -163,7 +157,7 @@ export default class NewCodePeriod extends React.PureComponent<{}, State> {
<DocLink to="/project-administration/new-code-period/">
{translate('learn_more')}
</DocLink>
- )
+ ),
}}
/>
<p className="spacer-top">
diff --git a/server/sonar-web/src/main/js/apps/settings/components/SettingsApp.tsx b/server/sonar-web/src/main/js/apps/settings/components/SettingsApp.tsx
index 4315e5f760e..3d179d676db 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/SettingsApp.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/SettingsApp.tsx
@@ -24,7 +24,7 @@ import {
addSideBarClass,
addWhitePageClass,
removeSideBarClass,
- removeWhitePageClass
+ removeWhitePageClass,
} from '../../../helpers/pages';
import { ExtendedSettingDefinition } from '../../../types/settings';
import { Component } from '../../../types/types';
@@ -66,9 +66,9 @@ export class SettingsApp extends React.PureComponent<Props, State> {
fetchSettings = async () => {
const { component } = this.props;
- const definitions: ExtendedSettingDefinition[] = await getDefinitions(
- component?.key
- ).catch(() => []);
+ const definitions: ExtendedSettingDefinition[] = await getDefinitions(component?.key).catch(
+ () => []
+ );
if (this.mounted) {
this.setState({ definitions, loading: false });
diff --git a/server/sonar-web/src/main/js/apps/settings/components/SettingsAppRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/SettingsAppRenderer.tsx
index 0e2c35c6d36..947801706d8 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/SettingsAppRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/SettingsAppRenderer.tsx
@@ -45,8 +45,8 @@ export function SettingsAppRenderer(props: SettingsAppRendererProps) {
const categories = React.useMemo(() => {
return uniqBy(
- definitions.map(definition => definition.category),
- category => category.toLowerCase()
+ definitions.map((definition) => definition.category),
+ (category) => category.toLowerCase()
);
}, [definitions]);
@@ -59,7 +59,7 @@ export function SettingsAppRenderer(props: SettingsAppRendererProps) {
const originalCategory = (query.category as string) || defaultCategory;
const overriddenCategory = CATEGORY_OVERRIDES[originalCategory.toLowerCase()];
const selectedCategory = overriddenCategory || originalCategory;
- const foundAdditionalCategory = ADDITIONAL_CATEGORIES.find(c => c.key === selectedCategory);
+ const foundAdditionalCategory = ADDITIONAL_CATEGORIES.find((c) => c.key === selectedCategory);
const isProjectSettings = component;
const shouldRenderAdditionalCategory =
foundAdditionalCategory &&
@@ -97,7 +97,7 @@ export function SettingsAppRenderer(props: SettingsAppRendererProps) {
categories,
component,
definitions,
- selectedCategory: originalCategory
+ selectedCategory: originalCategory,
})
) : (
<CategoryDefinitionsList
diff --git a/server/sonar-web/src/main/js/apps/settings/components/SettingsSearch.tsx b/server/sonar-web/src/main/js/apps/settings/components/SettingsSearch.tsx
index 21af1e9ac28..8f58794a0e9 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/SettingsSearch.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/SettingsSearch.tsx
@@ -27,7 +27,7 @@ import { Component, Dict } from '../../../types/types';
import {
ADDITIONAL_PROJECT_SETTING_DEFINITIONS,
ADDITIONAL_SETTING_DEFINITIONS,
- buildSettingLink
+ buildSettingLink,
} from '../utils';
import SettingsSearchRenderer from './SettingsSearchRenderer';
@@ -52,7 +52,7 @@ export class SettingsSearch extends React.Component<Props, State> {
index: LunrIndex;
state: State = {
searchQuery: '',
- showResults: false
+ showResults: false,
};
constructor(props: Props) {
@@ -69,14 +69,14 @@ export class SettingsSearch extends React.Component<Props, State> {
}
buildSearchIndex(definitions: ExtendedSettingDefinition[]) {
- return lunr(function() {
+ return lunr(function () {
this.ref('key');
this.field('key');
this.field('name');
this.field('description');
this.field('splitkey');
- definitions.forEach(definition => {
+ definitions.forEach((definition) => {
this.add({ ...definition, splitkey: definition.key.replace('.', ' ') });
});
});
@@ -94,10 +94,10 @@ export class SettingsSearch extends React.Component<Props, State> {
.search(
cleanQuery
.split(/\s+/)
- .map(s => `${s} *${s}*`)
+ .map((s) => `${s} *${s}*`)
.join(' ')
)
- .map(match => this.definitionsByKey[match.ref]);
+ .map((match) => this.definitionsByKey[match.ref]);
this.setState({ showResults: true, results, selectedResult: results[0]?.key });
};
@@ -145,7 +145,7 @@ export class SettingsSearch extends React.Component<Props, State> {
const { results, selectedResult } = this.state;
if (results && selectedResult) {
- const index = results.findIndex(r => r.key === selectedResult);
+ const index = results.findIndex((r) => r.key === selectedResult);
if (index > 0) {
this.setState({ selectedResult: results[index - 1].key });
@@ -157,7 +157,7 @@ export class SettingsSearch extends React.Component<Props, State> {
const { results, selectedResult } = this.state;
if (results && selectedResult) {
- const index = results.findIndex(r => r.key === selectedResult);
+ const index = results.findIndex((r) => r.key === selectedResult);
if (index < results.length - 1) {
this.setState({ selectedResult: results[index + 1].key });
diff --git a/server/sonar-web/src/main/js/apps/settings/components/SettingsSearchRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/SettingsSearchRenderer.tsx
index ffe222aee7d..b48a442b5d7 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/SettingsSearchRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/SettingsSearchRenderer.tsx
@@ -71,17 +71,19 @@ export default function SettingsSearchRenderer(props: SettingsSearchRendererProp
<DropdownOverlay noPadding={true}>
<ul className="settings-search-results menu" ref={scrollableNodeRef}>
{results && results.length > 0 ? (
- results.map(r => (
+ results.map((r) => (
<li
key={r.key}
className={classNames('spacer-bottom spacer-top', {
- active: selectedResult === r.key
+ active: selectedResult === r.key,
})}
- ref={selectedResult === r.key ? selectedNodeRef : undefined}>
+ ref={selectedResult === r.key ? selectedNodeRef : undefined}
+ >
<Link
onClick={props.onClickOutside}
onMouseEnter={() => props.onMouseOverResult(r.key)}
- to={buildSettingLink(r, component)}>
+ to={buildSettingLink(r, component)}
+ >
<div className="settings-search-result-title display-flex-space-between">
<h3>{r.name || r.subCategory}</h3>
</div>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.tsx b/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.tsx
index 975c87a54f9..f72744a0ffa 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/SubCategoryDefinitionsList.tsx
@@ -36,9 +36,7 @@ export interface SubCategoryDefinitionsListProps {
displaySubCategoryTitle?: boolean;
}
-export class SubCategoryDefinitionsList extends React.PureComponent<
- SubCategoryDefinitionsListProps
-> {
+export class SubCategoryDefinitionsList extends React.PureComponent<SubCategoryDefinitionsListProps> {
componentDidUpdate(prevProps: SubCategoryDefinitionsListProps) {
const { hash } = this.props.location;
if (hash && prevProps.location.hash !== hash) {
@@ -67,27 +65,28 @@ export class SubCategoryDefinitionsList extends React.PureComponent<
render() {
const { displaySubCategoryTitle = true, settings, subCategory, component } = this.props;
- const bySubCategory = groupBy(settings, setting => setting.definition.subCategory);
- const subCategories = Object.keys(bySubCategory).map(key => ({
+ const bySubCategory = groupBy(settings, (setting) => setting.definition.subCategory);
+ const subCategories = Object.keys(bySubCategory).map((key) => ({
key,
name: getSubCategoryName(bySubCategory[key][0].definition.category, key),
- description: getSubCategoryDescription(bySubCategory[key][0].definition.category, key)
+ description: getSubCategoryDescription(bySubCategory[key][0].definition.category, key),
}));
- const sortedSubCategories = sortBy(subCategories, subCategory =>
+ const sortedSubCategories = sortBy(subCategories, (subCategory) =>
subCategory.name.toLowerCase()
);
const filteredSubCategories = subCategory
- ? sortedSubCategories.filter(c => c.key === subCategory)
+ ? sortedSubCategories.filter((c) => c.key === subCategory)
: sortedSubCategories;
return (
<ul className="settings-sub-categories-list">
- {filteredSubCategories.map(subCategory => (
+ {filteredSubCategories.map((subCategory) => (
<li key={subCategory.key}>
{displaySubCategoryTitle && (
<h2
className="settings-sub-category-name"
data-key={subCategory.key}
- ref={this.scrollToSubCategoryOrDefinition}>
+ ref={this.scrollToSubCategoryOrDefinition}
+ >
{subCategory.name}
</h2>
)}
@@ -96,7 +95,7 @@ export class SubCategoryDefinitionsList extends React.PureComponent<
className="settings-sub-category-description markdown"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
- __html: sanitizeStringRestricted(subCategory.description)
+ __html: sanitizeStringRestricted(subCategory.description),
}}
/>
)}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AdditionalCategories-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AdditionalCategories-test.tsx
index 2bdeab6a2c4..dd485db2063 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AdditionalCategories-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AdditionalCategories-test.tsx
@@ -23,13 +23,13 @@ import { PULL_REQUEST_DECORATION_BINDING_CATEGORY } from '../../constants';
import { ADDITIONAL_CATEGORIES } from '../AdditionalCategories';
it('should render additional categories component correctly', () => {
- ADDITIONAL_CATEGORIES.forEach(cat => {
+ ADDITIONAL_CATEGORIES.forEach((cat) => {
expect(
cat.renderComponent({
categories: [],
component: mockComponent(),
definitions: [],
- selectedCategory: 'TEST'
+ selectedCategory: 'TEST',
})
).toMatchSnapshot();
});
@@ -38,7 +38,7 @@ it('should render additional categories component correctly', () => {
it('should not render pull request decoration binding component when the component is not defined', () => {
const category = find(
ADDITIONAL_CATEGORIES,
- c => c.key === PULL_REQUEST_DECORATION_BINDING_CATEGORY
+ (c) => c.key === PULL_REQUEST_DECORATION_BINDING_CATEGORY
);
expect(
@@ -46,7 +46,7 @@ it('should not render pull request decoration binding component when the compone
categories: [],
component: undefined,
definitions: [],
- selectedCategory: ''
+ selectedCategory: '',
})
).toBeUndefined();
});
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AllCategoriesList-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AllCategoriesList-test.tsx
index bcf8ac67203..8005bf7637a 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/AllCategoriesList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/AllCategoriesList-test.tsx
@@ -33,7 +33,7 @@ jest.mock('../AdditionalCategories', () => ({
availableGlobally: true,
availableForProject: true,
displayTab: true,
- requiresBranchSupport: true
+ requiresBranchSupport: true,
},
{
key: 'CAT_2',
@@ -41,7 +41,7 @@ jest.mock('../AdditionalCategories', () => ({
renderComponent: jest.fn(),
availableGlobally: true,
availableForProject: false,
- displayTab: true
+ displayTab: true,
},
{
key: 'CAT_3',
@@ -49,7 +49,7 @@ jest.mock('../AdditionalCategories', () => ({
renderComponent: jest.fn(),
availableGlobally: false,
availableForProject: true,
- displayTab: true
+ displayTab: true,
},
{
key: 'CAT_4',
@@ -57,9 +57,9 @@ jest.mock('../AdditionalCategories', () => ({
renderComponent: jest.fn(),
availableGlobally: true,
availableForProject: true,
- displayTab: false
- }
- ] as AdditionalCategory[]
+ displayTab: false,
+ },
+ ] as AdditionalCategory[],
}));
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/CategoryDefinitionsList-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/CategoryDefinitionsList-test.tsx
index 9f5dedb2a4a..5d1f54507be 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/CategoryDefinitionsList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/CategoryDefinitionsList-test.tsx
@@ -26,7 +26,7 @@ import { waitAndUpdate } from '../../../../helpers/testUtils';
import CategoryDefinitionsList from '../CategoryDefinitionsList';
jest.mock('../../../../api/settings', () => ({
- getValues: jest.fn().mockResolvedValue([])
+ getValues: jest.fn().mockResolvedValue([]),
}));
it('should load settings values', async () => {
@@ -36,11 +36,11 @@ it('should load settings values', async () => {
const definitions = [
mockDefinition({ category: 'general', key: 'yes' }),
mockDefinition({ category: 'other', key: 'nope' }),
- mockDefinition({ category: 'general', key: 'yesagain' })
+ mockDefinition({ category: 'general', key: 'yesagain' }),
];
const wrapper = shallowRender({
- definitions
+ definitions,
});
await waitAndUpdate(wrapper);
@@ -49,7 +49,7 @@ it('should load settings values', async () => {
expect(wrapper.state().settings).toEqual([
{ definition: definitions[0], settingValue: settings[0] },
- { definition: definitions[2], settingValue: settings[1] }
+ { definition: definitions[2], settingValue: settings[1] },
]);
});
@@ -57,7 +57,7 @@ it('should reload on category change', async () => {
const definitions = [
mockDefinition({ category: 'general', key: 'yes' }),
mockDefinition({ category: 'other', key: 'nope' }),
- mockDefinition({ category: 'general', key: 'yesagain' })
+ mockDefinition({ category: 'general', key: 'yesagain' }),
];
const wrapper = shallowRender({ component: mockComponent({ key: 'comp-key' }), definitions });
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/Definition-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/Definition-test.tsx
index 8a64edf7ed5..e1c9f3deddf 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/Definition-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/Definition-test.tsx
@@ -28,7 +28,7 @@ import Definition from '../Definition';
jest.mock('../../../../api/settings', () => ({
getValue: jest.fn().mockResolvedValue({}),
resetSettingValue: jest.fn().mockResolvedValue(undefined),
- setSettingValue: jest.fn().mockResolvedValue(undefined)
+ setSettingValue: jest.fn().mockResolvedValue(undefined),
}));
beforeAll(() => {
@@ -51,27 +51,27 @@ describe('Handle change (and check)', () => {
'empty, default',
mockDefinition({ defaultValue: 'dflt' }),
'',
- 'settings.state.value_cant_be_empty'
+ 'settings.state.value_cant_be_empty',
],
[
'invalid url',
mockDefinition({ key: 'sonar.core.serverBaseURL' }),
'%invalid',
- 'settings.state.url_not_valid.%invalid'
+ 'settings.state.url_not_valid.%invalid',
],
[
'valid url',
mockDefinition({ key: 'sonar.core.serverBaseURL' }),
'http://www.sonarqube.org',
- undefined
+ undefined,
],
[
'invalid JSON',
mockDefinition({ type: SettingType.JSON }),
'{{broken: "json}',
- 'Unexpected token { in JSON at position 1'
+ 'Unexpected token { in JSON at position 1',
],
- ['valid JSON', mockDefinition({ type: SettingType.JSON }), '{"validJson": true}', undefined]
+ ['valid JSON', mockDefinition({ type: SettingType.JSON }), '{"validJson": true}', undefined],
])(
'should handle change (and check value): %s',
(_caseName, definition, changedValue, expectedValidationMessage) => {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionActions-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionActions-test.tsx
index c8bafc2f964..5f3904a0eef 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionActions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionActions-test.tsx
@@ -30,14 +30,14 @@ const definition: ExtendedSettingDefinition = {
name: 'foobar',
options: [],
subCategory: 'bar',
- type: SettingType.STRING
+ type: SettingType.STRING,
};
const settings = {
key: 'key',
hasValue: true,
definition,
- value: 'baz'
+ value: 'baz',
};
it('displays default message when value is default', () => {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionRenderer-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionRenderer-test.tsx
index f84052ba949..eb89d098043 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/DefinitionRenderer-test.tsx
@@ -29,7 +29,7 @@ it('should render correctly', () => {
).toMatchSnapshot('with description');
expect(
shallowRender({
- validationMessage: 'validation message'
+ validationMessage: 'validation message',
})
).toMatchSnapshot('in error');
expect(shallowRender({ success: true })).toMatchSnapshot('success');
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/EmailForm-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/EmailForm-test.tsx
index 1c065e0471f..944bd3ea30b 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/EmailForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/EmailForm-test.tsx
@@ -25,11 +25,11 @@ import { change, submit, waitAndUpdate } from '../../../../helpers/testUtils';
import { EmailForm } from '../EmailForm';
jest.mock('../../../../helpers/request', () => ({
- parseError: jest.fn().mockResolvedValue('Error message')
+ parseError: jest.fn().mockResolvedValue('Error message'),
}));
jest.mock('../../../../api/settings', () => ({
- sendTestEmail: jest.fn().mockResolvedValue(null)
+ sendTestEmail: jest.fn().mockResolvedValue(null),
}));
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/NewCodePeriod-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/NewCodePeriod-test.tsx
index fe71d9b74da..64bc8a2bdb0 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/NewCodePeriod-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/NewCodePeriod-test.tsx
@@ -25,7 +25,7 @@ import NewCodePeriod from '../NewCodePeriod';
jest.mock('../../../../api/newCodePeriod', () => ({
getNewCodePeriod: jest.fn().mockResolvedValue({}),
- setNewCodePeriod: jest.fn(() => Promise.resolve())
+ setNewCodePeriod: jest.fn(() => Promise.resolve()),
}));
beforeEach(() => {
@@ -77,22 +77,12 @@ it('should disable the button if the days are invalid', async () => {
wrapper.instance().onSelectDays('asd');
await waitAndUpdate(wrapper);
- expect(
- wrapper
- .find('SubmitButton')
- .first()
- .prop('disabled')
- ).toBe(true);
+ expect(wrapper.find('SubmitButton').first().prop('disabled')).toBe(true);
wrapper.instance().onSelectDays('23');
await waitAndUpdate(wrapper);
- expect(
- wrapper
- .find('SubmitButton')
- .first()
- .prop('disabled')
- ).toBe(false);
+ expect(wrapper.find('SubmitButton').first().prop('disabled')).toBe(false);
});
it('should submit correctly', async () => {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsApp-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsApp-test.tsx
index e9193b069b8..30257db64b6 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsApp-test.tsx
@@ -25,7 +25,7 @@ import {
addSideBarClass,
addWhitePageClass,
removeSideBarClass,
- removeWhitePageClass
+ removeWhitePageClass,
} from '../../../../helpers/pages';
import { waitAndUpdate } from '../../../../helpers/testUtils';
import { SettingsApp } from '../SettingsApp';
@@ -34,11 +34,11 @@ jest.mock('../../../../helpers/pages', () => ({
addSideBarClass: jest.fn(),
addWhitePageClass: jest.fn(),
removeSideBarClass: jest.fn(),
- removeWhitePageClass: jest.fn()
+ removeWhitePageClass: jest.fn(),
}));
jest.mock('../../../../api/settings', () => ({
- getDefinitions: jest.fn().mockResolvedValue([])
+ getDefinitions: jest.fn().mockResolvedValue([]),
}));
it('should render default view correctly', async () => {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsAppRenderer-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsAppRenderer-test.tsx
index 4479fd6bb3a..eede0b6bbe8 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsAppRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsAppRenderer-test.tsx
@@ -27,7 +27,7 @@ import {
ANALYSIS_SCOPE_CATEGORY,
LANGUAGES_CATEGORY,
NEW_CODE_PERIOD_CATEGORY,
- PULL_REQUEST_DECORATION_BINDING_CATEGORY
+ PULL_REQUEST_DECORATION_BINDING_CATEGORY,
} from '../../constants';
import { SettingsAppRenderer, SettingsAppRendererProps } from '../SettingsAppRenderer';
@@ -47,10 +47,10 @@ it.each([
[LANGUAGES_CATEGORY],
[ANALYSIS_SCOPE_CATEGORY],
[ALM_INTEGRATION_CATEGORY],
- [PULL_REQUEST_DECORATION_BINDING_CATEGORY]
-])('should render %s correctly', category => {
+ [PULL_REQUEST_DECORATION_BINDING_CATEGORY],
+])('should render %s correctly', (category) => {
const wrapper = shallowRender({
- location: mockLocation({ query: { category } })
+ location: mockLocation({ query: { category } }),
});
expect(wrapper).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsSearch-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsSearch-test.tsx
index fd69cd348b9..7ec5c541a6f 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsSearch-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsSearch-test.tsx
@@ -31,12 +31,12 @@ jest.mock('lunr', () =>
jest.fn(() => ({
search: jest.fn(() => [
{
- ref: 'foo'
+ ref: 'foo',
},
{
- ref: 'sonar.new_code_period'
- }
- ])
+ ref: 'sonar.new_code_period',
+ },
+ ]),
}))
);
@@ -108,7 +108,7 @@ describe('instance', () => {
expect(router.push).toHaveBeenCalledWith({
hash: '#foo',
pathname: '/admin/settings',
- search: queryToSearch({ category: 'foo category' })
+ search: queryToSearch({ category: 'foo category' }),
});
});
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsSearchRenderer-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsSearchRenderer-test.tsx
index ee55b011216..d0809a21628 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsSearchRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SettingsSearchRenderer-test.tsx
@@ -24,14 +24,14 @@ import { scrollToElement } from '../../../../helpers/scrolling';
import SettingsSearchRenderer, { SettingsSearchRendererProps } from '../SettingsSearchRenderer';
jest.mock('../../../../helpers/scrolling', () => ({
- scrollToElement: jest.fn()
+ scrollToElement: jest.fn(),
}));
jest.mock('react', () => {
return {
...jest.requireActual('react'),
useRef: jest.fn(),
- useEffect: jest.fn()
+ useEffect: jest.fn(),
};
});
@@ -49,7 +49,7 @@ it('should render correctly when open', () => {
shallowRender({
results: [mockDefinition({ name: 'Foo!' }), mockDefinition({ key: 'bar' })],
selectedResult: 'bar',
- showResults: true
+ showResults: true,
})
).toMatchSnapshot('results');
});
@@ -63,7 +63,7 @@ it('should scroll to selected element', () => {
(React.useRef as jest.Mock)
.mockImplementationOnce(() => scrollableRef)
.mockImplementationOnce(() => selectedRef);
- (React.useEffect as jest.Mock).mockImplementationOnce(f => f());
+ (React.useEffect as jest.Mock).mockImplementationOnce((f) => f());
shallowRender();
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SubCategoryDefinitionsList-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SubCategoryDefinitionsList-test.tsx
index 035ce8d6479..b0651ae0e3f 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/SubCategoryDefinitionsList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/SubCategoryDefinitionsList-test.tsx
@@ -24,11 +24,11 @@ import { mockLocation } from '../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../helpers/testUtils';
import {
SubCategoryDefinitionsList,
- SubCategoryDefinitionsListProps
+ SubCategoryDefinitionsListProps,
} from '../SubCategoryDefinitionsList';
jest.mock('../../../../helpers/scrolling', () => ({
- scrollToElement: jest.fn()
+ scrollToElement: jest.fn(),
}));
it('should render correctly', () => {
@@ -42,7 +42,7 @@ it('should scroll if hash is defined and updated', async () => {
await waitAndUpdate(wrapper);
- wrapper.find('h2').forEach(node => mount(node.getElement()));
+ wrapper.find('h2').forEach((node) => mount(node.getElement()));
expect(window.HTMLElement.prototype.scrollIntoView).toHaveBeenCalled();
@@ -65,9 +65,9 @@ function shallowRender(props: Partial<SubCategoryDefinitionsListProps> = {}) {
subCategory: 'qg',
fields: [],
options: [],
- description: 'awesome description'
- }
- })
+ description: 'awesome description',
+ },
+ }),
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionBox.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionBox.tsx
index 0924eedf763..7a5b9780acf 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionBox.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionBox.tsx
@@ -35,7 +35,7 @@ import {
AlmBindingDefinitionBase,
AlmKeys,
AlmSettingsBindingStatus,
- AlmSettingsBindingStatusType
+ AlmSettingsBindingStatusType,
} from '../../../../types/alm-settings';
import { EditionKey } from '../../../../types/editions';
@@ -53,12 +53,12 @@ export interface AlmBindingDefinitionBoxProps {
const DEFAULT_STATUS: AlmSettingsBindingStatus = {
alertSuccess: false,
failureMessage: '',
- type: AlmSettingsBindingStatusType.Validating
+ type: AlmSettingsBindingStatusType.Validating,
};
const STATUS_ICON = {
[AlmSettingsBindingStatusType.Failure]: <AlertErrorIcon className="spacer-left" />,
- [AlmSettingsBindingStatusType.Success]: <AlertSuccessIcon className="spacer-left" />
+ [AlmSettingsBindingStatusType.Success]: <AlertSuccessIcon className="spacer-left" />,
};
function getPRDecorationFeatureStatus(
@@ -86,15 +86,16 @@ function getPRDecorationFeatureStatus(
link: (
<a
href={getEditionUrl(getEdition(EditionKey.developer), {
- sourceEdition: EditionKey.community
+ sourceEdition: EditionKey.community,
})}
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate(
'settings.almintegration.feature.pr_decoration.disabled.no_branches.link'
)}
</a>
- )
+ ),
}}
/>
}
@@ -194,7 +195,8 @@ export default function AlmBindingDefinitionBox(props: AlmBindingDefinitionBoxPr
<Tooltip
overlay={translate(
'settings.almintegration.feature.alm_repo_import.description'
- )}>
+ )}
+ >
<span>
{translate('settings.almintegration.feature.alm_repo_import.title')}
</span>
@@ -233,7 +235,7 @@ export default function AlmBindingDefinitionBox(props: AlmBindingDefinitionBoxPr
<DocLink to={ALM_DOCUMENTATION_PATHS[AlmKeys.GitHub]}>
{translate('learn_more')}
</DocLink>
- )
+ ),
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionForm.tsx
index 5f45305d093..4016fe316fd 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionForm.tsx
@@ -30,7 +30,7 @@ import {
updateBitbucketServerConfiguration,
updateGithubConfiguration,
updateGitlabConfiguration,
- validateAlmSettings
+ validateAlmSettings,
} from '../../../../api/alm-settings';
import {
AlmBindingDefinition,
@@ -41,7 +41,7 @@ import {
BitbucketServerBindingDefinition,
GithubBindingDefinition,
GitlabBindingDefinition,
- isBitbucketCloudBindingDefinition
+ isBitbucketCloudBindingDefinition,
} from '../../../../types/alm-settings';
import { Dict } from '../../../../types/types';
import { BITBUCKET_CLOUD_WORKSPACE_ID_FORMAT } from '../../constants';
@@ -77,7 +77,7 @@ const BINDING_PER_ALM: {
createApi: createAzureConfiguration,
updateApi: updateAzureConfiguration,
defaultBinding: { key: '', personalAccessToken: '', url: '' } as AzureBindingDefinition,
- optionalFields: {}
+ optionalFields: {},
},
[AlmKeys.GitHub]: {
createApi: createGithubConfiguration,
@@ -89,15 +89,15 @@ const BINDING_PER_ALM: {
clientSecret: '',
url: '',
privateKey: '',
- webhookSecret: ''
+ webhookSecret: '',
} as GithubBindingDefinition,
- optionalFields: { webhookSecret: true }
+ optionalFields: { webhookSecret: true },
},
[AlmKeys.GitLab]: {
createApi: createGitlabConfiguration,
updateApi: updateGitlabConfiguration,
defaultBinding: { key: '', personalAccessToken: '', url: '' } as GitlabBindingDefinition,
- optionalFields: {}
+ optionalFields: {},
},
[AlmKeys.BitbucketServer]: {
createApi: createBitbucketServerConfiguration,
@@ -105,9 +105,9 @@ const BINDING_PER_ALM: {
defaultBinding: {
key: '',
url: '',
- personalAccessToken: ''
+ personalAccessToken: '',
} as BitbucketServerBindingDefinition,
- optionalFields: {}
+ optionalFields: {},
},
[AlmKeys.BitbucketCloud]: {
createApi: createBitbucketCloudConfiguration,
@@ -116,10 +116,10 @@ const BINDING_PER_ALM: {
key: '',
clientId: '',
clientSecret: '',
- workspace: ''
+ workspace: '',
} as BitbucketCloudBindingDefinition,
- optionalFields: {}
- }
+ optionalFields: {},
+ },
};
export default class AlmBindingDefinitionForm extends React.PureComponent<Props, State> {
@@ -141,7 +141,7 @@ export default class AlmBindingDefinitionForm extends React.PureComponent<Props,
formData: props.bindingDefinition ?? BINDING_PER_ALM[alm].defaultBinding,
touched: false,
submitting: false,
- bitbucketVariant
+ bitbucketVariant,
};
}
@@ -157,9 +157,9 @@ export default class AlmBindingDefinitionForm extends React.PureComponent<Props,
this.setState(({ formData }) => ({
formData: {
...formData,
- [fieldId]: value
+ [fieldId]: value,
},
- touched: true
+ touched: true,
}));
};
@@ -174,13 +174,13 @@ export default class AlmBindingDefinitionForm extends React.PureComponent<Props,
apiMethod = BINDING_PER_ALM[apiAlm].updateApi({
newKey: formData.key,
...formData,
- key: alreadySavedFormData.key
+ key: alreadySavedFormData.key,
} as any);
} else if (this.props.bindingDefinition?.key) {
apiMethod = BINDING_PER_ALM[apiAlm].updateApi({
newKey: formData.key,
...formData,
- key: this.props.bindingDefinition.key
+ key: this.props.bindingDefinition.key,
} as any);
} else {
apiMethod = BINDING_PER_ALM[apiAlm].createApi({ ...formData } as any);
@@ -234,7 +234,7 @@ export default class AlmBindingDefinitionForm extends React.PureComponent<Props,
) => {
this.setState({
bitbucketVariant,
- formData: { ...BINDING_PER_ALM[bitbucketVariant].defaultBinding }
+ formData: { ...BINDING_PER_ALM[bitbucketVariant].defaultBinding },
});
};
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx
index 9ebfd7a8d53..c75fc2d9c6f 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormField.tsx
@@ -22,7 +22,7 @@ import { FormattedMessage } from 'react-intl';
import DocLink from '../../../../components/common/DocLink';
import { ButtonLink } from '../../../../components/controls/buttons';
import ValidationInput, {
- ValidationInputErrorPlacement
+ ValidationInputErrorPlacement,
} from '../../../../components/controls/ValidationInput';
import { Alert } from '../../../../components/ui/Alert';
import MandatoryFieldMarker from '../../../../components/ui/MandatoryFieldMarker';
@@ -61,7 +61,7 @@ export function AlmBindingDefinitionFormField<B extends AlmBindingDefinitionBase
overwriteOnly = false,
propKey,
value,
- isSecret
+ isSecret,
} = props;
const [showField, setShowField] = React.useState(!overwriteOnly);
@@ -82,7 +82,8 @@ export function AlmBindingDefinitionFormField<B extends AlmBindingDefinitionBase
onClick={() => {
props.onFieldChange(propKey, '');
setShowField(true);
- }}>
+ }}
+ >
{translate('settings.almintegration.form.secret.update_field')}
</ButtonLink>
</div>
@@ -93,7 +94,7 @@ export function AlmBindingDefinitionFormField<B extends AlmBindingDefinitionBase
className="width-100"
id={id}
maxLength={maxLength || 2000}
- onChange={e => props.onFieldChange(propKey, e.currentTarget.value)}
+ onChange={(e) => props.onFieldChange(propKey, e.currentTarget.value)}
required={!optional}
rows={5}
value={value}
@@ -105,14 +106,15 @@ export function AlmBindingDefinitionFormField<B extends AlmBindingDefinitionBase
error={error}
errorPlacement={ValidationInputErrorPlacement.Bottom}
isValid={false}
- isInvalid={isInvalid}>
+ isInvalid={isInvalid}
+ >
<input
className="width-100"
autoFocus={autoFocus}
id={id}
maxLength={maxLength || 100}
name={id}
- onChange={e => props.onFieldChange(propKey, e.currentTarget.value)}
+ onChange={(e) => props.onFieldChange(propKey, e.currentTarget.value)}
size={50}
type="text"
value={value}
@@ -130,7 +132,7 @@ export function AlmBindingDefinitionFormField<B extends AlmBindingDefinitionBase
<DocLink to="/instance-administration/security/#settings-encryption">
{translate('learn_more')}
</DocLink>
- )
+ ),
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormRenderer.tsx
index 127a9abd9d2..a0afc3d82f0 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionFormRenderer.tsx
@@ -30,7 +30,7 @@ import {
BitbucketCloudBindingDefinition,
BitbucketServerBindingDefinition,
GithubBindingDefinition,
- GitlabBindingDefinition
+ GitlabBindingDefinition,
} from '../../../../types/alm-settings';
import AzureForm from './AzureForm';
import BitbucketForm from './BitbucketForm';
@@ -54,9 +54,7 @@ export interface AlmBindingDefinitionFormProps {
validationError?: string;
}
-export default class AlmBindingDefinitionFormRenderer extends React.PureComponent<
- AlmBindingDefinitionFormProps
-> {
+export default class AlmBindingDefinitionFormRenderer extends React.PureComponent<AlmBindingDefinitionFormProps> {
renderForm = () => {
const { alm, formData, isUpdate, bitbucketVariant } = this.props;
@@ -100,13 +98,8 @@ export default class AlmBindingDefinitionFormRenderer extends React.PureComponen
};
render() {
- const {
- isUpdate,
- alreadyHaveInstanceConfigured,
- canSubmit,
- submitting,
- validationError
- } = this.props;
+ const { isUpdate, alreadyHaveInstanceConfigured, canSubmit, submitting, validationError } =
+ this.props;
const header = translate('settings.almintegration.form.header', isUpdate ? 'edit' : 'create');
const handleSubmit = (event: React.SyntheticEvent<HTMLFormElement>) => {
@@ -119,7 +112,8 @@ export default class AlmBindingDefinitionFormRenderer extends React.PureComponen
contentLabel={header}
onRequestClose={this.props.onCancel}
shouldCloseOnOverlayClick={false}
- size="medium">
+ size="medium"
+ >
<form className="views-form" onSubmit={handleSubmit}>
<div className="modal-head">
<h2>{header}</h2>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx
index eac5572f4ca..c91bd06951e 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx
@@ -22,10 +22,10 @@ import {
countBindedProjects,
deleteConfiguration,
getAlmDefinitions,
- validateAlmSettings
+ validateAlmSettings,
} from '../../../../api/alm-settings';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../../app/components/available-features/withAvailableFeatures';
import { Location, Router, withRouter } from '../../../../components/hoc/withRouter';
import {
@@ -33,7 +33,7 @@ import {
AlmKeys,
AlmSettingsBindingDefinitions,
AlmSettingsBindingStatus,
- AlmSettingsBindingStatusType
+ AlmSettingsBindingStatusType,
} from '../../../../types/alm-settings';
import { Feature } from '../../../../types/features';
import { Dict } from '../../../../types/types';
@@ -76,17 +76,17 @@ export class AlmIntegration extends React.PureComponent<Props, State> {
[AlmKeys.BitbucketServer]: [],
[AlmKeys.BitbucketCloud]: [],
[AlmKeys.GitHub]: [],
- [AlmKeys.GitLab]: []
+ [AlmKeys.GitLab]: [],
},
definitionStatus: {},
loadingAlmDefinitions: true,
- loadingProjectCount: false
+ loadingProjectCount: false,
};
}
componentDidMount() {
this.mounted = true;
- return this.fetchPullRequestDecorationSetting().then(definitions => {
+ return this.fetchPullRequestDecorationSetting().then((definitions) => {
if (definitions) {
// Validate all alms on load:
[
@@ -94,8 +94,8 @@ export class AlmIntegration extends React.PureComponent<Props, State> {
AlmKeys.BitbucketCloud,
AlmKeys.BitbucketServer,
AlmKeys.GitHub,
- AlmKeys.GitLab
- ].forEach(alm => {
+ AlmKeys.GitLab,
+ ].forEach((alm) => {
this.state.definitions[alm].forEach((def: AlmBindingDefinitionBase) =>
this.handleCheck(def.key, false)
);
@@ -128,11 +128,11 @@ export class AlmIntegration extends React.PureComponent<Props, State> {
fetchPullRequestDecorationSetting = () => {
this.setState({ loadingAlmDefinitions: true });
return getAlmDefinitions()
- .then(definitions => {
+ .then((definitions) => {
if (this.mounted) {
this.setState({
definitions,
- loadingAlmDefinitions: false
+ loadingAlmDefinitions: false,
});
return definitions;
}
@@ -159,12 +159,12 @@ export class AlmIntegration extends React.PureComponent<Props, State> {
handleDelete = (definitionKey: string) => {
this.setState({ loadingProjectCount: true });
return countBindedProjects(definitionKey)
- .then(projectCount => {
+ .then((projectCount) => {
if (this.mounted) {
this.setState({
definitionKeyForDeletion: definitionKey,
loadingProjectCount: false,
- projectCount
+ projectCount,
});
}
})
@@ -179,7 +179,7 @@ export class AlmIntegration extends React.PureComponent<Props, State> {
this.setState(({ definitionStatus }) => {
definitionStatus[definitionKey] = {
...definitionStatus[definitionKey],
- type: AlmSettingsBindingStatusType.Validating
+ type: AlmSettingsBindingStatusType.Validating,
};
return { definitionStatus: { ...definitionStatus } };
@@ -202,7 +202,7 @@ export class AlmIntegration extends React.PureComponent<Props, State> {
definitionStatus[definitionKey] = {
alertSuccess,
failureMessage,
- type
+ type,
};
return { definitionStatus: { ...definitionStatus } };
@@ -219,7 +219,7 @@ export class AlmIntegration extends React.PureComponent<Props, State> {
definitionStatus,
loadingAlmDefinitions,
loadingProjectCount,
- projectCount
+ projectCount,
} = this.state;
return (
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx
index 769a2b2d79e..ad038232f4d 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx
@@ -24,7 +24,7 @@ import { getBaseUrl } from '../../../../helpers/system';
import {
AlmKeys,
AlmSettingsBindingDefinitions,
- AlmSettingsBindingStatus
+ AlmSettingsBindingStatus,
} from '../../../../types/alm-settings';
import { Dict } from '../../../../types/types';
import { AlmTabs } from './AlmIntegration';
@@ -62,7 +62,7 @@ const tabs = [
/>
GitHub
</>
- )
+ ),
},
{
key: AlmKeys.BitbucketServer,
@@ -76,7 +76,7 @@ const tabs = [
/>
Bitbucket
</>
- )
+ ),
},
{
key: AlmKeys.Azure,
@@ -90,7 +90,7 @@ const tabs = [
/>
Azure DevOps
</>
- )
+ ),
},
{
key: AlmKeys.GitLab,
@@ -104,8 +104,8 @@ const tabs = [
/>
GitLab
</>
- )
- }
+ ),
+ },
];
export default function AlmIntegrationRenderer(props: AlmIntegrationRendererProps) {
@@ -118,14 +118,14 @@ export default function AlmIntegrationRenderer(props: AlmIntegrationRendererProp
loadingProjectCount,
branchesEnabled,
multipleAlmEnabled,
- projectCount
+ projectCount,
} = props;
const bindingDefinitions = {
[AlmKeys.Azure]: definitions.azure,
[AlmKeys.GitLab]: definitions.gitlab,
[AlmKeys.GitHub]: definitions.github,
- [AlmKeys.BitbucketServer]: [...definitions.bitbucket, ...definitions.bitbucketcloud]
+ [AlmKeys.BitbucketServer]: [...definitions.bitbucket, ...definitions.bitbucketcloud],
};
return (
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTab.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTab.tsx
index 95c05874c1b..93c7492341e 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTab.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTab.tsx
@@ -21,7 +21,7 @@ import * as React from 'react';
import {
AlmBindingDefinition,
AlmBindingDefinitionBase,
- AlmSettingsBindingStatus
+ AlmSettingsBindingStatus,
} from '../../../../types/alm-settings';
import { Dict } from '../../../../types/types';
import { AlmTabs } from './AlmIntegration';
@@ -66,7 +66,7 @@ export default class AlmTab extends React.PureComponent<Props, State> {
};
handleEdit = (definitionKey: string) => {
- const editedDefinition = this.props.definitions.find(d => d.key === definitionKey);
+ const editedDefinition = this.props.definitions.find((d) => d.key === definitionKey);
this.setState({ editDefinition: true, editedDefinition });
};
@@ -74,7 +74,7 @@ export default class AlmTab extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
editDefinition: false,
- editedDefinition: undefined
+ editedDefinition: undefined,
});
}
@@ -91,7 +91,7 @@ export default class AlmTab extends React.PureComponent<Props, State> {
definitionStatus,
loadingAlmDefinitions,
loadingProjectCount,
- multipleAlmEnabled
+ multipleAlmEnabled,
} = this.props;
const { editDefinition, editedDefinition } = this.state;
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx
index d2f72177858..6e1382cc881 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx
@@ -30,7 +30,7 @@ import {
AlmBindingDefinitionBase,
AlmKeys,
AlmSettingsBindingStatus,
- isBitbucketCloudBindingDefinition
+ isBitbucketCloudBindingDefinition,
} from '../../../../types/alm-settings';
import { Dict } from '../../../../types/types';
import AlmBindingDefinitionBox from './AlmBindingDefinitionBox';
@@ -59,7 +59,7 @@ export interface AlmTabRendererProps {
const AUTHENTICATION_AVAILABLE_PLATFORMS = [
AlmKeys.GitHub,
AlmKeys.GitLab,
- AlmKeys.BitbucketServer
+ AlmKeys.BitbucketServer,
];
export default function AlmTabRenderer(props: AlmTabRendererProps) {
@@ -72,7 +72,7 @@ export default function AlmTabRenderer(props: AlmTabRendererProps) {
editedDefinition,
loadingAlmDefinitions,
loadingProjectCount,
- multipleAlmEnabled
+ multipleAlmEnabled,
} = props;
const preventCreation = loadingProjectCount || (!multipleAlmEnabled && definitions.length > 0);
@@ -82,7 +82,8 @@ export default function AlmTabRenderer(props: AlmTabRendererProps) {
className="bordered"
role="tabpanel"
id={getTabPanelId(almTab)}
- aria-labelledby={getTabId(almTab)}>
+ aria-labelledby={getTabId(almTab)}
+ >
<div className="big-padded">
<DeferredSpinner loading={loadingAlmDefinitions}>
{definitions.length === 0 && (
@@ -94,12 +95,13 @@ export default function AlmTabRenderer(props: AlmTabRendererProps) {
<Button
data-test="settings__alm-create"
disabled={preventCreation}
- onClick={props.onCreate}>
+ onClick={props.onCreate}
+ >
{translate('settings.almintegration.create')}
</Button>
</CreationTooltip>
</div>
- {definitions.map(def => (
+ {definitions.map((def) => (
<AlmBindingDefinitionBox
alm={isBitbucketCloudBindingDefinition(def) ? AlmKeys.BitbucketCloud : almTab}
branchesEnabled={branchesEnabled}
@@ -134,11 +136,12 @@ export default function AlmTabRenderer(props: AlmTabRendererProps) {
<Link
to={{
pathname: '/admin/settings',
- search: `category=authentication&tab=${almTab}`
- }}>
+ search: `category=authentication&tab=${almTab}`,
+ }}
+ >
{translate('property.category.authentication')}
</Link>
- )
+ ),
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx
index 3b454eb03fe..ebdfb67f52b 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureForm.tsx
@@ -75,7 +75,8 @@ export default function AzureForm(props: AzureFormProps) {
pat: (
<Link
to="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate"
- target="_blank">
+ target="_blank"
+ >
{translate('settings.almintegration.form.personal_access_token.azure.help.url')}
</Link>
),
@@ -84,7 +85,7 @@ export default function AzureForm(props: AzureFormProps) {
<DocLink to={ALM_DOCUMENTATION_PATHS[AlmKeys.Azure]}>
{translate('learn_more')}
</DocLink>
- )
+ ),
}}
/>
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketCloudForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketCloudForm.tsx
index 449ecdf5b17..4cec42eb8b2 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketCloudForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketCloudForm.tsx
@@ -62,7 +62,7 @@ export default function BitbucketCloudForm(props: BitbucketCloudFormProps) {
<strong>{'{workspace}'}</strong>
{'/{repository}'}
</>
- )
+ ),
}}
/>
}
@@ -86,7 +86,8 @@ export default function BitbucketCloudForm(props: BitbucketCloudFormProps) {
oauth: (
<Link
to="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/"
- target="_blank">
+ target="_blank"
+ >
{translate('settings.almintegration.bitbucketcloud.oauth')}
</Link>
),
@@ -95,7 +96,7 @@ export default function BitbucketCloudForm(props: BitbucketCloudFormProps) {
<DocLink to={ALM_DOCUMENTATION_PATHS[AlmKeys.BitbucketCloud]}>
{translate('learn_more')}
</DocLink>
- )
+ ),
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketForm.tsx
index 7b1c7c94e50..6a5b3d4eaeb 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketForm.tsx
@@ -23,7 +23,7 @@ import { translate } from '../../../../helpers/l10n';
import {
AlmKeys,
BitbucketCloudBindingDefinition,
- BitbucketServerBindingDefinition
+ BitbucketServerBindingDefinition,
} from '../../../../types/alm-settings';
import BitbucketCloudForm from './BitbucketCloudForm';
import BitbucketServerForm from './BitbucketServerForm';
@@ -54,9 +54,9 @@ export default function BitbucketForm(props: BitbucketFormProps) {
options={[
{
label: 'Bitbucket Server',
- value: AlmKeys.BitbucketServer
+ value: AlmKeys.BitbucketServer,
},
- { label: 'Bitbucket Cloud', value: AlmKeys.BitbucketCloud }
+ { label: 'Bitbucket Cloud', value: AlmKeys.BitbucketCloud },
]}
value={variant}
/>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketServerForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketServerForm.tsx
index 3b60f43a85c..a18659e1785 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketServerForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketServerForm.tsx
@@ -71,7 +71,8 @@ export default function BitbucketServerForm(props: BitbucketServerFormProps) {
pat: (
<Link
to="https://confluence.atlassian.com/bitbucketserver0515/personal-access-tokens-961275199.html"
- target="_blank">
+ target="_blank"
+ >
{translate(
'settings.almintegration.form.personal_access_token.bitbucket.help.url'
)}
@@ -82,7 +83,7 @@ export default function BitbucketServerForm(props: BitbucketServerFormProps) {
<DocLink to={ALM_DOCUMENTATION_PATHS[AlmKeys.BitbucketServer]}>
{translate('learn_more')}
</DocLink>
- )
+ ),
}}
/>
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/CreationTooltip.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/CreationTooltip.tsx
index eaca7a893d2..e1d3447e021 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/CreationTooltip.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/CreationTooltip.tsx
@@ -39,7 +39,7 @@ export function CreationTooltip(props: CreationTooltipProps) {
alm,
appState: { edition },
children,
- preventCreation
+ preventCreation,
} = props;
const sourceEdition = edition ? EditionKey[edition] : undefined;
@@ -55,19 +55,21 @@ export function CreationTooltip(props: CreationTooltipProps) {
link: (
<a
href={getEditionUrl(getEdition(EditionKey.enterprise), {
- sourceEdition
+ sourceEdition,
})}
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate('settings.almintegration.create.tooltip.link')}
</a>
),
- alm: translate('alm', alm)
+ alm: translate('alm', alm),
}}
/>
) : null
}
- mouseLeaveDelay={0.25}>
+ mouseLeaveDelay={0.25}
+ >
{children}
</Tooltip>
);
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/DeleteModal.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/DeleteModal.tsx
index 9e79cbba5df..7d7f661c0b1 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/DeleteModal.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/DeleteModal.tsx
@@ -47,7 +47,8 @@ export default function DeleteModal({ id, onDelete, onCancel, projectCount }: De
header={translate('settings.almintegration.delete.header')}
isDestructive={true}
onClose={onCancel}
- onConfirm={onDelete}>
+ onConfirm={onDelete}
+ >
<>
<p className="spacer-bottom">
<FormattedMessage
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubForm.tsx
index cda048ea286..829908871e8 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubForm.tsx
@@ -73,7 +73,7 @@ export default function GithubForm(props: GithubFormProps) {
<DocLink to={ALM_DOCUMENTATION_PATHS[AlmKeys.GitHub]}>
{translate('learn_more')}
</DocLink>
- )
+ ),
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabForm.tsx
index 58686ea35a8..9500ae47f25 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabForm.tsx
@@ -70,7 +70,8 @@ export default function GitlabForm(props: GitlabFormProps) {
pat: (
<Link
to="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html"
- target="_blank">
+ target="_blank"
+ >
{translate('settings.almintegration.form.personal_access_token.gitlab.help.url')}
</Link>
),
@@ -80,7 +81,7 @@ export default function GitlabForm(props: GitlabFormProps) {
<DocLink to={ALM_DOCUMENTATION_PATHS[AlmKeys.GitLab]}>
{translate('learn_more')}
</DocLink>
- )
+ ),
}}
/>
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionBox-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionBox-test.tsx
index c449925092b..8a1f5e2754c 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionBox-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionBox-test.tsx
@@ -24,7 +24,7 @@ import {
mockAzureBindingDefinition,
mockBitbucketCloudBindingDefinition,
mockGithubBindingDefinition,
- mockGitlabBindingDefinition
+ mockGitlabBindingDefinition,
} from '../../../../../helpers/mocks/alm-settings';
import { AlmKeys, AlmSettingsBindingStatusType } from '../../../../../types/alm-settings';
import AlmBindingDefinitionBox, { AlmBindingDefinitionBoxProps } from '../AlmBindingDefinitionBox';
@@ -35,16 +35,16 @@ it('should render correctly', () => {
expect(
shallowRender({
status: mockAlmSettingsBindingStatus({
- type: AlmSettingsBindingStatusType.Success
- })
+ type: AlmSettingsBindingStatusType.Success,
+ }),
})
).toMatchSnapshot('success');
expect(
shallowRender({
status: mockAlmSettingsBindingStatus({
failureMessage: 'Oops, something went wrong',
- type: AlmSettingsBindingStatusType.Failure
- })
+ type: AlmSettingsBindingStatusType.Failure,
+ }),
})
).toMatchSnapshot('error');
@@ -52,16 +52,16 @@ it('should render correctly', () => {
shallowRender({
status: mockAlmSettingsBindingStatus({
alertSuccess: true,
- type: AlmSettingsBindingStatusType.Success
- })
+ type: AlmSettingsBindingStatusType.Success,
+ }),
})
).toMatchSnapshot('success with alert');
expect(
shallowRender({
status: mockAlmSettingsBindingStatus({
- type: AlmSettingsBindingStatusType.Warning
- })
+ type: AlmSettingsBindingStatusType.Warning,
+ }),
})
).toMatchSnapshot('warning');
@@ -72,20 +72,20 @@ it('should render correctly', () => {
expect(
shallowRender({
status: mockAlmSettingsBindingStatus({
- type: AlmSettingsBindingStatusType.Success
+ type: AlmSettingsBindingStatusType.Success,
}),
alm: AlmKeys.GitLab,
- definition: mockGitlabBindingDefinition()
+ definition: mockGitlabBindingDefinition(),
})
).toMatchSnapshot('success for GitLab');
expect(
shallowRender({
status: mockAlmSettingsBindingStatus({
- type: AlmSettingsBindingStatusType.Success
+ type: AlmSettingsBindingStatusType.Success,
}),
alm: AlmKeys.BitbucketCloud,
- definition: mockBitbucketCloudBindingDefinition()
+ definition: mockBitbucketCloudBindingDefinition(),
})
).toMatchSnapshot('success for Bitbucket Cloud');
@@ -94,8 +94,8 @@ it('should render correctly', () => {
branchesEnabled: false,
status: mockAlmSettingsBindingStatus({
alertSuccess: true,
- type: AlmSettingsBindingStatusType.Success
- })
+ type: AlmSettingsBindingStatusType.Success,
+ }),
})
).toMatchSnapshot('success with branches disabled');
});
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionForm-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionForm-test.tsx
index bf9adfa568b..726ac19a3e2 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionForm-test.tsx
@@ -31,14 +31,14 @@ import {
updateBitbucketServerConfiguration,
updateGithubConfiguration,
updateGitlabConfiguration,
- validateAlmSettings
+ validateAlmSettings,
} from '../../../../../api/alm-settings';
import {
mockAzureBindingDefinition,
mockBitbucketCloudBindingDefinition,
mockBitbucketServerBindingDefinition,
mockGithubBindingDefinition,
- mockGitlabBindingDefinition
+ mockGitlabBindingDefinition,
} from '../../../../../helpers/mocks/alm-settings';
import { waitAndUpdate } from '../../../../../helpers/testUtils';
import { AlmBindingDefinition, AlmKeys } from '../../../../../types/alm-settings';
@@ -57,7 +57,7 @@ jest.mock('../../../../../api/alm-settings', () => ({
updateGithubConfiguration: jest.fn().mockResolvedValue({}),
updateGitlabConfiguration: jest.fn().mockResolvedValue({}),
validateAlmSettings: jest.fn().mockResolvedValue(undefined),
- deleteConfiguration: jest.fn().mockResolvedValue(undefined)
+ deleteConfiguration: jest.fn().mockResolvedValue(undefined),
}));
beforeEach(() => {
@@ -111,10 +111,7 @@ it('should handle validation error during submit, and cancellation', async () =>
expect(wrapper.state().validationError).toBe(error);
expect(afterSubmit).not.toHaveBeenCalledWith();
- wrapper
- .find(AlmBindingDefinitionFormRenderer)
- .props()
- .onCancel();
+ wrapper.find(AlmBindingDefinitionFormRenderer).props().onCancel();
expect(deleteConfiguration).toHaveBeenCalledWith(formData.key);
});
@@ -129,8 +126,8 @@ it.each([
[
AlmKeys.BitbucketServer,
mockBitbucketServerBindingDefinition(),
- updateBitbucketServerConfiguration
- ]
+ updateBitbucketServerConfiguration,
+ ],
])(
'should call the proper api on submit for %s | %s',
async (
@@ -150,7 +147,7 @@ it('should call the proper api for BBC', async () => {
const wrapper = shallowRender({
// Reminder: due to the way the settings app works, we never pass AlmKeys.BitbucketCloud as `alm`.
alm: AlmKeys.BitbucketServer,
- bindingDefinition: undefined
+ bindingDefinition: undefined,
});
wrapper.instance().handleBitbucketVariantChange(AlmKeys.BitbucketCloud);
@@ -179,7 +176,7 @@ it('should store bitbucket variant', async () => {
clientId: '',
clientSecret: '',
key: '',
- workspace: ''
+ workspace: '',
});
});
@@ -187,13 +184,13 @@ it('should (dis)allow submit by validating its state (Bitbucket Cloud)', () => {
const wrapper = shallowRender({
// Reminder: due to the way the settings app works, we never pass AlmKeys.BitbucketCloud as `alm`.
alm: AlmKeys.BitbucketServer,
- bindingDefinition: mockBitbucketCloudBindingDefinition()
+ bindingDefinition: mockBitbucketCloudBindingDefinition(),
});
expect(wrapper.instance().canSubmit()).toBe(false);
wrapper.setState({
formData: mockBitbucketCloudBindingDefinition({ workspace: 'foo/bar' }),
- touched: true
+ touched: true,
});
expect(wrapper.instance().canSubmit()).toBe(false);
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionFormField-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionFormField-test.tsx
index ae49847d64f..381f8465c87 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionFormField-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionFormField-test.tsx
@@ -24,7 +24,7 @@ import { click } from '../../../../../helpers/testUtils';
import { AlmBindingDefinitionBase } from '../../../../../types/alm-settings';
import {
AlmBindingDefinitionFormField,
- AlmBindingDefinitionFormFieldProps
+ AlmBindingDefinitionFormFieldProps,
} from '../AlmBindingDefinitionFormField';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionFormRenderer-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionFormRenderer-test.tsx
index ace1308a6f2..46740621671 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionFormRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionFormRenderer-test.tsx
@@ -24,7 +24,7 @@ import { mockGithubBindingDefinition } from '../../../../../helpers/mocks/alm-se
import { click, mockEvent } from '../../../../../helpers/testUtils';
import { AlmKeys } from '../../../../../types/alm-settings';
import AlmBindingDefinitionFormRenderer, {
- AlmBindingDefinitionFormProps
+ AlmBindingDefinitionFormProps,
} from '../AlmBindingDefinitionFormRenderer';
import GithubForm from '../GithubForm';
@@ -40,7 +40,7 @@ it('should render correctly', () => {
it.each([[AlmKeys.Azure], [AlmKeys.GitHub], [AlmKeys.GitLab], [AlmKeys.BitbucketServer]])(
'should render correctly for %s',
- alm => {
+ (alm) => {
expect(shallowRender({ alm })).toMatchSnapshot();
}
);
@@ -69,10 +69,7 @@ it('should handle field change', () => {
const onFieldChange = jest.fn();
const wrapper = shallowRender({ onFieldChange });
- wrapper
- .find(GithubForm)
- .props()
- .onFieldChange('key', 'test');
+ wrapper.find(GithubForm).props().onFieldChange('key', 'test');
expect(onFieldChange).toHaveBeenCalledWith('key', 'test');
});
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-test.tsx
index a9c0596dbea..f4c64f56a22 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-test.tsx
@@ -23,7 +23,7 @@ import {
countBindedProjects,
deleteConfiguration,
getAlmDefinitions,
- validateAlmSettings
+ validateAlmSettings,
} from '../../../../../api/alm-settings';
import { mockLocation, mockRouter } from '../../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../../helpers/testUtils';
@@ -37,7 +37,7 @@ jest.mock('../../../../../api/alm-settings', () => ({
getAlmDefinitions: jest
.fn()
.mockResolvedValue({ azure: [], bitbucket: [], bitbucketcloud: [], github: [], gitlab: [] }),
- validateAlmSettings: jest.fn().mockResolvedValue('')
+ validateAlmSettings: jest.fn().mockResolvedValue(''),
}));
beforeEach(() => {
@@ -54,7 +54,7 @@ it('should validate existing configurations', async () => {
[AlmKeys.BitbucketServer]: [{ key: 'b1' }],
[AlmKeys.BitbucketCloud]: [{ key: 'bc1' }],
[AlmKeys.GitHub]: [{ key: 'gh1' }, { key: 'gh2' }],
- [AlmKeys.GitLab]: [{ key: 'gl1' }]
+ [AlmKeys.GitLab]: [{ key: 'gl1' }],
});
const wrapper = shallowRender();
@@ -89,18 +89,12 @@ it('should handle delete', async () => {
(countBindedProjects as jest.Mock).mockResolvedValueOnce(7);
const wrapper = shallowRender();
- wrapper
- .find(AlmIntegrationRenderer)
- .props()
- .onDelete(toBeDeleted);
+ wrapper.find(AlmIntegrationRenderer).props().onDelete(toBeDeleted);
await waitAndUpdate(wrapper);
expect(wrapper.state().projectCount).toBe(7);
expect(wrapper.state().definitionKeyForDeletion).toBe(toBeDeleted);
- wrapper
- .find(AlmIntegrationRenderer)
- .props()
- .onCancelDelete();
+ wrapper.find(AlmIntegrationRenderer).props().onCancelDelete();
await waitAndUpdate(wrapper);
expect(wrapper.state().projectCount).toBeUndefined();
expect(wrapper.state().definitionKeyForDeletion).toBeUndefined();
@@ -134,7 +128,7 @@ it('should validate a configuration', async () => {
expect(wrapper.state().definitionStatus[definitionKey]).toEqual({
alertSuccess: true,
failureMessage: '',
- type: AlmSettingsBindingStatusType.Warning
+ type: AlmSettingsBindingStatusType.Warning,
});
await wrapper.instance().handleCheck(definitionKey);
@@ -142,7 +136,7 @@ it('should validate a configuration', async () => {
expect(wrapper.state().definitionStatus[definitionKey]).toEqual({
alertSuccess: true,
failureMessage,
- type: AlmSettingsBindingStatusType.Failure
+ type: AlmSettingsBindingStatusType.Failure,
});
await wrapper.instance().handleCheck(definitionKey);
@@ -150,7 +144,7 @@ it('should validate a configuration', async () => {
expect(wrapper.state().definitionStatus[definitionKey]).toEqual({
alertSuccess: true,
failureMessage: '',
- type: AlmSettingsBindingStatusType.Success
+ type: AlmSettingsBindingStatusType.Success,
});
});
@@ -160,7 +154,7 @@ it('should fetch settings', async () => {
[AlmKeys.BitbucketServer]: [{ key: 'b1' }],
[AlmKeys.BitbucketCloud]: [{ key: 'bc1' }],
[AlmKeys.GitHub]: [{ key: 'gh1' }],
- [AlmKeys.GitLab]: [{ key: 'gl1' }]
+ [AlmKeys.GitLab]: [{ key: 'gl1' }],
};
const wrapper = shallowRender();
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTab-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTab-test.tsx
index 7fbd2c73f0c..506c2037c32 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTab-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTab-test.tsx
@@ -32,7 +32,7 @@ it('should handle cancel', async () => {
const wrapper = shallowRender();
wrapper.setState({
- editedDefinition: mockAzureBindingDefinition()
+ editedDefinition: mockAzureBindingDefinition(),
});
wrapper.instance().handleCancel();
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTabRenderer-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTabRenderer-test.tsx
index 76bb366affb..1a7dca90118 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTabRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTabRenderer-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import {
mockAzureBindingDefinition,
mockBitbucketCloudBindingDefinition,
- mockGithubBindingDefinition
+ mockGithubBindingDefinition,
} from '../../../../../helpers/mocks/alm-settings';
import { AlmKeys } from '../../../../../types/alm-settings';
import AlmTabRenderer, { AlmTabRendererProps } from '../AlmTabRenderer';
@@ -53,7 +53,7 @@ it('should render correctly for single-ALM binding', () => {
it('should render correctly with validation', () => {
const githubProps = {
alm: AlmKeys.GitHub,
- definitions: [mockGithubBindingDefinition()]
+ definitions: [mockGithubBindingDefinition()],
};
expect(shallowRender(githubProps)).toMatchSnapshot('default');
expect(shallowRender({ ...githubProps, definitions: [] })).toMatchSnapshot('empty');
@@ -61,7 +61,7 @@ it('should render correctly with validation', () => {
expect(
shallowRender({
...githubProps,
- editedDefinition: mockGithubBindingDefinition()
+ editedDefinition: mockGithubBindingDefinition(),
})
).toMatchSnapshot('create a second');
@@ -69,14 +69,14 @@ it('should render correctly with validation', () => {
shallowRender({
...githubProps,
definitions: [],
- editedDefinition: mockGithubBindingDefinition()
+ editedDefinition: mockGithubBindingDefinition(),
})
).toMatchSnapshot('create a first');
expect(
shallowRender({
almTab: AlmKeys.BitbucketServer, // BitbucketServer will be passed for both Bitbucket variants.
- definitions: [mockBitbucketCloudBindingDefinition()]
+ definitions: [mockBitbucketCloudBindingDefinition()],
})
).toMatchSnapshot('pass the correct key for bitbucket cloud');
});
@@ -84,7 +84,7 @@ it('should render correctly with validation', () => {
function shallowRenderAzure(props: Partial<AlmTabRendererProps>) {
return shallowRender({
definitions: [mockAzureBindingDefinition()],
- ...props
+ ...props,
});
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/BitbucketForm-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/BitbucketForm-test.tsx
index 9bbf537a0bf..9618f064e06 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/BitbucketForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/BitbucketForm-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import ButtonToggle from '../../../../../components/controls/ButtonToggle';
import {
mockBitbucketCloudBindingDefinition,
- mockBitbucketServerBindingDefinition
+ mockBitbucketServerBindingDefinition,
} from '../../../../../helpers/mocks/alm-settings';
import { AlmKeys } from '../../../../../types/alm-settings';
import BitbucketForm, { BitbucketFormProps } from '../BitbucketForm';
@@ -30,27 +30,27 @@ import BitbucketForm, { BitbucketFormProps } from '../BitbucketForm';
it('should render correctly', () => {
let wrapper = shallowRender({
variant: AlmKeys.BitbucketServer,
- formData: mockBitbucketServerBindingDefinition()
+ formData: mockBitbucketServerBindingDefinition(),
});
expect(wrapper).toMatchSnapshot('bbs');
wrapper = shallowRender({
variant: AlmKeys.BitbucketCloud,
- formData: mockBitbucketCloudBindingDefinition()
+ formData: mockBitbucketCloudBindingDefinition(),
});
expect(wrapper).toMatchSnapshot('bbc');
wrapper = shallowRender({
isUpdate: true,
variant: AlmKeys.BitbucketServer,
- formData: mockBitbucketServerBindingDefinition()
+ formData: mockBitbucketServerBindingDefinition(),
});
expect(wrapper).toMatchSnapshot('update bbs');
wrapper = shallowRender({
isUpdate: true,
variant: AlmKeys.BitbucketCloud,
- formData: mockBitbucketCloudBindingDefinition()
+ formData: mockBitbucketCloudBindingDefinition(),
});
expect(wrapper).toMatchSnapshot('update bbc');
});
@@ -59,10 +59,7 @@ it('should render propagete variant properly', () => {
const onVariantChange = jest.fn();
const wrapper = shallowRender({ onVariantChange });
- wrapper
- .find(ButtonToggle)
- .props()
- .onCheck(AlmKeys.BitbucketServer);
+ wrapper.find(ButtonToggle).props().onCheck(AlmKeys.BitbucketServer);
expect(onVariantChange).toHaveBeenCalledWith(AlmKeys.BitbucketServer);
});
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/CreationTooltip-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/CreationTooltip-test.tsx
index 5757e07faf9..4643c5bbedd 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/CreationTooltip-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/CreationTooltip-test.tsx
@@ -35,7 +35,8 @@ function shallowRender(props: Partial<CreationTooltipProps> = {}) {
alm={AlmKeys.Azure}
appState={mockAppState({ edition: EditionKey.community })}
preventCreation={true}
- {...props}>
+ {...props}
+ >
<span>Child</span>
</CreationTooltip>
);
diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/GithubForm-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/GithubForm-test.tsx
index 2268faf51dd..168f7e5ad7c 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/GithubForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/GithubForm-test.tsx
@@ -37,7 +37,7 @@ function shallowRender(props: Partial<GithubFormProps> = {}) {
clientSecret: '',
privateKey: '',
url: '',
- webhookSecret: ''
+ webhookSecret: '',
}}
onFieldChange={jest.fn()}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx
index 316c8099252..532e7f46340 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/Authentication.tsx
@@ -21,7 +21,7 @@ import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { useSearchParams } from 'react-router-dom';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../../app/components/available-features/withAvailableFeatures';
import DocLink from '../../../../components/common/DocLink';
import Link from '../../../../components/common/Link';
@@ -56,7 +56,7 @@ const DOCUMENTATION_LINK_SUFFIXES = {
[SAML]: 'saml/overview',
[AlmKeys.GitHub]: 'github',
[AlmKeys.GitLab]: 'gitlab',
- [AlmKeys.BitbucketServer]: 'bitbucket-cloud'
+ [AlmKeys.BitbucketServer]: 'bitbucket-cloud',
};
function renderDevOpsIcon(key: string) {
@@ -80,7 +80,7 @@ export function Authentication(props: Props & WithAvailableFeaturesProps) {
const tabs = [
{
key: SAML,
- label: 'SAML'
+ label: 'SAML',
},
{
key: AlmKeys.GitHub,
@@ -89,7 +89,7 @@ export function Authentication(props: Props & WithAvailableFeaturesProps) {
{renderDevOpsIcon(AlmKeys.GitHub)}
GitHub
</>
- )
+ ),
},
{
key: AlmKeys.BitbucketServer,
@@ -98,7 +98,7 @@ export function Authentication(props: Props & WithAvailableFeaturesProps) {
{renderDevOpsIcon(AlmKeys.BitbucketServer)}
Bitbucket
</>
- )
+ ),
},
{
key: AlmKeys.GitLab,
@@ -107,8 +107,8 @@ export function Authentication(props: Props & WithAvailableFeaturesProps) {
{renderDevOpsIcon(AlmKeys.GitLab)}
GitLab
</>
- )
- }
+ ),
+ },
];
return (
@@ -127,7 +127,7 @@ export function Authentication(props: Props & WithAvailableFeaturesProps) {
<Link to="/admin/settings?category=general#sonar.login.message">
{translate('settings.authentication.custom_message_information.link')}
</Link>
- )
+ ),
}}
/>
</Alert>
@@ -149,13 +149,14 @@ export function Authentication(props: Props & WithAvailableFeaturesProps) {
{({ top }) => (
<div
style={{
- maxHeight: `calc(100vh - ${top + HEIGHT_ADJUSTMENT}px)`
+ maxHeight: `calc(100vh - ${top + HEIGHT_ADJUSTMENT}px)`,
}}
className="bordered overflow-y-auto tabbed-definitions"
key={currentTab}
role="tabpanel"
aria-labelledby={getTabId(currentTab)}
- id={getTabPanelId(currentTab)}>
+ id={getTabPanelId(currentTab)}
+ >
<div className="big-padded-top big-padded-left big-padded-right">
<Alert variant="info">
<FormattedMessage
@@ -164,16 +165,17 @@ export function Authentication(props: Props & WithAvailableFeaturesProps) {
values={{
link: (
<DocLink
- to={`/instance-administration/authentication/${DOCUMENTATION_LINK_SUFFIXES[currentTab]}/`}>
+ to={`/instance-administration/authentication/${DOCUMENTATION_LINK_SUFFIXES[currentTab]}/`}
+ >
{translate('settings.authentication.help.link')}
</DocLink>
- )
+ ),
}}
/>
</Alert>
{currentTab === SAML && (
<SamlAuthentication
- definitions={definitions.filter(def => def.subCategory === SAML)}
+ definitions={definitions.filter((def) => def.subCategory === SAML)}
/>
)}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlAuthentication.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlAuthentication.tsx
index 1196ed4309c..520b4dc2a53 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlAuthentication.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlAuthentication.tsx
@@ -58,7 +58,7 @@ const OPTIONAL_FIELDS = [
'sonar.auth.saml.sp.privateKey.secured',
'sonar.auth.saml.signature.enabled',
'sonar.auth.saml.user.email',
- 'sonar.auth.saml.group.name'
+ 'sonar.auth.saml.group.name',
];
class SamlAuthentication extends React.PureComponent<
@@ -69,9 +69,9 @@ class SamlAuthentication extends React.PureComponent<
constructor(props: SamlAuthenticationProps) {
super(props);
- const settingValue = props.definitions.map(def => {
+ const settingValue = props.definitions.map((def) => {
return {
- key: def.key
+ key: def.key,
};
});
@@ -80,13 +80,13 @@ class SamlAuthentication extends React.PureComponent<
submitting: false,
dirtyFields: [],
securedFieldsSubmitted: [],
- error: {}
+ error: {},
};
}
componentDidMount() {
const { definitions } = this.props;
- const keys = definitions.map(definition => definition.key);
+ const keys = definitions.map((definition) => definition.key);
// Added setTimeout to make sure the component gets updated before scrolling
setTimeout(() => {
if (location.hash) {
@@ -108,14 +108,14 @@ class SamlAuthentication extends React.PureComponent<
this.formFieldRef.current.scrollIntoView({
behavior: 'smooth',
block: 'center',
- inline: 'nearest'
+ inline: 'nearest',
});
}
};
onFieldChange = (id: string, value: string | boolean) => {
const { settingValue, dirtyFields } = this.state;
- const updatedSettingValue = settingValue?.map(set => {
+ const updatedSettingValue = settingValue?.map((set) => {
if (set.key === id) {
set.value = String(value);
}
@@ -125,23 +125,23 @@ class SamlAuthentication extends React.PureComponent<
if (!dirtyFields.includes(id)) {
const updatedDirtyFields = [...dirtyFields, id];
this.setState({
- dirtyFields: updatedDirtyFields
+ dirtyFields: updatedDirtyFields,
});
}
this.setState({
- settingValue: updatedSettingValue
+ settingValue: updatedSettingValue,
});
};
async loadSettingValues(keys: string[]) {
const { settingValue, securedFieldsSubmitted } = this.state;
const values = await getValues({
- keys
+ keys,
});
const valuesByDefinitionKey = keyBy(values, 'key');
const updatedSecuredFieldsSubmitted: string[] = [...securedFieldsSubmitted];
- const updateSettingValue = settingValue?.map(set => {
+ const updateSettingValue = settingValue?.map((set) => {
if (valuesByDefinitionKey[set.key]) {
set.value =
valuesByDefinitionKey[set.key].value ?? valuesByDefinitionKey[set.key].parentValue;
@@ -160,13 +160,13 @@ class SamlAuthentication extends React.PureComponent<
this.setState({
settingValue: updateSettingValue,
- securedFieldsSubmitted: updatedSecuredFieldsSubmitted
+ securedFieldsSubmitted: updatedSecuredFieldsSubmitted,
});
}
isSecuredField = (key: string) => {
const { definitions } = this.props;
- const fieldDefinition = definitions.find(def => def.key === key);
+ const fieldDefinition = definitions.find((def) => def.key === key);
if (fieldDefinition && fieldDefinition.type === SettingType.PASSWORD) {
return true;
}
@@ -184,9 +184,9 @@ class SamlAuthentication extends React.PureComponent<
this.setState({ submitting: true, error: {}, success: false });
const promises: Promise<void>[] = [];
- dirtyFields.forEach(field => {
- const definition = definitions.find(def => def.key === field);
- const value = settingValue.find(def => def.key === field)?.value;
+ dirtyFields.forEach((field) => {
+ const definition = definitions.find((def) => def.key === field);
+ const value = settingValue.find((def) => def.key === field)?.value;
if (definition && value !== undefined) {
const apiCall =
value.length > 0
@@ -197,16 +197,16 @@ class SamlAuthentication extends React.PureComponent<
}
});
- await Promise.all(promises.map(p => p.catch(e => e))).then(data => {
+ await Promise.all(promises.map((p) => p.catch((e) => e))).then((data) => {
const dataWithError = data
.map((data, index) => ({ data, index }))
- .filter(d => d.data !== undefined && !isSuccessStatus(d.data.status));
+ .filter((d) => d.data !== undefined && !isSuccessStatus(d.data.status));
if (dataWithError.length > 0) {
- dataWithError.forEach(async d => {
+ dataWithError.forEach(async (d) => {
const validationMessage = await parseError(d.data as Response);
const { error } = this.state;
this.setState({
- error: { ...error, ...{ [dirtyFields[d.index]]: validationMessage } }
+ error: { ...error, ...{ [dirtyFields[d.index]]: validationMessage } },
});
});
}
@@ -218,7 +218,7 @@ class SamlAuthentication extends React.PureComponent<
allowEnabling = () => {
const { settingValue } = this.state;
- const enabledFlagSettingValue = settingValue.find(set => set.key === SAML_ENABLED_FIELD);
+ const enabledFlagSettingValue = settingValue.find((set) => set.key === SAML_ENABLED_FIELD);
if (enabledFlagSettingValue && enabledFlagSettingValue.value === 'true') {
return true;
@@ -230,7 +230,7 @@ class SamlAuthentication extends React.PureComponent<
onEnableFlagChange = (value: boolean) => {
const { settingValue, dirtyFields } = this.state;
- const updatedSettingValue = settingValue?.map(set => {
+ const updatedSettingValue = settingValue?.map((set) => {
if (set.key === SAML_ENABLED_FIELD) {
set.value = String(value);
}
@@ -240,7 +240,7 @@ class SamlAuthentication extends React.PureComponent<
this.setState(
{
settingValue: updatedSettingValue,
- dirtyFields: [...dirtyFields, SAML_ENABLED_FIELD]
+ dirtyFields: [...dirtyFields, SAML_ENABLED_FIELD],
},
() => {
this.onSaveConfig();
@@ -273,7 +273,7 @@ class SamlAuthentication extends React.PureComponent<
const isNotSecuredAndNotSubmitted =
!isSecured && (setting.value === '' || setting.value === undefined);
if (isMandatory && (isSecuredAndNotSubmitted || isNotSecuredAndNotSubmitted)) {
- const settingDef = definitions.find(def => def.key === setting.key);
+ const settingDef = definitions.find((def) => def.key === setting.key);
if (settingDef && settingDef.name) {
updatedRequiredFields.push(settingDef.name);
@@ -285,31 +285,26 @@ class SamlAuthentication extends React.PureComponent<
render() {
const { definitions } = this.props;
- const {
- submitting,
- settingValue,
- securedFieldsSubmitted,
- error,
- dirtyFields,
- success
- } = this.state;
- const enabledFlagDefinition = definitions.find(def => def.key === SAML_ENABLED_FIELD);
+ const { submitting, settingValue, securedFieldsSubmitted, error, dirtyFields, success } =
+ this.state;
+ const enabledFlagDefinition = definitions.find((def) => def.key === SAML_ENABLED_FIELD);
const formIsIncomplete = !this.allowEnabling();
const preventTestingConfig = this.getEmptyRequiredFields().length > 0 || dirtyFields.length > 0;
return (
<div>
- {definitions.map(def => {
+ {definitions.map((def) => {
if (def.key === SAML_ENABLED_FIELD) {
return null;
}
return (
<div
key={def.key}
- ref={this.props.location.hash.substring(1) === def.key ? this.formFieldRef : null}>
+ ref={this.props.location.hash.substring(1) === def.key ? this.formFieldRef : null}
+ >
<SamlFormField
- settingValue={settingValue?.find(set => set.key === def.key)}
+ settingValue={settingValue?.find((set) => set.key === def.key)}
definition={def}
mandatory={!OPTIONAL_FIELDS.includes(def.key)}
onFieldChange={this.onFieldChange}
@@ -331,12 +326,13 @@ class SamlAuthentication extends React.PureComponent<
'settings.authentication.saml.tooltip.required_fields',
this.getEmptyRequiredFields().join(', ')
)
- }>
+ }
+ >
<div className="display-inline-flex-center">
<label className="h3 spacer-right">{enabledFlagDefinition.name}</label>
<SamlToggleField
definition={enabledFlagDefinition}
- settingValue={settingValue?.find(set => set.key === enabledFlagDefinition.key)}
+ settingValue={settingValue?.find((set) => set.key === enabledFlagDefinition.key)}
toggleDisabled={formIsIncomplete}
onChange={this.onEnableFlagChange}
/>
@@ -354,7 +350,8 @@ class SamlAuthentication extends React.PureComponent<
Object.keys(error).length
)
: null
- }>
+ }
+ >
{Object.keys(error).length > 0 ? (
<span>
<AlertWarnIcon className="spacer-right" />
@@ -376,14 +373,16 @@ class SamlAuthentication extends React.PureComponent<
</SubmitButton>
<Tooltip
- overlay={this.getTestButtonTooltipContent(formIsIncomplete, dirtyFields.length > 0)}>
+ overlay={this.getTestButtonTooltipContent(formIsIncomplete, dirtyFields.length > 0)}
+ >
<a
className={classNames('button', {
- disabled: preventTestingConfig
+ disabled: preventTestingConfig,
})}
href={preventTestingConfig ? undefined : `${getBaseUrl()}${CONFIG_TEST_PATH}`}
target="_blank"
- rel="noopener noreferrer">
+ rel="noopener noreferrer"
+ >
<DetachIcon className="spacer-right" />
{translate('settings.authentication.saml.form.test')}
</a>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlFormField.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlFormField.tsx
index c73285875cd..f54d5db9e1c 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlFormField.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlFormField.tsx
@@ -19,7 +19,7 @@
*/
import React from 'react';
import ValidationInput, {
- ValidationInputErrorPlacement
+ ValidationInputErrorPlacement,
} from '../../../../components/controls/ValidationInput';
import MandatoryFieldMarker from '../../../../components/ui/MandatoryFieldMarker';
import { ExtendedSettingDefinition, SettingType, SettingValue } from '../../../../types/settings';
@@ -65,7 +65,7 @@ export default function SamlFormField(props: SamlToggleFieldProps) {
definition={definition}
settingValue={settingValue}
toggleDisabled={false}
- onChange={val => props.onFieldChange(SAML_SIGNATURE_FIELD, val)}
+ onChange={(val) => props.onFieldChange(SAML_SIGNATURE_FIELD, val)}
/>
)}
{definition.type === undefined && (
@@ -73,13 +73,14 @@ export default function SamlFormField(props: SamlToggleFieldProps) {
error={error[definition.key]}
errorPlacement={ValidationInputErrorPlacement.Bottom}
isValid={false}
- isInvalid={Boolean(error[definition.key])}>
+ isInvalid={Boolean(error[definition.key])}
+ >
<input
className="width-100"
id={definition.key}
maxLength={100}
name={definition.key}
- onChange={e => props.onFieldChange(definition.key, e.currentTarget.value)}
+ onChange={(e) => props.onFieldChange(definition.key, e.currentTarget.value)}
size={50}
type="text"
value={settingValue?.value ?? ''}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlSecuredField.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlSecuredField.tsx
index b78ca353f74..9af10cf8e7c 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlSecuredField.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/SamlSecuredField.tsx
@@ -45,7 +45,7 @@ export default function SamlSecuredField(props: SamlToggleFieldProps) {
className="width-100"
id={definition.key}
maxLength={4000}
- onChange={e => props.onFieldChange(definition.key, e.currentTarget.value)}
+ onChange={(e) => props.onFieldChange(definition.key, e.currentTarget.value)}
required={!optional}
rows={5}
value={settingValue?.value ?? ''}
@@ -57,7 +57,8 @@ export default function SamlSecuredField(props: SamlToggleFieldProps) {
<ButtonLink
onClick={() => {
setShowField(true);
- }}>
+ }}
+ >
{translate('settings.almintegration.form.secret.update_field')}
</ButtonLink>
</div>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-test.tsx
index 0671022d940..f0671e05cfb 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/__tests__/Authentication-test.tsx
@@ -36,14 +36,14 @@ const mockDefinitionFields = [
category: 'authentication',
subCategory: 'saml',
name: 'test1',
- description: 'desc1'
+ description: 'desc1',
}),
mockDefinition({
key: 'test2',
category: 'authentication',
subCategory: 'saml',
name: 'test2',
- description: 'desc2'
+ description: 'desc2',
}),
mockDefinition({
key: 'sonar.auth.saml.certificate.secured',
@@ -51,7 +51,7 @@ const mockDefinitionFields = [
subCategory: 'saml',
name: 'Certificate',
description: 'Secured certificate',
- type: SettingType.PASSWORD
+ type: SettingType.PASSWORD,
}),
mockDefinition({
key: 'sonar.auth.saml.enabled',
@@ -59,8 +59,8 @@ const mockDefinitionFields = [
subCategory: 'saml',
name: 'Enabled',
description: 'To enable the flag',
- type: SettingType.BOOLEAN
- })
+ type: SettingType.BOOLEAN,
+ }),
];
let handler: AuthenticationServiceMock;
@@ -99,7 +99,7 @@ describe('SAML tab', () => {
subCategory: 'saml',
name: 'Certificate',
description: 'Secured certificate',
- type: SettingType.PASSWORD
+ type: SettingType.PASSWORD,
}),
mockDefinition({
key: 'sonar.auth.saml.enabled',
@@ -107,8 +107,8 @@ describe('SAML tab', () => {
subCategory: 'saml',
name: 'Enabled',
description: 'To enable the flag',
- type: SettingType.BOOLEAN
- })
+ type: SettingType.BOOLEAN,
+ }),
];
renderAuthentication(definitions);
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/Input.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/Input.tsx
index 1220c6d8c23..6b850545313 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/Input.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/Input.tsx
@@ -25,7 +25,7 @@ import {
getUniqueName,
isCategoryDefinition,
isDefaultOrInherited,
- isSecuredDefinition
+ isSecuredDefinition,
} from '../../utils';
import InputForSecured from './InputForSecured';
import MultiValueInput from './MultiValueInput';
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForFormattedText.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForFormattedText.tsx
index d2309911317..129e399bb2d 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForFormattedText.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForFormattedText.tsx
@@ -36,7 +36,7 @@ export default class InputForFormattedText extends React.PureComponent<
constructor(props: DefaultSpecializedInputProps) {
super(props);
this.state = {
- editMessage: !this.props.setting.hasValue
+ editMessage: !this.props.setting.hasValue,
};
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSecured.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSecured.tsx
index 4233c6d7dae..cae3cd79293 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSecured.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSecured.tsx
@@ -26,7 +26,7 @@ import {
DefaultInputProps,
DefaultSpecializedInputProps,
getUniqueName,
- isDefaultOrInherited
+ isDefaultOrInherited,
} from '../../utils';
interface State {
@@ -39,7 +39,7 @@ interface Props extends DefaultInputProps {
export default class InputForSecured extends React.PureComponent<Props, State> {
state: State = {
- changing: !this.props.setting.hasValue
+ changing: !this.props.setting.hasValue,
};
componentDidUpdate(prevProps: Props) {
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.tsx
index 6b41d66209b..7219e5f4951 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.tsx
@@ -32,9 +32,9 @@ export default class InputForSingleSelectList extends React.PureComponent<Props>
render() {
const { options: opts, name, value } = this.props;
- const options = opts.map(option => ({
+ const options = opts.map((option) => ({
label: option,
- value: option
+ value: option,
}));
return (
@@ -43,7 +43,7 @@ export default class InputForSingleSelectList extends React.PureComponent<Props>
name={name}
onChange={this.handleInputChange}
options={options}
- value={options.find(option => option.value === value)}
+ value={options.find((option) => option.value === value)}
/>
);
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.tsx
index 73ec6074885..f61ed55142d 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.tsx
@@ -47,7 +47,7 @@ export default class MultiValueInput extends React.PureComponent<DefaultSpeciali
isDefault={isDefault}
name={name}
hasValueChanged={this.props.hasValueChanged}
- onChange={value => this.handleSingleInputChange(index, value)}
+ onChange={(value) => this.handleSingleInputChange(index, value)}
setting={setting}
value={value}
/>
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.tsx
index d56ca2531c2..be8de19466b 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.tsx
@@ -50,7 +50,7 @@ export default function PrimitiveInput(props: DefaultSpecializedInputProps) {
LONG: InputForNumber,
FLOAT: InputForNumber,
SINGLE_SELECT_LIST: withOptions(definition.options),
- FORMATTED_TEXT: InputForFormattedText
+ FORMATTED_TEXT: InputForFormattedText,
};
const InputComponent = (definition.type && typeMapping[definition.type]) || InputForString;
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.tsx
index d9413426b8d..08edb4fbb6b 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.tsx
@@ -23,7 +23,7 @@ import {
DefaultSpecializedInputProps,
getEmptyValue,
getUniqueName,
- isCategoryDefinition
+ isCategoryDefinition,
} from '../../utils';
import PrimitiveInput from './PrimitiveInput';
@@ -53,11 +53,11 @@ export default class PropertySetInput extends React.PureComponent<DefaultSpecial
return (
<tr key={index}>
{isCategoryDefinition(definition) &&
- definition.fields.map(field => {
+ definition.fields.map((field) => {
const newSetting = {
...setting,
definition: field,
- value: fieldValues[field.key]
+ value: fieldValues[field.key],
};
return (
<td key={field.key}>
@@ -65,7 +65,7 @@ export default class PropertySetInput extends React.PureComponent<DefaultSpecial
isDefault={isDefault}
hasValueChanged={this.props.hasValueChanged}
name={getUniqueName(definition, field.key)}
- onChange={value => this.handleInputChange(index, field.key, value)}
+ onChange={(value) => this.handleInputChange(index, field.key, value)}
setting={newSetting}
value={fieldValues[field.key]}
/>
@@ -92,11 +92,12 @@ export default class PropertySetInput extends React.PureComponent<DefaultSpecial
<div>
<table
className="data zebra-hover no-outer-padding"
- style={{ width: 'auto', minWidth: 480, marginTop: -12 }}>
+ style={{ width: 'auto', minWidth: 480, marginTop: -12 }}
+ >
<thead>
<tr>
{isCategoryDefinition(definition) &&
- definition.fields.map(field => (
+ definition.fields.map((field) => (
<th key={field.key}>
{field.name}
{field.description != null && (
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.tsx
index 0ddc02b9b62..2af3d726f4c 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.tsx
@@ -39,7 +39,7 @@ it('should render PrimitiveInput', () => {
it('should render Secured input', () => {
const setting: Setting = mockSetting({
key: 'foo.secured',
- definition: mockDefinition({ key: 'foo.secured', type: SettingType.PROPERTY_SET })
+ definition: mockDefinition({ key: 'foo.secured', type: SettingType.PROPERTY_SET }),
});
const onChange = jest.fn();
const input = shallowRender({ onChange, setting }).find(InputForSecured);
@@ -50,7 +50,7 @@ it('should render Secured input', () => {
it('should render MultiValueInput', () => {
const setting = mockSetting({
- definition: mockDefinition({ multiValues: true })
+ definition: mockDefinition({ multiValues: true }),
});
const onChange = jest.fn();
const value = ['foo', 'bar'];
@@ -63,7 +63,7 @@ it('should render MultiValueInput', () => {
it('should render PropertySetInput', () => {
const setting: Setting = mockSetting({
- definition: mockDefinition({ type: SettingType.PROPERTY_SET })
+ definition: mockDefinition({ type: SettingType.PROPERTY_SET }),
});
const onChange = jest.fn();
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForFormattedText-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForFormattedText-test.tsx
index 3d3df0cb466..d102b675e25 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForFormattedText-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForFormattedText-test.tsx
@@ -33,7 +33,7 @@ it('renders correctly with no value for login message', () => {
it('renders correctly with a value for login message', async () => {
const user = userEvent.setup();
renderInputForFormattedText({
- setting: mockSetting({ values: ['*text*', 'text'], hasValue: true })
+ setting: mockSetting({ values: ['*text*', 'text'], hasValue: true }),
});
expect(screen.getByRole('button', { name: 'edit' })).toBeInTheDocument();
expect(screen.getByText('text')).toBeInTheDocument();
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForSingleSelectList-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForSingleSelectList-test.tsx
index c2d7bcb0c66..74c0985d68b 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForSingleSelectList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForSingleSelectList-test.tsx
@@ -33,7 +33,7 @@ it('should render Select', () => {
expect(select.prop('options')).toEqual([
{ value: 'foo', label: 'foo' },
{ value: 'bar', label: 'bar' },
- { value: 'baz', label: 'baz' }
+ { value: 'baz', label: 'baz' },
]);
expect(select.prop('onChange')).toBeDefined();
});
diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.tsx
index 4140dc30331..63b71c526c7 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.tsx
@@ -27,7 +27,7 @@ import PrimitiveInput from '../PrimitiveInput';
const settingValue = {
key: 'example',
- hasValue: true
+ hasValue: true,
};
const settingDefinition: ExtendedSettingDefinition = {
@@ -37,7 +37,7 @@ const settingDefinition: ExtendedSettingDefinition = {
multiValues: true,
options: [],
subCategory: 'Branches',
- type: SettingType.STRING
+ type: SettingType.STRING,
};
const assertValues = (inputs: ShallowWrapper<any>, values: string[]) => {
@@ -71,20 +71,14 @@ it('should remove value', () => {
it('should change existing value', () => {
const onChange = jest.fn();
const multiValueInput = shallowRender({ onChange, value: ['foo', 'bar', 'baz'] });
- multiValueInput
- .find(PrimitiveInput)
- .at(1)
- .prop('onChange')('qux');
+ multiValueInput.find(PrimitiveInput).at(1).prop('onChange')('qux');
expect(onChange).toHaveBeenCalledWith(['foo', 'qux', 'baz']);
});
it('should add new value', () => {
const onChange = jest.fn();
const multiValueInput = shallowRender({ onChange });
- multiValueInput
- .find(PrimitiveInput)
- .at(1)
- .prop('onChange')('bar');
+ multiValueInput.find(PrimitiveInput).at(1).prop('onChange')('bar');
expect(onChange).toHaveBeenCalledWith(['foo', 'bar']);
});
diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx
index 5544186be4c..c853566219b 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../../app/components/available-features/withAvailableFeatures';
import DocLink from '../../../../components/common/DocLink';
import Toggle from '../../../../components/controls/Toggle';
@@ -32,7 +32,7 @@ import { convertGithubApiUrlToLink, stripTrailingSlash } from '../../../../helpe
import {
AlmKeys,
AlmSettingsInstance,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../../../../types/alm-settings';
import { Feature } from '../../../../types/features';
import { Dict } from '../../../../types/types';
@@ -113,7 +113,7 @@ function renderBooleanField(
renderLabel({ ...props, optional: true }),
<div className="display-flex-center big-spacer-top">
<div className="display-inline-block text-top">
- <Toggle name={id} onChange={v => onFieldChange(propKey, v)} value={value} />
+ <Toggle name={id} onChange={(v) => onFieldChange(propKey, v)} value={value} />
{value == null && <span className="spacer-left note">{translate('settings.not_set')}</span>}
</div>
{inputExtra}
@@ -135,7 +135,7 @@ function renderField(
id={id}
maxLength={256}
name={id}
- onChange={e => onFieldChange(propKey, e.currentTarget.value)}
+ onChange={(e) => onFieldChange(propKey, e.currentTarget.value)}
type="text"
value={value}
/>,
@@ -147,11 +147,11 @@ export function AlmSpecificForm(props: AlmSpecificFormProps) {
const {
alm,
instances,
- formData: { repository, slug, summaryCommentEnabled, monorepo }
+ formData: { repository, slug, summaryCommentEnabled, monorepo },
} = props;
let formFields: JSX.Element;
- const instance = instances.find(i => i.alm === alm);
+ const instance = instances.find((i) => i.alm === alm);
switch (alm) {
case AlmKeys.Azure:
@@ -163,7 +163,7 @@ export function AlmSpecificForm(props: AlmSpecificFormProps) {
id: 'azure.project',
onFieldChange: props.onFieldChange,
propKey: 'slug',
- value: slug || ''
+ value: slug || '',
})}
{renderField({
help: true,
@@ -171,7 +171,7 @@ export function AlmSpecificForm(props: AlmSpecificFormProps) {
id: 'azure.repository',
onFieldChange: props.onFieldChange,
propKey: 'repository',
- value: repository || ''
+ value: repository || '',
})}
</>
);
@@ -193,7 +193,7 @@ export function AlmSpecificForm(props: AlmSpecificFormProps) {
id: 'bitbucket.repository',
onFieldChange: props.onFieldChange,
propKey: 'repository',
- value: repository || ''
+ value: repository || '',
})}
{renderField({
help: true,
@@ -209,7 +209,7 @@ export function AlmSpecificForm(props: AlmSpecificFormProps) {
id: 'bitbucket.slug',
onFieldChange: props.onFieldChange,
propKey: 'slug',
- value: slug || ''
+ value: slug || '',
})}
</>
);
@@ -228,7 +228,7 @@ export function AlmSpecificForm(props: AlmSpecificFormProps) {
id: 'bitbucketcloud.repository',
onFieldChange: props.onFieldChange,
propKey: 'repository',
- value: repository || ''
+ value: repository || '',
})}
</>
);
@@ -249,14 +249,14 @@ export function AlmSpecificForm(props: AlmSpecificFormProps) {
id: 'github.repository',
onFieldChange: props.onFieldChange,
propKey: 'repository',
- value: repository || ''
+ value: repository || '',
})}
{renderBooleanField({
help: true,
id: 'github.summary_comment_setting',
onFieldChange: props.onFieldChange,
propKey: 'summaryCommentEnabled',
- value: summaryCommentEnabled === undefined ? true : summaryCommentEnabled
+ value: summaryCommentEnabled === undefined ? true : summaryCommentEnabled,
})}
</>
);
@@ -270,7 +270,7 @@ export function AlmSpecificForm(props: AlmSpecificFormProps) {
id: 'gitlab.repository',
onFieldChange: props.onFieldChange,
propKey: 'repository',
- value: repository || ''
+ value: repository || '',
})}
</>
);
@@ -286,7 +286,9 @@ export function AlmSpecificForm(props: AlmSpecificFormProps) {
renderBooleanField({
help: true,
helpParams: {
- doc_link: <DocLink to={ALM_DOCUMENTATION_PATHS[alm]}>{translate('learn_more')}</DocLink>
+ doc_link: (
+ <DocLink to={ALM_DOCUMENTATION_PATHS[alm]}>{translate('learn_more')}</DocLink>
+ ),
},
id: 'monorepo',
onFieldChange: props.onFieldChange,
@@ -296,7 +298,7 @@ export function AlmSpecificForm(props: AlmSpecificFormProps) {
<Alert className="no-margin-bottom spacer-left" variant="warning" display="inline">
{translate('settings.pr_decoration.binding.form.monorepo.warning')}
</Alert>
- )
+ ),
})}
</>
);
diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx
index 5d307e589cc..b8fce04469a 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx
@@ -27,7 +27,7 @@ import {
setProjectBitbucketCloudBinding,
setProjectGithubBinding,
setProjectGitlabBinding,
- validateProjectAlmBinding
+ validateProjectAlmBinding,
} from '../../../../api/alm-settings';
import withCurrentUserContext from '../../../../app/components/current-user/withCurrentUserContext';
import { throwGlobalError } from '../../../../helpers/error';
@@ -37,7 +37,7 @@ import {
AlmKeys,
AlmSettingsInstance,
ProjectAlmBindingConfigurationErrors,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../../../../types/alm-settings';
import { Permissions } from '../../../../types/permissions';
import { Component } from '../../../../types/types';
@@ -72,7 +72,7 @@ const REQUIRED_FIELDS_BY_ALM: {
[AlmKeys.BitbucketServer]: ['repository', 'slug'],
[AlmKeys.BitbucketCloud]: ['repository'],
[AlmKeys.GitHub]: ['repository'],
- [AlmKeys.GitLab]: ['repository']
+ [AlmKeys.GitLab]: ['repository'],
};
export class PRDecorationBinding extends React.PureComponent<Props, State> {
@@ -86,7 +86,7 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
loading: true,
updating: false,
successfullyUpdated: false,
- checkingConfiguration: false
+ checkingConfiguration: false,
};
componentDidMount() {
@@ -113,7 +113,7 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
isValid: this.validateForm(newFormData),
loading: false,
originalData: newFormData,
- configurationErrors: undefined
+ configurationErrors: undefined,
};
});
}
@@ -152,14 +152,14 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
key: '',
repository: '',
slug: '',
- monorepo: false
+ monorepo: false,
},
originalData: undefined,
isChanged: false,
isConfigured: false,
updating: false,
successfullyUpdated: true,
- configurationErrors: undefined
+ configurationErrors: undefined,
});
}
})
@@ -191,7 +191,7 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
project,
projectName: slug,
repositoryName: repository,
- monorepo
+ monorepo,
});
}
case AlmKeys.BitbucketServer: {
@@ -203,7 +203,7 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
project,
repository,
slug,
- monorepo
+ monorepo,
});
}
case AlmKeys.BitbucketCloud: {
@@ -211,7 +211,7 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
almSetting,
project,
repository,
- monorepo
+ monorepo,
});
}
case AlmKeys.GitHub: {
@@ -222,7 +222,7 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
project,
repository,
summaryCommentEnabled,
- monorepo
+ monorepo,
});
}
@@ -231,7 +231,7 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
almSetting,
project,
repository,
- monorepo
+ monorepo,
});
}
@@ -242,7 +242,7 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
checkConfiguration = async () => {
const {
- component: { key: projectKey }
+ component: { key: projectKey },
} = this.props;
const { isConfigured } = this.state;
@@ -253,7 +253,7 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
this.setState({ checkingConfiguration: true, configurationErrors: undefined });
- const configurationErrors = await validateProjectAlmBinding(projectKey).catch(error => error);
+ const configurationErrors = await validateProjectAlmBinding(projectKey).catch((error) => error);
if (this.mounted) {
this.setState({ checkingConfiguration: false, configurationErrors });
@@ -264,10 +264,10 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
this.setState({ updating: true });
const {
formData: { key, ...additionalFields },
- instances
+ instances,
} = this.state;
- const selected = instances.find(i => i.key === key);
+ const selected = instances.find((i) => i.key === key);
if (!key || !selected) {
return;
}
@@ -277,7 +277,7 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
updating: false,
- successfullyUpdated: true
+ successfullyUpdated: true,
});
}
})
@@ -292,7 +292,7 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
repository: oRepository = '',
slug: oSlug = '',
summaryCommentEnabled: osummaryCommentEnabled = false,
- monorepo: omonorepo = false
+ monorepo: omonorepo = false,
}: FormData
) {
return (
@@ -308,21 +308,21 @@ export class PRDecorationBinding extends React.PureComponent<Props, State> {
this.setState(({ formData, originalData }) => {
const newFormData = {
...formData,
- [id]: value
+ [id]: value,
};
return {
formData: newFormData,
isValid: this.validateForm(newFormData),
isChanged: !this.isDataSame(newFormData, originalData || { key: '', monorepo: false }),
- successfullyUpdated: false
+ successfullyUpdated: false,
};
});
};
validateForm = ({ key, ...additionalFields }: State['formData']) => {
const { instances } = this.state;
- const selected = instances.find(i => i.key === key);
+ const selected = instances.find((i) => i.key === key);
if (!key || !selected) {
return false;
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx
index ff4d0528a6d..5589c1e9527 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx
@@ -34,7 +34,7 @@ import {
AlmSettingsInstance,
ProjectAlmBindingConfigurationErrors,
ProjectAlmBindingConfigurationErrorScope,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../../../../types/alm-settings';
import { ALM_INTEGRATION_CATEGORY } from '../../constants';
import AlmSpecificForm from './AlmSpecificForm';
@@ -88,7 +88,7 @@ export default function PRDecorationBindingRenderer(props: PRDecorationBindingRe
successfullyUpdated,
checkingConfiguration,
configurationErrors,
- isSysAdmin
+ isSysAdmin,
} = props;
if (loading) {
@@ -108,7 +108,7 @@ export default function PRDecorationBindingRenderer(props: PRDecorationBindingRe
<Link to={getGlobalSettingsUrl(ALM_INTEGRATION_CATEGORY)}>
{translate('settings.pr_decoration.binding.no_bindings.link')}
</Link>
- )
+ ),
}}
/>
) : (
@@ -119,7 +119,7 @@ export default function PRDecorationBindingRenderer(props: PRDecorationBindingRe
);
}
- const selected = formData.key && instances.find(i => i.key === formData.key);
+ const selected = formData.key && instances.find((i) => i.key === formData.key);
const alm = selected && selected.alm;
return (
@@ -136,7 +136,8 @@ export default function PRDecorationBindingRenderer(props: PRDecorationBindingRe
onSubmit={(event: React.SyntheticEvent<HTMLFormElement>) => {
event.preventDefault();
props.onSubmit();
- }}>
+ }}
+ >
<MandatoryFieldsExplanation className="form-field" />
<div className="settings-definition big-spacer-bottom">
@@ -159,9 +160,9 @@ export default function PRDecorationBindingRenderer(props: PRDecorationBindingRe
onChange={(instance: AlmSettingsInstance) => props.onFieldChange('key', instance.key)}
components={{
Option: optionRenderer,
- SingleValue: singleValueRenderer
+ SingleValue: singleValueRenderer,
}}
- value={instances.filter(instance => instance.key === formData.key)}
+ value={instances.filter((instance) => instance.key === formData.key)}
/>
</div>
</div>
@@ -228,7 +229,7 @@ export default function PRDecorationBindingRenderer(props: PRDecorationBindingRe
'settings.pr_decoration.binding.check_configuration.failure.check_global_settings.link'
)}
</Link>
- )
+ ),
}}
/>
) : (
diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/AlmSpecificForm-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/AlmSpecificForm-test.tsx
index 4e89001515b..7a7de8bb724 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/AlmSpecificForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/AlmSpecificForm-test.tsx
@@ -28,18 +28,18 @@ it.each([
[AlmKeys.BitbucketServer],
[AlmKeys.BitbucketCloud],
[AlmKeys.GitHub],
- [AlmKeys.GitLab]
-])('should render correctly for %s', alm => {
+ [AlmKeys.GitLab],
+])('should render correctly for %s', (alm) => {
expect(shallowRender(alm)).toMatchSnapshot();
});
it.each([
[
AlmKeys.BitbucketServer,
- [mockAlmSettingsInstance({ alm: AlmKeys.BitbucketServer, url: 'http://bbs.example.com' })]
+ [mockAlmSettingsInstance({ alm: AlmKeys.BitbucketServer, url: 'http://bbs.example.com' })],
],
[AlmKeys.GitHub, [mockAlmSettingsInstance({ url: 'http://example.com/api/v3' })]],
- [AlmKeys.GitHub, [mockAlmSettingsInstance({ url: 'http://api.github.com' })]]
+ [AlmKeys.GitHub, [mockAlmSettingsInstance({ url: 'http://api.github.com' })]],
])(
'should render correctly for %s if an instance URL is provided',
(alm: AlmKeys, instances: AlmSettingsInstance[]) => {
@@ -60,7 +60,7 @@ function shallowRender(alm: AlmKeys, props: Partial<AlmSpecificFormProps> = {})
key: '',
repository: '',
slug: '',
- monorepo: false
+ monorepo: false,
}}
onFieldChange={jest.fn()}
hasFeature={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx
index 614b259dec9..247af0f5011 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx
@@ -28,12 +28,12 @@ import {
setProjectBitbucketCloudBinding,
setProjectGithubBinding,
setProjectGitlabBinding,
- validateProjectAlmBinding
+ validateProjectAlmBinding,
} from '../../../../../api/alm-settings';
import {
mockAlmSettingsInstance,
mockProjectAlmBindingConfigurationErrors,
- mockProjectAlmBindingResponse
+ mockProjectAlmBindingResponse,
} from '../../../../../helpers/mocks/alm-settings';
import { mockComponent } from '../../../../../helpers/mocks/component';
import { mockCurrentUser } from '../../../../../helpers/testMocks';
@@ -51,7 +51,7 @@ jest.mock('../../../../../api/alm-settings', () => ({
setProjectGitlabBinding: jest.fn().mockResolvedValue(undefined),
setProjectBitbucketCloudBinding: jest.fn().mockResolvedValue(undefined),
deleteProjectAlmBinding: jest.fn().mockResolvedValue(undefined),
- validateProjectAlmBinding: jest.fn().mockResolvedValue(undefined)
+ validateProjectAlmBinding: jest.fn().mockResolvedValue(undefined),
}));
const PROJECT_KEY = 'project-key';
@@ -69,7 +69,7 @@ it('should fill selects and fill formdata', async () => {
const instances = [{ key: 'instance1', url, alm: AlmKeys.GitHub }];
const formdata = {
key: 'instance1',
- repository: 'account/repo'
+ repository: 'account/repo',
};
(getAlmSettings as jest.Mock).mockResolvedValueOnce(instances);
(getProjectAlmBinding as jest.Mock).mockResolvedValueOnce(formdata);
@@ -89,8 +89,8 @@ it('should handle reset', async () => {
formData: {
key: 'whatever',
repository: 'something/else',
- monorepo: false
- }
+ monorepo: false,
+ },
});
wrapper.instance().handleReset();
@@ -107,7 +107,7 @@ describe('handleSubmit', () => {
{ key: 'azure', alm: AlmKeys.Azure },
{ key: 'bitbucket', alm: AlmKeys.BitbucketServer },
{ key: 'gitlab', alm: AlmKeys.GitLab },
- { key: 'bitbucketcloud', alm: AlmKeys.BitbucketCloud }
+ { key: 'bitbucketcloud', alm: AlmKeys.BitbucketCloud },
];
it('should work for github', async () => {
@@ -119,7 +119,7 @@ describe('handleSubmit', () => {
const monorepo = true;
wrapper.setState({
formData: { key: githubKey, repository, summaryCommentEnabled, monorepo },
- instances
+ instances,
});
wrapper.instance().handleSubmit();
await waitAndUpdate(wrapper);
@@ -129,7 +129,7 @@ describe('handleSubmit', () => {
project: PROJECT_KEY,
repository,
summaryCommentEnabled,
- monorepo
+ monorepo,
});
expect(wrapper.state().successfullyUpdated).toBe(true);
});
@@ -143,7 +143,7 @@ describe('handleSubmit', () => {
const monorepo = true;
wrapper.setState({
formData: { key: azureKey, repository, slug, monorepo },
- instances
+ instances,
});
wrapper.instance().handleSubmit();
await waitAndUpdate(wrapper);
@@ -153,7 +153,7 @@ describe('handleSubmit', () => {
project: PROJECT_KEY,
projectName: slug,
repositoryName: repository,
- monorepo
+ monorepo,
});
expect(wrapper.state().successfullyUpdated).toBe(true);
});
@@ -174,7 +174,7 @@ describe('handleSubmit', () => {
project: PROJECT_KEY,
repository,
slug,
- monorepo
+ monorepo,
});
expect(wrapper.state().successfullyUpdated).toBe(true);
});
@@ -187,7 +187,7 @@ describe('handleSubmit', () => {
const monorepo = true;
wrapper.setState({
formData: { key: gitlabKey, repository, monorepo },
- instances
+ instances,
});
wrapper.instance().handleSubmit();
await waitAndUpdate(wrapper);
@@ -196,7 +196,7 @@ describe('handleSubmit', () => {
almSetting: gitlabKey,
project: PROJECT_KEY,
repository,
- monorepo
+ monorepo,
});
expect(wrapper.state().successfullyUpdated).toBe(true);
});
@@ -220,18 +220,18 @@ describe('handleSubmit', () => {
almSetting: bitbucketKey,
project: PROJECT_KEY,
repository,
- monorepo
+ monorepo,
});
expect(wrapper.state().successfullyUpdated).toBe(true);
});
});
-describe.each([[500], [404]])('For status %i', status => {
+describe.each([[500], [404]])('For status %i', (status) => {
it('should handle failures gracefully', async () => {
const newFormData = {
key: 'whatever',
repository: 'something/else',
- monorepo: false
+ monorepo: false,
};
(getProjectAlmBinding as jest.Mock).mockRejectedValueOnce({ status });
@@ -242,7 +242,7 @@ describe.each([[500], [404]])('For status %i', status => {
await waitAndUpdate(wrapper);
wrapper.setState({
formData: newFormData,
- originalData: undefined
+ originalData: undefined,
});
wrapper.instance().handleSubmit();
@@ -260,7 +260,7 @@ it('should handle field changes', async () => {
const instances: AlmSettingsInstance[] = [
{ key: 'instance1', url, alm: AlmKeys.GitHub },
{ key: 'instance2', url, alm: AlmKeys.GitHub },
- { key: 'instance3', url: 'otherurl', alm: AlmKeys.GitHub }
+ { key: 'instance3', url: 'otherurl', alm: AlmKeys.GitHub },
];
(getAlmSettings as jest.Mock).mockResolvedValueOnce(instances);
const wrapper = shallowRender();
@@ -270,7 +270,7 @@ it('should handle field changes', async () => {
await waitAndUpdate(wrapper);
expect(wrapper.state().formData).toEqual({
key: 'instance2',
- monorepo: false
+ monorepo: false,
});
wrapper.instance().handleFieldChange('repository', repository);
@@ -278,7 +278,7 @@ it('should handle field changes', async () => {
expect(wrapper.state().formData).toEqual({
key: 'instance2',
repository,
- monorepo: false
+ monorepo: false,
});
wrapper.instance().handleFieldChange('summaryCommentEnabled', true);
@@ -287,7 +287,7 @@ it('should handle field changes', async () => {
key: 'instance2',
monorepo: false,
repository,
- summaryCommentEnabled: true
+ summaryCommentEnabled: true,
});
wrapper.instance().handleFieldChange('monorepo', true);
@@ -296,7 +296,7 @@ it('should handle field changes', async () => {
key: 'instance2',
repository,
summaryCommentEnabled: true,
- monorepo: true
+ monorepo: true,
});
});
@@ -309,7 +309,7 @@ it.each([
[AlmKeys.BitbucketServer, { repository: 'test', monorepo: false }],
[AlmKeys.BitbucketCloud, { monorepo: false }],
[AlmKeys.GitHub, { monorepo: false }],
- [AlmKeys.GitLab, { monorepo: false }]
+ [AlmKeys.GitLab, { monorepo: false }],
])(
'should properly reject promise for %s & %s',
async (almKey: AlmKeys, params: { monorepo: boolean }) => {
@@ -337,8 +337,8 @@ it('should validate form', async () => {
{ key: 'bitbucket', alm: AlmKeys.BitbucketServer },
{ key: 'bitbucketcloud', alm: AlmKeys.BitbucketCloud },
{ key: 'github', alm: AlmKeys.GitHub },
- { key: 'gitlab', alm: AlmKeys.GitLab }
- ]
+ { key: 'gitlab', alm: AlmKeys.GitLab },
+ ],
});
[
@@ -346,19 +346,19 @@ it('should validate form', async () => {
{ values: { key: 'azure', monorepo: false, slug: 'project' }, result: false },
{
values: { key: 'azure', monorepo: false, repository: 'repo', slug: 'project' },
- result: true
+ result: true,
},
{ values: { key: 'github', monorepo: false, repository: '' }, result: false },
{ values: { key: 'github', monorepo: false, repository: 'asdf' }, result: true },
{ values: { key: 'bitbucket', monorepo: false, repository: 'key' }, result: false },
{
values: { key: 'bitbucket', monorepo: false, repository: 'key', slug: 'slug' },
- result: true
+ result: true,
},
{ values: { key: 'bitbucketcloud', monorepo: false, repository: '' }, result: false },
{ values: { key: 'bitbucketcloud', monorepo: false, repository: 'key' }, result: true },
{ values: { key: 'gitlab', monorepo: false }, result: false },
- { values: { key: 'gitlab', monorepo: false, repository: 'key' }, result: true }
+ { values: { key: 'gitlab', monorepo: false, repository: 'key' }, result: true },
].forEach(({ values, result }) => {
expect(validateMethod(values)).toBe(result);
});
@@ -375,10 +375,7 @@ it('should call the validation WS and store errors', async () => {
const wrapper = shallowRender();
- wrapper
- .find(PRDecorationBindingRenderer)
- .props()
- .onCheckConfiguration();
+ wrapper.find(PRDecorationBindingRenderer).props().onCheckConfiguration();
await waitAndUpdate(wrapper);
diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBindingRenderer-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBindingRenderer-test.tsx
index d61e57e0ea6..ef323b95e1a 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBindingRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBindingRenderer-test.tsx
@@ -23,10 +23,10 @@ import {
AlmKeys,
AlmSettingsInstance,
ProjectAlmBindingConfigurationErrors,
- ProjectAlmBindingConfigurationErrorScope
+ ProjectAlmBindingConfigurationErrorScope,
} from '../../../../../types/alm-settings';
import PRDecorationBindingRenderer, {
- PRDecorationBindingRendererProps
+ PRDecorationBindingRendererProps,
} from '../PRDecorationBindingRenderer';
const urls = ['http://github.enterprise.com', 'http://bbs.enterprise.com'];
@@ -34,26 +34,26 @@ const instances: AlmSettingsInstance[] = [
{
alm: AlmKeys.GitHub,
key: 'i1',
- url: urls[0]
+ url: urls[0],
},
{
alm: AlmKeys.GitHub,
key: 'i2',
- url: urls[0]
+ url: urls[0],
},
{
alm: AlmKeys.BitbucketServer,
key: 'i3',
- url: urls[1]
+ url: urls[1],
},
{
alm: AlmKeys.Azure,
- key: 'i4'
- }
+ key: 'i4',
+ },
];
const configurationErrors: ProjectAlmBindingConfigurationErrors = {
scope: ProjectAlmBindingConfigurationErrorScope.Global,
- errors: [{ msg: 'Test' }, { msg: 'tesT' }]
+ errors: [{ msg: 'Test' }, { msg: 'tesT' }],
};
it.each([
@@ -68,16 +68,16 @@ it.each([
formData: {
key: 'i1',
repository: 'account/repo',
- monorepo: false
+ monorepo: false,
},
isChanged: false,
isConfigured: true,
- instances
- }
+ instances,
+ },
],
[
'when there are configuration errors (non-admin user)',
- { instances, isConfigured: true, configurationErrors }
+ { instances, isConfigured: true, configurationErrors },
],
[
'when there are configuration errors (admin user)',
@@ -85,13 +85,13 @@ it.each([
formData: {
key: 'i1',
repository: 'account/repo',
- monorepo: false
+ monorepo: false,
},
instances,
isConfigured: true,
configurationErrors,
- isSysAdmin: true
- }
+ isSysAdmin: true,
+ },
],
[
'when there are configuration errors (admin user) and error are at PROJECT level',
@@ -100,11 +100,11 @@ it.each([
isConfigured: true,
configurationErrors: {
...configurationErrors,
- scope: ProjectAlmBindingConfigurationErrorScope.Project
+ scope: ProjectAlmBindingConfigurationErrorScope.Project,
},
- isSysAdmin: true
- }
- ]
+ isSysAdmin: true,
+ },
+ ],
])('should render correctly', (name: string, props: PRDecorationBindingRendererProps) => {
expect(shallowRender(props)).toMatchSnapshot(name);
});
@@ -114,7 +114,7 @@ it.each([
['update is successfull', { successfullyUpdated: true }],
['form is valid', { isValid: true }],
['configuration is saved', { isConfigured: true }],
- ['configuration check is in progress', { isConfigured: true, checkingConfiguration: true }]
+ ['configuration check is in progress', { isConfigured: true, checkingConfiguration: true }],
])(
'should display action section correctly when',
(name: string, props: PRDecorationBindingRendererProps) => {
@@ -128,7 +128,7 @@ function shallowRender(props: Partial<PRDecorationBindingRendererProps> = {}) {
formData={{
key: '',
repository: '',
- monorepo: false
+ monorepo: false,
}}
instances={[]}
isChanged={false}
diff --git a/server/sonar-web/src/main/js/apps/settings/constants.ts b/server/sonar-web/src/main/js/apps/settings/constants.ts
index ad2699e47ad..1f480508b1b 100644
--- a/server/sonar-web/src/main/js/apps/settings/constants.ts
+++ b/server/sonar-web/src/main/js/apps/settings/constants.ts
@@ -57,7 +57,7 @@ export const CATEGORY_OVERRIDES: Dict<string> = {
'vb.net': LANGUAGES_CATEGORY,
'visual basic': LANGUAGES_CATEGORY,
xml: LANGUAGES_CATEGORY,
- yaml: LANGUAGES_CATEGORY
+ yaml: LANGUAGES_CATEGORY,
};
// As per Bitbucket Cloud's documentation, Workspace ID's can only contain lowercase letters,
diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.tsx b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.tsx
index 5307a9bd840..e4ff6c4542c 100644
--- a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionForm.tsx
@@ -122,7 +122,8 @@ export default class EncryptionForm extends React.PureComponent<Props, State> {
<form
className="huge-spacer-top bordered-top"
id="encryption-new-key-form"
- onSubmit={this.handleGenerateSecretKey}>
+ onSubmit={this.handleGenerateSecretKey}
+ >
<p className="big-spacer-top spacer-bottom">
<FormattedMessage
defaultMessage={translate('encryption.form_note')}
@@ -132,7 +133,7 @@ export default class EncryptionForm extends React.PureComponent<Props, State> {
<DocLink to="/instance-administration/security/">
{translate('more_information')}
</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.tsx b/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.tsx
index 6fc39716548..3a8cabf8f06 100644
--- a/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/encryption/GenerateSecretKeyForm.tsx
@@ -86,7 +86,7 @@ export default class GenerateSecretKeyForm extends React.PureComponent<Props, St
values={{
secret_file: <code>~/.sonar/sonar-secret.txt</code>,
property: <code>sonar.secretKeyPath</code>,
- propreties_file: <code>conf/sonar.properties</code>
+ propreties_file: <code>conf/sonar.properties</code>,
}}
/>
</li>
@@ -96,7 +96,7 @@ export default class GenerateSecretKeyForm extends React.PureComponent<Props, St
defaultMessage={translate('encryption.how_to_use.content3')}
id="encryption.how_to_use.content3"
values={{
- property: <code>sonar.secretKeyPath</code>
+ property: <code>sonar.secretKeyPath</code>,
}}
/>
</li>
@@ -115,7 +115,7 @@ export default class GenerateSecretKeyForm extends React.PureComponent<Props, St
<DocLink to="/instance-administration/security/">
{translate('more_information')}
</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/EncryptionApp-test.tsx b/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/EncryptionApp-test.tsx
index 0707d96e493..7de0a7693bc 100644
--- a/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/EncryptionApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/encryption/__tests__/EncryptionApp-test.tsx
@@ -25,7 +25,7 @@ import EncryptionApp from '../EncryptionApp';
jest.mock('../../../../api/settings', () => ({
checkSecretKey: jest.fn().mockResolvedValue({ secretKeyAvailable: true }),
- generateSecretKey: jest.fn().mockResolvedValue({ secretKey: 'secret' })
+ generateSecretKey: jest.fn().mockResolvedValue({ secretKey: 'secret' }),
}));
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/settings/utils.ts b/server/sonar-web/src/main/js/apps/settings/utils.ts
index 0d0ad2160c1..b54d6ee9562 100644
--- a/server/sonar-web/src/main/js/apps/settings/utils.ts
+++ b/server/sonar-web/src/main/js/apps/settings/utils.ts
@@ -28,7 +28,7 @@ import {
SettingDefinition,
SettingType,
SettingValue,
- SettingWithCategory
+ SettingWithCategory,
} from '../../types/settings';
import { Component, Dict } from '../../types/types';
@@ -103,7 +103,7 @@ export function combineDefinitionAndSettingValue(
key: definition.key,
hasValue,
...value,
- definition
+ definition,
};
}
@@ -111,7 +111,9 @@ export function getDefaultCategory(categories: string[]) {
if (categories.includes(DEFAULT_CATEGORY)) {
return DEFAULT_CATEGORY;
}
- const sortedCategories = sortBy(categories, category => getCategoryName(category).toLowerCase());
+ const sortedCategories = sortBy(categories, (category) =>
+ getCategoryName(category).toLowerCase()
+ );
return sortedCategories[0];
}
@@ -133,7 +135,7 @@ export function isURLKind(definition: SettingDefinition) {
'sonar.auth.gitlab.url',
'sonar.lf.gravatarServerUrl',
'sonar.lf.logoUrl',
- 'sonar.auth.saml.loginUrl'
+ 'sonar.auth.saml.loginUrl',
].includes(definition.key);
}
@@ -153,7 +155,7 @@ export function getEmptyValue(item: SettingDefinition | ExtendedSettingDefinitio
if (item.type === 'PROPERTY_SET') {
const value: Dict<string> = {};
- item.fields.forEach(field => (value[field.key] = getEmptyValue(field)));
+ item.fields.forEach((field) => (value[field.key] = getEmptyValue(field)));
return [value];
}
}
@@ -208,7 +210,7 @@ export function isRealSettingKey(key: string) {
`sonar.almintegration.${AlmKeys.Azure}`,
`sonar.almintegration.${AlmKeys.BitbucketServer}`,
`sonar.almintegration.${AlmKeys.GitHub}`,
- `sonar.almintegration.${AlmKeys.GitLab}`
+ `sonar.almintegration.${AlmKeys.GitLab}`,
].includes(key);
}
@@ -221,7 +223,7 @@ export function buildSettingLink(
if (component !== undefined) {
return {
...getProjectSettingsUrl(component.key, category),
- hash: `#${escape(key)}`
+ hash: `#${escape(key)}`,
};
}
@@ -239,7 +241,7 @@ export function buildSettingLink(
return {
...getGlobalSettingsUrl(category, query),
- hash: `#${escape(key)}`
+ hash: `#${escape(key)}`,
};
}
@@ -254,8 +256,8 @@ export const ADDITIONAL_PROJECT_SETTING_DEFINITIONS: ExtendedSettingDefinition[]
key: ``,
fields: [],
options: [],
- subCategory: ''
- }
+ subCategory: '',
+ },
];
export const ADDITIONAL_SETTING_DEFINITIONS: ExtendedSettingDefinition[] = [
@@ -269,7 +271,7 @@ export const ADDITIONAL_SETTING_DEFINITIONS: ExtendedSettingDefinition[] = [
key: `sonar.new_code_period`,
fields: [],
options: [],
- subCategory: ''
+ subCategory: '',
},
{
name: 'Azure DevOps integration',
@@ -292,7 +294,7 @@ export const ADDITIONAL_SETTING_DEFINITIONS: ExtendedSettingDefinition[] = [
key: `sonar.almintegration.${AlmKeys.Azure}`,
fields: [],
options: [],
- subCategory: ''
+ subCategory: '',
},
{
name: 'Bitbucket integration',
@@ -323,7 +325,7 @@ export const ADDITIONAL_SETTING_DEFINITIONS: ExtendedSettingDefinition[] = [
key: `sonar.almintegration.${AlmKeys.BitbucketServer}`,
fields: [],
options: [],
- subCategory: ''
+ subCategory: '',
},
{
name: 'GitHub integration',
@@ -352,7 +354,7 @@ export const ADDITIONAL_SETTING_DEFINITIONS: ExtendedSettingDefinition[] = [
key: `sonar.almintegration.${AlmKeys.GitHub}`,
fields: [],
options: [],
- subCategory: ''
+ subCategory: '',
},
{
name: 'Gitlab integration',
@@ -373,6 +375,6 @@ export const ADDITIONAL_SETTING_DEFINITIONS: ExtendedSettingDefinition[] = [
key: `sonar.almintegration.${AlmKeys.GitLab}`,
fields: [],
options: [],
- subCategory: ''
- }
+ subCategory: '',
+ },
];
diff --git a/server/sonar-web/src/main/js/apps/system/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/system/__tests__/utils-test.ts
index 5c5107d63b3..7b16f49011d 100644
--- a/server/sonar-web/src/main/js/apps/system/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/system/__tests__/utils-test.ts
@@ -39,7 +39,7 @@ describe('groupSections', () => {
it('should correctly group the root field into a main section', () => {
expect(u.groupSections({ foo: 'Foo', bar: 3, baz: { a: 'a' } })).toEqual({
mainSection: { foo: 'Foo', bar: 3 },
- sections: { baz: { a: 'a' } }
+ sections: { baz: { a: 'a' } },
});
});
});
@@ -57,14 +57,14 @@ describe('getSystemLogsLevel', () => {
expect(
u.getSystemLogsLevel(
mockClusterSysInfo({
- 'Application Nodes': [{ Name: 'App 1' }, { Name: 'App 2' }]
+ 'Application Nodes': [{ Name: 'App 1' }, { Name: 'App 2' }],
})
)
).toBe('INFO');
expect(
u.getSystemLogsLevel(
mockClusterSysInfo({
- 'Application Nodes': [{ 'Compute Engine Logging': {} }, { Name: 'App 2' }]
+ 'Application Nodes': [{ 'Compute Engine Logging': {} }, { Name: 'App 2' }],
})
)
).toBe('INFO');
@@ -113,7 +113,7 @@ describe('getStandaloneMainSections', () => {
'High Availability',
'Health',
'Health Causes',
- 'Database'
+ 'Database',
])
);
});
@@ -131,7 +131,7 @@ describe('getClusterMainCardSection', () => {
'Database',
'Compute Engine Tasks',
'Search State',
- 'Search Indexes'
+ 'Search Indexes',
])
);
});
@@ -142,7 +142,7 @@ describe('getSearchNodes', () => {
expect(
u.getSearchNodes(
mockClusterSysInfo({
- 'Search Nodes': [{ Name: 'searchnode1' }]
+ 'Search Nodes': [{ Name: 'searchnode1' }],
})
)
).toEqual([{ Name: 'searchnode1' }]);
@@ -154,7 +154,7 @@ describe('getAppNodes', () => {
expect(
u.getAppNodes(
mockClusterSysInfo({
- 'Application Nodes': [{ Name: 'appnode1' }]
+ 'Application Nodes': [{ Name: 'appnode1' }],
})
)
).toEqual([{ Name: 'appnode1' }]);
@@ -190,7 +190,7 @@ describe('getLogsLevel', () => {
expect(
u.getLogsLevel({
'Web Logging': { 'Logs Level': 'DEBUG' },
- 'Compute Engine Logging': { 'Logs Level': 'TRACE' }
+ 'Compute Engine Logging': { 'Logs Level': 'TRACE' },
})
).toEqual('TRACE');
});
@@ -227,7 +227,7 @@ describe('getClusterVersion', () => {
expect(
u.getClusterVersion(
mockClusterSysInfo({
- 'Application Nodes': [{ System: { Version: '1.0' } }]
+ 'Application Nodes': [{ System: { Version: '1.0' } }],
})
)
).toEqual('1.0');
@@ -241,7 +241,7 @@ describe('getClusterVersion', () => {
u.getClusterVersion(
mockClusterSysInfo({
'Application Nodes': [],
- System: { Version: '1.0' }
+ System: { Version: '1.0' },
})
)
).toBeUndefined();
diff --git a/server/sonar-web/src/main/js/apps/system/components/App.tsx b/server/sonar-web/src/main/js/apps/system/components/App.tsx
index 8ba55c260de..180f6815b34 100644
--- a/server/sonar-web/src/main/js/apps/system/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/App.tsx
@@ -34,7 +34,7 @@ import {
isCluster,
parseQuery,
Query,
- serializeQuery
+ serializeQuery,
} from '../utils';
import ClusterSysInfos from './ClusterSysInfos';
import PageHeader from './PageHeader';
@@ -66,7 +66,7 @@ export class App extends React.PureComponent<Props, State> {
fetchSysInfo = () => {
this.setState({ loading: true });
getSystemInfo().then(
- sysInfoData => {
+ (sysInfoData) => {
if (this.mounted) {
this.setState({ loading: false, sysInfoData });
}
@@ -83,7 +83,7 @@ export class App extends React.PureComponent<Props, State> {
const query = parseQuery(this.props.location.query);
let expandedCards;
if (query.expandedCards.includes(toggledCard)) {
- expandedCards = query.expandedCards.filter(card => card !== toggledCard);
+ expandedCards = query.expandedCards.filter((card) => card !== toggledCard);
} else {
expandedCards = query.expandedCards.concat(toggledCard);
}
diff --git a/server/sonar-web/src/main/js/apps/system/components/ChangeLogLevelForm.tsx b/server/sonar-web/src/main/js/apps/system/components/ChangeLogLevelForm.tsx
index 0e2a643b97e..eef612670e4 100644
--- a/server/sonar-web/src/main/js/apps/system/components/ChangeLogLevelForm.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/ChangeLogLevelForm.tsx
@@ -68,7 +68,7 @@ export default class ChangeLogLevelForm extends React.PureComponent<Props, State
<h2>{header}</h2>
</div>
<div className="modal-body">
- {LOGS_LEVELS.map(level => (
+ {LOGS_LEVELS.map((level) => (
<p className="spacer-bottom" key={level}>
<input
checked={level === newLevel}
diff --git a/server/sonar-web/src/main/js/apps/system/components/ClusterSysInfos.tsx b/server/sonar-web/src/main/js/apps/system/components/ClusterSysInfos.tsx
index 3379b33d425..8f5dfa45ee8 100644
--- a/server/sonar-web/src/main/js/apps/system/components/ClusterSysInfos.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/ClusterSysInfos.tsx
@@ -28,7 +28,7 @@ import {
getHealthCauses,
getNodeName,
getSearchNodes,
- ignoreInfoFields
+ ignoreInfoFields,
} from '../utils';
import HealthCard from './info-items/HealthCard';
diff --git a/server/sonar-web/src/main/js/apps/system/components/PageActions.tsx b/server/sonar-web/src/main/js/apps/system/components/PageActions.tsx
index ffcd1ed9712..9c7fa5561e0 100644
--- a/server/sonar-web/src/main/js/apps/system/components/PageActions.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/PageActions.tsx
@@ -42,7 +42,7 @@ export default class PageActions extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
- openLogsLevelForm: false
+ openLogsLevelForm: false,
};
}
@@ -91,7 +91,8 @@ export default class PageActions extends React.PureComponent<Props, State> {
href={logsUrl + '?process=app'}
id="logs-link"
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
Main Process
</a>
</li>
@@ -101,7 +102,8 @@ export default class PageActions extends React.PureComponent<Props, State> {
href={logsUrl + '?process=ce'}
id="ce-logs-link"
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
Compute Engine
</a>
</li>
@@ -111,7 +113,8 @@ export default class PageActions extends React.PureComponent<Props, State> {
href={logsUrl + '?process=es'}
id="es-logs-link"
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
Search Engine
</a>
</li>
@@ -121,7 +124,8 @@ export default class PageActions extends React.PureComponent<Props, State> {
href={logsUrl + '?process=web'}
id="web-logs-link"
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
Web Server
</a>
</li>
@@ -131,12 +135,14 @@ export default class PageActions extends React.PureComponent<Props, State> {
href={logsUrl + '?process=access'}
id="access-logs-link"
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
Access Logs
</a>
</li>
</ul>
- }>
+ }
+ >
<Button>
{translate('system.download_logs')}
<DropdownIcon className="little-spacer-left" />
@@ -150,7 +156,8 @@ export default class PageActions extends React.PureComponent<Props, State> {
id="download-link"
onClick={this.removeElementFocus}
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate('system.download_system_info')}
</a>
{this.state.openLogsLevelForm && (
diff --git a/server/sonar-web/src/main/js/apps/system/components/PageHeader.tsx b/server/sonar-web/src/main/js/apps/system/components/PageHeader.tsx
index 44ec350200c..9802b79389d 100644
--- a/server/sonar-web/src/main/js/apps/system/components/PageHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/PageHeader.tsx
@@ -90,7 +90,8 @@ export function PageHeader(props: Props) {
Server ID: ${serverId}
Version: ${version}
Date: ${toShortNotSoISOString(Date.now())}
-`}>
+`}
+ >
{translate('system.copy_id_info')}
</ClipboardButton>
</div>
diff --git a/server/sonar-web/src/main/js/apps/system/components/StandaloneSysInfos.tsx b/server/sonar-web/src/main/js/apps/system/components/StandaloneSysInfos.tsx
index eca398afa90..9e55e8e9db0 100644
--- a/server/sonar-web/src/main/js/apps/system/components/StandaloneSysInfos.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/StandaloneSysInfos.tsx
@@ -25,7 +25,7 @@ import {
getHealthCauses,
getStandaloneMainSections,
getStandaloneSecondarySections,
- ignoreInfoFields
+ ignoreInfoFields,
} from '../utils';
import HealthCard from './info-items/HealthCard';
diff --git a/server/sonar-web/src/main/js/apps/system/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/system/components/__tests__/App-test.tsx
index e2425dc52c7..86c54436265 100644
--- a/server/sonar-web/src/main/js/apps/system/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/__tests__/App-test.tsx
@@ -24,13 +24,13 @@ import {
mockClusterSysInfo,
mockLocation,
mockRouter,
- mockStandaloneSysInfo
+ mockStandaloneSysInfo,
} from '../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../helpers/testUtils';
import { App } from '../App';
jest.mock('../../../../api/system', () => ({
- getSystemInfo: jest.fn().mockResolvedValue(null)
+ getSystemInfo: jest.fn().mockResolvedValue(null),
}));
beforeEach(jest.clearAllMocks);
@@ -64,7 +64,7 @@ it('should toggle cards and update the URL', () => {
wrapper.instance().toggleSysInfoCards('foo');
expect(replace).toHaveBeenCalledWith(
expect.objectContaining({
- query: { expand: 'foo' }
+ query: { expand: 'foo' },
})
);
@@ -74,7 +74,7 @@ it('should toggle cards and update the URL', () => {
wrapper.instance().toggleSysInfoCards('foo');
expect(replace).toHaveBeenCalledWith(
expect.objectContaining({
- query: { expand: 'bar' }
+ query: { expand: 'bar' },
})
);
});
diff --git a/server/sonar-web/src/main/js/apps/system/components/__tests__/ClusterSysInfos-test.tsx b/server/sonar-web/src/main/js/apps/system/components/__tests__/ClusterSysInfos-test.tsx
index ce4a5b33599..e51b9079619 100644
--- a/server/sonar-web/src/main/js/apps/system/components/__tests__/ClusterSysInfos-test.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/__tests__/ClusterSysInfos-test.tsx
@@ -35,24 +35,24 @@ it('should render correctly', () => {
Health: 'GREEN',
'Health Causes': [],
'Compute Engine Logging': { 'Logs Level': 'INFO' },
- 'Web Logging': { 'Logs Level': 'INFO' }
+ 'Web Logging': { 'Logs Level': 'INFO' },
},
{
Name: 'Bar',
Health: 'RED',
'Health Causes': [],
'Compute Engine Logging': { 'Logs Level': 'INFO' },
- 'Web Logging': { 'Logs Level': 'DEBUG' }
+ 'Web Logging': { 'Logs Level': 'DEBUG' },
},
{
Name: 'Baz',
Health: 'YELLOW',
'Health Causes': [],
'Compute Engine Logging': { 'Logs Level': 'TRACE' },
- 'Web Logging': { 'Logs Level': 'DEBUG' }
- }
- ]
- }
+ 'Web Logging': { 'Logs Level': 'DEBUG' },
+ },
+ ],
+ },
})
).find('HealthCard')
).toHaveLength(4);
@@ -75,8 +75,8 @@ function shallowRender(props = {}) {
Health: 'GREEN',
'Health Causes': [],
'Compute Engine Logging': { 'Logs Level': 'INFO' },
- 'Web Logging': { 'Logs Level': 'INFO' }
- }
+ 'Web Logging': { 'Logs Level': 'INFO' },
+ },
],
ALMs: [{}],
Bundled: [{}],
@@ -87,9 +87,9 @@ function shallowRender(props = {}) {
Health: 'YELLOW',
'Health Causes': [],
'Compute Engine Logging': { 'Logs Level': 'INFO' },
- 'Web Logging': { 'Logs Level': 'INFO' }
- }
- ]
+ 'Web Logging': { 'Logs Level': 'INFO' },
+ },
+ ],
})}
toggleCard={() => {}}
{...props}
diff --git a/server/sonar-web/src/main/js/apps/system/components/__tests__/PageActions-test.tsx b/server/sonar-web/src/main/js/apps/system/components/__tests__/PageActions-test.tsx
index 47ba22c92e0..7c338f7b88f 100644
--- a/server/sonar-web/src/main/js/apps/system/components/__tests__/PageActions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/__tests__/PageActions-test.tsx
@@ -23,7 +23,7 @@ import { click } from '../../../../helpers/testUtils';
import PageActions from '../PageActions';
jest.mock('../../utils', () => ({
- getFileNameSuffix: (suffix?: string) => `filesuffix(${suffix || ''})`
+ getFileNameSuffix: (suffix?: string) => `filesuffix(${suffix || ''})`,
}));
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/system/components/__tests__/PageHeader-test.tsx b/server/sonar-web/src/main/js/apps/system/components/__tests__/PageHeader-test.tsx
index e8725a325af..bdcc2ed5140 100644
--- a/server/sonar-web/src/main/js/apps/system/components/__tests__/PageHeader-test.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/__tests__/PageHeader-test.tsx
@@ -23,7 +23,7 @@ import { mockAppState } from '../../../../helpers/testMocks';
import { PageHeader, Props } from '../PageHeader';
jest.mock('../../../../helpers/dates', () => ({
- toShortNotSoISOString: () => '2019-01-01'
+ toShortNotSoISOString: () => '2019-01-01',
}));
it('should render correctly', () => {
@@ -32,7 +32,7 @@ it('should render correctly', () => {
shallowRender({
appState: mockAppState({ productionDatabase: false }),
serverId: 'foo-bar',
- version: '7.7.0.1234'
+ version: '7.7.0.1234',
})
).toMatchSnapshot('on embedded database');
expect(shallowRender({ loading: true, showActions: false })).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCard.tsx b/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCard.tsx
index db4ffc207b2..d454a1daa11 100644
--- a/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCard.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCard.tsx
@@ -44,7 +44,7 @@ export default function HealthCard({
onClick,
open,
name,
- sysInfoData
+ sysInfoData,
}: Props) {
const { mainSection, sections } = groupSections(sysInfoData);
const showFields = open && mainSection && Object.keys(mainSection).length > 0;
@@ -62,7 +62,8 @@ export default function HealthCard({
<Alert
className="boxed-group-accordion-alert spacer-left"
display="inline"
- variant="warning">
+ variant="warning"
+ >
{translate('system.log_level.warning.short')}
</Alert>
)}
@@ -76,7 +77,8 @@ export default function HealthCard({
)}
</>
)}
- title={name}>
+ title={name}
+ >
{showFields && <Section items={mainSection} />}
{showSections &&
map(sections, (section, name) => <Section items={section} key={name} name={name} />)}
diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCauseItem.tsx b/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCauseItem.tsx
index 64f0ffefe42..551b557e252 100644
--- a/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCauseItem.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCauseItem.tsx
@@ -33,7 +33,8 @@ export default function HealthCauseItem({ className, health, healthCause }: Prop
<Alert
className={classNames('boxed-group-accordion-alert', className)}
display="inline"
- variant={health === 'RED' ? 'error' : 'warning'}>
+ variant={health === 'RED' ? 'error' : 'warning'}
+ >
{healthCause}
</Alert>
);
diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/HealthCard-test.tsx b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/HealthCard-test.tsx
index db99e1e7733..ba802478928 100644
--- a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/HealthCard-test.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/HealthCard-test.tsx
@@ -30,7 +30,7 @@ it('should show a main section and multiple sub sections', () => {
Name: 'foo',
bar: 'Bar',
Database: { db: 'test' },
- Elasticseach: { Elastic: 'search' }
+ Elasticseach: { Elastic: 'search' },
};
expect(getWrapper({ open: true, sysInfoData })).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/SysInfoItem-test.tsx b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/SysInfoItem-test.tsx
index 25e59266b56..202945daa0e 100644
--- a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/SysInfoItem-test.tsx
+++ b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/SysInfoItem-test.tsx
@@ -30,11 +30,7 @@ it('should render correctly', () => {
});
it('should render health item', () => {
- expect(
- shallowRender('GREEN', 'Health')
- .find(HealthItem)
- .prop('health')
- ).toBe('GREEN');
+ expect(shallowRender('GREEN', 'Health').find(HealthItem).prop('health')).toBe('GREEN');
});
function shallowRender(value: Props['value'], name: Props['name'] = 'foo') {
diff --git a/server/sonar-web/src/main/js/apps/system/utils.ts b/server/sonar-web/src/main/js/apps/system/utils.ts
index 6a81d914c04..73d03d57de8 100644
--- a/server/sonar-web/src/main/js/apps/system/utils.ts
+++ b/server/sonar-web/src/main/js/apps/system/utils.ts
@@ -29,7 +29,7 @@ import {
SysInfoSearchNode,
SysInfoSection,
SysInfoStandalone,
- SysInfoValueObject
+ SysInfoValueObject,
} from '../../types/types';
export interface Query {
@@ -72,7 +72,7 @@ export function ignoreInfoFields(sysInfoObject: SysInfoValueObject) {
PLUGINS_FIELD,
SETTINGS_FIELD,
SERVER_ID_FIELD,
- VERSION_FIELD
+ VERSION_FIELD,
]);
}
@@ -92,9 +92,9 @@ export function getLogsLevel(sysInfoObject?: SysInfoValueObject): string {
return sortBy(
[
getLogsLevel(sysInfoObject[WEB_LOGGING_FIELD]),
- getLogsLevel(sysInfoObject[CE_LOGGING_FIELD])
+ getLogsLevel(sysInfoObject[CE_LOGGING_FIELD]),
],
- logLevel => LOGS_LEVELS.indexOf(logLevel)
+ (logLevel) => LOGS_LEVELS.indexOf(logLevel)
)[1];
}
}
@@ -140,7 +140,7 @@ export function getClusterVersion(sysInfoData: SysInfoCluster): string | undefin
export function getSystemLogsLevel(sysInfoData: SysInfoCluster | SysInfoStandalone): string {
if (isCluster(sysInfoData)) {
- const logLevels = sortBy(getAppNodes(sysInfoData).map(getLogsLevel), logLevel =>
+ const logLevels = sortBy(getAppNodes(sysInfoData).map(getLogsLevel), (logLevel) =>
LOGS_LEVELS.indexOf(logLevel)
);
return logLevels.length > 0 ? logLevels[logLevels.length - 1] : DEFAULT_LOG_LEVEL;
@@ -171,8 +171,8 @@ export function getClusterMainCardSection(sysInfoData: SysInfoCluster): SysInfoV
SEARCH_NODES_FIELD,
SETTINGS_FIELD,
STATS_FIELD,
- SYSTEM_FIELD
- ])
+ SYSTEM_FIELD,
+ ]),
};
}
@@ -187,7 +187,7 @@ export function getStandaloneMainSections(sysInfoData: SysInfoBase): SysInfoValu
key.startsWith(CE_FIELD_PREFIX) ||
key.startsWith(SEARCH_PREFIX) ||
key.startsWith(WEB_PREFIX)
- ) as SysInfoValueObject)
+ ) as SysInfoValueObject),
};
}
@@ -199,7 +199,7 @@ export function getStandaloneSecondarySections(sysInfoData: SysInfoBase): SysInf
) as SysInfoValueObject,
'Search Engine': pickBy(sysInfoData, (_, key) =>
key.startsWith(SEARCH_PREFIX)
- ) as SysInfoValueObject
+ ) as SysInfoValueObject,
};
}
@@ -227,13 +227,13 @@ export function groupSections(sysInfoData: SysInfoValueObject) {
export const parseQuery = memoize(
(urlQuery: RawQuery): Query => ({
- expandedCards: parseAsArray(urlQuery.expand, parseAsString)
+ expandedCards: parseAsArray(urlQuery.expand, parseAsString),
})
);
export const serializeQuery = memoize(
(query: Query): RawQuery =>
cleanQuery({
- expand: serializeStringArray(query.expandedCards)
+ expand: serializeStringArray(query.expandedCards),
})
);
diff --git a/server/sonar-web/src/main/js/apps/users/UsersApp.tsx b/server/sonar-web/src/main/js/apps/users/UsersApp.tsx
index 136a91a1394..d09374d4dd8 100644
--- a/server/sonar-web/src/main/js/apps/users/UsersApp.tsx
+++ b/server/sonar-web/src/main/js/apps/users/UsersApp.tsx
@@ -94,10 +94,10 @@ export class UsersApp extends React.PureComponent<Props, State> {
this.setState({ loading: true });
searchUsers({
p: paging.pageIndex + 1,
- q: parseQuery(this.props.location.query).search
+ q: parseQuery(this.props.location.query).search,
}).then(({ paging, users }) => {
if (this.mounted) {
- this.setState(state => ({ loading: false, users: [...state.users, ...users], paging }));
+ this.setState((state) => ({ loading: false, users: [...state.users, ...users], paging }));
}
}, this.finishLoading);
}
@@ -109,8 +109,8 @@ export class UsersApp extends React.PureComponent<Props, State> {
};
updateTokensCount = (login: string, tokensCount: number) => {
- this.setState(state => ({
- users: state.users.map(user => (user.login === login ? { ...user, tokensCount } : user))
+ this.setState((state) => ({
+ users: state.users.map((user) => (user.login === login ? { ...user, tokensCount } : user)),
}));
};
diff --git a/server/sonar-web/src/main/js/apps/users/UsersList.tsx b/server/sonar-web/src/main/js/apps/users/UsersList.tsx
index d4761fc7c60..b5e2502eb2d 100644
--- a/server/sonar-web/src/main/js/apps/users/UsersList.tsx
+++ b/server/sonar-web/src/main/js/apps/users/UsersList.tsx
@@ -36,7 +36,7 @@ export default function UsersList({
identityProviders,
onUpdateUsers,
updateTokensCount,
- users
+ users,
}: Props) {
return (
<div className="boxed-group boxed-group-inner">
@@ -53,10 +53,10 @@ export default function UsersList({
</tr>
</thead>
<tbody>
- {users.map(user => (
+ {users.map((user) => (
<UserListItem
identityProvider={identityProviders.find(
- provider => user.externalProvider === provider.key
+ (provider) => user.externalProvider === provider.key
)}
isCurrentUser={currentUser.isLoggedIn && currentUser.login === user.login}
key={user.login}
diff --git a/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-test.tsx b/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-test.tsx
index d309c8b36cd..e2ca30b7612 100644
--- a/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/__tests__/UsersApp-test.tsx
@@ -32,9 +32,9 @@ jest.mock('../../../api/users', () => ({
backgroundColor: 'blue',
iconPath: 'icon/path',
key: 'foo',
- name: 'Foo Provider'
- }
- ]
+ name: 'Foo Provider',
+ },
+ ],
})
),
searchUsers: jest.fn(() =>
@@ -42,7 +42,7 @@ jest.mock('../../../api/users', () => ({
paging: {
pageIndex: 1,
pageSize: 1,
- total: 2
+ total: 2,
},
users: [
{
@@ -50,11 +50,11 @@ jest.mock('../../../api/users', () => ({
name: 'Luke',
active: true,
scmAccounts: [],
- local: false
- }
- ]
+ local: false,
+ },
+ ],
})
- )
+ ),
}));
const getIdentityProviders = require('../../../api/users').getIdentityProviders as jest.Mock<any>;
diff --git a/server/sonar-web/src/main/js/apps/users/__tests__/UsersList-test.tsx b/server/sonar-web/src/main/js/apps/users/__tests__/UsersList-test.tsx
index 1bbe7748170..cd2fbb24c4f 100644
--- a/server/sonar-web/src/main/js/apps/users/__tests__/UsersList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/__tests__/UsersList-test.tsx
@@ -27,15 +27,15 @@ const users = [
name: 'Luke',
active: true,
scmAccounts: [],
- local: false
+ local: false,
},
{
login: 'obi',
name: 'One',
active: true,
scmAccounts: [],
- local: false
- }
+ local: false,
+ },
];
it('should render correctly', () => {
@@ -51,8 +51,8 @@ function getWrapper(props = {}) {
backgroundColor: 'blue',
iconPath: 'icon/path',
key: 'foo',
- name: 'Foo Provider'
- }
+ name: 'Foo Provider',
+ },
]}
onUpdateUsers={jest.fn()}
updateTokensCount={jest.fn()}
diff --git a/server/sonar-web/src/main/js/apps/users/components/DeactivateForm.tsx b/server/sonar-web/src/main/js/apps/users/components/DeactivateForm.tsx
index bffd08731c0..8e787a76a46 100644
--- a/server/sonar-web/src/main/js/apps/users/components/DeactivateForm.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/DeactivateForm.tsx
@@ -88,7 +88,8 @@ export default class DeactivateForm extends React.PureComponent<Props, State> {
id="delete-user"
className="big-spacer-top"
checked={anonymize}
- onCheck={this.handleAnonymize}>
+ onCheck={this.handleAnonymize}
+ >
<label className="little-spacer-left" htmlFor="delete-user">
{translate('users.delete_user')}
</label>
@@ -103,7 +104,7 @@ export default class DeactivateForm extends React.PureComponent<Props, State> {
<DocLink to="/instance-administration/authentication/overview/">
{translate('users.delete_user.help.link')}
</DocLink>
- )
+ ),
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/apps/users/components/GroupsForm.tsx b/server/sonar-web/src/main/js/apps/users/components/GroupsForm.tsx
index 0a112561f3a..8e3a91aacd4 100644
--- a/server/sonar-web/src/main/js/apps/users/components/GroupsForm.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/GroupsForm.tsx
@@ -24,7 +24,7 @@ import { addUserToGroup, removeUserFromGroup } from '../../../api/user_groups';
import Modal from '../../../components/controls/Modal';
import SelectList, {
SelectListFilter,
- SelectListSearchParams
+ SelectListSearchParams,
} from '../../../components/controls/SelectList';
import { translate } from '../../../helpers/l10n';
import { User } from '../../../types/users';
@@ -52,7 +52,7 @@ export default class GroupsForm extends React.PureComponent<Props, State> {
this.state = {
needToReload: false,
groups: [],
- selectedGroups: []
+ selectedGroups: [],
};
}
@@ -70,14 +70,14 @@ export default class GroupsForm extends React.PureComponent<Props, State> {
p: searchParams.page,
ps: searchParams.pageSize,
q: searchParams.query !== '' ? searchParams.query : undefined,
- selected: searchParams.filter
- }).then(data => {
+ selected: searchParams.filter,
+ }).then((data) => {
if (this.mounted) {
- this.setState(prevState => {
+ this.setState((prevState) => {
const more = searchParams.page != null && searchParams.page > 1;
const groups = more ? [...prevState.groups, ...data.groups] : data.groups;
- const newSeletedGroups = data.groups.filter(gp => gp.selected).map(gp => gp.name);
+ const newSeletedGroups = data.groups.filter((gp) => gp.selected).map((gp) => gp.name);
const selectedGroups = more
? [...prevState.selectedGroups, ...newSeletedGroups]
: newSeletedGroups;
@@ -87,7 +87,7 @@ export default class GroupsForm extends React.PureComponent<Props, State> {
needToReload: false,
groups,
groupsTotalCount: data.paging.total,
- selectedGroups
+ selectedGroups,
};
});
}
@@ -96,12 +96,12 @@ export default class GroupsForm extends React.PureComponent<Props, State> {
handleSelect = (name: string) =>
addUserToGroup({
name,
- login: this.props.user.login
+ login: this.props.user.login,
}).then(() => {
if (this.mounted) {
this.setState((state: State) => ({
needToReload: true,
- selectedGroups: [...state.selectedGroups, name]
+ selectedGroups: [...state.selectedGroups, name],
}));
}
});
@@ -109,12 +109,12 @@ export default class GroupsForm extends React.PureComponent<Props, State> {
handleUnselect = (name: string) =>
removeUserFromGroup({
name,
- login: this.props.user.login
+ login: this.props.user.login,
}).then(() => {
if (this.mounted) {
this.setState((state: State) => ({
needToReload: true,
- selectedGroups: without(state.selectedGroups, name)
+ selectedGroups: without(state.selectedGroups, name),
}));
}
});
@@ -157,7 +157,7 @@ export default class GroupsForm extends React.PureComponent<Props, State> {
<div className="modal-body modal-container">
<SelectList
- elements={this.state.groups.map(group => group.name)}
+ elements={this.state.groups.map((group) => group.name)}
elementsTotalCount={this.state.groupsTotalCount}
needToReload={
this.state.needToReload &&
diff --git a/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx b/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx
index 6aec452fe45..59f12ae57c6 100644
--- a/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/PasswordForm.tsx
@@ -50,7 +50,7 @@ export default class PasswordForm extends React.PureComponent<Props, State> {
confirmPassword: '',
newPassword: '',
oldPassword: '',
- submitting: false
+ submitting: false,
};
componentDidMount() {
@@ -66,7 +66,7 @@ export default class PasswordForm extends React.PureComponent<Props, State> {
return throwGlobalError(response);
} else {
return parseError(response).then(
- errorMsg => this.setState({ error: errorMsg, submitting: false }),
+ (errorMsg) => this.setState({ error: errorMsg, submitting: false }),
throwGlobalError
);
}
@@ -91,7 +91,7 @@ export default class PasswordForm extends React.PureComponent<Props, State> {
changePassword({
login: this.props.user.login,
password: this.state.newPassword,
- previousPassword: this.state.oldPassword
+ previousPassword: this.state.oldPassword,
}).then(() => {
addGlobalSuccessMessage(translate('my_profile.password.changed'));
this.props.onClose();
diff --git a/server/sonar-web/src/main/js/apps/users/components/TokensForm.tsx b/server/sonar-web/src/main/js/apps/users/components/TokensForm.tsx
index 3aac3fa858f..9f7754b0c9e 100644
--- a/server/sonar-web/src/main/js/apps/users/components/TokensForm.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/TokensForm.tsx
@@ -29,7 +29,7 @@ import { translate } from '../../../helpers/l10n';
import {
computeTokenExpirationDate,
EXPIRATION_OPTIONS,
- getAvailableExpirationOptions
+ getAvailableExpirationOptions,
} from '../../../helpers/tokens';
import { hasGlobalPermission } from '../../../helpers/users';
import { Permissions } from '../../../types/permissions';
@@ -71,7 +71,7 @@ export class TokensForm extends React.PureComponent<Props, State> {
projects: [],
newTokenExpiration: TokenExpiration.OneMonth,
tokenExpirationOptions: EXPIRATION_OPTIONS,
- tokenTypeOptions: []
+ tokenTypeOptions: [],
};
componentDidMount() {
@@ -96,7 +96,7 @@ export class TokensForm extends React.PureComponent<Props, State> {
fetchTokens = () => {
this.setState({ loading: true });
getTokens(this.props.login).then(
- tokens => {
+ (tokens) => {
if (this.mounted) {
this.setState({ loading: false, tokens });
}
@@ -118,11 +118,11 @@ export class TokensForm extends React.PureComponent<Props, State> {
fetchProjects = async () => {
const { projects: projectArray } = await getScannableProjects();
- const projects = projectArray.map(project => ({ label: project.name, value: project.key }));
+ const projects = projectArray.map((project) => ({ label: project.name, value: project.key }));
this.setState({
projects,
- selectedProject: projects.length === 1 ? projects[0] : undefined
+ selectedProject: projects.length === 1 ? projects[0] : undefined,
});
return projects;
@@ -132,25 +132,25 @@ export class TokensForm extends React.PureComponent<Props, State> {
const { currentUser } = this.props;
const tokenTypeOptions = [
- { label: translate('users.tokens', TokenType.User), value: TokenType.User }
+ { label: translate('users.tokens', TokenType.User), value: TokenType.User },
];
if (hasGlobalPermission(currentUser, Permissions.Scan)) {
tokenTypeOptions.unshift({
label: translate('users.tokens', TokenType.Global),
- value: TokenType.Global
+ value: TokenType.Global,
});
}
if (!isEmpty(projects)) {
tokenTypeOptions.unshift({
label: translate('users.tokens', TokenType.Project),
- value: TokenType.Project
+ value: TokenType.Project,
});
}
if (tokenTypeOptions.length === 1) {
this.setState({
newTokenType: tokenTypeOptions[0].value,
- tokenTypeOptions
+ tokenTypeOptions,
});
} else {
this.setState({ tokenTypeOptions });
@@ -171,7 +171,7 @@ export class TokensForm extends React.PureComponent<Props, State> {
newTokenType = TokenType.User,
selectedProject,
tokenTypeOptions,
- newTokenExpiration
+ newTokenExpiration,
} = this.state;
this.setState({ generating: true });
@@ -183,12 +183,12 @@ export class TokensForm extends React.PureComponent<Props, State> {
...(newTokenType === TokenType.Project &&
selectedProject !== undefined && { projectKey: selectedProject.value }),
...(newTokenExpiration !== TokenExpiration.NoExpiration && {
- expirationDate: computeTokenExpirationDate(newTokenExpiration)
- })
+ expirationDate: computeTokenExpirationDate(newTokenExpiration),
+ }),
});
if (this.mounted) {
- this.setState(state => {
+ this.setState((state) => {
const tokens: UserToken[] = [
...state.tokens,
{
@@ -199,9 +199,9 @@ export class TokensForm extends React.PureComponent<Props, State> {
type: newTokenType,
...(newTokenType === TokenType.Project &&
selectedProject !== undefined && {
- project: { key: selectedProject.value, name: selectedProject.label }
- })
- }
+ project: { key: selectedProject.value, name: selectedProject.label },
+ }),
+ },
];
return {
generating: false,
@@ -210,7 +210,7 @@ export class TokensForm extends React.PureComponent<Props, State> {
selectedProject: undefined,
newTokenType: tokenTypeOptions.length === 1 ? tokenTypeOptions[0].value : undefined,
newTokenExpiration: TokenExpiration.OneMonth,
- tokens
+ tokens,
};
}, this.updateTokensCount);
}
@@ -223,8 +223,8 @@ export class TokensForm extends React.PureComponent<Props, State> {
handleRevokeToken = (revokedToken: UserToken) => {
this.setState(
- state => ({
- tokens: state.tokens.filter(token => token.name !== revokedToken.name)
+ (state) => ({
+ tokens: state.tokens.filter((token) => token.name !== revokedToken.name),
}),
this.updateTokensCount
);
@@ -272,7 +272,7 @@ export class TokensForm extends React.PureComponent<Props, State> {
selectedProject,
newTokenExpiration,
tokenExpirationOptions,
- tokenTypeOptions
+ tokenTypeOptions,
} = this.state;
const { displayTokenTypeInput } = this.props;
@@ -308,7 +308,7 @@ export class TokensForm extends React.PureComponent<Props, State> {
placeholder={translate('users.tokens.select_type')}
value={
newTokenType
- ? tokenTypeOptions.find(option => option.value === newTokenType)
+ ? tokenTypeOptions.find((option) => option.value === newTokenType)
: null
}
/>
@@ -340,13 +340,14 @@ export class TokensForm extends React.PureComponent<Props, State> {
isSearchable={false}
onChange={this.handleNewTokenExpirationChange}
options={tokenExpirationOptions}
- value={tokenExpirationOptions.find(option => option.value === newTokenExpiration)}
+ value={tokenExpirationOptions.find((option) => option.value === newTokenExpiration)}
/>
</div>
<SubmitButton
className="it__generate-token"
style={{ marginTop: 'auto' }}
- disabled={this.isSubmitButtonDisabled()}>
+ disabled={this.isSubmitButtonDisabled()}
+ >
{translate('users.generate')}
</SubmitButton>
</form>
@@ -364,7 +365,7 @@ export class TokensForm extends React.PureComponent<Props, State> {
</tr>
);
}
- return tokens.map(token => (
+ return tokens.map((token) => (
<TokensFormItem
deleteConfirmation={this.props.deleteConfirmation}
key={token.name}
diff --git a/server/sonar-web/src/main/js/apps/users/components/TokensFormItem.tsx b/server/sonar-web/src/main/js/apps/users/components/TokensFormItem.tsx
index 2615a0f824c..b489e93f899 100644
--- a/server/sonar-web/src/main/js/apps/users/components/TokensFormItem.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/TokensFormItem.tsx
@@ -122,13 +122,15 @@ export default class TokensFormItem extends React.PureComponent<Props, State> {
/>
}
modalHeader={translate('users.tokens.revoke_token')}
- onConfirm={this.handleRevoke}>
+ onConfirm={this.handleRevoke}
+ >
{({ onClick }) => (
<Button
className="button-red input-small"
disabled={loading}
onClick={onClick}
- title={translate('users.tokens.revoke_token')}>
+ title={translate('users.tokens.revoke_token')}
+ >
{translate('users.tokens.revoke')}
</Button>
)}
@@ -137,7 +139,8 @@ export default class TokensFormItem extends React.PureComponent<Props, State> {
<Button
className="button-red input-small"
disabled={loading}
- onClick={this.handleClick}>
+ onClick={this.handleClick}
+ >
<DeferredSpinner className="little-spacer-right" loading={loading} />
{showConfirmation ? translate('users.tokens.sure') : translate('users.tokens.revoke')}
</Button>
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx b/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx
index 32d01fd35c5..c767c646a57 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import ActionsDropdown, {
ActionsDropdownDivider,
- ActionsDropdownItem
+ ActionsDropdownItem,
} from '../../../components/controls/ActionsDropdown';
import { translate } from '../../../helpers/l10n';
import { isUserActive, User } from '../../../types/users';
@@ -67,7 +67,8 @@ export default class UserActions extends React.PureComponent<Props, State> {
{user.local && (
<ActionsDropdownItem
className="js-user-change-password"
- onClick={this.handleOpenPasswordForm}>
+ onClick={this.handleOpenPasswordForm}
+ >
{translate('my_profile.password.title')}
</ActionsDropdownItem>
)}
@@ -76,7 +77,8 @@ export default class UserActions extends React.PureComponent<Props, State> {
<ActionsDropdownItem
className="js-user-deactivate"
destructive={true}
- onClick={this.handleOpenDeactivateForm}>
+ onClick={this.handleOpenDeactivateForm}
+ >
{translate('users.deactivate')}
</ActionsDropdownItem>
)}
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx b/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx
index 74be9ade5b3..9d615da4d93 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx
@@ -57,7 +57,7 @@ export default class UserForm extends React.PureComponent<Props, State> {
login: user.login,
name: user.name || '',
password: '',
- scmAccounts: user.scmAccounts || []
+ scmAccounts: user.scmAccounts || [],
};
} else {
this.state = {
@@ -65,7 +65,7 @@ export default class UserForm extends React.PureComponent<Props, State> {
login: '',
name: '',
password: '',
- scmAccounts: []
+ scmAccounts: [],
};
}
}
@@ -83,7 +83,7 @@ export default class UserForm extends React.PureComponent<Props, State> {
return throwGlobalError(response);
} else {
return parseError(response).then(
- errorMsg => this.setState({ error: errorMsg }),
+ (errorMsg) => this.setState({ error: errorMsg }),
throwGlobalError
);
}
@@ -107,7 +107,7 @@ export default class UserForm extends React.PureComponent<Props, State> {
login: this.state.login,
name: this.state.name,
password: this.state.password,
- scmAccount: this.state.scmAccounts
+ scmAccount: this.state.scmAccounts,
}).then(() => {
this.props.onUpdateUsers();
this.props.onClose();
@@ -120,7 +120,7 @@ export default class UserForm extends React.PureComponent<Props, State> {
email: user!.local ? this.state.email : undefined,
login: this.state.login,
name: user!.local ? this.state.name : undefined,
- scmAccount: this.state.scmAccounts
+ scmAccount: this.state.scmAccounts,
}).then(() => {
this.props.onUpdateUsers();
this.props.onClose();
@@ -140,7 +140,7 @@ export default class UserForm extends React.PureComponent<Props, State> {
handleRemoveScmAccount = (idx: number) =>
this.setState(({ scmAccounts }) => ({
- scmAccounts: scmAccounts.slice(0, idx).concat(scmAccounts.slice(idx + 1))
+ scmAccounts: scmAccounts.slice(0, idx).concat(scmAccounts.slice(idx + 1)),
}));
render() {
@@ -153,7 +153,8 @@ export default class UserForm extends React.PureComponent<Props, State> {
header={header}
onClose={this.props.onClose}
onSubmit={user ? this.handleUpdateUser : this.handleCreateUser}
- size="small">
+ size="small"
+ >
{({ onCloseClick, onFormSubmit, submitting }) => (
<form autoComplete="off" id="user-form" onSubmit={onFormSubmit}>
<header className="modal-head">
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx b/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx
index cea99845583..67ba8ab8d1d 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx
@@ -45,7 +45,7 @@ export default class UserGroups extends React.PureComponent<Props, State> {
toggleShowMore = (evt: React.SyntheticEvent<HTMLAnchorElement>) => {
evt.preventDefault();
- this.setState(state => ({ showMore: !state.showMore }));
+ this.setState((state) => ({ showMore: !state.showMore }));
};
render() {
@@ -53,14 +53,14 @@ export default class UserGroups extends React.PureComponent<Props, State> {
const limit = groups.length > GROUPS_LIMIT ? GROUPS_LIMIT - 1 : GROUPS_LIMIT;
return (
<ul>
- {groups.slice(0, limit).map(group => (
+ {groups.slice(0, limit).map((group) => (
<li className="little-spacer-bottom" key={group}>
{group}
</li>
))}
{groups.length > GROUPS_LIMIT &&
this.state.showMore &&
- groups.slice(limit).map(group => (
+ groups.slice(limit).map((group) => (
<li className="little-spacer-bottom" key={group}>
{group}
</li>
@@ -74,7 +74,8 @@ export default class UserGroups extends React.PureComponent<Props, State> {
<ButtonIcon
className="js-user-groups button-small"
onClick={this.handleOpenForm}
- tooltip={translate('users.update_groups')}>
+ tooltip={translate('users.update_groups')}
+ >
<BulletListIcon />
</ButtonIcon>
</li>
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx b/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx
index 8dd7b8784f9..8a4a49d30c9 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx
@@ -72,7 +72,8 @@ export default class UserListItem extends React.PureComponent<Props, State> {
<ButtonIcon
className="js-user-tokens spacer-left button-small"
onClick={this.handleOpenTokensForm}
- tooltip={translate('users.update_tokens')}>
+ tooltip={translate('users.update_tokens')}
+ >
<BulletListIcon />
</ButtonIcon>
</td>
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx b/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx
index 6cb47ae2a3a..66f765b8c3d 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx
@@ -61,8 +61,9 @@ export function ExternalProvider({ identityProvider, user }: Props) {
className="identity-provider"
style={{
backgroundColor: identityProvider.backgroundColor,
- color: getTextColor(identityProvider.backgroundColor, colors.secondFontColor)
- }}>
+ color: getTextColor(identityProvider.backgroundColor, colors.secondFontColor),
+ }}
+ >
<img
alt={identityProvider.name}
className="little-spacer-right"
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx b/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx
index 757f948f5d4..90f3305c2ac 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx
@@ -35,7 +35,7 @@ export default class UserScmAccounts extends React.PureComponent<Props, State> {
toggleShowMore = (evt: React.SyntheticEvent<HTMLAnchorElement>) => {
evt.preventDefault();
- this.setState(state => ({ showMore: !state.showMore }));
+ this.setState((state) => ({ showMore: !state.showMore }));
};
render() {
diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/DeactivateForm-test.tsx b/server/sonar-web/src/main/js/apps/users/components/__tests__/DeactivateForm-test.tsx
index dc49f44876a..e968d191acc 100644
--- a/server/sonar-web/src/main/js/apps/users/components/__tests__/DeactivateForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/DeactivateForm-test.tsx
@@ -26,7 +26,7 @@ import { UserActive } from '../../../../types/users';
import DeactivateForm from '../DeactivateForm';
jest.mock('../../../../api/users', () => ({
- deactivateUser: jest.fn().mockResolvedValue({})
+ deactivateUser: jest.fn().mockResolvedValue({}),
}));
it('should deactivate user with anonymize set to true', () => {
diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/GroupsForm-test.tsx b/server/sonar-web/src/main/js/apps/users/components/__tests__/GroupsForm-test.tsx
index 0e50fbdf875..9d754e73795 100644
--- a/server/sonar-web/src/main/js/apps/users/components/__tests__/GroupsForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/GroupsForm-test.tsx
@@ -36,27 +36,27 @@ jest.mock('../../../../api/users', () => ({
id: 1001,
name: 'test1',
description: 'test1',
- selected: true
+ selected: true,
},
{
id: 1002,
name: 'test2',
description: 'test2',
- selected: true
+ selected: true,
},
{
id: 1003,
name: 'test3',
description: 'test3',
- selected: false
- }
- ]
- })
+ selected: false,
+ },
+ ],
+ }),
}));
jest.mock('../../../../api/user_groups', () => ({
addUserToGroup: jest.fn().mockResolvedValue({}),
- removeUserFromGroup: jest.fn().mockResolvedValue({})
+ removeUserFromGroup: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
@@ -65,15 +65,12 @@ beforeEach(() => {
it('should render correctly', async () => {
const wrapper = shallowRender();
- wrapper
- .find(SelectList)
- .props()
- .onSearch({
- query: '',
- filter: SelectListFilter.Selected,
- page: 1,
- pageSize: 100
- });
+ wrapper.find(SelectList).props().onSearch({
+ query: '',
+ filter: SelectListFilter.Selected,
+ page: 1,
+ pageSize: 100,
+ });
await waitAndUpdate(wrapper);
expect(wrapper.instance().mounted).toBe(true);
@@ -87,7 +84,7 @@ it('should render correctly', async () => {
p: 1,
ps: 100,
q: undefined,
- selected: SelectListFilter.Selected
+ selected: SelectListFilter.Selected,
})
);
expect(wrapper.state().needToReload).toBe(false);
@@ -104,7 +101,7 @@ it('should handle selection properly', async () => {
expect(addUserToGroup).toHaveBeenCalledWith(
expect.objectContaining({
login: user.login,
- name: 'toto'
+ name: 'toto',
})
);
expect(wrapper.state().needToReload).toBe(true);
@@ -118,7 +115,7 @@ it('should handle deselection properly', async () => {
expect(removeUserFromGroup).toHaveBeenCalledWith(
expect.objectContaining({
login: user.login,
- name: 'tata'
+ name: 'tata',
})
);
expect(wrapper.state().needToReload).toBe(true);
diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/PasswordForm-test.tsx b/server/sonar-web/src/main/js/apps/users/components/__tests__/PasswordForm-test.tsx
index 6cc0b1e7fc1..7126791b37b 100644
--- a/server/sonar-web/src/main/js/apps/users/components/__tests__/PasswordForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/PasswordForm-test.tsx
@@ -26,7 +26,7 @@ import PasswordForm from '../PasswordForm';
const password = 'new password asdf';
jest.mock('../../../../api/users', () => ({
- changePassword: jest.fn(() => Promise.resolve())
+ changePassword: jest.fn(() => Promise.resolve()),
}));
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/TokensFormItem-test.tsx b/server/sonar-web/src/main/js/apps/users/components/__tests__/TokensFormItem-test.tsx
index 7016a97518d..25e1803aed4 100644
--- a/server/sonar-web/src/main/js/apps/users/components/__tests__/TokensFormItem-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/TokensFormItem-test.tsx
@@ -29,13 +29,13 @@ jest.mock('../../../../components/intl/DateFromNow');
jest.mock('../../../../components/intl/DateTimeFormatter');
jest.mock('../../../../api/user-tokens', () => ({
- revokeToken: jest.fn().mockResolvedValue(undefined)
+ revokeToken: jest.fn().mockResolvedValue(undefined),
}));
const userToken = mockUserToken({
name: 'foo',
createdAt: '2019-01-15T15:06:33+0100',
- lastConnectionDate: '2019-01-18T15:06:33+0100'
+ lastConnectionDate: '2019-01-18T15:06:33+0100',
});
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/UserActions-test.tsx b/server/sonar-web/src/main/js/apps/users/components/__tests__/UserActions-test.tsx
index 20f4bd11bb8..b2b9c8bc269 100644
--- a/server/sonar-web/src/main/js/apps/users/components/__tests__/UserActions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/UserActions-test.tsx
@@ -27,7 +27,7 @@ const user = {
name: 'One',
active: true,
scmAccounts: [],
- local: false
+ local: false,
};
it('should render correctly', () => {
@@ -37,34 +37,19 @@ it('should render correctly', () => {
it('should open the update form', () => {
const wrapper = getWrapper();
click(wrapper.find('.js-user-update'));
- expect(
- wrapper
- .first()
- .find('UserForm')
- .exists()
- ).toBe(true);
+ expect(wrapper.first().find('UserForm').exists()).toBe(true);
});
it('should open the password form', () => {
const wrapper = getWrapper({ user: { ...user, local: true } });
click(wrapper.find('.js-user-change-password'));
- expect(
- wrapper
- .first()
- .find('PasswordForm')
- .exists()
- ).toBe(true);
+ expect(wrapper.first().find('PasswordForm').exists()).toBe(true);
});
it('should open the deactivate form', () => {
const wrapper = getWrapper();
click(wrapper.find('.js-user-deactivate'));
- expect(
- wrapper
- .first()
- .find('DeactivateForm')
- .exists()
- ).toBe(true);
+ expect(wrapper.first().find('DeactivateForm').exists()).toBe(true);
});
function getWrapper(props = {}) {
diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/UserForm-test.tsx b/server/sonar-web/src/main/js/apps/users/components/__tests__/UserForm-test.tsx
index df36a221be6..43a6ccfc2f2 100644
--- a/server/sonar-web/src/main/js/apps/users/components/__tests__/UserForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/UserForm-test.tsx
@@ -27,7 +27,7 @@ import UserForm from '../UserForm';
jest.mock('../../../../api/users', () => ({
createUser: jest.fn().mockResolvedValue({}),
- updateUser: jest.fn().mockResolvedValue({})
+ updateUser: jest.fn().mockResolvedValue({}),
}));
beforeEach(() => {
@@ -49,13 +49,7 @@ it('should correctly show errors', async () => {
submit(wrapper.dive().find('form'));
await waitAndUpdate(wrapper);
- expect(
- wrapper
- .dive()
- .find(Alert)
- .children()
- .text()
- ).toMatch('default_error_message');
+ expect(wrapper.dive().find(Alert).children().text()).toMatch('default_error_message');
});
it('should correctly disable name and email fields for non-local users', () => {
@@ -63,12 +57,7 @@ it('should correctly disable name and email fields for non-local users', () => {
expect(wrapper.find('#create-user-name').prop('disabled')).toBe(true);
expect(wrapper.find('#create-user-email').prop('disabled')).toBe(true);
expect(wrapper.find('Alert').exists()).toBe(true);
- expect(
- wrapper
- .find(Alert)
- .children()
- .text()
- ).toMatch('users.cannot_update_delegated_user');
+ expect(wrapper.find(Alert).children().text()).toMatch('users.cannot_update_delegated_user');
});
it('should correctly create a new user', () => {
@@ -88,7 +77,7 @@ it('should correctly create a new user', () => {
login,
name,
password,
- scmAccount: ['gh', 'gh', 'bitbucket']
+ scmAccount: ['gh', 'gh', 'bitbucket'],
});
});
@@ -105,7 +94,7 @@ it('should correctly update a local user', () => {
email,
login,
name,
- scmAccount: ['gh', 'gh', 'bitbucket']
+ scmAccount: ['gh', 'gh', 'bitbucket'],
});
});
@@ -115,7 +104,7 @@ it('should correctly update a non-local user', () => {
const name = 'Foo';
const scmAccounts = ['gh', 'bitbucket'];
const wrapper = shallowRender({
- user: mockUser({ email, local: false, login, name, scmAccounts })
+ user: mockUser({ email, local: false, login, name, scmAccounts }),
}).dive();
submit(wrapper.find('form'));
@@ -123,7 +112,7 @@ it('should correctly update a non-local user', () => {
expect(updateUser).toHaveBeenCalledWith(
expect.not.objectContaining({
email,
- name
+ name,
})
);
});
diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/UserGroups-test.tsx b/server/sonar-web/src/main/js/apps/users/components/__tests__/UserGroups-test.tsx
index 788f2026585..beb05ea23ad 100644
--- a/server/sonar-web/src/main/js/apps/users/components/__tests__/UserGroups-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/UserGroups-test.tsx
@@ -27,7 +27,7 @@ const user = {
name: 'One',
active: true,
scmAccounts: [],
- local: false
+ local: false,
};
const groups = ['foo', 'bar', 'baz', 'plop'];
diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/UserListItem-test.tsx b/server/sonar-web/src/main/js/apps/users/components/__tests__/UserListItem-test.tsx
index ab949c308f9..ac2abe13496 100644
--- a/server/sonar-web/src/main/js/apps/users/components/__tests__/UserListItem-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/UserListItem-test.tsx
@@ -32,7 +32,7 @@ const user: User = {
local: false,
login: 'obi',
name: 'One',
- scmAccounts: []
+ scmAccounts: [],
};
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/UserListItemIdentity-test.tsx b/server/sonar-web/src/main/js/apps/users/components/__tests__/UserListItemIdentity-test.tsx
index bb3b8d583d6..e32b5b99ac3 100644
--- a/server/sonar-web/src/main/js/apps/users/components/__tests__/UserListItemIdentity-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/UserListItemIdentity-test.tsx
@@ -33,7 +33,7 @@ describe('#UserListItemIdentity', () => {
backgroundColor: 'blue',
iconPath: 'icon/path',
key: 'foo',
- name: 'Foo Provider'
+ name: 'Foo Provider',
}}
user={{
active: true,
@@ -43,7 +43,7 @@ describe('#UserListItemIdentity', () => {
local: false,
login: 'obi',
name: 'One',
- scmAccounts: []
+ scmAccounts: [],
}}
{...props}
/>
@@ -67,7 +67,7 @@ describe('#ExternalProvider', () => {
backgroundColor: 'blue',
iconPath: 'icon/path',
key: 'foo',
- name: 'Foo Provider'
+ name: 'Foo Provider',
}}
user={{
active: true,
@@ -77,7 +77,7 @@ describe('#ExternalProvider', () => {
local: false,
login: 'obi',
name: 'One',
- scmAccounts: []
+ scmAccounts: [],
}}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/apps/users/utils.ts b/server/sonar-web/src/main/js/apps/users/utils.ts
index 4a187200698..6a58fb1826c 100644
--- a/server/sonar-web/src/main/js/apps/users/utils.ts
+++ b/server/sonar-web/src/main/js/apps/users/utils.ts
@@ -27,13 +27,13 @@ export interface Query {
export const parseQuery = memoize(
(urlQuery: RawQuery): Query => ({
- search: parseAsString(urlQuery['search'])
+ search: parseAsString(urlQuery['search']),
})
);
export const serializeQuery = memoize(
(query: Query): RawQuery =>
cleanQuery({
- search: query.search ? serializeString(query.search) : undefined
+ search: query.search ? serializeString(query.search) : undefined,
})
);
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx
index 621a0a624b2..3d27eefb646 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx
@@ -48,33 +48,33 @@ export default class Action extends React.PureComponent<Props, State> {
state: State = {
showChangelog: false,
showParams: false,
- showResponse: false
+ showResponse: false,
};
handleShowParamsClick = (e: React.SyntheticEvent<HTMLElement>) => {
e.preventDefault();
- this.setState(state => ({
+ this.setState((state) => ({
showChangelog: false,
showResponse: false,
- showParams: !state.showParams
+ showParams: !state.showParams,
}));
};
handleShowResponseClick = (e: React.SyntheticEvent<HTMLElement>) => {
e.preventDefault();
- this.setState(state => ({
+ this.setState((state) => ({
showChangelog: false,
showParams: false,
- showResponse: !state.showResponse
+ showResponse: !state.showResponse,
}));
};
handleChangelogClick = (e: React.SyntheticEvent<HTMLElement>) => {
e.preventDefault();
- this.setState(state => ({
+ this.setState((state) => ({
showChangelog: !state.showChangelog,
showParams: false,
- showResponse: false
+ showResponse: false,
}));
};
@@ -90,7 +90,8 @@ export default class Action extends React.PureComponent<Props, State> {
<a
className={classNames({ selected: showParams })}
href="#"
- onClick={this.handleShowParamsClick}>
+ onClick={this.handleShowParamsClick}
+ >
{translate('api_documentation.parameters')}
</a>
</li>
@@ -101,7 +102,8 @@ export default class Action extends React.PureComponent<Props, State> {
<a
className={classNames({ selected: showResponse })}
href="#"
- onClick={this.handleShowResponseClick}>
+ onClick={this.handleShowResponseClick}
+ >
{translate('api_documentation.response_example')}
</a>
</li>
@@ -112,7 +114,8 @@ export default class Action extends React.PureComponent<Props, State> {
<a
className={classNames({ selected: showChangelog })}
href="#"
- onClick={this.handleChangelogClick}>
+ onClick={this.handleChangelogClick}
+ >
{translate('api_documentation.changelog')}
</a>
</li>
@@ -140,10 +143,11 @@ export default class Action extends React.PureComponent<Props, State> {
search: queryToSearch(
serializeQuery({
deprecated: Boolean(action.deprecatedSince),
- internal: Boolean(action.internal)
+ internal: Boolean(action.internal),
})
- )
- }}>
+ ),
+ }}
+ >
<LinkIcon />
</Link>
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx
index ea33843252a..898109ea024 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/Domain.tsx
@@ -30,7 +30,7 @@ interface Props {
}
export default function Domain({ domain, query }: Props) {
- const filteredActions = domain.actions.filter(action => actionsFilter(query, domain, action));
+ const filteredActions = domain.actions.filter((action) => actionsFilter(query, domain, action));
return (
<div className="web-api-domain">
@@ -59,7 +59,7 @@ export default function Domain({ domain, query }: Props) {
)}
<div className="web-api-domain-actions">
- {filteredActions.map(action => (
+ {filteredActions.map((action) => (
<Action
action={action}
domain={domain}
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx
index 997f5b3c05b..6539f039aee 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/Menu.tsx
@@ -35,21 +35,24 @@ interface Props {
export default function Menu(props: Props) {
const { domains, query, splat } = props;
const filteredDomains = (domains || [])
- .map(domain => {
- const filteredActions = domain.actions.filter(action => actionsFilter(query, domain, action));
+ .map((domain) => {
+ const filteredActions = domain.actions.filter((action) =>
+ actionsFilter(query, domain, action)
+ );
return { ...domain, filteredActions };
})
- .filter(domain => domain.filteredActions.length);
+ .filter((domain) => domain.filteredActions.length);
const renderDomain = (domain: WebApi.Domain) => {
- const internal = !domain.actions.find(action => !action.internal);
+ const internal = !domain.actions.find((action) => !action.internal);
return (
<Link
className={classNames('list-group-item', {
- active: isDomainPathActive(domain.path, splat)
+ active: isDomainPathActive(domain.path, splat),
})}
key={domain.path}
- to={{ pathname: '/web_api/' + domain.path, search: queryToSearch(serializeQuery(query)) }}>
+ to={{ pathname: '/web_api/' + domain.path, search: queryToSearch(serializeQuery(query)) }}
+ >
<h3 className="list-group-item-heading">
{domain.path}
{domain.deprecatedSince && <DeprecatedBadge since={domain.deprecatedSince} />}
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx
index b2b63f0ba0f..2e8279f6752 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx
@@ -87,13 +87,13 @@ export default class Params extends React.PureComponent<Props> {
render() {
const { params, showDeprecated, showInternal } = this.props;
const displayedParameters = params
- .filter(p => showDeprecated || !p.deprecatedSince)
- .filter(p => showInternal || !p.internal);
+ .filter((p) => showDeprecated || !p.deprecatedSince)
+ .filter((p) => showInternal || !p.internal);
return (
<div className="web-api-params">
<table>
<tbody>
- {displayedParameters.map(param => (
+ {displayedParameters.map((param) => (
<tr key={param.key}>
{this.renderKey(param)}
@@ -110,7 +110,7 @@ export default class Params extends React.PureComponent<Props> {
<div>
<h4>{translate('api_documentation.possible_values')}</h4>
<ul className="list-styled">
- {param.possibleValues.map(value => (
+ {param.possibleValues.map((value) => (
<li className="little-spacer-top" key={value}>
<code>{value}</code>
</li>
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx b/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx
index e1e888a341e..dcd76cb1a5e 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/ResponseExample.tsx
@@ -52,7 +52,7 @@ export default class ResponseExample extends React.PureComponent<Props, State> {
fetchResponseExample() {
const { domain, action } = this.props;
fetchResponseExampleApi(domain.path, action.key).then(
- responseExample => this.setState({ responseExample }),
+ (responseExample) => this.setState({ responseExample }),
() => {}
);
}
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx
index ce56fd9101d..7bfebc44f2c 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx
@@ -38,7 +38,7 @@ import {
parseQuery,
parseVersion,
Query,
- serializeQuery
+ serializeQuery,
} from '../utils';
import Domain from './Domain';
import Menu from './Menu';
@@ -76,7 +76,7 @@ export class WebApiApp extends React.PureComponent<Props, State> {
fetchList() {
fetchWebApi().then(
- domains => {
+ (domains) => {
if (this.mounted) {
this.setState({ domains: this.parseDomains(domains) });
}
@@ -86,7 +86,7 @@ export class WebApiApp extends React.PureComponent<Props, State> {
}
parseDomains(domains: any[]): WebApi.Domain[] {
- return domains.map(domain => {
+ return domains.map((domain) => {
const deprecated = getLatestDeprecatedAction(domain);
const internal = !domain.actions.find((action: any) => !action.internal);
return { ...domain, deprecatedSince: deprecated && deprecated.deprecatedSince, internal };
@@ -113,9 +113,11 @@ export class WebApiApp extends React.PureComponent<Props, State> {
const { domains } = this.state;
const query = parseQuery(this.props.location.query);
- const domain = domains.find(domain => splat.startsWith(domain.path));
+ const domain = domains.find((domain) => splat.startsWith(domain.path));
if (domain) {
- const action = domain.actions.find(action => getActionKey(domain.path, action.key) === splat);
+ const action = domain.actions.find(
+ (action) => getActionKey(domain.path, action.key) === splat
+ );
const internal = Boolean(!query.internal && (domain.internal || (action && action.internal)));
const deprecated = Boolean(
!query.deprecated && (domain.deprecatedSince || (action && action.deprecatedSince))
@@ -133,14 +135,14 @@ export class WebApiApp extends React.PureComponent<Props, State> {
toggleFlag(flag: 'deprecated' | 'internal', domainFlag: 'deprecatedSince' | 'internal') {
const splat = this.props.params.splat || '';
const { domains } = this.state;
- const domain = domains.find(domain => isDomainPathActive(domain.path, splat));
+ const domain = domains.find((domain) => isDomainPathActive(domain.path, splat));
const query = parseQuery(this.props.location.query);
const value = !query[flag];
if (domain && domain[domainFlag] && !value) {
this.props.router.push({
pathname: '/web_api',
- query: serializeQuery({ ...query, [flag]: false })
+ query: serializeQuery({ ...query, [flag]: false }),
});
} else {
this.updateQuery({ [flag]: value });
@@ -160,7 +162,7 @@ export class WebApiApp extends React.PureComponent<Props, State> {
const query = parseQuery(this.props.location.query);
const { domains } = this.state;
- const domain = domains.find(domain => isDomainPathActive(domain.path, splat));
+ const domain = domains.find((domain) => isDomainPathActive(domain.path, splat));
return (
<div className="layout-page">
@@ -219,7 +221,7 @@ function getLatestDeprecatedAction(domain: Pick<WebApi.Domain, 'actions'>) {
);
const latestDeprecation =
allActionsDeprecated &&
- maxBy(domain.actions, action => {
+ maxBy(domain.actions, (action) => {
const version = (action.deprecatedSince && parseVersion(action.deprecatedSince)) || noVersion;
return version.major * 1024 + version.minor;
});
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Action-test.tsx b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Action-test.tsx
index 5a80864a0fb..c87a71b5a95 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Action-test.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Action-test.tsx
@@ -32,24 +32,24 @@ const ACTION = {
key: 'param',
description: 'Param desc',
internal: true,
- required: true
- }
+ required: true,
+ },
],
- post: false
+ post: false,
};
const DOMAIN = {
actions: [ACTION],
path: 'foo',
description: 'API Foo',
deprecated: false,
- internal: false
+ internal: false,
};
const PROPS = {
action: ACTION,
domain: DOMAIN,
showDeprecated: false,
- showInternal: false
+ showInternal: false,
};
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/ActionChangelog-test.tsx b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/ActionChangelog-test.tsx
index 215ebc78173..8896fd73c08 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/ActionChangelog-test.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/ActionChangelog-test.tsx
@@ -24,7 +24,7 @@ import ActionChangelog from '../ActionChangelog';
it('should render', () => {
const changelog = [
{ version: '5.0', description: 'foo' },
- { version: '5.1', description: 'bar' }
+ { version: '5.1', description: 'bar' },
];
expect(shallow(<ActionChangelog changelog={changelog} />)).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Domain-test.tsx b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Domain-test.tsx
index e608798c003..5efab91ea22 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Domain-test.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Domain-test.tsx
@@ -27,18 +27,18 @@ const ACTION = {
description: 'Foo Desc',
hasResponseExample: false,
internal: false,
- post: false
+ post: false,
};
const DOMAIN = {
actions: [ACTION],
path: 'api',
description: 'API Desc',
deprecated: false,
- internal: false
+ internal: false,
};
const DEFAULT_PROPS = {
domain: DOMAIN,
- query: { search: '', deprecated: false, internal: false }
+ query: { search: '', deprecated: false, internal: false },
};
const SHOW_DEPRECATED = { search: '', deprecated: true, internal: false };
const SHOW_INTERNAL = { search: '', deprecated: false, internal: true };
@@ -86,7 +86,7 @@ it('should also render actions with a description matching the query', () => {
const actions = [
ACTION,
{ ...ACTION, key: 'bar', description: 'Bar desc' },
- { ...ACTION, key: 'baz', description: 'foobar' }
+ { ...ACTION, key: 'baz', description: 'foobar' },
];
const domain = { ...DOMAIN, actions };
expect(
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Menu-test.tsx b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Menu-test.tsx
index 0a4195e7681..81e6e67f359 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Menu-test.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Menu-test.tsx
@@ -28,22 +28,22 @@ const ACTION: WebApi.Action = {
description: 'Foo Desc',
hasResponseExample: false,
internal: false,
- post: false
+ post: false,
};
const DOMAIN1: WebApi.Domain = {
actions: [ACTION],
path: 'foo',
- description: 'API Foo'
+ description: 'API Foo',
};
const DOMAIN2: WebApi.Domain = {
actions: [ACTION],
path: 'bar',
- description: 'API Bar'
+ description: 'API Bar',
};
const PROPS = {
domains: [DOMAIN1, DOMAIN2],
query: { search: '', deprecated: false, internal: false },
- splat: ''
+ splat: '',
};
const SHOW_DEPRECATED = { search: '', deprecated: true, internal: false };
@@ -55,7 +55,7 @@ it('should render deprecated domains', () => {
const domain: WebApi.Domain = {
...DOMAIN2,
deprecatedSince: '5.0',
- actions: [{ ...ACTION, deprecatedSince: '5.0' }]
+ actions: [{ ...ACTION, deprecatedSince: '5.0' }],
};
const domains = [DOMAIN1, domain];
expect(shallow(<Menu {...PROPS} domains={domains} query={SHOW_DEPRECATED} />)).toMatchSnapshot();
@@ -65,7 +65,7 @@ it('should not render deprecated domains', () => {
const domain: WebApi.Domain = {
...DOMAIN2,
deprecatedSince: '5.0',
- actions: [{ ...ACTION, deprecatedSince: '5.0' }]
+ actions: [{ ...ACTION, deprecatedSince: '5.0' }],
};
const domains = [DOMAIN1, domain];
expect(shallow(<Menu {...PROPS} domains={domains} />)).toMatchSnapshot();
@@ -75,7 +75,7 @@ it('should render internal domains', () => {
const domain: WebApi.Domain = {
...DOMAIN2,
internal: true,
- actions: [{ ...ACTION, internal: true }]
+ actions: [{ ...ACTION, internal: true }],
};
const domains = [DOMAIN1, domain];
expect(shallow(<Menu {...PROPS} domains={domains} query={SHOW_INTERNAL} />)).toMatchSnapshot();
@@ -85,7 +85,7 @@ it('should not render internal domains', () => {
const domain: WebApi.Domain = {
...DOMAIN2,
internal: true,
- actions: [{ ...ACTION, internal: true }]
+ actions: [{ ...ACTION, internal: true }],
};
const domains = [DOMAIN1, domain];
expect(shallow(<Menu {...PROPS} domains={domains} />)).toMatchSnapshot();
@@ -94,7 +94,7 @@ it('should not render internal domains', () => {
it('should render only domains with an action matching the query', () => {
const domain: WebApi.Domain = {
...DOMAIN2,
- actions: [{ ...ACTION, key: 'bar', description: 'Bar Desc' }]
+ actions: [{ ...ACTION, key: 'bar', description: 'Bar Desc' }],
};
const domains = [DOMAIN1, domain];
expect(shallow(<Menu {...PROPS} domains={domains} query={SEARCH_FOO} />)).toMatchSnapshot();
@@ -105,7 +105,7 @@ it('should also render domains with an actions description matching the query',
...DOMAIN1,
path: 'baz',
description: 'API Baz',
- actions: [{ ...ACTION, key: 'baz', description: 'barbaz' }]
+ actions: [{ ...ACTION, key: 'baz', description: 'barbaz' }],
};
const domains = [DOMAIN1, DOMAIN2, domain];
expect(shallow(<Menu {...PROPS} domains={domains} query={SEARCH_BAR} />)).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Params-test.tsx b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Params-test.tsx
index 70c17c3cb23..2027ea06e9a 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Params-test.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Params-test.tsx
@@ -26,13 +26,13 @@ const DEFAULT_PARAM: WebApi.Param = {
key: 'foo',
description: 'Foo desc',
internal: false,
- required: false
+ required: false,
};
it('should render deprecated and internal parameters', () => {
const params = [
{ ...DEFAULT_PARAM, deprecatedSince: '5.0' },
- { ...DEFAULT_PARAM, deprecatedSince: '5.0', internal: true }
+ { ...DEFAULT_PARAM, deprecatedSince: '5.0', internal: true },
];
expect(
shallow(<Params params={params} showDeprecated={true} showInternal={true} />)
@@ -49,7 +49,7 @@ it('should not render deprecated parameters', () => {
it('should render deprecated key', () => {
const params = [
{ ...DEFAULT_PARAM, deprecatedKey: 'foo-deprecated', deprecatedKeySince: '5.0' },
- { ...DEFAULT_PARAM, deprecatedSince: '5.0', internal: true }
+ { ...DEFAULT_PARAM, deprecatedSince: '5.0', internal: true },
];
expect(
shallow(<Params params={params} showDeprecated={true} showInternal={false} />)
@@ -66,7 +66,7 @@ it('should render different value constraints', () => {
minimumValue: 1,
maximumValue: 500,
maxValuesAllowed: 1000,
- possibleValues: ['foo', 'bar']
+ possibleValues: ['foo', 'bar'],
};
expect(
shallow(<Params params={[param]} showDeprecated={true} showInternal={true} />)
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/ResponseExample-test.tsx b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/ResponseExample-test.tsx
index 2c8b2badc10..18df3426caf 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/ResponseExample-test.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/ResponseExample-test.tsx
@@ -27,19 +27,19 @@ const ACTION = {
description: 'Foo Desc',
hasResponseExample: false,
internal: false,
- post: false
+ post: false,
};
const DOMAIN = {
actions: [ACTION],
path: 'foo',
description: 'API Foo',
deprecated: false,
- internal: false
+ internal: false,
};
const PROPS = {
action: ACTION,
- domain: DOMAIN
+ domain: DOMAIN,
};
it('should render correctly after fetching an example', () => {
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Search-test.tsx b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Search-test.tsx
index 3a4f178d7fa..7275fe65363 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Search-test.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/Search-test.tsx
@@ -25,7 +25,7 @@ const PROPS = {
query: { search: '', deprecated: false, internal: false },
onSearch: () => {},
onToggleInternal: () => {},
- onToggleDeprecated: () => {}
+ onToggleDeprecated: () => {},
};
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/WebApiApp-test.tsx b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/WebApiApp-test.tsx
index ea897b894ae..67554782e77 100644
--- a/server/sonar-web/src/main/js/apps/web-api/components/__tests__/WebApiApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/web-api/components/__tests__/WebApiApp-test.tsx
@@ -34,14 +34,14 @@ jest.mock('../../../../api/web-api', () => ({
description: 'foo',
internal: true,
path: 'foo/bar',
- since: '1.0'
- }
- ])
+ since: '1.0',
+ },
+ ]),
}));
jest.mock('../../../../helpers/pages', () => ({
addSideBarClass: jest.fn(),
- removeSideBarClass: jest.fn()
+ removeSideBarClass: jest.fn(),
}));
it('should render correctly', async () => {
diff --git a/server/sonar-web/src/main/js/apps/web-api/utils.ts b/server/sonar-web/src/main/js/apps/web-api/utils.ts
index e35a5540ffe..46928af312b 100644
--- a/server/sonar-web/src/main/js/apps/web-api/utils.ts
+++ b/server/sonar-web/src/main/js/apps/web-api/utils.ts
@@ -22,7 +22,7 @@ import {
cleanQuery,
parseAsOptionalBoolean,
parseAsString,
- serializeString
+ serializeString,
} from '../../helpers/query';
import { RawQuery, WebApi } from '../../types/types';
@@ -67,7 +67,7 @@ export const parseQuery = memoize(
(urlQuery: RawQuery): Query => ({
search: parseAsString(urlQuery['query']),
deprecated: parseAsOptionalBoolean(urlQuery['deprecated']) || false,
- internal: parseAsOptionalBoolean(urlQuery['internal']) || false
+ internal: parseAsOptionalBoolean(urlQuery['internal']) || false,
})
);
@@ -76,7 +76,7 @@ export const serializeQuery = memoize(
cleanQuery({
query: query.search ? serializeString(query.search) : undefined,
deprecated: query.deprecated || undefined,
- internal: query.internal || undefined
+ internal: query.internal || undefined,
})
);
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx
index 679e4315950..0821987dc06 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx
@@ -69,7 +69,7 @@ export class App extends React.PureComponent<Props, State> {
getScopeParams = ({ component } = this.props) => {
return {
- project: component && component.key
+ project: component && component.key,
};
};
@@ -78,7 +78,7 @@ export class App extends React.PureComponent<Props, State> {
name: data.name,
url: data.url,
...(data.secret && { secret: data.secret }),
- ...this.getScopeParams()
+ ...this.getScopeParams(),
};
return createWebhook(createData).then(({ webhook }) => {
@@ -92,7 +92,7 @@ export class App extends React.PureComponent<Props, State> {
return deleteWebhook({ webhook }).then(() => {
if (this.mounted) {
this.setState(({ webhooks }) => ({
- webhooks: webhooks.filter(item => item.key !== webhook)
+ webhooks: webhooks.filter((item) => item.key !== webhook),
}));
}
});
@@ -103,17 +103,17 @@ export class App extends React.PureComponent<Props, State> {
webhook: data.webhook,
name: data.name,
url: data.url,
- ...(data.secret && { secret: data.secret })
+ ...(data.secret && { secret: data.secret }),
};
return updateWebhook(udpateData).then(() => {
if (this.mounted) {
this.setState(({ webhooks }) => ({
- webhooks: webhooks.map(webhook =>
+ webhooks: webhooks.map((webhook) =>
webhook.key === data.webhook
? { ...webhook, name: data.name, secret: data.secret, url: data.url }
: webhook
- )
+ ),
}));
}
});
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/CreateWebhookForm.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/CreateWebhookForm.tsx
index 5f0320d3861..4a19e73aad4 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/CreateWebhookForm.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/CreateWebhookForm.tsx
@@ -76,12 +76,13 @@ export default class CreateWebhookForm extends React.PureComponent<Props> {
initialValues={{
name: (webhook && webhook.name) || '',
secret: (webhook && webhook.secret) || '',
- url: (webhook && webhook.url) || ''
+ url: (webhook && webhook.url) || '',
}}
onClose={this.props.onClose}
onSubmit={this.props.onDone}
size="small"
- validate={this.handleValidate}>
+ validate={this.handleValidate}
+ >
{({ dirty, errors, handleBlur, handleChange, isSubmitting, touched, values }) => (
<>
<MandatoryFieldsExplanation className="big-spacer-bottom" />
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx
index 3851b830630..19e91a09a72 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx
@@ -72,7 +72,7 @@ export default class DeliveriesForm extends React.PureComponent<Props, State> {
this.setState((state: State) => ({
deliveries: [...state.deliveries, ...deliveries],
loading: false,
- paging
+ paging,
}));
}
},
@@ -98,7 +98,7 @@ export default class DeliveriesForm extends React.PureComponent<Props, State> {
<h2>{header}</h2>
</header>
<div className="modal-body modal-container">
- {deliveries.map(delivery => (
+ {deliveries.map((delivery) => (
<DeliveryAccordion delivery={delivery} key={delivery.id} />
))}
<div className="text-center">
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryAccordion.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryAccordion.tsx
index 9fa865fe7da..7304d98f811 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryAccordion.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveryAccordion.tsx
@@ -95,7 +95,8 @@ export default class DeliveryAccordion extends React.PureComponent<Props, State>
<AlertErrorIcon aria-label={translate('error')} className="js-error" />
)
}
- title={<DateTimeFormatter date={delivery.at} />}>
+ title={<DateTimeFormatter date={delivery.at} />}
+ >
<DeliveryItem
className="big-spacer-left"
delivery={delivery}
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx
index 19088eb99ea..2b1fd6db2a7 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/PageHeader.tsx
@@ -44,7 +44,7 @@ export default function PageHeader({ children, loading }: Props) {
<DocLink to="/project-administration/webhooks/">
{translate('webhooks.documentation_link')}
</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/WebhookActions.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/WebhookActions.tsx
index 246b31fb0ff..6978a8ea21e 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/WebhookActions.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/WebhookActions.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import ActionsDropdown, {
ActionsDropdownDivider,
- ActionsDropdownItem
+ ActionsDropdownItem,
} from '../../../components/controls/ActionsDropdown';
import { translate } from '../../../helpers/l10n';
import { Webhook } from '../../../types/webhook';
@@ -97,7 +97,8 @@ export default class WebhookActions extends React.PureComponent<Props, State> {
{webhook.latestDelivery && (
<ActionsDropdownItem
className="js-webhook-deliveries"
- onClick={this.handleDeliveriesClick}>
+ onClick={this.handleDeliveriesClick}
+ >
{translate('webhooks.deliveries.show')}
</ActionsDropdownItem>
)}
@@ -105,7 +106,8 @@ export default class WebhookActions extends React.PureComponent<Props, State> {
<ActionsDropdownItem
className="js-webhook-delete"
destructive={true}
- onClick={this.handleDeleteClick}>
+ onClick={this.handleDeleteClick}
+ >
{translate('delete')}
</ActionsDropdownItem>
</ActionsDropdown>
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx
index 4ef486ec09a..84b66f19594 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/WebhooksList.tsx
@@ -51,7 +51,7 @@ export default class WebhooksList extends React.PureComponent<Props> {
<table className="data zebra">
{this.renderHeader()}
<tbody>
- {sortBy(webhooks, webhook => webhook.name.toLowerCase()).map(webhook => (
+ {sortBy(webhooks, (webhook) => webhook.name.toLowerCase()).map((webhook) => (
<WebhookItem
key={webhook.key}
onDelete={this.props.onDelete}
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-test.tsx
index 2c8fb34c2d4..5d09e9b0951 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/App-test.tsx
@@ -23,7 +23,7 @@ import {
createWebhook,
deleteWebhook,
searchWebhooks,
- updateWebhook
+ updateWebhook,
} from '../../../../api/webhooks';
import { mockComponent } from '../../../../helpers/mocks/component';
import { App } from '../App';
@@ -37,11 +37,11 @@ jest.mock('../../../../api/webhooks', () => ({
Promise.resolve({
webhooks: [
{ key: '1', name: 'foo', url: 'http://foo' },
- { key: '2', name: 'bar', url: 'http://bar' }
- ]
+ { key: '2', name: 'bar', url: 'http://bar' },
+ ],
})
),
- updateWebhook: jest.fn(() => Promise.resolve())
+ updateWebhook: jest.fn(() => Promise.resolve()),
}));
const component = mockComponent({ key: 'bar', qualifier: 'TRK' });
@@ -81,7 +81,7 @@ describe('should correctly fetch webhooks when', () => {
await new Promise(setImmediate);
expect(searchWebhooks).toHaveBeenCalledWith({
- project: component.key
+ project: component.key,
});
});
});
@@ -92,7 +92,7 @@ it('should correctly handle webhook creation', async () => {
(wrapper.instance() as App).handleCreate({ ...webhook });
expect(createWebhook).toHaveBeenLastCalledWith({
...webhook,
- project: undefined
+ project: undefined,
});
await new Promise(setImmediate);
@@ -100,7 +100,7 @@ it('should correctly handle webhook creation', async () => {
expect(wrapper.state('webhooks')).toEqual([
{ key: '1', name: 'foo', url: 'http://foo' },
{ key: '2', name: 'bar', url: 'http://bar' },
- { key: '3', name: 'baz', url: 'http://baz' }
+ { key: '3', name: 'baz', url: 'http://baz' },
]);
});
@@ -124,6 +124,6 @@ it('should correctly handle webhook update', async () => {
wrapper.update();
expect(wrapper.state('webhooks')).toEqual([
{ key: '1', name: 'Cfoo', url: 'http://cfoo' },
- { key: '2', name: 'bar', url: 'http://bar' }
+ { key: '2', name: 'bar', url: 'http://bar' },
]);
});
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/DeliveriesForm-test.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/DeliveriesForm-test.tsx
index 46bbe4cbb54..bbd8b6559f4 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/DeliveriesForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/DeliveriesForm-test.tsx
@@ -31,23 +31,23 @@ jest.mock('../../../../api/webhooks', () => ({
durationMs: 20,
httpStatus: 200,
id: '2',
- success: true
+ success: true,
},
{
at: '11.02.2018',
durationMs: 122,
httpStatus: 500,
id: '1',
- success: false
- }
+ success: false,
+ },
],
paging: {
pageIndex: 1,
pageSize: 10,
- total: 15
- }
+ total: 15,
+ },
})
- )
+ ),
}));
const webhook = { key: '1', name: 'foo', url: 'http://foo.bar' };
@@ -63,7 +63,7 @@ it('should render correctly', async () => {
await new Promise(setImmediate);
expect(searchDeliveries as jest.Mock<any>).toHaveBeenLastCalledWith({
webhook: webhook.key,
- ps: 10
+ ps: 10,
});
wrapper.update();
expect(wrapper).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/DeliveryAccordion-test.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/DeliveryAccordion-test.tsx
index d9377f7974c..198f8285f83 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/DeliveryAccordion-test.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/DeliveryAccordion-test.tsx
@@ -28,8 +28,8 @@ import DeliveryAccordion from '../DeliveryAccordion';
jest.mock('../../../../api/webhooks', () => ({
getDelivery: jest.fn().mockResolvedValue({
- delivery: { payload: '{ "message": "This was successful" }' }
- })
+ delivery: { payload: '{ "message": "This was successful" }' },
+ }),
}));
beforeEach(jest.clearAllMocks);
@@ -51,10 +51,10 @@ it('should render correctly for successful payloads', async () => {
it('should render correctly for errored payloads', async () => {
const user = userEvent.setup();
(getDelivery as jest.Mock).mockResolvedValueOnce({
- delivery: { payload: '503 Service Unavailable' }
+ delivery: { payload: '503 Service Unavailable' },
});
renderDeliveryAccordion({
- delivery: mockWebhookDelivery({ httpStatus: undefined, success: false })
+ delivery: mockWebhookDelivery({ httpStatus: undefined, success: false }),
});
expect(screen.getByLabelText('error')).toBeInTheDocument();
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/LatestDeliveryForm-test.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/LatestDeliveryForm-test.tsx
index 8e1a9b5af14..bc3beb00dc5 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/LatestDeliveryForm-test.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/LatestDeliveryForm-test.tsx
@@ -25,9 +25,9 @@ import LatestDeliveryForm from '../LatestDeliveryForm';
jest.mock('../../../../api/webhooks', () => ({
getDelivery: jest.fn(() =>
Promise.resolve({
- delivery: { payload: '{ "success": true }' }
+ delivery: { payload: '{ "success": true }' },
})
- )
+ ),
}));
const delivery = {
@@ -35,7 +35,7 @@ const delivery = {
durationMs: 20,
httpStatus: 200,
id: '2',
- success: true
+ success: true,
};
const webhook = { key: '1', name: 'foo', url: 'http://foo.bar' };
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/PageActions-test.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/PageActions-test.tsx
index 443f48fb5d6..e76fd504191 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/PageActions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/PageActions-test.tsx
@@ -41,7 +41,7 @@ it('should display the create form', () => {
expect(wrapper.find('CreateWebhookForm').exists()).toBe(true);
wrapper.find('CreateWebhookForm').prop<Function>('onDone')({
name: 'foo',
- url: 'http://foo.bar'
+ url: 'http://foo.bar',
});
expect(onCreate).toHaveBeenLastCalledWith({ name: 'foo', url: 'http://foo.bar' });
});
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookActions-test.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookActions-test.tsx
index f82ec5b3b32..a9f28c143d7 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookActions-test.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookActions-test.tsx
@@ -25,7 +25,7 @@ import WebhookActions from '../WebhookActions';
const webhook = {
key: '1',
name: 'foo',
- url: 'http://foo.bar'
+ url: 'http://foo.bar',
};
const delivery = {
@@ -33,7 +33,7 @@ const delivery = {
durationMs: 20,
httpStatus: 200,
id: '2',
- success: true
+ success: true,
};
it('should render correctly', () => {
@@ -47,12 +47,12 @@ it('should display the update webhook form', () => {
expect(wrapper.find('CreateWebhookForm').exists()).toBe(true);
wrapper.find('CreateWebhookForm').prop<Function>('onDone')({
name: webhook.name,
- url: webhook.url
+ url: webhook.url,
});
expect(onUpdate).toHaveBeenLastCalledWith({
webhook: webhook.key,
name: webhook.name,
- url: webhook.url
+ url: webhook.url,
});
});
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookItem-test.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookItem-test.tsx
index cc062836cb3..a8e2e4c9075 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookItem-test.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookItem-test.tsx
@@ -24,7 +24,7 @@ import WebhookItem from '../WebhookItem';
const webhook = {
key: '1',
name: 'my webhook',
- url: 'http://webhook.target'
+ url: 'http://webhook.target',
};
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookItemLatestDelivery-test.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookItemLatestDelivery-test.tsx
index 52308431e09..b412f357ca9 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookItemLatestDelivery-test.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhookItemLatestDelivery-test.tsx
@@ -27,14 +27,14 @@ const latestDelivery = {
durationMs: 20,
httpStatus: 200,
id: '2',
- success: true
+ success: true,
};
const webhook = {
key: '1',
name: 'my webhook',
url: 'http://webhook.target',
- latestDelivery
+ latestDelivery,
};
it('should render correctly a success delivery', () => {
@@ -53,7 +53,7 @@ it('should render correctly a failed delivery', () => {
<WebhookItemLatestDelivery
webhook={{
...webhook,
- latestDelivery: { ...latestDelivery, httpStatus: 500, success: false }
+ latestDelivery: { ...latestDelivery, httpStatus: 500, success: false },
}}
/>
)
diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhooksList-test.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhooksList-test.tsx
index df4be5f5e18..82c07640edd 100644
--- a/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhooksList-test.tsx
+++ b/server/sonar-web/src/main/js/apps/webhooks/components/__tests__/WebhooksList-test.tsx
@@ -23,7 +23,7 @@ import WebhooksList from '../WebhooksList';
const webhooks = [
{ key: '1', name: 'my webhook', url: 'http://webhook.target' },
- { key: '2', name: 'jenkins webhook', url: 'http://jenkins.target' }
+ { key: '2', name: 'jenkins webhook', url: 'http://jenkins.target' },
];
it('should correctly render empty webhook list', () => {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx
index 075ec4d96fd..98a097d94d3 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx
@@ -23,7 +23,7 @@ import {
getComponentData,
getComponentForSourceViewer,
getDuplications,
- getSources
+ getSources,
} from '../../api/components';
import { getBranchLikeQuery, isSameBranchLike } from '../../helpers/branch-like';
import { translate } from '../../helpers/l10n';
@@ -38,7 +38,7 @@ import {
LinearIssueLocation,
Measure,
SourceLine,
- SourceViewerFile
+ SourceViewerFile,
} from '../../types/types';
import { Alert } from '../ui/Alert';
import { WorkspaceContext } from '../workspace/context';
@@ -46,14 +46,14 @@ import DuplicationPopup from './components/DuplicationPopup';
import {
filterDuplicationBlocksByLine,
getDuplicationBlocksForIndex,
- isDuplicationBlockInRemovedComponent
+ isDuplicationBlockInRemovedComponent,
} from './helpers/duplications';
import getCoverageStatus from './helpers/getCoverageStatus';
import {
duplicationsByLine,
issuesByLine,
locationsByLine,
- symbolsByLine
+ symbolsByLine,
} from './helpers/indexing';
import { LINES_TO_LOAD } from './helpers/lines';
import loadIssues from './helpers/loadIssues';
@@ -116,7 +116,7 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
displayAllIssues: false,
displayIssueLocationsCount: true,
displayIssueLocationsLink: true,
- displayLocationMarkers: true
+ displayLocationMarkers: true,
};
constructor(props: Props) {
@@ -136,7 +136,7 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
openIssuesByLine: {},
selectedIssue: props.selectedIssue,
sourceRemoved: false,
- symbolsByLine: {}
+ symbolsByLine: {},
};
}
@@ -168,7 +168,7 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
this.setState(
{
sources: sources.slice(0, LINES_TO_LOAD),
- hasSourcesAfter: sources.length > LINES_TO_LOAD
+ hasSourcesAfter: sources.length > LINES_TO_LOAD,
},
() => {
if (this.props.onLoaded && this.state.component && this.state.issues) {
@@ -187,10 +187,10 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
loadComponent(component: string, branchLike?: BranchLike) {
return Promise.all([
getComponentForSourceViewer({ component, ...getBranchLikeQuery(branchLike) }),
- getComponentData({ component, ...getBranchLikeQuery(branchLike) })
+ getComponentData({ component, ...getBranchLikeQuery(branchLike) }),
]).then(([sourceViewerComponent, { component }]) => ({
...sourceViewerComponent,
- leakPeriodDate: component.leakPeriodDate
+ leakPeriodDate: component.leakPeriodDate,
}));
}
@@ -204,7 +204,7 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
}
computeCoverageStatus(lines: SourceLine[]) {
- return lines.map(line => ({ ...line, coverageStatus: getCoverageStatus(line) }));
+ return lines.map((line) => ({ ...line, coverageStatus: getCoverageStatus(line) }));
}
isLineOutsideOfRange(lineNumber: number) {
@@ -223,7 +223,7 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
const loadIssuesCallback = (component: SourceViewerFile, sources: SourceLine[]) => {
loadIssues(this.props.component, this.props.branchLike).then(
- issues => {
+ (issues) => {
if (this.mounted) {
const finalSources = sources.slice(0, LINES_TO_LOAD);
this.setState(
@@ -244,7 +244,7 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
issuePopup: undefined,
sourceRemoved: false,
sources: this.computeCoverageStatus(finalSources),
- symbolsByLine: symbolsByLine(sources.slice(0, LINES_TO_LOAD))
+ symbolsByLine: symbolsByLine(sources.slice(0, LINES_TO_LOAD)),
},
() => {
if (this.props.onLoaded) {
@@ -284,8 +284,8 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
const sourcesRequest =
component.q === 'FIL' || component.q === 'UTS' ? this.fetchSources() : Promise.resolve([]);
sourcesRequest.then(
- sources => loadIssuesCallback(component, sources),
- response => onFailLoadSources(response, component)
+ (sources) => loadIssuesCallback(component, sources),
+ (response) => onFailLoadSources(response, component)
);
};
@@ -321,7 +321,7 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
// request one additional line to define `hasSourcesAfter`
to++;
- this.loadSources(this.props.component, from, to, this.props.branchLike).then(sources => {
+ this.loadSources(this.props.component, from, to, this.props.branchLike).then((sources) => {
resolve(sources);
}, onFailLoadSources);
});
@@ -340,13 +340,13 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
firstSourceLine.line - 1,
this.props.branchLike
).then(
- sources => {
+ (sources) => {
if (this.mounted) {
- this.setState(prevState => {
+ this.setState((prevState) => {
return {
loadingSourcesBefore: false,
sources: [...this.computeCoverageStatus(sources), ...(prevState.sources || [])],
- symbolsByLine: { ...prevState.symbolsByLine, ...symbolsByLine(sources) }
+ symbolsByLine: { ...prevState.symbolsByLine, ...symbolsByLine(sources) },
};
});
}
@@ -366,21 +366,21 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
const fromLine = lastSourceLine.line + 1;
const toLine = lastSourceLine.line + LINES_TO_LOAD + 1;
this.loadSources(this.props.component, fromLine, toLine, this.props.branchLike).then(
- sources => {
+ (sources) => {
if (this.mounted) {
const hasSourcesAfter = LINES_TO_LOAD < sources.length;
if (hasSourcesAfter) {
sources.pop();
}
- this.setState(prevState => {
+ this.setState((prevState) => {
return {
hasSourcesAfter,
loadingSourcesAfter: false,
sources: [...(prevState.sources || []), ...this.computeCoverageStatus(sources)],
symbolsByLine: {
...prevState.symbolsByLine,
- ...symbolsByLine(sources)
- }
+ ...symbolsByLine(sources),
+ },
};
});
}
@@ -394,14 +394,14 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
loadDuplications = () => {
getDuplications({
key: this.props.component,
- ...getBranchLikeQuery(this.props.branchLike)
+ ...getBranchLikeQuery(this.props.branchLike),
}).then(
- r => {
+ (r) => {
if (this.mounted) {
this.setState({
duplications: r.duplications,
duplicationsByLine: duplicationsByLine(r.duplications),
- duplicatedFiles: r.files
+ duplicatedFiles: r.files,
});
}
},
@@ -425,7 +425,7 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
};
handleSymbolClick = (symbols: string[]) => {
- this.setState(state => {
+ this.setState((state) => {
const shouldDisable = intersection(state.highlightedSymbols, symbols).length > 0;
const highlightedSymbols = shouldDisable ? [] : symbols;
return { highlightedSymbols };
@@ -449,20 +449,22 @@ export default class SourceViewer extends React.PureComponent<Props, State> {
};
handleOpenIssues = (line: SourceLine) => {
- this.setState(state => ({
- openIssuesByLine: { ...state.openIssuesByLine, [line.line]: true }
+ this.setState((state) => ({
+ openIssuesByLine: { ...state.openIssuesByLine, [line.line]: true },
}));
};
handleCloseIssues = (line: SourceLine) => {
- this.setState(state => ({
- openIssuesByLine: { ...state.openIssuesByLine, [line.line]: false }
+ this.setState((state) => ({
+ openIssuesByLine: { ...state.openIssuesByLine, [line.line]: false },
}));
};
handleIssueChange = (issue: Issue) => {
this.setState(({ issues = [] }) => {
- const newIssues = issues.map(candidate => (candidate.key === issue.key ? issue : candidate));
+ const newIssues = issues.map((candidate) =>
+ candidate.key === issue.key ? issue : candidate
+ );
return { issues: newIssues, issuesByLine: issuesByLine(newIssues) };
});
if (this.props.onIssueChange) {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx
index 0a42eadc3c2..6bc2252f2ea 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx
@@ -27,7 +27,7 @@ import {
FlowLocation,
Issue,
LinearIssueLocation,
- SourceLine
+ SourceLine,
} from '../../types/types';
import Line from './components/Line';
import LineIssuesList from './components/LineIssuesList';
@@ -40,7 +40,7 @@ const ZERO_LINE = {
code: '',
duplicated: false,
isNew: false,
- line: 0
+ line: 0,
};
interface Props {
@@ -110,7 +110,7 @@ export default class SourceViewerCode extends React.PureComponent<Props> {
index,
displayCoverage,
displayDuplications,
- displayIssues
+ displayIssues,
}: {
line: SourceLine;
index: number;
@@ -126,7 +126,7 @@ export default class SourceViewerCode extends React.PureComponent<Props> {
displayAllIssues,
highlightedLocations,
metricKey,
- sources
+ sources,
} = this.props;
const secondaryIssueLocations = getSecondaryIssueLocationsForLine(line, highlightedLocations);
@@ -185,7 +185,8 @@ export default class SourceViewerCode extends React.PureComponent<Props> {
previousLine={index > 0 ? sources[index - 1] : undefined}
renderDuplicationPopup={this.props.renderDuplicationPopup}
scrollToUncoveredLine={scrollToUncoveredLine}
- secondaryIssueLocations={secondaryIssueLocations}>
+ secondaryIssueLocations={secondaryIssueLocations}
+ >
<LineIssuesList
displayWhyIsThisAnIssue={true}
displayAllIssues={displayAllIssues}
@@ -209,11 +210,11 @@ export default class SourceViewerCode extends React.PureComponent<Props> {
render() {
const { issues = [], sources } = this.props;
- const displayCoverage = sources.some(s => s.coverageStatus != null);
- const displayDuplications = sources.some(s => !!s.duplicated);
+ const displayCoverage = sources.some((s) => s.coverageStatus != null);
+ const displayDuplications = sources.some((s) => !!s.duplicated);
const displayIssues = issues.length > 0;
- const hasFileIssues = displayIssues && issues.some(issue => !issue.textRange);
+ const hasFileIssues = displayIssues && issues.some((issue) => !issue.textRange);
return (
<div className="source-viewer-code">
@@ -229,7 +230,8 @@ export default class SourceViewerCode extends React.PureComponent<Props> {
) : (
<Button
className="js-component-viewer-source-before"
- onClick={this.props.loadSourcesBefore}>
+ onClick={this.props.loadSourcesBefore}
+ >
{translate('source_viewer.load_more_code')}
</Button>
)}
@@ -244,7 +246,7 @@ export default class SourceViewerCode extends React.PureComponent<Props> {
index: -1,
displayCoverage,
displayDuplications,
- displayIssues
+ displayIssues,
})}
{sources.map((line, index) =>
this.renderLine({ line, index, displayCoverage, displayDuplications, displayIssues })
@@ -264,7 +266,8 @@ export default class SourceViewerCode extends React.PureComponent<Props> {
) : (
<Button
className="js-component-viewer-source-after"
- onClick={this.props.loadSourcesAfter}>
+ onClick={this.props.loadSourcesAfter}
+ >
{translate('source_viewer.load_more_code')}
</Button>
)}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerContext.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerContext.tsx
index 8fa5d175560..10f57ee9571 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerContext.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerContext.tsx
@@ -28,5 +28,5 @@ interface SourceViewerContextShape {
export const SourceViewerContext = React.createContext<SourceViewerContextShape>({
branchLike: {} as BranchLike,
- file: {} as SourceViewerFile
+ file: {} as SourceViewerFile,
});
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx
index 214f55f1419..17892e4124d 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx
@@ -37,7 +37,7 @@ import {
getCodeUrl,
getComponentIssuesUrl,
getComponentSecurityHotspotsUrl,
- getPathUrlAsString
+ getPathUrlAsString,
} from '../../helpers/urls';
import { BranchLike } from '../../types/branch-like';
import { ComponentQualifier } from '../../types/component';
@@ -90,11 +90,11 @@ export default class SourceViewerHeader extends React.PureComponent<Props, State
...getBranchLikeQuery(branchLike),
files: sourceViewerFile.path,
resolved: 'false',
- types: type
+ types: type,
};
const measure = componentMeasures.find(
- m => m.metric === ISSUETYPE_METRIC_KEYS_MAP[type].metric
+ (m) => m.metric === ISSUETYPE_METRIC_KEYS_MAP[type].metric
);
const linkUrl =
@@ -136,7 +136,8 @@ export default class SourceViewerHeader extends React.PureComponent<Props, State
<div className="component-name-parent">
<a
className="link-no-underline"
- href={getPathUrlAsString(getBranchLikeUrl(project, this.props.branchLike))}>
+ href={getPathUrlAsString(getBranchLikeUrl(project, this.props.branchLike))}
+ >
<QualifierIcon qualifier={ComponentQualifier.Project} /> <span>{projectName}</span>
</a>
</div>
@@ -216,7 +217,8 @@ export default class SourceViewerHeader extends React.PureComponent<Props, State
className="js-new-window"
rel="noopener noreferrer"
target="_blank"
- to={getCodeUrl(this.props.sourceViewerFile.project, this.props.branchLike, key)}>
+ to={getCodeUrl(this.props.sourceViewerFile.project, this.props.branchLike, key)}
+ >
{translate('component_viewer.new_window')}
</Link>
</li>
@@ -232,13 +234,15 @@ export default class SourceViewerHeader extends React.PureComponent<Props, State
className="js-raw-source"
href={rawSourcesLink}
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate('component_viewer.show_raw_source')}
</a>
</li>
</ul>
}
- overlayPlacement={PopupPlacement.BottomRight}>
+ overlayPlacement={PopupPlacement.BottomRight}
+ >
<ButtonIcon className="js-actions" aria-label={translate('component_viewer.action_menu')}>
<ListIcon />
</ButtonIcon>
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
index 9ad5f0ba05e..3e445208c1a 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-it.tsx
@@ -32,19 +32,19 @@ jest.mock('../../../api/components');
jest.mock('../../../api/issues');
jest.mock('../helpers/loadIssues', () => ({
__esModule: true,
- default: jest.fn().mockResolvedValue([])
+ default: jest.fn().mockResolvedValue([]),
}));
jest.mock('../helpers/lines', () => {
const lines = jest.requireActual('../helpers/lines');
return {
...lines,
- LINES_TO_LOAD: 20
+ LINES_TO_LOAD: 20,
};
});
const ui = {
codeSmellTypeButton: byRole('button', { name: 'issue.type.CODE_SMELL' }),
- minorSeverityButton: byRole('button', { name: 'severity.MINOR' })
+ minorSeverityButton: byRole('button', { name: 'severity.MINOR' }),
};
const handler = new SourceViewerServiceMock();
@@ -61,12 +61,12 @@ it('should show a permalink on line number', async () => {
const rowScreen = within(row);
await user.click(
rowScreen.getByRole('button', {
- name: 'source_viewer.line_X.1'
+ name: 'source_viewer.line_X.1',
})
);
await user.click(
rowScreen.getByRole('button', {
- name: 'component_viewer.copy_permalink'
+ name: 'component_viewer.copy_permalink',
})
);
@@ -95,13 +95,13 @@ it('should show a permalink on line number', async () => {
const lowerRowScreen = within(row);
await user.click(
lowerRowScreen.getByRole('button', {
- name: 'source_viewer.line_X.6'
+ name: 'source_viewer.line_X.6',
})
);
expect(
lowerRowScreen.getByRole('button', {
- name: 'component_viewer.copy_permalink'
+ name: 'component_viewer.copy_permalink',
})
).toBeInTheDocument();
@@ -114,11 +114,11 @@ it('should show issue on empty file', async () => {
key: 'first-issue',
message: 'First Issue',
line: undefined,
- textRange: undefined
- })
+ textRange: undefined,
+ }),
]);
renderSourceViewer({
- component: handler.getEmptyFile()
+ component: handler.getEmptyFile(),
});
expect(await screen.findByRole('table')).toBeInTheDocument();
expect(await screen.findByRole('row', { name: 'First Issue' })).toBeInTheDocument();
@@ -131,8 +131,8 @@ it('should be able to interact with issue action', async () => {
key: 'first-issue',
message: 'First Issue',
line: 1,
- textRange: { startLine: 1, endLine: 1, startOffset: 0, endOffset: 1 }
- })
+ textRange: { startLine: 1, endLine: 1, startOffset: 0, endOffset: 1 },
+ }),
]);
const user = userEvent.setup();
renderSourceViewer();
@@ -146,7 +146,7 @@ it('should be able to interact with issue action', async () => {
// Open severity
await user.click(
await screen.findByRole('button', {
- name: 'issue.severity.severity_x_click_to_change.severity.MAJOR'
+ name: 'issue.severity.severity_x_click_to_change.severity.MAJOR',
})
);
expect(ui.minorSeverityButton.get()).toBeInTheDocument();
@@ -158,14 +158,14 @@ it('should be able to interact with issue action', async () => {
// Change the severity
await user.click(
await screen.findByRole('button', {
- name: 'issue.severity.severity_x_click_to_change.severity.MAJOR'
+ name: 'issue.severity.severity_x_click_to_change.severity.MAJOR',
})
);
expect(ui.minorSeverityButton.get()).toBeInTheDocument();
await user.click(ui.minorSeverityButton.get());
expect(
screen.getByRole('button', {
- name: 'issue.severity.severity_x_click_to_change.severity.MINOR'
+ name: 'issue.severity.severity_x_click_to_change.severity.MINOR',
})
).toBeInTheDocument();
});
@@ -173,7 +173,7 @@ it('should be able to interact with issue action', async () => {
it('should load line when looking arround unloaded line', async () => {
const { rerender } = renderSourceViewer({
aroundLine: 50,
- component: handler.getHugeFile()
+ component: handler.getHugeFile(),
});
expect(await screen.findByRole('row', { name: /Line 50$/ })).toBeInTheDocument();
rerender(getSourceViewerUi({ aroundLine: 100, component: handler.getHugeFile() }));
@@ -192,8 +192,7 @@ it('should show SCM information', async () => {
).toBeInTheDocument();
await user.click(
firstRowScreen.getByRole('button', {
- name:
- 'source_viewer.author_X.stas.vilchik@sonarsource.com, source_viewer.click_for_scm_info.1'
+ name: 'source_viewer.author_X.stas.vilchik@sonarsource.com, source_viewer.click_for_scm_info.1',
})
);
@@ -220,8 +219,7 @@ it('should show SCM information', async () => {
const fourthRowScreen = within(row);
await user.click(
fourthRowScreen.getByRole('button', {
- name:
- 'source_viewer.author_X.stas.vilchik@sonarsource.com, source_viewer.click_for_scm_info.4'
+ name: 'source_viewer.author_X.stas.vilchik@sonarsource.com, source_viewer.click_for_scm_info.4',
})
);
@@ -231,7 +229,7 @@ it('should show SCM information', async () => {
expect(
fourthRowScreen.queryByRole('heading', {
level: 4,
- name: 'source_viewer.tooltip.scm.commited_on'
+ name: 'source_viewer.tooltip.scm.commited_on',
})
).not.toBeInTheDocument();
expect(
@@ -245,7 +243,7 @@ it('should show SCM information', async () => {
expect(fithRowScreen.getByText('…')).toBeInTheDocument();
await user.click(
fithRowScreen.getByRole('button', {
- name: 'source_viewer.click_for_scm_info.5'
+ name: 'source_viewer.click_for_scm_info.5',
})
);
@@ -255,7 +253,7 @@ it('should show SCM information', async () => {
expect(
fithRowScreen.queryByRole('heading', {
level: 4,
- name: 'source_viewer.tooltip.scm.commited_on'
+ name: 'source_viewer.tooltip.scm.commited_on',
})
).not.toBeInTheDocument();
expect(
@@ -264,7 +262,7 @@ it('should show SCM information', async () => {
// No SCM Popup
row = await screen.findByRole('row', {
- name: /\* This program is free software; you can redistribute it and\/or$/
+ name: /\* This program is free software; you can redistribute it and\/or$/,
});
expect(row).toBeInTheDocument();
expect(within(row).queryByRole('button')).not.toBeInTheDocument();
@@ -276,28 +274,27 @@ it('should show issue indicator', async () => {
key: 'first-issue',
message: 'First Issue',
line: 1,
- textRange: { startLine: 1, endLine: 1, startOffset: 0, endOffset: 1 }
+ textRange: { startLine: 1, endLine: 1, startOffset: 0, endOffset: 1 },
}),
mockIssue(false, {
key: 'second-issue',
message: 'Second Issue',
line: 1,
- textRange: { startLine: 1, endLine: 1, startOffset: 1, endOffset: 2 }
- })
+ textRange: { startLine: 1, endLine: 1, startOffset: 1, endOffset: 2 },
+ }),
]);
const user = userEvent.setup();
const onIssueSelect = jest.fn();
renderSourceViewer({
onIssueSelect,
- displayAllIssues: false
+ displayAllIssues: false,
});
const row = await screen.findByRole('row', { name: /.*\/ \*$/ });
const issueRow = within(row);
expect(issueRow.getByText('2')).toBeInTheDocument();
await user.click(
issueRow.getByRole('button', {
- name:
- 'source_viewer.issues_on_line.X_issues_of_type_Y.source_viewer.issues_on_line.show.2.issue.type.BUG.plural'
+ name: 'source_viewer.issues_on_line.X_issues_of_type_Y.source_viewer.issues_on_line.show.2.issue.type.BUG.plural',
})
);
const firstIssueBox = issueRow.getByRole('region', { name: 'First Issue' });
@@ -306,8 +303,7 @@ it('should show issue indicator', async () => {
expect(secondIssueBox).toBeInTheDocument();
expect(
issueRow.getByRole('button', {
- name:
- 'source_viewer.issues_on_line.X_issues_of_type_Y.source_viewer.issues_on_line.hide.2.issue.type.BUG.plural'
+ name: 'source_viewer.issues_on_line.X_issues_of_type_Y.source_viewer.issues_on_line.hide.2.issue.type.BUG.plural',
})
).toBeInTheDocument();
@@ -381,7 +377,7 @@ it('should highlight symbol', async () => {
await user.click(symbols[0]);
// For now just check the class. Maybe found a better accessible way of showing higlighted symbole
- symbols.forEach(element => {
+ symbols.forEach((element) => {
expect(element).toHaveClass('highlighted');
});
});
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-test.tsx
index e59897ea35e..7a7507a9f5e 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewer-test.tsx
@@ -32,7 +32,7 @@ jest.mock('../helpers/loadIssues', () => jest.fn().mockRejectedValue({}));
jest.mock('../../../api/components', () => ({
getComponentForSourceViewer: jest.fn().mockRejectedValue(''),
getComponentData: jest.fn().mockRejectedValue(''),
- getSources: jest.fn().mockRejectedValue('')
+ getSources: jest.fn().mockRejectedValue(''),
}));
beforeEach(() => {
@@ -47,7 +47,7 @@ it('should render correctly', async () => {
(defaultLoadIssues as jest.Mock).mockResolvedValueOnce([mockIssue()]);
(getComponentForSourceViewer as jest.Mock).mockResolvedValueOnce(mockSourceViewerFile());
(getComponentData as jest.Mock).mockResolvedValueOnce({
- component: { leakPeriodDate: '2018-06-20T17:12:19+0200' }
+ component: { leakPeriodDate: '2018-06-20T17:12:19+0200' },
});
(getSources as jest.Mock).mockResolvedValueOnce([]);
@@ -60,11 +60,11 @@ it('should render correctly', async () => {
it('should load sources before', async () => {
(defaultLoadIssues as jest.Mock).mockResolvedValueOnce([
mockIssue(false, { key: 'issue1' }),
- mockIssue(false, { key: 'issue2' })
+ mockIssue(false, { key: 'issue2' }),
]);
(getComponentForSourceViewer as jest.Mock).mockResolvedValueOnce(mockSourceViewerFile());
(getComponentData as jest.Mock).mockResolvedValueOnce({
- component: { leakPeriodDate: '2018-06-20T17:12:19+0200' }
+ component: { leakPeriodDate: '2018-06-20T17:12:19+0200' },
});
(getSources as jest.Mock)
.mockResolvedValueOnce([mockSourceLine()])
@@ -87,11 +87,11 @@ it('should load sources before', async () => {
it('should load sources after', async () => {
(defaultLoadIssues as jest.Mock).mockResolvedValueOnce([
mockIssue(false, { key: 'issue1' }),
- mockIssue(false, { key: 'issue2' })
+ mockIssue(false, { key: 'issue2' }),
]);
(getComponentForSourceViewer as jest.Mock).mockResolvedValueOnce(mockSourceViewerFile());
(getComponentData as jest.Mock).mockResolvedValueOnce({
- component: { leakPeriodDate: '2018-06-20T17:12:19+0200' }
+ component: { leakPeriodDate: '2018-06-20T17:12:19+0200' },
});
(getSources as jest.Mock)
.mockResolvedValueOnce([mockSourceLine()])
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx
index 746d7cd495b..c8d2ded1b57 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerCode-test.tsx
@@ -30,40 +30,20 @@ it('should correctly flag a line for scrolling', () => {
const sources = [
mockSourceLine({ line: 1, coverageStatus: 'covered', isNew: false }),
mockSourceLine({ line: 2, coverageStatus: 'partially-covered', isNew: false }),
- mockSourceLine({ line: 3, coverageStatus: 'uncovered', isNew: true })
+ mockSourceLine({ line: 3, coverageStatus: 'uncovered', isNew: true }),
];
let wrapper = shallowRender({ sources, metricKey: MetricKey.uncovered_lines });
- expect(
- wrapper
- .find(Line)
- .at(1)
- .props().scrollToUncoveredLine
- ).toBe(true);
- expect(
- wrapper
- .find(Line)
- .at(2)
- .props().scrollToUncoveredLine
- ).toBe(false);
+ expect(wrapper.find(Line).at(1).props().scrollToUncoveredLine).toBe(true);
+ expect(wrapper.find(Line).at(2).props().scrollToUncoveredLine).toBe(false);
wrapper = shallowRender({
sources,
- metricKey: MetricKey.new_uncovered_lines
+ metricKey: MetricKey.new_uncovered_lines,
});
- expect(
- wrapper
- .find(Line)
- .at(1)
- .props().scrollToUncoveredLine
- ).toBe(false);
- expect(
- wrapper
- .find(Line)
- .at(2)
- .props().scrollToUncoveredLine
- ).toBe(true);
+ expect(wrapper.find(Line).at(1).props().scrollToUncoveredLine).toBe(false);
+ expect(wrapper.find(Line).at(2).props().scrollToUncoveredLine).toBe(true);
});
function shallowRender(props: Partial<SourceViewerCode['props']> = {}) {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeader-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeader-test.tsx
index fea1c7eda90..414dd68e762 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeader-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/__tests__/SourceViewerHeader-test.tsx
@@ -36,8 +36,8 @@ it('should render correctly for a unit test', () => {
showMeasures: true,
sourceViewerFile: mockSourceViewerFile('foo/bar.ts', 'my-project', {
q: ComponentQualifier.TestFile,
- measures: { tests: '12' }
- })
+ measures: { tests: '12' },
+ }),
})
).toMatchSnapshot();
});
@@ -47,20 +47,20 @@ it('should render correctly if issue details are passed', () => {
{ metric: MetricKey.code_smells, value: '1' },
{ metric: MetricKey.file_complexity_distribution, value: '42' }, // unused, should be ignored
{ metric: MetricKey.security_hotspots, value: '2' },
- { metric: MetricKey.vulnerabilities, value: '2' }
+ { metric: MetricKey.vulnerabilities, value: '2' },
];
expect(
shallowRender({
componentMeasures,
- showMeasures: true
+ showMeasures: true,
})
).toMatchSnapshot();
expect(
shallowRender({
componentMeasures,
- showMeasures: false
+ showMeasures: false,
})
.find('.source-viewer-header-measure')
.exists()
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
index 1b392a2cb99..fde7342c1b8 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
@@ -57,7 +57,7 @@ export default class DuplicationPopup extends React.PureComponent<Props> {
this.props.openComponent({
branchLike: this.props.branchLike,
key,
- line: line ? Number(line) : undefined
+ line: line ? Number(line) : undefined,
});
}
};
@@ -69,7 +69,8 @@ export default class DuplicationPopup extends React.PureComponent<Props> {
data-line={line}
href="#"
onClick={this.handleFileClick}
- title={file.name}>
+ title={file.name}
+ >
{children}
</a>
) : (
@@ -81,10 +82,10 @@ export default class DuplicationPopup extends React.PureComponent<Props> {
const { duplicatedFiles = {}, sourceViewerFile } = this.props;
const groupedBlocks = groupBy(this.props.blocks, '_ref');
- let duplications = Object.keys(groupedBlocks).map(fileRef => {
+ let duplications = Object.keys(groupedBlocks).map((fileRef) => {
return {
blocks: groupedBlocks[fileRef],
- file: duplicatedFiles[fileRef]
+ file: duplicatedFiles[fileRef],
};
});
@@ -94,8 +95,8 @@ export default class DuplicationPopup extends React.PureComponent<Props> {
// then duplications in other projects
duplications = sortBy(
duplications,
- d => d.file.projectName !== sourceViewerFile.projectName,
- d => d.file.key !== sourceViewerFile.key
+ (d) => d.file.projectName !== sourceViewerFile.projectName,
+ (d) => d.file.key !== sourceViewerFile.key
);
return (
@@ -110,7 +111,7 @@ export default class DuplicationPopup extends React.PureComponent<Props> {
<h6 className="spacer-bottom">
{translate('component_viewer.transition.duplication')}
</h6>
- {duplications.map(duplication => (
+ {duplications.map((duplication) => (
<div className="spacer-top text-ellipsis" key={duplication.file.key}>
<div className="component-name">
{this.isDifferentComponent(duplication.file, this.props.sourceViewerFile) && (
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx
index bafb2d54376..e3511eeb6fc 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx
@@ -104,7 +104,7 @@ export default class Line extends React.PureComponent<Props> {
previousLine,
scrollToUncoveredLine,
secondaryIssueLocations,
- verticalBuffer
+ verticalBuffer,
} = this.props;
const className = classNames('source-line', {
@@ -113,7 +113,7 @@ export default class Line extends React.PureComponent<Props> {
'source-line-filtered-dark':
displayCoverage &&
(line.coverageStatus === 'uncovered' || line.coverageStatus === 'partially-covered'),
- 'source-line-last': last === true
+ 'source-line-last': last === true,
});
const bottomPadding = verticalBuffer ? verticalBuffer * LINE_HEIGHT : undefined;
@@ -150,7 +150,7 @@ export default class Line extends React.PureComponent<Props> {
)}
{blocksLoaded &&
- times(duplicationsCount - 1, index => {
+ times(duplicationsCount - 1, (index) => {
return (
<LineDuplicationBlock
blocksLoaded={blocksLoaded}
@@ -176,7 +176,8 @@ export default class Line extends React.PureComponent<Props> {
onLocationSelect={this.props.onLocationSelect}
onSymbolClick={this.props.onSymbolClick}
padding={bottomPadding}
- secondaryIssueLocations={secondaryIssueLocations}>
+ secondaryIssueLocations={secondaryIssueLocations}
+ >
{children}
</LineCode>
</tr>
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx
index b095392a2e3..e14ce3f6e4f 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.tsx
@@ -27,7 +27,7 @@ import {
highlightIssueLocations,
highlightSymbol,
splitByTokens,
- Token
+ Token,
} from '../helpers/highlight';
interface Props {
@@ -91,10 +91,10 @@ export default class LineCode extends React.PureComponent<React.PropsWithChildre
tokens.forEach((token, index) => {
if (this.props.displayLocationMarkers && token.markers.length > 0) {
- token.markers.forEach(marker => {
+ token.markers.forEach((marker) => {
const selected =
highlightedLocationMessage !== undefined && highlightedLocationMessage.index === marker;
- const loc = secondaryIssueLocations.find(loc => loc.index === marker);
+ const loc = secondaryIssueLocations.find((loc) => loc.index === marker);
const message = loc && loc.text;
renderedTokens.push(this.renderMarker(marker, message, selected, leadingMarker));
});
@@ -123,9 +123,10 @@ export default class LineCode extends React.PureComponent<React.PropsWithChildre
onClick={onClick}
selected={selected}
aria-current={selected ? 'location' : false}
- aria-label={message ? `${index + 1}-${message}` : index + 1}>
+ aria-label={message ? `${index + 1}-${message}` : index + 1}
+ >
<IssueSourceViewerScrollContext.Consumer>
- {ctx => (
+ {(ctx) => (
<span ref={selected ? ctx?.registerSelectedSecondaryLocationRef : undefined}>
{index + 1}
</span>
@@ -145,7 +146,7 @@ export default class LineCode extends React.PureComponent<React.PropsWithChildre
issueLocations,
line,
padding,
- secondaryIssueLocations
+ secondaryIssueLocations,
} = this.props;
const container = document.createElement('div');
@@ -154,7 +155,7 @@ export default class LineCode extends React.PureComponent<React.PropsWithChildre
let tokens = splitByTokens(container.childNodes);
if (highlightedSymbols) {
- highlightedSymbols.forEach(symbol => {
+ highlightedSymbols.forEach((symbol) => {
tokens = highlightSymbol(tokens, symbol);
});
}
@@ -168,7 +169,7 @@ export default class LineCode extends React.PureComponent<React.PropsWithChildre
if (highlightedLocationMessage) {
const location = secondaryIssueLocations.find(
- location => location.index === highlightedLocationMessage.index
+ (location) => location.index === highlightedLocationMessage.index
);
if (location) {
tokens = highlightIssueLocations(tokens, [location], 'selected');
@@ -184,7 +185,8 @@ export default class LineCode extends React.PureComponent<React.PropsWithChildre
<td
className={classNames('source-line-code code', className)}
data-line-number={line.line}
- style={style}>
+ style={style}
+ >
<div className="source-line-code-inner">
<pre ref={this.nodeNodeRef}>{renderedTokens}</pre>
</div>
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx
index c5d69b53b40..74e4733c1e5 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCoverage.tsx
@@ -34,7 +34,7 @@ export function LineCoverage({ line, scrollToUncoveredLine }: LineCoverageProps)
coverageMarker.current.scrollIntoView({
behavior: 'smooth',
block: 'center',
- inline: 'center'
+ inline: 'center',
});
}
}, [scrollToUncoveredLine, coverageMarker]);
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.tsx
index 038acbf733b..2892289a92f 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplicationBlock.tsx
@@ -41,7 +41,7 @@ export function LineDuplicationBlock(props: LineDuplicationBlockProps) {
const [dropdownOpen, setDropdownOpen] = React.useState(false);
const className = classNames('source-meta', 'source-line-duplications', {
- 'source-line-duplicated': duplicated
+ 'source-line-duplicated': duplicated,
});
const tooltip = dropdownOpen ? undefined : translate('source_viewer.tooltip.duplicated_block');
@@ -57,7 +57,8 @@ export function LineDuplicationBlock(props: LineDuplicationBlockProps) {
<DropdownOverlay placement={PopupPlacement.RightTop}>
{props.renderDuplicationPopup(index, line.line)}
</DropdownOverlay>
- }>
+ }
+ >
<ButtonPlain
aria-label={translate('source_viewer.tooltip.duplicated_block')}
className="source-line-bar"
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx
index e824642f4d3..ba8de19f3f6 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx
@@ -38,7 +38,7 @@ export function LineIssuesIndicator(props: LineIssuesIndicatorProps) {
const { issues, issuesOpen, line } = props;
const hasIssues = issues.length > 0;
const className = classNames('source-meta', 'source-line-issues', {
- 'source-line-with-issues': hasIssues
+ 'source-line-with-issues': hasIssues,
});
if (!hasIssues) {
@@ -46,7 +46,7 @@ export function LineIssuesIndicator(props: LineIssuesIndicatorProps) {
}
const mostImportantIssue = sortByType(issues)[0];
- const issueTypes = uniq(issues.map(i => i.type));
+ const issueTypes = uniq(issues.map((i) => i.type));
const tooltipShowHide = translate('source_viewer.issues_on_line', issuesOpen ? 'hide' : 'show');
let tooltipContent;
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.tsx
index 3bd7852163b..74ab3eec86f 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.tsx
@@ -48,7 +48,7 @@ export default function LineIssuesList(props: LineIssuesListProps) {
selectedIssue,
issuesForLine,
issueLocationsByLine,
- issuePopup
+ issuePopup,
} = props;
const showIssues = openIssuesByLine[line.line] || displayAllIssues;
@@ -57,7 +57,7 @@ export default function LineIssuesList(props: LineIssuesListProps) {
if (showIssues && issuesForLine.length > 0) {
displayedIssue = issuesForLine;
} else if (selectedIssue && !showIssues && issueLocations.length) {
- displayedIssue = issuesForLine.filter(i => i.key === selectedIssue);
+ displayedIssue = issuesForLine.filter((i) => i.key === selectedIssue);
}
if (displayedIssue.length === 0) {
@@ -65,7 +65,7 @@ export default function LineIssuesList(props: LineIssuesListProps) {
}
return (
<div className="issue-list">
- {displayedIssue.map(issue => (
+ {displayedIssue.map((issue) => (
<Issue
branchLike={props.branchLike}
displayWhyIsThisAnIssue={displayWhyIsThisAnIssue}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx
index 55ba93354d3..da70a614bdd 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineNumber.tsx
@@ -42,12 +42,14 @@ export function LineNumber({ displayOptions, firstLineNumber, line }: LineNumber
closeOnClickOutside={true}
onRequestClose={() => setOpen(false)}
open={isOpen}
- overlay={<LineOptionsPopup firstLineNumber={firstLineNumber} line={line} />}>
+ overlay={<LineOptionsPopup firstLineNumber={firstLineNumber} line={line} />}
+ >
<ButtonPlain
aria-expanded={isOpen}
aria-haspopup={true}
aria-label={translateWithParameters('source_viewer.line_X', lineNumber)}
- onClick={() => setOpen(true)}>
+ onClick={() => setOpen(true)}
+ >
{lineNumber}
</ButtonPlain>
</Toggler>
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineOptionsPopup.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineOptionsPopup.tsx
index ef523ceb15f..a0b20cea80d 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineOptionsPopup.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineOptionsPopup.tsx
@@ -42,12 +42,14 @@ export function LineOptionsPopup({ firstLineNumber, line }: LineOptionsPopupProp
<DropdownOverlay
className="big-spacer-left"
noPadding={true}
- placement={isAtTop ? PopupPlacement.BottomLeft : PopupPlacement.TopLeft}>
+ placement={isAtTop ? PopupPlacement.BottomLeft : PopupPlacement.TopLeft}
+ >
<div className="padded source-viewer-bubble-popup nowrap">
<ClipboardButton
className="button-link"
copyValue={codeUrl}
- aria-label={translate('component_viewer.copy_permalink')}>
+ aria-label={translate('component_viewer.copy_permalink')}
+ >
{translate('component_viewer.copy_permalink')}
</ClipboardButton>
</div>
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx
index aba809cc6b6..ef12d330745 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx
@@ -35,7 +35,7 @@ import { getLocalizedMetricName, translate } from '../../../helpers/l10n';
import {
enhanceMeasuresWithMetrics,
formatMeasure,
- getDisplayMetrics
+ getDisplayMetrics,
} from '../../../helpers/measures';
import { getBranchLikeUrl } from '../../../helpers/urls';
import { BranchLike } from '../../../types/branch-like';
@@ -94,19 +94,19 @@ export default class MeasuresOverlay extends React.PureComponent<Props, State> {
};
fetchMeasures = () => {
- return getAllMetrics().then(metrics => {
- const metricKeys = getDisplayMetrics(metrics).map(metric => metric.key);
+ return getAllMetrics().then((metrics) => {
+ const metricKeys = getDisplayMetrics(metrics).map((metric) => metric.key);
// eslint-disable-next-line promise/no-nesting
return getMeasures({
component: this.props.sourceViewerFile.key,
metricKeys: metricKeys.join(),
- ...getBranchLikeQuery(this.props.branchLike)
- }).then(measures => {
+ ...getBranchLikeQuery(this.props.branchLike),
+ }).then((measures) => {
const withMetrics = enhanceMeasuresWithMetrics(measures, metrics).filter(
- measure => measure.metric
+ (measure) => measure.metric
);
- return keyBy(withMetrics, measure => measure.metric.key);
+ return keyBy(withMetrics, (measure) => measure.metric.key);
});
});
};
@@ -116,17 +116,17 @@ export default class MeasuresOverlay extends React.PureComponent<Props, State> {
{
componentKeys: this.props.sourceViewerFile.key,
resolved: 'false',
- ...getBranchLikeQuery(this.props.branchLike)
+ ...getBranchLikeQuery(this.props.branchLike),
},
['types', 'severities', 'tags']
).then(({ facets }) => {
- const severitiesFacet = facets.find(f => f.property === 'severities');
- const tagsFacet = facets.find(f => f.property === 'tags');
- const typesFacet = facets.find(f => f.property === 'types');
+ const severitiesFacet = facets.find((f) => f.property === 'severities');
+ const tagsFacet = facets.find((f) => f.property === 'tags');
+ const typesFacet = facets.find((f) => f.property === 'types');
return {
severitiesFacet: severitiesFacet && severitiesFacet.values,
tagsFacet: tagsFacet && tagsFacet.values,
- typesFacet: typesFacet && (typesFacet.values as FacetValue<IssueType>[])
+ typesFacet: typesFacet && (typesFacet.values as FacetValue<IssueType>[]),
};
});
};
@@ -192,20 +192,22 @@ export default class MeasuresOverlay extends React.PureComponent<Props, State> {
<>
{typesFacet && (
<div className="measures">
- {sortBy(typesFacet, f => ISSUE_TYPES.indexOf(f.val as IssueTypeEnum)).map(f => (
- <div className="measure measure-one-line" key={f.val}>
- <span className="measure-name">
- <IssueTypeIcon className="little-spacer-right" query={f.val} />
- {translate('issue.type', f.val)}
- </span>
- <span className="measure-value">{formatMeasure(f.count, 'SHORT_INT')}</span>
- </div>
- ))}
+ {sortBy(typesFacet, (f) => ISSUE_TYPES.indexOf(f.val as IssueTypeEnum)).map(
+ (f) => (
+ <div className="measure measure-one-line" key={f.val}>
+ <span className="measure-name">
+ <IssueTypeIcon className="little-spacer-right" query={f.val} />
+ {translate('issue.type', f.val)}
+ </span>
+ <span className="measure-value">{formatMeasure(f.count, 'SHORT_INT')}</span>
+ </div>
+ )
+ )}
</div>
)}
{severitiesFacet && (
<div className="measures">
- {sortBy(severitiesFacet, f => SEVERITIES.indexOf(f.val)).map(f => (
+ {sortBy(severitiesFacet, (f) => SEVERITIES.indexOf(f.val)).map((f) => (
<div className="measure measure-one-line" key={f.val}>
<span className="measure-name">
<SeverityHelper severity={f.val} />
@@ -217,7 +219,7 @@ export default class MeasuresOverlay extends React.PureComponent<Props, State> {
)}
{tagsFacet && (
<div className="measures">
- {tagsFacet.map(f => (
+ {tagsFacet.map((f) => (
<div className="measure measure-one-line" key={f.val}>
<span className="measure-name">
<TagsIcon className="little-spacer-right" />
@@ -337,26 +339,26 @@ export default class MeasuresOverlay extends React.PureComponent<Props, State> {
<span className="measure-name">{translate('metric_domain', domain)}</span>
</div>
{sortBy(
- measures.filter(measure => measure.value !== undefined),
- measure => getLocalizedMetricName(measure.metric)
- ).map(measure => this.renderMeasure(measure))}
+ measures.filter((measure) => measure.value !== undefined),
+ (measure) => getLocalizedMetricName(measure.metric)
+ ).map((measure) => this.renderMeasure(measure))}
</div>
</div>
);
};
renderAllMeasures = () => {
- const domains = groupBy(Object.values(this.state.measures), measure => measure.metric.domain);
+ const domains = groupBy(Object.values(this.state.measures), (measure) => measure.metric.domain);
const domainKeys = Object.keys(domains);
const odd = domainKeys.filter((_, index) => index % 2 === 1);
const even = domainKeys.filter((_, index) => index % 2 === 0);
return (
<div className="measures-viewer measures-viewer-secondary">
<div className="measures-viewer-section">
- {odd.map(domain => this.renderDomain(domain, domains[domain]))}
+ {odd.map((domain) => this.renderDomain(domain, domains[domain]))}
</div>
<div className="measures-viewer-section">
- {even.map(domain => this.renderDomain(domain, domains[domain]))}
+ {even.map((domain) => this.renderDomain(domain, domains[domain]))}
</div>
</div>
);
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayMeasure.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayMeasure.tsx
index df6c2df4c1e..61a6db69fd3 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayMeasure.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayMeasure.tsx
@@ -38,7 +38,8 @@ export default function MeasuresOverlayMeasure({ measure }: Props) {
<div
className="measure measure-one-line"
data-metric={measure.metric.key}
- key={measure.metric.key}>
+ key={measure.metric.key}
+ >
<span className="measure-name">
{isMetricKey(measure.metric.key) &&
[MetricKey.bugs, MetricKey.vulnerabilities, MetricKey.code_smells].includes(
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/Line-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/Line-test.tsx
index 5d36ff80d13..24488004ab9 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/Line-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/Line-test.tsx
@@ -28,7 +28,7 @@ it('should render correctly for last, new, and highlighted lines', () => {
shallowRender({
highlighted: true,
last: true,
- line: mockSourceLine({ isNew: true })
+ line: mockSourceLine({ isNew: true }),
})
).toMatchSnapshot();
});
@@ -47,7 +47,7 @@ it('handles the opening and closing of issues', () => {
onIssueSelect,
onIssuesOpen,
onIssueUnselect,
- openIssues: true
+ openIssues: true,
});
const instance = wrapper.instance();
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx
index 5339dfc9828..e075d1bf2a9 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx
@@ -30,8 +30,8 @@ it('render code', () => {
expect(
shallowRender({
secondaryIssueLocations: [
- { index: 1, from: 5, to: 6, line: 16, startLine: 16, text: 'secondary-location-msg' }
- ]
+ { index: 1, from: 5, to: 6, line: 16, startLine: 16, text: 'secondary-location-msg' },
+ ],
})
).toMatchSnapshot('with secondary location');
});
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.tsx
index 19e84a05c0a..885d8864781 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCoverage-test.tsx
@@ -25,14 +25,14 @@ jest.mock('react', () => {
return {
...jest.requireActual('react'),
useRef: jest.fn(),
- useEffect: jest.fn()
+ useEffect: jest.fn(),
};
});
it('should correctly trigger a scroll', () => {
const scroll = jest.fn();
const element = { current: { scrollIntoView: scroll } };
- (React.useEffect as jest.Mock).mockImplementation(f => f());
+ (React.useEffect as jest.Mock).mockImplementation((f) => f());
(React.useRef as jest.Mock).mockImplementation(() => element);
shallowRender({ scrollToUncoveredLine: true });
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx
index 712221baa93..b7788091c8b 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssueList-test.tsx
@@ -29,7 +29,7 @@ it('should render issues', () => {
selectedIssue: 'issue',
issueLocationsByLine: { '1': [{ from: 1, to: 1, line: 1 }] },
line: mockSourceLine({ line: 1 }),
- issuesForLine: [mockIssue(false, { key: 'issue' })]
+ issuesForLine: [mockIssue(false, { key: 'issue' })],
});
expect(wrapper).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx
index 21d20fbb05b..d8c571147ca 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx
@@ -30,8 +30,8 @@ it('should render correctly', () => {
shallowRender({
issues: [
mockIssue(false, { key: 'foo', type: 'VULNERABILITY' }),
- mockIssue(false, { key: 'bar', type: 'VULNERABILITY' })
- ]
+ mockIssue(false, { key: 'bar', type: 'VULNERABILITY' }),
+ ],
})
).toMatchSnapshot('multiple issues, same type');
expect(
@@ -53,7 +53,7 @@ function shallowRender(props: Partial<LineIssuesIndicatorProps> = {}) {
<LineIssuesIndicator
issues={[
mockIssue(false, { key: 'foo', type: 'CODE_SMELL' }),
- mockIssue(false, { key: 'bar', type: 'BUG' })
+ mockIssue(false, { key: 'bar', type: 'BUG' }),
]}
line={{ line: 3 }}
onClick={jest.fn()}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx
index caf553c4d9f..d18de176968 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlay-test.tsx
@@ -35,8 +35,8 @@ jest.mock('../../../../api/issues', () => ({
values: [
{ val: 'CODE_SMELL', count: 2 },
{ val: 'BUG', count: 1 },
- { val: 'VULNERABILITY', count: 0 }
- ]
+ { val: 'VULNERABILITY', count: 0 },
+ ],
},
{
property: 'severities',
@@ -45,19 +45,19 @@ jest.mock('../../../../api/issues', () => ({
{ val: 'INFO', count: 2 },
{ val: 'MINOR', count: 3 },
{ val: 'CRITICAL', count: 4 },
- { val: 'BLOCKER', count: 5 }
- ]
+ { val: 'BLOCKER', count: 5 },
+ ],
},
{
property: 'tags',
values: [
{ val: 'bad-practice', count: 1 },
{ val: 'cert', count: 3 },
- { val: 'design', count: 1 }
- ]
- }
- ]
- })
+ { val: 'design', count: 1 },
+ ],
+ },
+ ],
+ }),
}));
jest.mock('../../../../api/measures', () => ({
@@ -96,8 +96,8 @@ jest.mock('../../../../api/measures', () => ({
{ metric: MetricKey.statements, value: '3' },
{ metric: MetricKey.skipped_tests, value: '0' },
{ metric: MetricKey.test_failures, value: '0' },
- { metric: MetricKey.violations, value: '1' }
- ])
+ { metric: MetricKey.violations, value: '1' },
+ ]),
}));
jest.mock('../../../../api/metrics', () => ({
@@ -137,8 +137,8 @@ jest.mock('../../../../api/metrics', () => ({
{ key: MetricKey.violations, type: 'INT', domain: 'Issues' },
// next two must be filtered out
{ key: 'data', type: 'DATA' },
- { key: 'hidden', hidden: true }
- ])
+ { key: 'hidden', hidden: true },
+ ]),
}));
const sourceViewerFile: SourceViewerFile = {
@@ -148,7 +148,7 @@ const sourceViewerFile: SourceViewerFile = {
project: 'project-key',
projectName: 'Project Name',
q: ComponentQualifier.File,
- uuid: 'abcd123'
+ uuid: 'abcd123',
};
const branchLike = mockBranch({ name: 'feature' });
@@ -164,7 +164,7 @@ it('should render source file', async () => {
it('should render test file', async () => {
const wrapper = shallowRender({
- sourceViewerFile: { ...sourceViewerFile, q: ComponentQualifier.TestFile }
+ sourceViewerFile: { ...sourceViewerFile, q: ComponentQualifier.TestFile },
});
await waitAndUpdate(wrapper);
expect(wrapper).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx
index 45c2c00f319..098dc67d12f 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayMeasure-test.tsx
@@ -27,7 +27,7 @@ it('should render', () => {
<MeasuresOverlayMeasure
measure={{
metric: { id: '1', key: 'coverage', name: 'Coverage', type: 'PERCENT' },
- value: '72'
+ value: '72',
}}
/>
)
@@ -40,7 +40,7 @@ it('should render issues icon', () => {
<MeasuresOverlayMeasure
measure={{
metric: { id: '1', key: 'bugs', name: 'Bugs', type: 'INT' },
- value: '2'
+ value: '2',
}}
/>
)
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/duplications-test.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/duplications-test.ts
index 3cd521eae09..33037bfc9f1 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/duplications-test.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/duplications-test.ts
@@ -19,7 +19,7 @@
*/
import {
getDuplicationBlocksForIndex,
- isDuplicationBlockInRemovedComponent
+ isDuplicationBlockInRemovedComponent,
} from '../duplications';
describe('getDuplicationBlocksForIndex', () => {
@@ -36,13 +36,13 @@ describe('isDuplicationBlockInRemovedComponent', () => {
expect(
isDuplicationBlockInRemovedComponent([
{ _ref: '0', from: 2, size: 2 },
- { _ref: '0', from: 3, size: 1 }
+ { _ref: '0', from: 3, size: 1 },
])
).toBe(false);
expect(
isDuplicationBlockInRemovedComponent([
{ _ref: undefined, from: 2, size: 2 },
- { _ref: '0', from: 3, size: 1 }
+ { _ref: '0', from: 3, size: 1 },
])
).toBe(true);
});
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/highlight-test.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/highlight-test.ts
index d458754c7c1..6c365f76e54 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/highlight-test.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/highlight-test.ts
@@ -28,7 +28,7 @@ describe('highlightSymbol', () => {
{ className: 'a sym-18 b', markers: [], text: 'foo' },
{ className: 'sym-1 d', markers: [], text: 'bar' },
{ className: 'c sym-1', markers: [], text: 'bar' },
- { className: 'c sym-1 d', markers: [], text: 'bar' }
+ { className: 'c sym-1 d', markers: [], text: 'bar' },
];
expect(highlightSymbol(tokens, 'sym-1')).toEqual([
{ className: 'sym-18 b', markers: [], text: 'foo' },
@@ -36,7 +36,7 @@ describe('highlightSymbol', () => {
{ className: 'a sym-18 b', markers: [], text: 'foo' },
{ className: 'sym-1 d highlighted', markers: [], text: 'bar' },
{ className: 'c sym-1 highlighted', markers: [], text: 'bar' },
- { className: 'c sym-1 d highlighted', markers: [], text: 'bar' }
+ { className: 'c sym-1 d highlighted', markers: [], text: 'bar' },
]);
});
@@ -44,12 +44,12 @@ describe('highlightSymbol', () => {
const tokens = [
{ className: 'sym sym-1 sym sym-2', markers: [], text: 'foo' },
{ className: 'sym sym-1', markers: [], text: 'bar' },
- { className: 'sym sym-2', markers: [], text: 'qux' }
+ { className: 'sym sym-2', markers: [], text: 'qux' },
];
expect(highlightSymbol(tokens, 'sym-1')).toEqual([
{ className: 'sym sym-1 sym sym-2 highlighted', markers: [], text: 'foo' },
{ className: 'sym sym-1 highlighted', markers: [], text: 'bar' },
- { className: 'sym sym-2', markers: [], text: 'qux' }
+ { className: 'sym sym-2', markers: [], text: 'qux' },
]);
});
});
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/indexing-test.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/indexing-test.ts
index ffd984f195e..93363448aff 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/indexing-test.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/indexing-test.ts
@@ -26,11 +26,11 @@ describe('issuesByComponentAndLine', () => {
mockIssue(true, { component: 'foo.js' }),
mockIssue(false, {
component: 'foo.js',
- textRange: { startLine: 5, endLine: 5, startOffset: 0, endOffset: 0 }
+ textRange: { startLine: 5, endLine: 5, startOffset: 0, endOffset: 0 },
}),
mockIssue(false, { component: 'bar.js' }),
mockIssue(),
- mockIssue()
+ mockIssue(),
];
const result = issuesByComponentAndLine(issues);
expect(Object.keys(result['foo.js'])).toHaveLength(2);
@@ -49,12 +49,12 @@ describe('symbolsByLine', () => {
const lines = [
{ line: 1, code: '<span class="sym-54 sym"><span class="sym-56 sym">foo</span></span>' },
{ line: 2, code: '<span class="sym-56 sym">bar</span>' },
- { line: 3, code: '<span class="k">qux</span>' }
+ { line: 3, code: '<span class="k">qux</span>' },
];
expect(symbolsByLine(lines)).toEqual({
1: ['sym-54', 'sym-56'],
2: ['sym-56'],
- 3: []
+ 3: [],
});
});
});
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/issueLocations-test.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/issueLocations-test.ts
index 265c7d58e14..6a380ff4268 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/issueLocations-test.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/issueLocations-test.ts
@@ -26,7 +26,7 @@ describe('getSecondaryIssueLocationsForLine', () => {
const sourceLine = mockSourceLine({ line: 2 });
expect(getSecondaryIssueLocationsForLine(sourceLine, undefined)).toEqual([]);
expect(getSecondaryIssueLocationsForLine(sourceLine, [mockFlowLocation()])).toEqual([
- { from: 0, index: undefined, line: 2, startLine: 1, text: undefined, to: 2 }
+ { from: 0, index: undefined, line: 2, startLine: 1, text: undefined, to: 2 },
]);
});
});
@@ -37,11 +37,11 @@ describe('getLinearLocations', () => {
[
{ from: 3, line: 6, to: 999999 },
{ from: 0, line: 7, to: 999999 },
- { from: 0, line: 8, to: 56 }
+ { from: 0, line: 8, to: 56 },
]
);
- expect(
- getLinearLocations({ startLine: 6, startOffset: 0, endLine: 6, endOffset: 42 })
- ).toEqual([{ from: 0, line: 6, to: 42 }]);
+ expect(getLinearLocations({ startLine: 6, startOffset: 0, endLine: 6, endOffset: 42 })).toEqual(
+ [{ from: 0, line: 6, to: 42 }]
+ );
});
});
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/loadIssues-test.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/loadIssues-test.ts
index ca57c36d947..b4abefb57a0 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/loadIssues-test.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/__tests__/loadIssues-test.ts
@@ -45,8 +45,8 @@ jest.mock('../../../../api/issues', () => ({
comments: [],
creationDate: '2016-08-15T15:25:38+0200',
updateDate: '2018-10-25T10:23:08+0200',
- type: 'SECURITY_HOTSPOT'
- }
+ type: 'SECURITY_HOTSPOT',
+ },
],
components: [
{
@@ -54,7 +54,7 @@ jest.mock('../../../../api/issues', () => ({
enabled: true,
qualifier: 'TRK',
name: 'SonarJava',
- longName: 'SonarJava'
+ longName: 'SonarJava',
},
{
key: 'foo.java',
@@ -62,8 +62,8 @@ jest.mock('../../../../api/issues', () => ({
qualifier: 'FIL',
name: 'foo.java',
longName: 'Foo.java',
- path: '/foo.java'
- }
+ path: '/foo.java',
+ },
],
rules: [
{
@@ -71,13 +71,13 @@ jest.mock('../../../../api/issues', () => ({
name: 'Handling files is security-sensitive',
lang: 'java',
status: 'READY',
- langName: 'Java'
- }
+ langName: 'Java',
+ },
],
users: [{ login: 'luke', name: 'Luke', avatar: 'lukavatar', active: true }],
languages: [{ key: 'java', name: 'Java' }],
- facets: []
- })
+ facets: [],
+ }),
}));
describe('loadIssues', () => {
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/duplications.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/duplications.ts
index 21484f7222b..121c2cb1789 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/duplications.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/duplications.ts
@@ -23,7 +23,7 @@ import { Duplication, DuplicationBlock } from '../../../types/types';
export function filterDuplicationBlocksByLine(blocks: DuplicationBlock[], line: number) {
/* eslint-disable no-underscore-dangle */
let foundOne = false;
- return blocks.filter(b => {
+ return blocks.filter((b) => {
const outOfBounds = b.from > line || b.from + b.size < line;
const currentFile = b._ref === '1';
const shouldDisplayForCurrentFile = outOfBounds || foundOne;
@@ -45,5 +45,5 @@ export function getDuplicationBlocksForIndex(
}
export function isDuplicationBlockInRemovedComponent(blocks: DuplicationBlock[]) {
- return blocks.some(b => b._ref === undefined); // eslint-disable-line no-underscore-dangle
+ return blocks.some((b) => b._ref === undefined); // eslint-disable-line no-underscore-dangle
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts
index 9749f769b7c..f7fad63d419 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/highlight.ts
@@ -47,7 +47,7 @@ export function splitByTokens(code: NodeListOf<ChildNode>, rootClassName = ''):
export function highlightSymbol(tokens: Token[], symbol: string): Token[] {
const symbolRegExp = new RegExp(`\\b${symbol}\\b`);
- return tokens.map(token =>
+ return tokens.map((token) =>
symbolRegExp.test(token.className)
? { ...token, className: `${token.className} highlighted` }
: token
@@ -85,11 +85,11 @@ export function highlightIssueLocations(
issueLocations: LinearIssueLocation[],
rootClassName: string = ISSUE_LOCATION_CLASS
): Token[] {
- issueLocations.forEach(location => {
+ issueLocations.forEach((location) => {
const nextTokens: Token[] = [];
let acc = 0;
let markerAdded = location.line !== location.startLine;
- tokens.forEach(token => {
+ tokens.forEach((token) => {
const x = intersect(acc, acc + token.text.length, location.from, location.to);
const p1 = part(token.text, acc, x.from, acc);
const p2 = part(token.text, x.from, x.to, acc);
@@ -108,7 +108,7 @@ export function highlightIssueLocations(
!markerAdded && location.index != null
? uniq([...token.markers, location.index])
: token.markers,
- text: p2
+ text: p2,
});
markerAdded = true;
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/indexing.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/indexing.ts
index 92e594ebc11..774f8e8283f 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/indexing.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/indexing.ts
@@ -24,7 +24,7 @@ import { getLinearLocations } from './issueLocations';
export function issuesByLine(issues: Issue[]) {
const index: { [line: number]: Issue[] } = {};
- issues.forEach(issue => {
+ issues.forEach((issue) => {
const line = issue.textRange ? issue.textRange.endLine : 0;
if (!(line in index)) {
index[line] = [];
@@ -34,9 +34,9 @@ export function issuesByLine(issues: Issue[]) {
return index;
}
-export function issuesByComponentAndLine(
- issues: Issue[] = []
-): { [component: string]: { [line: number]: Issue[] } } {
+export function issuesByComponentAndLine(issues: Issue[] = []): {
+ [component: string]: { [line: number]: Issue[] };
+} {
return issues.reduce((mapping: { [component: string]: { [line: number]: Issue[] } }, issue) => {
mapping[issue.component] = mapping[issue.component] || {};
const line = issue.textRange ? issue.textRange.endLine : 0;
@@ -48,8 +48,8 @@ export function issuesByComponentAndLine(
export function locationsByLine(issues: Pick<Issue, 'textRange'>[]) {
const index: { [line: number]: LinearIssueLocation[] } = {};
- issues.forEach(issue => {
- getLinearLocations(issue.textRange).forEach(location => {
+ issues.forEach((issue) => {
+ getLinearLocations(issue.textRange).forEach((location) => {
if (!(location.line in index)) {
index[location.line] = [];
}
@@ -67,7 +67,7 @@ export function duplicationsByLine(duplications: Duplication[] | undefined) {
const duplicationsByLine: { [line: number]: number[] } = {};
duplications.forEach(({ blocks }, duplicationIndex) => {
- blocks.forEach(block => {
+ blocks.forEach((block) => {
// eslint-disable-next-line no-underscore-dangle
if (block._ref === '1') {
for (let line = block.from; line < block.from + block.size; line++) {
@@ -85,17 +85,17 @@ export function duplicationsByLine(duplications: Duplication[] | undefined) {
export function symbolsByLine(sources: SourceLine[]) {
const index: { [line: number]: string[] } = {};
- sources.forEach(line => {
+ sources.forEach((line) => {
const container = document.createElement('div');
container.innerHTML = line.code || '';
const tokens = splitByTokens(container.childNodes);
const symbols = flatten(
- tokens.map(token => {
+ tokens.map((token) => {
const keys = token.className.match(/sym-\d+/g);
return keys != null ? keys : [];
})
);
- index[line.line] = symbols.filter(key => key);
+ index[line.line] = symbols.filter((key) => key);
});
return index;
}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/issueLocations.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/issueLocations.ts
index 265bb7d7e87..241e36ac4b2 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/issueLocations.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/issueLocations.ts
@@ -45,12 +45,12 @@ export function getSecondaryIssueLocationsForLine(
return highlightedLocations.reduce((locations, location) => {
const linearLocations: LinearIssueLocation[] = location
? getLinearLocations(location.textRange)
- .filter(l => l.line === line.line)
- .map(l => ({
+ .filter((l) => l.line === line.line)
+ .map((l) => ({
...l,
startLine: location.textRange.startLine,
index: location.index,
- text: location.msg
+ text: location.msg,
}))
: [];
return [...locations, ...linearLocations];
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/lines.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/lines.ts
index 63d1395b079..ddcf00ed30b 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/lines.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/lines.ts
@@ -37,7 +37,7 @@ export function optimizeLocationMessage(
) {
return highlightedLocationMessage != null &&
optimizedSecondaryIssueLocations.some(
- location => location.index === highlightedLocationMessage.index
+ (location) => location.index === highlightedLocationMessage.index
)
? highlightedLocationMessage
: undefined;
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/helpers/loadIssues.ts b/server/sonar-web/src/main/js/components/SourceViewer/helpers/loadIssues.ts
index aa4bb6ab580..dbe31174ce7 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/helpers/loadIssues.ts
+++ b/server/sonar-web/src/main/js/components/SourceViewer/helpers/loadIssues.ts
@@ -34,7 +34,7 @@ function buildQuery(component: string, branchLike: BranchLike | undefined) {
resolved: 'false',
componentKeys: component,
s: 'FILE_LINE',
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
};
}
@@ -42,9 +42,9 @@ function loadPage(query: RawQuery, page: number, pageSize = PAGE_SIZE): Promise<
return searchIssues({
...query,
p: page,
- ps: pageSize
- }).then(r =>
- r.issues.map(issue => parseIssueFromResponse(issue, r.components, r.users, r.rules))
+ ps: pageSize,
+ }).then((r) =>
+ r.issues.map((issue) => parseIssueFromResponse(issue, r.components, r.users, r.rules))
);
}
diff --git a/server/sonar-web/src/main/js/components/a11y/A11yContext.tsx b/server/sonar-web/src/main/js/components/a11y/A11yContext.tsx
index 3bf2444f4e0..ee76719ae81 100644
--- a/server/sonar-web/src/main/js/components/a11y/A11yContext.tsx
+++ b/server/sonar-web/src/main/js/components/a11y/A11yContext.tsx
@@ -33,5 +33,5 @@ export const A11yContext = createContext<A11yContextShape>({
removeA11ySkipLink: () => {
/* Implemented by Provider */
},
- links: []
+ links: [],
});
diff --git a/server/sonar-web/src/main/js/components/a11y/A11yProvider.tsx b/server/sonar-web/src/main/js/components/a11y/A11yProvider.tsx
index f515d9f15f7..fd41eb84691 100644
--- a/server/sonar-web/src/main/js/components/a11y/A11yProvider.tsx
+++ b/server/sonar-web/src/main/js/components/a11y/A11yProvider.tsx
@@ -31,7 +31,7 @@ export default class A11yProvider extends React.Component<{}, State> {
state: State = { links: [] };
addA11ySkipLink = (link: A11ySkipLink) => {
- this.setState(prevState => {
+ this.setState((prevState) => {
const links = [...prevState.links];
links.push({ ...link, weight: link.weight || 0 });
return { links };
@@ -39,8 +39,8 @@ export default class A11yProvider extends React.Component<{}, State> {
};
removeA11ySkipLink = (link: A11ySkipLink) => {
- this.setState(prevState => {
- const links = prevState.links.filter(l => l.key !== link.key);
+ this.setState((prevState) => {
+ const links = prevState.links.filter((l) => l.key !== link.key);
return { links };
});
};
@@ -52,8 +52,9 @@ export default class A11yProvider extends React.Component<{}, State> {
value={{
addA11ySkipLink: this.addA11ySkipLink,
links,
- removeA11ySkipLink: this.removeA11ySkipLink
- }}>
+ removeA11ySkipLink: this.removeA11ySkipLink,
+ }}
+ >
{this.props.children}
</A11yContext.Provider>
);
diff --git a/server/sonar-web/src/main/js/components/a11y/A11ySkipLinks.tsx b/server/sonar-web/src/main/js/components/a11y/A11ySkipLinks.tsx
index 8af879bbec2..302fe8de0c8 100644
--- a/server/sonar-web/src/main/js/components/a11y/A11ySkipLinks.tsx
+++ b/server/sonar-web/src/main/js/components/a11y/A11ySkipLinks.tsx
@@ -25,7 +25,7 @@ export default function A11ySkipLinks() {
return (
<A11yContext.Consumer>
{({ links }) =>
- links.map(link => (
+ links.map((link) => (
<a className="a11y-skip-link" href={`#a11y_target__${link.key}`} key={link.key}>
{link.label}
</a>
diff --git a/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx
index f19805d53af..7379f8d016c 100644
--- a/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx
+++ b/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx
@@ -27,11 +27,11 @@ jest.mock('../A11yContext', () => ({
return children({
links: [
{ key: 'link1', label: 'Label 1' },
- { key: 'link2', label: 'Label 2' }
- ]
+ { key: 'link2', label: 'Label 2' },
+ ],
});
- }
- }
+ },
+ },
}));
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/activity-graph/AddGraphMetric.tsx b/server/sonar-web/src/main/js/components/activity-graph/AddGraphMetric.tsx
index 29dfd8d6fb8..0d43caa4f56 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/AddGraphMetric.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/AddGraphMetric.tsx
@@ -45,14 +45,12 @@ export default class AddGraphMetric extends React.PureComponent<Props, State> {
state: State = {
metrics: [],
query: '',
- selectedMetrics: []
+ selectedMetrics: [],
};
filterSelected = (query: string, selectedElements: string[]) => {
- return selectedElements.filter(element =>
- this.getLocalizedMetricNameFromKey(element)
- .toLowerCase()
- .includes(query.toLowerCase())
+ return selectedElements.filter((element) =>
+ this.getLocalizedMetricNameFromKey(element).toLowerCase().includes(query.toLowerCase())
);
};
@@ -61,15 +59,13 @@ export default class AddGraphMetric extends React.PureComponent<Props, State> {
query: string
) => {
return metrics
- .filter(metric => {
+ .filter((metric) => {
if (
metric.hidden ||
isDiffMetric(metric.key) ||
['DATA', 'DISTRIB'].includes(metric.type) ||
selectedMetrics.includes(metric.key) ||
- !getLocalizedMetricName(metric)
- .toLowerCase()
- .includes(query.toLowerCase())
+ !getLocalizedMetricName(metric).toLowerCase().includes(query.toLowerCase())
) {
return false;
}
@@ -78,12 +74,12 @@ export default class AddGraphMetric extends React.PureComponent<Props, State> {
}
return true;
})
- .map(metric => metric.key);
+ .map((metric) => metric.key);
};
getSelectedMetricsElements = (metrics: Metric[], selectedMetrics?: string[]) => {
const selected = selectedMetrics || this.props.selectedMetrics;
- return metrics.filter(metric => selected.includes(metric.key)).map(metric => metric.key);
+ return metrics.filter((metric) => selected.includes(metric.key)).map((metric) => metric.key);
};
getLocalizedMetricNameFromKey = (key: string) => {
@@ -98,20 +94,20 @@ export default class AddGraphMetric extends React.PureComponent<Props, State> {
onSelect = (metric: string) => {
this.props.addMetric(metric);
- this.setState(state => {
+ this.setState((state) => {
return {
selectedMetrics: sortBy([...state.selectedMetrics, metric]),
- metrics: this.filterMetricsElements(this.props, state.query)
+ metrics: this.filterMetricsElements(this.props, state.query),
};
});
};
onUnselect = (metric: string) => {
this.props.removeMetric(metric);
- this.setState(state => {
+ this.setState((state) => {
return {
metrics: sortBy([...state.metrics, metric]),
- selectedMetrics: state.selectedMetrics.filter(selected => selected !== metric)
+ selectedMetrics: state.selectedMetrics.filter((selected) => selected !== metric),
};
});
};
@@ -136,10 +132,11 @@ export default class AddGraphMetric extends React.PureComponent<Props, State> {
onSearch={this.onSearch}
onSelect={this.onSelect}
onUnselect={this.onUnselect}
- renderLabel={element => this.getLocalizedMetricNameFromKey(element)}
+ renderLabel={(element) => this.getLocalizedMetricNameFromKey(element)}
selectedElements={selectedMetrics}
/>
- }>
+ }
+ >
<Button className="spacer-left">
<span className="text-ellipsis text-middle">
{translate('project_activity.graphs.custom.add')}
diff --git a/server/sonar-web/src/main/js/components/activity-graph/DataTableModal.tsx b/server/sonar-web/src/main/js/components/activity-graph/DataTableModal.tsx
index ef88cf83586..0b0fabb17e4 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/DataTableModal.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/DataTableModal.tsx
@@ -99,14 +99,14 @@ export default function DataTableModal(props: DataTableModalProps) {
<TimeFormatter date={date} />
</div>
</td>
- {metrics.map(metric => (
+ {metrics.map((metric) => (
<td key={metric} className="thin nowrap">
{values[metric] || '-'}
</td>
))}
<td>
<ul>
- {getAnalysisEventsForDate(analyses, date).map(event => (
+ {getAnalysisEventsForDate(analyses, date).map((event) => (
<li className="little-spacer-bottom" key={event.key}>
<EventInner event={event} readonly={true} />
</li>
@@ -158,7 +158,7 @@ export default function DataTableModal(props: DataTableModalProps) {
<thead>
<tr>
<th>{translate('date')}</th>
- {series.map(serie => (
+ {series.map((serie) => (
<th key={serie.name} className="thin nowrap">
{serie.translatedName}
</th>
diff --git a/server/sonar-web/src/main/js/components/activity-graph/DefinitionChangeEventInner.tsx b/server/sonar-web/src/main/js/components/activity-graph/DefinitionChangeEventInner.tsx
index 7d52c9c970b..41ea7117793 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/DefinitionChangeEventInner.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/DefinitionChangeEventInner.tsx
@@ -55,14 +55,15 @@ export class DefinitionChangeEventInner extends React.PureComponent<Props, State
};
toggleProjectsList = () => {
- this.setState(state => ({ expanded: !state.expanded }));
+ this.setState((state) => ({ expanded: !state.expanded }));
};
renderProjectLink = (project: { key: string; name: string }, branch: string | undefined) => (
<Link
onClick={this.stopPropagation}
title={project.name}
- to={getProjectUrl(project.key, branch)}>
+ to={getProjectUrl(project.key, branch)}
+ >
{limitComponentName(project.name, 28)}
</Link>
);
@@ -95,7 +96,7 @@ export class DefinitionChangeEventInner extends React.PureComponent<Props, State
id={message}
values={{
project: this.renderProjectLink(project, project.branch),
- branch: this.renderBranch(project.branch)
+ branch: this.renderBranch(project.branch),
}}
/>
</div>
@@ -111,7 +112,7 @@ export class DefinitionChangeEventInner extends React.PureComponent<Props, State
id={message}
values={{
project: this.renderProjectLink(project, project.branch),
- branch: this.renderBranch(project.branch)
+ branch: this.renderBranch(project.branch),
}}
/>
</div>
@@ -124,7 +125,7 @@ export class DefinitionChangeEventInner extends React.PureComponent<Props, State
values={{
project: this.renderProjectLink(project, project.newBranch),
oldBranch: this.renderBranch(project.oldBranch),
- newBranch: this.renderBranch(project.newBranch)
+ newBranch: this.renderBranch(project.newBranch),
}}
/>
);
@@ -147,7 +148,8 @@ export class DefinitionChangeEventInner extends React.PureComponent<Props, State
<ButtonLink
className="project-activity-event-inner-more-link"
onClick={this.toggleProjectsList}
- stopPropagation={true}>
+ stopPropagation={true}
+ >
{expanded ? translate('hide') : translate('more')}
<DropdownIcon className="little-spacer-left" turned={expanded} />
</ButtonLink>
@@ -156,7 +158,7 @@ export class DefinitionChangeEventInner extends React.PureComponent<Props, State
{expanded && (
<ul className="spacer-left spacer-top">
- {event.definitionChange.projects.map(project => (
+ {event.definitionChange.projects.map((project) => (
<li className="display-flex-center spacer-top" key={project.key}>
{this.renderProjectChange(project)}
</li>
diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphHistory.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphHistory.tsx
index bb674ec3a21..6698d2b614d 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/GraphHistory.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/GraphHistory.tsx
@@ -86,7 +86,7 @@ export default class GraphHistory extends React.PureComponent<Props, State> {
selectedDate,
series,
showAreas,
- graphDescription
+ graphDescription,
} = this.props;
const { tooltipIdx, tooltipXPos } = this.state;
const events = getAnalysisEventsForDate(analyses, selectedDate);
@@ -149,7 +149,8 @@ export default class GraphHistory extends React.PureComponent<Props, State> {
series={series}
onClose={onClose}
/>
- )}>
+ )}
+ >
{({ onClick }) => (
<Button className="a11y-hidden" onClick={onClick}>
{translate('project_activity.graphs.open_in_table')}
diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsHeader.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsHeader.tsx
index c15aaac724a..1dd1d58ae4f 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/GraphsHeader.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsHeader.tsx
@@ -53,14 +53,14 @@ export default class GraphsHeader extends React.PureComponent<Props> {
metrics,
metricsTypeFilter,
removeCustomMetric,
- selectedMetrics = []
+ selectedMetrics = [],
} = this.props;
const types = getGraphTypes(addCustomMetric === undefined || removeCustomMetric === undefined);
- const selectOptions = types.map(type => ({
+ const selectOptions = types.map((type) => ({
label: translate('project_activity.graphs', type),
- value: type
+ value: type,
}));
return (
@@ -76,7 +76,7 @@ export default class GraphsHeader extends React.PureComponent<Props> {
isSearchable={false}
onChange={this.handleGraphChange}
options={selectOptions}
- value={selectOptions.find(option => option.value === graph)}
+ value={selectOptions.find((option) => option.value === graph)}
/>
</div>
{isCustomGraph(graph) &&
diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx
index d4924ebb2be..0f4f8436644 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx
@@ -53,7 +53,7 @@ export default class GraphsHistory extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
- selectedDate: props.selectedDate
+ selectedDate: props.selectedDate,
};
}
diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendCustom.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendCustom.tsx
index 6dba9551e5e..a8f54da826a 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendCustom.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendCustom.tsx
@@ -49,7 +49,8 @@ export default function GraphsLegendCustom(props: GraphsLegendCustomProps) {
return (
<Tooltip
key={serie.name}
- overlay={translate('project_activity.graphs.custom.metric_no_history')}>
+ overlay={translate('project_activity.graphs.custom.metric_no_history')}
+ >
<span className="spacer-left spacer-right">{legendItem}</span>
</Tooltip>
);
diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendNewCode.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendNewCode.tsx
index 928c315a15f..06e81da93e4 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendNewCode.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendNewCode.tsx
@@ -26,7 +26,8 @@ export default function GraphsLegendNewCode() {
<Tooltip overlay={translate('project_activity.graphs.new_code_long')}>
<span
aria-label={translate('project_activity.graphs.new_code_long')}
- className="activity-graph-new-code-legend display-flex-center pull-right note">
+ className="activity-graph-new-code-legend display-flex-center pull-right note"
+ >
{translate('project_activity.graphs.new_code')}
</span>
</Tooltip>
diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltips.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltips.tsx
index b7d49b60cd5..9950dc79b32 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltips.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltips.tsx
@@ -93,7 +93,8 @@ export default class GraphsTooltips extends React.PureComponent<Props> {
<Popup
className="disabled-pointer-events"
placement={placement}
- style={{ top, left, width: TOOLTIP_WIDTH }}>
+ style={{ top, left, width: TOOLTIP_WIDTH }}
+ >
<div className="activity-graph-tooltip">
<div className="activity-graph-tooltip-title spacer-bottom">
<DateTimeFormatter date={this.props.selectedDate} />
diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentCoverage.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentCoverage.tsx
index edfc58c2e83..6021f6e382c 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentCoverage.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentCoverage.tsx
@@ -31,10 +31,10 @@ export interface GraphsTooltipsContentCoverageProps {
export default function GraphsTooltipsContentCoverage({
addSeparator,
measuresHistory,
- tooltipIdx
+ tooltipIdx,
}: GraphsTooltipsContentCoverageProps) {
- const uncovered = measuresHistory.find(measure => measure.metric === 'uncovered_lines');
- const coverage = measuresHistory.find(measure => measure.metric === 'coverage');
+ const uncovered = measuresHistory.find((measure) => measure.metric === 'uncovered_lines');
+ const coverage = measuresHistory.find((measure) => measure.metric === 'coverage');
if (!uncovered || !uncovered.history[tooltipIdx] || !coverage || !coverage.history[tooltipIdx]) {
return null;
}
diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentDuplication.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentDuplication.tsx
index 5c4a66aa2cf..e97d87d4f09 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentDuplication.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentDuplication.tsx
@@ -31,10 +31,10 @@ export interface GraphsTooltipsContentDuplicationProps {
export default function GraphsTooltipsContentDuplication({
addSeparator,
measuresHistory,
- tooltipIdx
+ tooltipIdx,
}: GraphsTooltipsContentDuplicationProps) {
const duplicationDensity = measuresHistory.find(
- measure => measure.metric === 'duplicated_lines_density'
+ (measure) => measure.metric === 'duplicated_lines_density'
);
if (!duplicationDensity || !duplicationDensity.history[tooltipIdx]) {
return null;
diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentEvents.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentEvents.tsx
index 85cafa0761b..ceba6c071c4 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentEvents.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentEvents.tsx
@@ -38,7 +38,7 @@ export default function GraphsTooltipsContentEvents({ addSeparator, events }: Pr
)}
<tr className="activity-graph-tooltip-line">
<td colSpan={3}>
- {events.map(event => (
+ {events.map((event) => (
<div className="little-spacer-bottom" key={event.key}>
<EventInner event={event} readonly={true} />
</div>
diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentIssues.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentIssues.tsx
index f4a97626c52..3ca06bd94ba 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentIssues.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContentIssues.tsx
@@ -35,12 +35,12 @@ export interface GraphsTooltipsContentIssuesProps {
const METRIC_RATING: Dict<string> = {
bugs: 'reliability_rating',
vulnerabilities: 'security_rating',
- code_smells: 'sqale_rating'
+ code_smells: 'sqale_rating',
};
export default function GraphsTooltipsContentIssues(props: GraphsTooltipsContentIssuesProps) {
const rating = props.measuresHistory.find(
- measure => measure.metric === METRIC_RATING[props.name]
+ (measure) => measure.metric === METRIC_RATING[props.name]
);
if (!rating || !rating.history[props.tooltipIdx]) {
return null;
diff --git a/server/sonar-web/src/main/js/components/activity-graph/RichQualityGateEventInner.tsx b/server/sonar-web/src/main/js/components/activity-graph/RichQualityGateEventInner.tsx
index 2f81862002c..f89adab3749 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/RichQualityGateEventInner.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/RichQualityGateEventInner.tsx
@@ -50,7 +50,7 @@ export class RichQualityGateEventInner extends React.PureComponent<Props, State>
};
toggleProjectsList = () => {
- this.setState(state => ({ expanded: !state.expanded }));
+ this.setState((state) => ({ expanded: !state.expanded }));
};
render() {
@@ -74,7 +74,8 @@ export class RichQualityGateEventInner extends React.PureComponent<Props, State>
<ResetButtonLink
className="project-activity-event-inner-more-link"
onClick={this.toggleProjectsList}
- stopPropagation={true}>
+ stopPropagation={true}
+ >
{expanded ? translate('hide') : translate('more')}
<DropdownIcon className="little-spacer-left" turned={expanded} />
</ResetButtonLink>
@@ -83,7 +84,7 @@ export class RichQualityGateEventInner extends React.PureComponent<Props, State>
{expanded && (
<ul className="spacer-left spacer-top">
- {event.qualityGate.failing.map(project => (
+ {event.qualityGate.failing.map((project) => (
<li className="display-flex-center spacer-top" key={project.key}>
<Level
aria-label={translate('quality_gates.status')}
@@ -95,7 +96,8 @@ export class RichQualityGateEventInner extends React.PureComponent<Props, State>
<Link
onClick={this.stopPropagation}
title={project.name}
- to={getProjectUrl(project.key, project.branch)}>
+ to={getProjectUrl(project.key, project.branch)}
+ >
<span aria-label={translateWithParameters('project_x', project.name)}>
{project.name}
</span>
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/ActivityGraph-it.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/ActivityGraph-it.tsx
index 786e404631d..42d90877818 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/ActivityGraph-it.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/ActivityGraph-it.tsx
@@ -30,7 +30,7 @@ import {
mockAnalysisEvent,
mockHistoryItem,
mockMeasureHistory,
- mockParsedAnalysis
+ mockParsedAnalysis,
} from '../../../helpers/mocks/project-activity';
import { mockMetric } from '../../../helpers/testMocks';
import { renderComponent } from '../../../helpers/testReactTestingUtils';
@@ -52,7 +52,7 @@ const ui = {
burnedBudgetCheckbox: byRole('checkbox', { name: MetricKey.burned_budget }),
vulnerabilityCheckbox: byRole('checkbox', { name: MetricKey.vulnerabilities }),
hiddenOptionsAlert: byText('project_activity.graphs.custom.type_x_message', {
- exact: false
+ exact: false,
}),
maxOptionsAlert: byText('project_activity.graphs.custom.add_metric_info'),
filterMetrics: byPlaceholderText('search.search_for_metrics'),
@@ -74,8 +74,8 @@ const ui = {
dataTableColHeaders: byRole('columnheader'),
onlyFirst100Text: byText('project_activity.graphs.data_table.max_lines_warning.100'),
noDataTableText: byText('project_activity.graphs.data_table.no_data_warning_check_dates_x', {
- exact: false
- })
+ exact: false,
+ }),
};
it('should correctly handle adding/removing custom metrics', async () => {
@@ -171,7 +171,7 @@ it('shows the same data in a table when filtered by date', async () => {
const user = userEvent.setup();
renderActivityGraph({
graphStartDate: parseDate('2017-01-01'),
- graphEndDate: parseDate('2019-01-01')
+ graphEndDate: parseDate('2019-01-01'),
});
await user.click(ui.openInTableBtn.get());
@@ -230,9 +230,9 @@ function renderActivityGraph(
MetricKey.uncovered_lines,
MetricKey.coverage,
MetricKey.duplicated_lines_density,
- MetricKey.test_success_density
- ].forEach(metric => {
- const history = times(HISTORY_COUNT, i => {
+ MetricKey.test_success_density,
+ ].forEach((metric) => {
+ const history = times(HISTORY_COUNT, (i) => {
const date = parseDate('2016-01-01T00:00:00+0200');
date.setDate(date.getDate() + i);
return mockHistoryItem({ date, value: i.toString() });
@@ -246,7 +246,7 @@ function renderActivityGraph(
mockMetric({
key: metric,
name: metric,
- type: metric.includes('_density') || metric === MetricKey.coverage ? 'PERCENT' : 'INT'
+ type: metric.includes('_density') || metric === MetricKey.coverage ? 'PERCENT' : 'INT',
})
);
});
@@ -267,14 +267,16 @@ function renderActivityGraph(
const metricsTypeFilter =
graphs.length < MAX_GRAPHS
? undefined
- : graphs.filter(graph => graph.length < MAX_SERIES_PER_GRAPH).map(graph => graph[0].type);
+ : graphs
+ .filter((graph) => graph.length < MAX_SERIES_PER_GRAPH)
+ .map((graph) => graph[0].type);
const addCustomMetric = (metricKey: string) => {
setSelectedMetrics([...selectedMetrics, metricKey]);
};
const removeCustomMetric = (metricKey: string) => {
- setSelectedMetrics(selectedMetrics.filter(m => m !== metricKey));
+ setSelectedMetrics(selectedMetrics.filter((m) => m !== metricKey));
};
const updateGraph = (graphType: string) => {
@@ -312,18 +314,18 @@ function renderActivityGraph(
key: '2',
category: 'VERSION',
description: undefined,
- qualityGate: undefined
+ qualityGate: undefined,
}),
mockAnalysisEvent({
key: '3',
category: 'DEFINITION_CHANGE',
definitionChange: {
- projects: [{ changeType: 'ADDED', key: 'foo', name: 'Foo' }]
+ projects: [{ changeType: 'ADDED', key: 'foo', name: 'Foo' }],
},
- qualityGate: undefined
- })
- ]
- })
+ qualityGate: undefined,
+ }),
+ ],
+ }),
]}
graph={graph}
graphEndDate={toDate}
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/DataTableModal-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/DataTableModal-test.tsx
index d9ec3fd7d1e..b4d16fb678e 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/DataTableModal-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/DataTableModal-test.tsx
@@ -49,7 +49,7 @@ it('should render correctly if there is no data and we have a start date', () =>
renderDataTableModal({ graphStartDate: parseDate('3022-01-01') });
expect(
screen.getByText('project_activity.graphs.data_table.no_data_warning_check_dates_x', {
- exact: false
+ exact: false,
})
).toBeInTheDocument();
});
@@ -58,7 +58,7 @@ it('should render correctly if there is no data and we have an end date', () =>
renderDataTableModal({ graphEndDate: parseDate('2015-01-01') });
expect(
screen.getByText('project_activity.graphs.data_table.no_data_warning_check_dates_y', {
- exact: false
+ exact: false,
})
).toBeInTheDocument();
});
@@ -66,11 +66,11 @@ it('should render correctly if there is no data and we have an end date', () =>
it('should render correctly if there is no data and we have a date range', () => {
renderDataTableModal({
graphEndDate: parseDate('2015-01-01'),
- graphStartDate: parseDate('2014-01-01')
+ graphStartDate: parseDate('2014-01-01'),
});
expect(
screen.getByText('project_activity.graphs.data_table.no_data_warning_check_dates_x_y', {
- exact: false
+ exact: false,
})
).toBeInTheDocument();
});
@@ -84,8 +84,8 @@ function renderDataTableModal(props: Partial<DataTableModalProps> = {}) {
function mockSeries(n = 10) {
const measuresHistory: MeasureHistory[] = [];
const metrics: Metric[] = [];
- [MetricKey.bugs, MetricKey.code_smells, MetricKey.vulnerabilities].forEach(metric => {
- const history = times(n, i => {
+ [MetricKey.bugs, MetricKey.code_smells, MetricKey.vulnerabilities].forEach((metric) => {
+ const history = times(n, (i) => {
const date = parseDate('2016-01-01T00:00:00+0200');
date.setDate(date.getDate() + 365 * i);
return mockHistoryItem({ date, value: i.toString() });
@@ -95,7 +95,7 @@ function mockSeries(n = 10) {
mockMetric({
key: metric,
name: metric,
- type: 'INT'
+ type: 'INT',
})
);
});
@@ -107,7 +107,7 @@ function mockSeries(n = 10) {
getDisplayedHistoryMetrics(GraphType.issues, [
MetricKey.bugs,
MetricKey.code_smells,
- MetricKey.vulnerabilities
+ MetricKey.vulnerabilities,
])
);
}
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/DefinitionChangeEventInner-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/DefinitionChangeEventInner-test.tsx
index 9c5d0a62286..cd609cbfeca 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/DefinitionChangeEventInner-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/DefinitionChangeEventInner-test.tsx
@@ -31,9 +31,9 @@ it('should render', () => {
definitionChange: {
projects: [
{ changeType: 'ADDED', key: 'foo', name: 'Foo', branch: 'master' },
- { changeType: 'REMOVED', key: 'bar', name: 'Bar', branch: 'master' }
- ]
- }
+ { changeType: 'REMOVED', key: 'bar', name: 'Bar', branch: 'master' },
+ ],
+ },
};
const wrapper = shallow(<DefinitionChangeEventInner branchLike={undefined} event={event} />);
expect(wrapper).toMatchSnapshot();
@@ -57,10 +57,10 @@ it('should render for a branch', () => {
key: 'bar',
name: 'Bar',
oldBranch: 'master',
- newBranch: 'feature-y'
- }
- ]
- }
+ newBranch: 'feature-y',
+ },
+ ],
+ },
};
const wrapper = shallow(<DefinitionChangeEventInner branchLike={branch} event={event} />);
click(wrapper.find('.project-activity-event-inner-more-link'));
@@ -76,9 +76,9 @@ it('should render when readonly', () => {
definitionChange: {
projects: [
{ changeType: 'ADDED', key: 'foo', name: 'Foo', branch: 'master' },
- { changeType: 'REMOVED', key: 'bar', name: 'Bar', branch: 'master' }
- ]
- }
+ { changeType: 'REMOVED', key: 'bar', name: 'Bar', branch: 'master' },
+ ],
+ },
};
const wrapper = shallow(
<DefinitionChangeEventInner branchLike={undefined} event={event} readonly={true} />
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendCustom-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendCustom-test.tsx
index 8a08a2dec57..c54700cf5ea 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendCustom-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendCustom-test.tsx
@@ -35,20 +35,20 @@ function shallowRender(props: Partial<GraphsLegendCustomProps> = {}) {
name: 'bugs',
translatedName: 'Bugs',
data: [{ x: parseDate('2017-05-16T13:50:02+0200'), y: 1 }],
- type: 'INT'
+ type: 'INT',
},
{
name: 'my_metric',
translatedName: 'My Metric',
data: [{ x: parseDate('2017-05-16T13:50:02+0200'), y: 1 }],
- type: 'INT'
+ type: 'INT',
},
{
name: 'foo',
translatedName: 'Foo',
data: [],
- type: 'INT'
- }
+ type: 'INT',
+ },
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendItem-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendItem-test.tsx
index b527754561d..d2c9a3ea8d5 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendItem-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendItem-test.tsx
@@ -31,7 +31,7 @@ it('should render correctly a legend', () => {
index: 1,
metric: 'foo',
name: 'Foo',
- removeMetric: jest.fn()
+ removeMetric: jest.fn(),
})
).toMatchSnapshot('with legend');
expect(shallowRender({ showWarning: true })).toMatchSnapshot('with warning');
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendStatic-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendStatic-test.tsx
index e4fc2d2e90e..98403cb1eb0 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendStatic-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsLegendStatic-test.tsx
@@ -30,7 +30,7 @@ function shallowRender(props: Partial<GraphsLegendStaticProps> = {}) {
<GraphsLegendStatic
series={[
{ name: 'bugs', translatedName: 'Bugs' },
- { name: 'code_smells', translatedName: 'Code Smells' }
+ { name: 'code_smells', translatedName: 'Code Smells' },
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltips-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltips-test.tsx
index b8087369c6a..d76eceafecb 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltips-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltips-test.tsx
@@ -31,14 +31,14 @@ const SERIES_ISSUES = [
data: [
{
x: parseDate('2011-10-01T22:01:00.000Z'),
- y: 3
+ y: 3,
},
{
x: parseDate('2011-10-25T10:27:41.000Z'),
- y: 0
- }
+ y: 0,
+ },
],
- type: 'INT'
+ type: 'INT',
},
{
name: 'code_smells',
@@ -46,14 +46,14 @@ const SERIES_ISSUES = [
data: [
{
x: parseDate('2011-10-01T22:01:00.000Z'),
- y: 18
+ y: 18,
},
{
x: parseDate('2011-10-25T10:27:41.000Z'),
- y: 15
- }
+ y: 15,
+ },
],
- type: 'INT'
+ type: 'INT',
},
{
name: 'vulnerabilities',
@@ -61,27 +61,27 @@ const SERIES_ISSUES = [
data: [
{
x: parseDate('2011-10-01T22:01:00.000Z'),
- y: 0
+ y: 0,
},
{
x: parseDate('2011-10-25T10:27:41.000Z'),
- y: 1
- }
+ y: 1,
+ },
],
- type: 'INT'
- }
+ type: 'INT',
+ },
];
const DEFAULT_PROPS: GraphsTooltips['props'] = {
events: [],
- formatValue: val => 'Formated.' + val,
+ formatValue: (val) => 'Formated.' + val,
graph: DEFAULT_GRAPH,
graphWidth: 500,
measuresHistory: [],
selectedDate: parseDate('2011-10-01T22:01:00.000Z'),
series: SERIES_ISSUES,
tooltipIdx: 0,
- tooltipPos: 666
+ tooltipPos: 666,
};
it('should render correctly for issues graphs', () => {
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContent-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContent-test.tsx
index 6eb1f63865e..ab5c3cb022c 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContent-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContent-test.tsx
@@ -25,7 +25,7 @@ const DEFAULT_PROPS = {
index: 1,
name: 'code_smells',
translatedName: 'Code Smells',
- value: '1.2k'
+ value: '1.2k',
};
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentCoverage-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentCoverage-test.tsx
index ca0d2dcc777..f7f1a6d1851 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentCoverage-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentCoverage-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import { parseDate } from '../../../helpers/dates';
import GraphsTooltipsContentCoverage, {
- GraphsTooltipsContentCoverageProps
+ GraphsTooltipsContentCoverageProps,
} from '../GraphsTooltipsContentCoverage';
it('should render correctly', () => {
@@ -39,23 +39,23 @@ function shallowRender(props: Partial<GraphsTooltipsContentCoverageProps> = {})
metric: 'coverage',
history: [
{ date: parseDate('2011-10-01T22:01:00.000Z') },
- { date: parseDate('2011-10-25T10:27:41.000Z'), value: '80.3' }
- ]
+ { date: parseDate('2011-10-25T10:27:41.000Z'), value: '80.3' },
+ ],
},
{
metric: 'lines_to_cover',
history: [
{ date: parseDate('2011-10-01T22:01:00.000Z'), value: '60545' },
- { date: parseDate('2011-10-25T10:27:41.000Z'), value: '65215' }
- ]
+ { date: parseDate('2011-10-25T10:27:41.000Z'), value: '65215' },
+ ],
},
{
metric: 'uncovered_lines',
history: [
{ date: parseDate('2011-10-01T22:01:00.000Z'), value: '40564' },
- { date: parseDate('2011-10-25T10:27:41.000Z'), value: '10245' }
- ]
- }
+ { date: parseDate('2011-10-25T10:27:41.000Z'), value: '10245' },
+ ],
+ },
]}
tooltipIdx={1}
{...props}
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentDuplication-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentDuplication-test.tsx
index b17df740d20..69d82091e3b 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentDuplication-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentDuplication-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import { parseDate } from '../../../helpers/dates';
import GraphsTooltipsContentDuplication, {
- GraphsTooltipsContentDuplicationProps
+ GraphsTooltipsContentDuplicationProps,
} from '../GraphsTooltipsContentDuplication';
it('should render correctly', () => {
@@ -40,9 +40,9 @@ function shallowRender(props: Partial<GraphsTooltipsContentDuplicationProps> = {
metric: 'duplicated_lines_density',
history: [
{ date: parseDate('2011-10-01T22:01:00.000Z') },
- { date: parseDate('2011-10-25T10:27:41.000Z'), value: '10245' }
- ]
- }
+ { date: parseDate('2011-10-25T10:27:41.000Z'), value: '10245' },
+ ],
+ },
]}
tooltipIdx={1}
{...props}
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentEvents-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentEvents-test.tsx
index d59e9fee197..24f8075b0cd 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentEvents-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentEvents-test.tsx
@@ -23,7 +23,7 @@ import GraphsTooltipsContentEvents from '../GraphsTooltipsContentEvents';
const EVENTS = [
{ key: '1', category: 'VERSION', name: '6.5' },
- { key: '2', category: 'OTHER', name: 'Foo' }
+ { key: '2', category: 'OTHER', name: 'Foo' },
];
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentIssues-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentIssues-test.tsx
index f8ff03bb389..b3ab3a252cb 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentIssues-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/GraphsTooltipsContentIssues-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import { parseDate } from '../../../helpers/dates';
import GraphsTooltipsContentIssues, {
- GraphsTooltipsContentIssuesProps
+ GraphsTooltipsContentIssuesProps,
} from '../GraphsTooltipsContentIssues';
it('should render correctly', () => {
@@ -38,16 +38,16 @@ function shallowRender(props: Partial<GraphsTooltipsContentIssuesProps> = {}) {
metric: 'bugs',
history: [
{ date: parseDate('2011-10-01T22:01:00.000Z'), value: '500' },
- { date: parseDate('2011-10-25T10:27:41.000Z'), value: '1.2k' }
- ]
+ { date: parseDate('2011-10-25T10:27:41.000Z'), value: '1.2k' },
+ ],
},
{
metric: 'reliability_rating',
history: [
{ date: parseDate('2011-10-01T22:01:00.000Z') },
- { date: parseDate('2011-10-25T10:27:41.000Z'), value: '5.0' }
- ]
- }
+ { date: parseDate('2011-10-25T10:27:41.000Z'), value: '5.0' },
+ ],
+ },
]}
name="bugs"
tooltipIdx={1}
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/RichQualityGateEventInner-test.tsx b/server/sonar-web/src/main/js/components/activity-graph/__tests__/RichQualityGateEventInner-test.tsx
index b4cd59e56c5..471c2ad61db 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/RichQualityGateEventInner-test.tsx
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/RichQualityGateEventInner-test.tsx
@@ -29,11 +29,11 @@ const event: RichQualityGateEvent = {
qualityGate: {
failing: [
{ branch: 'master', key: 'foo', name: 'Foo' },
- { branch: 'master', key: 'bar', name: 'Bar' }
+ { branch: 'master', key: 'bar', name: 'Bar' },
],
status: 'ERROR',
- stillFailing: true
- }
+ stillFailing: true,
+ },
};
it('should render', () => {
diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/utils-test.ts b/server/sonar-web/src/main/js/components/activity-graph/__tests__/utils-test.ts
index 4bb4c586c64..caea2f64e91 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/utils-test.ts
@@ -26,11 +26,11 @@ jest.mock('date-fns', () => {
const actual = jest.requireActual('date-fns');
return {
...actual,
- startOfDay: jest.fn(date => {
+ startOfDay: jest.fn((date) => {
const startDay = new Date(date);
startDay.setUTCHours(0, 0, 0, 0);
return startDay;
- })
+ }),
};
});
@@ -39,31 +39,31 @@ const HISTORY = [
metric: MetricKey.lines_to_cover,
history: [
{ date: dates.parseDate('2017-04-27T08:21:32.000Z'), value: '100' },
- { date: dates.parseDate('2017-04-30T23:06:24.000Z'), value: '100' }
- ]
+ { date: dates.parseDate('2017-04-30T23:06:24.000Z'), value: '100' },
+ ],
},
{
metric: MetricKey.uncovered_lines,
history: [
{ date: dates.parseDate('2017-04-27T08:21:32.000Z'), value: '12' },
- { date: dates.parseDate('2017-04-30T23:06:24.000Z'), value: '50' }
- ]
- }
+ { date: dates.parseDate('2017-04-30T23:06:24.000Z'), value: '50' },
+ ],
+ },
];
const METRICS = [
{ id: '1', key: MetricKey.uncovered_lines, name: 'Uncovered Lines', type: 'INT' },
- { id: '2', key: MetricKey.lines_to_cover, name: 'Line to Cover', type: 'PERCENT' }
+ { id: '2', key: MetricKey.lines_to_cover, name: 'Line to Cover', type: 'PERCENT' },
];
const SERIE: Serie = {
data: [
{ x: dates.parseDate('2017-04-27T08:21:32.000Z'), y: 2 },
- { x: dates.parseDate('2017-04-28T08:21:32.000Z'), y: 2 }
+ { x: dates.parseDate('2017-04-28T08:21:32.000Z'), y: 2 },
],
name: 'foo',
translatedName: 'Foo',
- type: 'PERCENT'
+ type: 'PERCENT',
};
describe('generateCoveredLinesMetric', () => {
@@ -78,7 +78,7 @@ describe('generateSeries', () => {
expect(
utils.generateSeries(HISTORY, GraphType.coverage, METRICS, [
MetricKey.uncovered_lines,
- MetricKey.lines_to_cover
+ MetricKey.lines_to_cover,
])
).toMatchSnapshot();
});
@@ -93,11 +93,11 @@ describe('getDisplayedHistoryMetrics', () => {
expect(utils.getDisplayedHistoryMetrics(utils.DEFAULT_GRAPH, [])).toEqual([
MetricKey.bugs,
MetricKey.code_smells,
- MetricKey.vulnerabilities
+ MetricKey.vulnerabilities,
]);
expect(utils.getDisplayedHistoryMetrics(GraphType.coverage, customMetrics)).toEqual([
MetricKey.lines_to_cover,
- MetricKey.uncovered_lines
+ MetricKey.uncovered_lines,
]);
});
it('should return all custom metrics for the custom graph', () => {
@@ -116,12 +116,12 @@ describe('getHistoryMetrics', () => {
MetricKey.vulnerabilities,
MetricKey.reliability_rating,
MetricKey.security_rating,
- MetricKey.sqale_rating
+ MetricKey.sqale_rating,
]);
expect(utils.getHistoryMetrics(GraphType.coverage, customMetrics)).toEqual([
MetricKey.lines_to_cover,
MetricKey.uncovered_lines,
- GraphType.coverage
+ GraphType.coverage,
]);
expect(utils.getHistoryMetrics(GraphType.custom, customMetrics)).toEqual(customMetrics);
});
@@ -137,9 +137,9 @@ describe('hasHistoryData', () => {
type: 'INT',
data: [
{ x: dates.parseDate('2017-04-27T08:21:32.000Z'), y: 2 },
- { x: dates.parseDate('2017-04-30T23:06:24.000Z'), y: 2 }
- ]
- }
+ { x: dates.parseDate('2017-04-30T23:06:24.000Z'), y: 2 },
+ ],
+ },
])
).toBe(true);
expect(
@@ -148,7 +148,7 @@ describe('hasHistoryData', () => {
name: 'foo',
translatedName: 'foo',
type: 'INT',
- data: []
+ data: [],
},
{
name: 'bar',
@@ -156,9 +156,9 @@ describe('hasHistoryData', () => {
type: 'INT',
data: [
{ x: dates.parseDate('2017-04-27T08:21:32.000Z'), y: 2 },
- { x: dates.parseDate('2017-04-30T23:06:24.000Z'), y: 2 }
- ]
- }
+ { x: dates.parseDate('2017-04-30T23:06:24.000Z'), y: 2 },
+ ],
+ },
])
).toBe(true);
expect(
@@ -167,8 +167,8 @@ describe('hasHistoryData', () => {
name: 'bar',
translatedName: 'bar',
type: 'INT',
- data: [{ x: dates.parseDate('2017-04-27T08:21:32.000Z'), y: 2 }]
- }
+ data: [{ x: dates.parseDate('2017-04-27T08:21:32.000Z'), y: 2 }],
+ },
])
).toBe(false);
});
diff --git a/server/sonar-web/src/main/js/components/activity-graph/utils.ts b/server/sonar-web/src/main/js/components/activity-graph/utils.ts
index 4c84246e277..22b94853464 100644
--- a/server/sonar-web/src/main/js/components/activity-graph/utils.ts
+++ b/server/sonar-web/src/main/js/components/activity-graph/utils.ts
@@ -30,20 +30,20 @@ export const DEFAULT_GRAPH = GraphType.issues;
const GRAPHS_METRICS_DISPLAYED: Dict<string[]> = {
[GraphType.issues]: [MetricKey.bugs, MetricKey.code_smells, MetricKey.vulnerabilities],
[GraphType.coverage]: [MetricKey.lines_to_cover, MetricKey.uncovered_lines],
- [GraphType.duplications]: [MetricKey.ncloc, MetricKey.duplicated_lines]
+ [GraphType.duplications]: [MetricKey.ncloc, MetricKey.duplicated_lines],
};
const GRAPHS_METRICS: Dict<string[]> = {
[GraphType.issues]: GRAPHS_METRICS_DISPLAYED[GraphType.issues].concat([
MetricKey.reliability_rating,
MetricKey.security_rating,
- MetricKey.sqale_rating
+ MetricKey.sqale_rating,
]),
[GraphType.coverage]: [...GRAPHS_METRICS_DISPLAYED[GraphType.coverage], MetricKey.coverage],
[GraphType.duplications]: [
...GRAPHS_METRICS_DISPLAYED[GraphType.duplications],
- MetricKey.duplicated_lines_density
- ]
+ MetricKey.duplicated_lines_density,
+ ],
};
export function isCustomGraph(graph: GraphType) {
@@ -56,11 +56,11 @@ export function getGraphTypes(ignoreCustom = false) {
}
export function hasDataValues(serie: Serie) {
- return serie.data.some(point => Boolean(point.y || point.y === 0));
+ return serie.data.some((point) => Boolean(point.y || point.y === 0));
}
export function hasHistoryData(series: Serie[]) {
- return series.some(serie => serie.data && serie.data.length > 1);
+ return series.some((serie) => serie.data && serie.data.length > 1);
}
export function getSeriesMetricType(series: Serie[]) {
@@ -76,13 +76,13 @@ export function getHistoryMetrics(graph: GraphType, customMetrics: string[]) {
}
export function hasHistoryDataValue(series: Serie[]) {
- return series.some(serie => serie.data && serie.data.length > 1 && hasDataValues(serie));
+ return series.some((serie) => serie.data && serie.data.length > 1 && hasDataValues(serie));
}
export function splitSeriesInGraphs(series: Serie[], maxGraph: number, maxSeries: number) {
return flatMap(
- groupBy(series, serie => serie.type),
- type => chunk(type, maxSeries)
+ groupBy(series, (serie) => serie.type),
+ (type) => chunk(type, maxSeries)
).slice(0, maxGraph);
}
@@ -90,17 +90,19 @@ export function generateCoveredLinesMetric(
uncoveredLines: MeasureHistory,
measuresHistory: MeasureHistory[]
) {
- const linesToCover = measuresHistory.find(measure => measure.metric === MetricKey.lines_to_cover);
+ const linesToCover = measuresHistory.find(
+ (measure) => measure.metric === MetricKey.lines_to_cover
+ );
return {
data: linesToCover
? uncoveredLines.history.map((analysis, idx) => ({
x: analysis.date,
- y: Number(linesToCover.history[idx].value) - Number(analysis.value)
+ y: Number(linesToCover.history[idx].value) - Number(analysis.value),
}))
: [],
name: 'covered_lines',
translatedName: translate('project_activity.custom_metric.covered_lines'),
- type: 'INT'
+ type: 'INT',
};
}
@@ -115,23 +117,23 @@ export function generateSeries(
}
return sortBy(
measuresHistory
- .filter(measure => displayedMetrics.indexOf(measure.metric) >= 0)
- .map(measure => {
+ .filter((measure) => displayedMetrics.indexOf(measure.metric) >= 0)
+ .map((measure) => {
if (measure.metric === MetricKey.uncovered_lines && !isCustomGraph(graph)) {
return generateCoveredLinesMetric(measure, measuresHistory);
}
const metric = findMetric(measure.metric, metrics);
return {
- data: measure.history.map(analysis => ({
+ data: measure.history.map((analysis) => ({
x: analysis.date,
- y: metric && metric.type === 'LEVEL' ? analysis.value : Number(analysis.value)
+ y: metric && metric.type === 'LEVEL' ? analysis.value : Number(analysis.value),
})),
name: measure.metric,
translatedName: metric ? getLocalizedMetricName(metric) : localizeMetric(measure.metric),
- type: metric ? metric.type : 'INT'
+ type: metric ? metric.type : 'INT',
};
}),
- serie =>
+ (serie) =>
displayedMetrics.indexOf(serie.name === 'covered_lines' ? 'uncovered_lines' : serie.name)
);
}
@@ -155,13 +157,13 @@ export function getActivityGraph(
const customGraphs = get(`${namespace}.custom`, project);
return {
graph: (get(namespace, project) as GraphType) || DEFAULT_GRAPH,
- customGraphs: customGraphs ? customGraphs.split(',') : []
+ customGraphs: customGraphs ? customGraphs.split(',') : [],
};
}
export function getAnalysisEventsForDate(analyses: ParsedAnalysis[], date?: Date) {
if (date) {
- const analysis = analyses.find(a => a.date.valueOf() === date.valueOf());
+ const analysis = analyses.find((a) => a.date.valueOf() === date.valueOf());
if (analysis) {
return analysis.events;
}
@@ -171,7 +173,7 @@ export function getAnalysisEventsForDate(analyses: ParsedAnalysis[], date?: Date
function findMetric(key: string, metrics: Metric[] | Dict<Metric>) {
if (Array.isArray(metrics)) {
- return metrics.find(metric => metric.key === key);
+ return metrics.find((metric) => metric.key === key);
}
return metrics[key];
}
diff --git a/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.tsx b/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.tsx
index 114afb0ae26..03100524339 100644
--- a/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.tsx
+++ b/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.tsx
@@ -77,7 +77,7 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
eventSize: 8,
maxYTicksCount: 4,
padding: [26, 10, 50, 60],
- zoomSpeed: 1
+ zoomSpeed: 1,
};
constructor(props: Props) {
@@ -131,15 +131,11 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
}
getRatingScale = (availableHeight: number) => {
- return scalePoint<number>()
- .domain([5, 4, 3, 2, 1])
- .range([availableHeight, 0]);
+ return scalePoint<number>().domain([5, 4, 3, 2, 1]).range([availableHeight, 0]);
};
getLevelScale = (availableHeight: number) => {
- return scalePoint()
- .domain(['ERROR', 'WARN', 'OK'])
- .range([availableHeight, 0]);
+ return scalePoint().domain(['ERROR', 'WARN', 'OK']).range([availableHeight, 0]);
};
getYScale = (props: Props, availableHeight: number, flatData: Chart.Point[]): YScale => {
@@ -150,12 +146,12 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
}
return scaleLinear()
.range([availableHeight, 0])
- .domain([0, max(flatData, d => Number(d.y || 0)) || 1])
+ .domain([0, max(flatData, (d) => Number(d.y || 0)) || 1])
.nice();
};
getXScale = ({ startDate, endDate }: Props, availableWidth: number, flatData: Chart.Point[]) => {
- const dateRange = extent(flatData, d => d.x) as [Date, Date];
+ const dateRange = extent(flatData, (d) => d.x) as [Date, Date];
const start = startDate && startDate > dateRange[0] ? startDate : dateRange[0];
const end = endDate && endDate < dateRange[1] ? endDate : dateRange[1];
const xScale: ScaleTime<number, number> = scaleTime()
@@ -164,31 +160,31 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
.clamp(false);
return {
xScale,
- maxXRange: dateRange.map(xScale)
+ maxXRange: dateRange.map(xScale),
};
};
getScales = (props: Props) => {
const availableWidth = props.width - props.padding[1] - props.padding[3];
const availableHeight = props.height - props.padding[0] - props.padding[2];
- const flatData = flatten(props.series.map(serie => serie.data));
+ const flatData = flatten(props.series.map((serie) => serie.data));
return {
...this.getXScale(props, availableWidth, flatData),
- yScale: this.getYScale(props, availableHeight, flatData)
+ yScale: this.getYScale(props, availableHeight, flatData),
};
};
getSelectedDatePos = (xScale: XScale, selectedDate?: Date) => {
const firstSerie = this.props.series[0];
if (selectedDate && firstSerie) {
- const idx = firstSerie.data.findIndex(p => p.x.valueOf() === selectedDate.valueOf());
+ const idx = firstSerie.data.findIndex((p) => p.x.valueOf() === selectedDate.valueOf());
const xRange = sortBy(xScale.range());
const xPos = xScale(selectedDate);
if (idx >= 0 && xPos >= xRange[0] && xPos <= xRange[1]) {
return {
selectedDate,
selectedDateXPos: xScale(selectedDate),
- selectedDateIdx: idx
+ selectedDateIdx: idx,
};
}
}
@@ -239,7 +235,7 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
mouseOver: false,
selectedDate: undefined,
selectedDateXPos: undefined,
- selectedDateIdx: undefined
+ selectedDateIdx: undefined,
});
updateTooltip(undefined, undefined, undefined);
}
@@ -259,12 +255,12 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
};
updateTooltipPos = (xPos: number) => {
- this.setState(state => {
+ this.setState((state) => {
const firstSerie = this.props.series[0];
if (state.mouseOver && firstSerie) {
const { updateTooltip } = this.props;
const date = state.xScale.invert(xPos);
- const bisectX = bisector<Chart.Point, Date>(d => d.x).right;
+ const bisectX = bisector<Chart.Point, Date>((d) => d.x).right;
let idx = bisectX(firstSerie.data, date);
if (idx >= 0) {
const previousPoint = firstSerie.data[idx - 1];
@@ -303,7 +299,7 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
// if there are duplicated ticks, that means 4 ticks are too much for this data
// so let's just use the domain values (min and max)
if (formatYTick) {
- const formattedTicks = ticks.map(tick => formatYTick(tick));
+ const formattedTicks = ticks.map((tick) => formatYTick(tick));
if (ticks.length > uniq(formattedTicks).length) {
ticks = yScale.domain();
}
@@ -311,7 +307,7 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
return (
<g>
- {ticks.map(tick => (
+ {ticks.map((tick) => (
<g key={tick}>
{formatYTick != null && (
<text
@@ -320,7 +316,8 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
dy="0.3em"
textAnchor="end"
x={xScale.range()[0]}
- y={yScale(tick)}>
+ y={yScale(tick)}
+ >
{formatYTick(tick)}
</text>
)}
@@ -355,7 +352,8 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
textAnchor="end"
transform={`rotate(-35, ${x}, ${y})`}
x={x}
- y={y}>
+ y={y}
+ >
{format(tick)}
</text>
);
@@ -407,7 +405,8 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
ref={this.setLeakLegendTextWidth}
x={legendPosition}
y={yRange[yRange.length - 1] - legendPadding - legendMargin}
- textAnchor={legendTextAnchor}>
+ textAnchor={legendTextAnchor}
+ >
new code
</text>
</>
@@ -449,9 +448,9 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
renderLines = () => {
const lineGenerator = d3Line<Chart.Point>()
- .defined(d => Boolean(d.y || d.y === 0))
- .x(d => this.state.xScale(d.x))
- .y(d => this.state.yScale(d.y));
+ .defined((d) => Boolean(d.y || d.y === 0))
+ .x((d) => this.state.xScale(d.x))
+ .y((d) => this.state.yScale(d.y));
if (this.props.basisCurve) {
lineGenerator.curve(curveBasis);
}
@@ -496,16 +495,16 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
})
.filter(isDefined)
)
- .filter(dots => dots.length > 0)}
+ .filter((dots) => dots.length > 0)}
</g>
);
};
renderAreas = () => {
const areaGenerator = area<Chart.Point>()
- .defined(d => Boolean(d.y || d.y === 0))
- .x(d => this.state.xScale(d.x))
- .y1(d => this.state.yScale(d.y))
+ .defined((d) => Boolean(d.y || d.y === 0))
+ .x((d) => this.state.xScale(d.x))
+ .y1((d) => this.state.yScale(d.y))
.y0(this.state.yScale(0));
if (this.props.basisCurve) {
areaGenerator.curve(curveBasis);
@@ -607,7 +606,7 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
hideGrid,
hideXAxis,
showAreas,
- graphDescription
+ graphDescription,
} = this.props;
if (!width || !height) {
return <div />;
@@ -619,7 +618,8 @@ export default class AdvancedTimeline extends React.PureComponent<Props, State>
aria-label={graphDescription}
className={classNames('line-chart', { 'chart-zoomed': isZoomed })}
height={height}
- width={width}>
+ width={width}
+ >
{zoomEnabled && this.renderClipPath()}
<g transform={`translate(${padding[3]}, ${padding[0]})`}>
{leakPeriodDate != null && this.renderLeak()}
diff --git a/server/sonar-web/src/main/js/components/charts/BarChart.tsx b/server/sonar-web/src/main/js/components/charts/BarChart.tsx
index 188a7cdb8bc..5d1ddc8654d 100644
--- a/server/sonar-web/src/main/js/components/charts/BarChart.tsx
+++ b/server/sonar-web/src/main/js/components/charts/BarChart.tsx
@@ -69,7 +69,8 @@ export default class BarChart<T> extends React.PureComponent<Props<T>> {
onClick={() => this.handleClick(point)}
style={{ cursor: this.props.onBarClick ? 'pointer' : 'default' }}
x={x}
- y={y}>
+ y={y}
+ >
{tick}
</text>
);
@@ -103,7 +104,8 @@ export default class BarChart<T> extends React.PureComponent<Props<T>> {
onClick={() => this.handleClick(point)}
style={{ cursor: this.props.onBarClick ? 'pointer' : 'default' }}
x={x}
- y={y}>
+ y={y}
+ >
{value}
</text>
);
@@ -156,14 +158,12 @@ export default class BarChart<T> extends React.PureComponent<Props<T>> {
const innerPadding = (availableWidth - barsWidth * data.length) / (data.length - 1);
const relativeInnerPadding = innerPadding / (innerPadding + barsWidth);
- const maxY = max(data, d => d.y) as number;
+ const maxY = max(data, (d) => d.y) as number;
const xScale = scaleBand<number>()
- .domain(data.map(d => d.x))
+ .domain(data.map((d) => d.x))
.range([0, availableWidth])
.paddingInner(relativeInnerPadding);
- const yScale = scaleLinear()
- .domain([0, maxY])
- .range([availableHeight, 0]);
+ const yScale = scaleLinear().domain([0, maxY]).range([availableHeight, 0]);
return (
<svg className="bar-chart" height={height} width={width}>
diff --git a/server/sonar-web/src/main/js/components/charts/BubbleChart.tsx b/server/sonar-web/src/main/js/components/charts/BubbleChart.tsx
index 955d9f62610..e2c0f16e638 100644
--- a/server/sonar-web/src/main/js/components/charts/BubbleChart.tsx
+++ b/server/sonar-web/src/main/js/components/charts/BubbleChart.tsx
@@ -77,7 +77,7 @@ export default class BubbleChart<T> extends React.PureComponent<Props<T>, State>
formatXTick: (d: number) => String(d),
formatYTick: (d: number) => String(d),
padding: [10, 10, 10, 10],
- sizeRange: [5, 45]
+ sizeRange: [5, 45],
};
constructor(props: Props<T>) {
@@ -90,16 +90,14 @@ export default class BubbleChart<T> extends React.PureComponent<Props<T>, State>
const rect = this.node.getBoundingClientRect();
this.zoom.translateExtent([
[0, 0],
- [rect.width, rect.height]
+ [rect.width, rect.height],
]);
}
}
boundNode = (node: SVGSVGElement) => {
this.node = node;
- this.zoom = zoom()
- .scaleExtent([1, 10])
- .on('zoom', this.zoomed);
+ this.zoom = zoom().scaleExtent([1, 10]).on('zoom', this.zoomed);
select(this.node).call(this.zoom as any);
};
@@ -110,8 +108,8 @@ export default class BubbleChart<T> extends React.PureComponent<Props<T>, State>
transform: {
x: x + padding[3] * (k - 1),
y: y + padding[0] * (k - 1),
- k
- }
+ k,
+ },
});
};
@@ -124,16 +122,16 @@ export default class BubbleChart<T> extends React.PureComponent<Props<T>, State>
};
getXRange(xScale: Scale, sizeScale: Scale, availableWidth: number) {
- const minX = min(this.props.items, d => xScale(d.x) - sizeScale(d.size)) || 0;
- const maxX = max(this.props.items, d => xScale(d.x) + sizeScale(d.size)) || 0;
+ const minX = min(this.props.items, (d) => xScale(d.x) - sizeScale(d.size)) || 0;
+ const maxX = max(this.props.items, (d) => xScale(d.x) + sizeScale(d.size)) || 0;
const dMinX = minX < 0 ? xScale.range()[0] - minX : xScale.range()[0];
const dMaxX = maxX > xScale.range()[1] ? maxX - xScale.range()[1] : 0;
return [dMinX, availableWidth - dMaxX];
}
getYRange(yScale: Scale, sizeScale: Scale, availableHeight: number) {
- const minY = min(this.props.items, d => yScale(d.y) - sizeScale(d.size)) || 0;
- const maxY = max(this.props.items, d => yScale(d.y) + sizeScale(d.size)) || 0;
+ const minY = min(this.props.items, (d) => yScale(d.y) - sizeScale(d.size)) || 0;
+ const maxY = max(this.props.items, (d) => yScale(d.y) + sizeScale(d.size)) || 0;
const dMinY = minY < 0 ? yScale.range()[1] - minY : yScale.range()[1];
const dMaxY = maxY > yScale.range()[0] ? maxY - yScale.range()[0] : 0;
return [availableHeight - dMaxY, dMinY];
@@ -141,7 +139,7 @@ export default class BubbleChart<T> extends React.PureComponent<Props<T>, State>
getTicks(scale: Scale, format: (d: number) => string) {
const zoomAmount = Math.ceil(this.state.transform.k);
- const ticks = scale.ticks(TICKS_COUNT * zoomAmount).map(tick => format(tick));
+ const ticks = scale.ticks(TICKS_COUNT * zoomAmount).map((tick) => format(tick));
const uniqueTicksCount = uniq(ticks).length;
const ticksCount =
uniqueTicksCount < TICKS_COUNT * zoomAmount ? uniqueTicksCount - 1 : TICKS_COUNT * zoomAmount;
@@ -243,7 +241,8 @@ export default class BubbleChart<T> extends React.PureComponent<Props<T>, State>
// eslint-disable-next-line react/no-array-index-key
key={index}
x={x}
- y={y}>
+ y={y}
+ >
{innerText}
</text>
) : null;
@@ -258,15 +257,15 @@ export default class BubbleChart<T> extends React.PureComponent<Props<T>, State>
const availableHeight = this.props.height - this.props.padding[0] - this.props.padding[2];
const xScale = scaleLinear()
- .domain(this.props.xDomain || [0, max(this.props.items, d => d.x) || 0])
+ .domain(this.props.xDomain || [0, max(this.props.items, (d) => d.x) || 0])
.range([0, availableWidth])
.nice();
const yScale = scaleLinear()
- .domain(this.props.yDomain || [0, max(this.props.items, d => d.y) || 0])
+ .domain(this.props.yDomain || [0, max(this.props.items, (d) => d.y) || 0])
.range([availableHeight, 0])
.nice();
const sizeScale = scaleLinear()
- .domain(this.props.sizeDomain || [0, max(this.props.items, d => d.size) || 0])
+ .domain(this.props.sizeDomain || [0, max(this.props.items, (d) => d.size) || 0])
.range(this.props.sizeRange || []);
const xScaleOriginal = xScale.copy();
@@ -275,7 +274,7 @@ export default class BubbleChart<T> extends React.PureComponent<Props<T>, State>
xScale.range(this.getXRange(xScale, sizeScale, availableWidth));
yScale.range(this.getYRange(yScale, sizeScale, availableHeight));
- const bubbles = sortBy(this.props.items, b => -b.size).map((item, index) => {
+ const bubbles = sortBy(this.props.items, (b) => -b.size).map((item, index) => {
return (
<Bubble
color={item.color}
@@ -299,7 +298,8 @@ export default class BubbleChart<T> extends React.PureComponent<Props<T>, State>
className={classNames('bubble-chart')}
height={this.props.height}
ref={this.boundNode}
- width={width}>
+ width={width}
+ >
<defs>
<clipPath id="graph-region">
<rect
@@ -336,7 +336,7 @@ export default class BubbleChart<T> extends React.PureComponent<Props<T>, State>
</Link>
</Tooltip>
</div>
- <AutoSizer disableHeight={true}>{size => this.renderChart(size.width)}</AutoSizer>
+ <AutoSizer disableHeight={true}>{(size) => this.renderChart(size.width)}</AutoSizer>
</div>
);
}
diff --git a/server/sonar-web/src/main/js/components/charts/ColorGradientLegend.tsx b/server/sonar-web/src/main/js/components/charts/ColorGradientLegend.tsx
index 98b37510dfb..8cd5c7659e9 100644
--- a/server/sonar-web/src/main/js/components/charts/ColorGradientLegend.tsx
+++ b/server/sonar-web/src/main/js/components/charts/ColorGradientLegend.tsx
@@ -42,7 +42,7 @@ export default function ColorGradientLegend({
padding = [12, 24, 0, 0],
height,
showColorNA = false,
- width
+ width,
}: Props) {
const colorRange: Array<string | number> = colorScale.range();
const colorDomain: Array<string | number> = colorScale.domain();
@@ -65,8 +65,9 @@ export default function ColorGradientLegend({
width="30"
height="30"
patternTransform="rotate(45 0 0)"
- patternUnits="userSpaceOnUse">
- {NA_GRADIENT_LINE_INCREMENTS.map(i => (
+ patternUnits="userSpaceOnUse"
+ >
+ {NA_GRADIENT_LINE_INCREMENTS.map((i) => (
<React.Fragment key={i}>
<line
x1={i}
@@ -95,7 +96,8 @@ export default function ColorGradientLegend({
// eslint-disable-next-line react/no-array-index-key
key={idx}
x={widthNoPadding * (idx / lastDomainIdx)}
- y={0}>
+ y={0}
+ >
{d}
</text>
))}
@@ -113,7 +115,8 @@ export default function ColorGradientLegend({
className="gradient-legend-na"
dy="-2px"
x={NA_SPACING + (padding[1] - NA_SPACING) / 2}
- y={0}>
+ y={0}
+ >
N/A
</text>
</g>
diff --git a/server/sonar-web/src/main/js/components/charts/ColorRatingsLegend.tsx b/server/sonar-web/src/main/js/components/charts/ColorRatingsLegend.tsx
index 982d0fea5c6..526f303b240 100644
--- a/server/sonar-web/src/main/js/components/charts/ColorRatingsLegend.tsx
+++ b/server/sonar-web/src/main/js/components/charts/ColorRatingsLegend.tsx
@@ -38,23 +38,26 @@ export default function ColorRatingsLegend(props: ColorRatingsLegendProps) {
const { className, filters } = props;
return (
<ul className={classNames('color-box-legend', className)}>
- {RATINGS.map(rating => (
+ {RATINGS.map((rating) => (
<li key={rating}>
<Tooltip
overlay={translateWithParameters(
'component_measures.legend.help_x',
formatMeasure(rating, 'RATING')
- )}>
+ )}
+ >
<Checkbox
className="display-flex-center"
checked={!filters[rating]}
- onCheck={() => props.onRatingClick(rating)}>
+ onCheck={() => props.onRatingClick(rating)}
+ >
<span
className="color-box-legend-rating little-spacer-left"
style={{
borderColor: RATING_COLORS[rating - 1].stroke,
- backgroundColor: RATING_COLORS[rating - 1].fillTransparent
- }}>
+ backgroundColor: RATING_COLORS[rating - 1].fillTransparent,
+ }}
+ >
{formatMeasure(rating, 'RATING')}
</span>
</Checkbox>
diff --git a/server/sonar-web/src/main/js/components/charts/DonutChart.tsx b/server/sonar-web/src/main/js/components/charts/DonutChart.tsx
index cee0f656c9e..3fbd261f68c 100644
--- a/server/sonar-web/src/main/js/components/charts/DonutChart.tsx
+++ b/server/sonar-web/src/main/js/components/charts/DonutChart.tsx
@@ -45,7 +45,7 @@ export default function DonutChart(props: DonutChartProps) {
const pie = d3Pie<any, DataPoint>()
.sort(null)
- .value(d => d.value);
+ .value((d) => d.value);
if (padAngle !== undefined) {
pie.padAngle(padAngle);
diff --git a/server/sonar-web/src/main/js/components/charts/Histogram.tsx b/server/sonar-web/src/main/js/components/charts/Histogram.tsx
index 22d634edcf6..f2dc6aa4641 100644
--- a/server/sonar-web/src/main/js/components/charts/Histogram.tsx
+++ b/server/sonar-web/src/main/js/components/charts/Histogram.tsx
@@ -92,7 +92,8 @@ export default class Histogram extends React.PureComponent<Props> {
dx={alignTicks ? 0 : '-1em'}
dy="0.3em"
x={x}
- y={y}>
+ y={y}
+ >
{tick}
</text>
);
diff --git a/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx b/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx
index 18dc1af38c6..377562b85d8 100644
--- a/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx
+++ b/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx
@@ -34,19 +34,19 @@ interface LanguageDistributionProps {
const NUMBER_FORMAT_THRESHOLD = 1000;
export function LanguageDistribution(props: LanguageDistributionProps) {
- let distribution = props.distribution.split(';').map(point => {
+ let distribution = props.distribution.split(';').map((point) => {
const tokens = point.split('=');
return { language: tokens[0], lines: parseInt(tokens[1], 10) };
});
- distribution = sortBy(distribution, d => -d.lines);
+ distribution = sortBy(distribution, (d) => -d.lines);
- const data = distribution.map(d => d.lines);
- const yTicks = distribution.map(d => getLanguageName(d.language)).map(cutLanguageName);
- const yTooltips = distribution.map(d =>
+ const data = distribution.map((d) => d.lines);
+ const yTicks = distribution.map((d) => getLanguageName(d.language)).map(cutLanguageName);
+ const yTooltips = distribution.map((d) =>
d.lines > NUMBER_FORMAT_THRESHOLD ? formatMeasure(d.lines, MetricType.Integer) : ''
);
- const yValues = distribution.map(d => formatMeasure(d.lines, MetricType.ShortInteger));
+ const yValues = distribution.map((d) => formatMeasure(d.lines, MetricType.ShortInteger));
return (
<Histogram
diff --git a/server/sonar-web/src/main/js/components/charts/LineChart.tsx b/server/sonar-web/src/main/js/components/charts/LineChart.tsx
index f08097ac18c..8354644e19c 100644
--- a/server/sonar-web/src/main/js/components/charts/LineChart.tsx
+++ b/server/sonar-web/src/main/js/components/charts/LineChart.tsx
@@ -52,16 +52,16 @@ export default class LineChart extends React.PureComponent<Props> {
}
const area = d3Area<DataPoint>()
- .x(d => xScale(d.x))
+ .x((d) => xScale(d.x))
.y0(yScale.range()[0])
- .y1(d => yScale(d.y || 0))
- .defined(d => d.y != null)
+ .y1((d) => yScale(d.y || 0))
+ .defined((d) => d.y != null)
.curve(curveBasis);
let { data } = this.props;
if (this.props.backdropConstraints) {
const c = this.props.backdropConstraints;
- data = data.filter(d => c[0] <= d.x && d.x <= c[1]);
+ data = data.filter((d) => c[0] <= d.x && d.x <= c[1]);
}
return <path className="line-chart-backdrop" d={area(data) as string} />;
@@ -75,7 +75,7 @@ export default class LineChart extends React.PureComponent<Props> {
}
const points = this.props.data
- .filter(point => point.y != null)
+ .filter((point) => point.y != null)
.map((point, index) => {
const x = xScale(point.x);
const y = yScale(point.y || 0);
@@ -146,9 +146,9 @@ export default class LineChart extends React.PureComponent<Props> {
renderLine(xScale: ScaleLinear<number, number>, yScale: ScaleLinear<number, number>) {
const p = d3Line<DataPoint>()
- .x(d => xScale(d.x))
- .y(d => yScale(d.y || 0))
- .defined(d => d.y != null)
+ .x((d) => xScale(d.x))
+ .y((d) => yScale(d.y || 0))
+ .defined((d) => d.y != null)
.curve(curveBasis);
return <path className="line-chart-path" d={p(this.props.data) as string} />;
}
@@ -164,14 +164,14 @@ export default class LineChart extends React.PureComponent<Props> {
const availableHeight = height - padding[0] - padding[2];
const xScale = scaleLinear()
- .domain(extent(this.props.data, d => d.x) as [number, number])
+ .domain(extent(this.props.data, (d) => d.x) as [number, number])
.range([0, availableWidth]);
const yScale = scaleLinear().range([availableHeight, 0]);
if (this.props.domain) {
yScale.domain(this.props.domain);
} else {
- const maxY = max(this.props.data, d => d.y) as number;
+ const maxY = max(this.props.data, (d) => d.y) as number;
yScale.domain([0, maxY]);
}
@@ -193,7 +193,7 @@ export default class LineChart extends React.PureComponent<Props> {
return this.props.width !== undefined ? (
this.renderChart(this.props.width)
) : (
- <AutoSizer disableHeight={true}>{size => this.renderChart(size.width)}</AutoSizer>
+ <AutoSizer disableHeight={true}>{(size) => this.renderChart(size.width)}</AutoSizer>
);
}
}
diff --git a/server/sonar-web/src/main/js/components/charts/TreeMap.tsx b/server/sonar-web/src/main/js/components/charts/TreeMap.tsx
index 9e55af3a974..68357581674 100644
--- a/server/sonar-web/src/main/js/components/charts/TreeMap.tsx
+++ b/server/sonar-web/src/main/js/components/charts/TreeMap.tsx
@@ -75,20 +75,18 @@ export default class TreeMap extends React.PureComponent<Props> {
render() {
const { items, height, width } = this.props;
const hierarchy = d3Hierarchy({ children: items } as HierarchicalTreemapItem)
- .sum(d => d.size)
+ .sum((d) => d.size)
.sort((a, b) => (b.value || 0) - (a.value || 0));
- const treemap = d3Treemap<TreeMapItem>()
- .round(true)
- .size([width, height]);
+ const treemap = d3Treemap<TreeMapItem>().round(true).size([width, height]);
const nodes = treemap(hierarchy).leaves();
- const prefix = this.mostCommitPrefix(items.map(item => item.label));
+ const prefix = this.mostCommitPrefix(items.map((item) => item.label));
const halfWidth = width / 2;
return (
<div className="sonar-d3">
<div className="treemap-container" style={{ width, height }}>
- {nodes.map(node => (
+ {nodes.map((node) => (
<TreeMapRect
fill={node.data.color}
gradient={node.data.gradient}
diff --git a/server/sonar-web/src/main/js/components/charts/TreeMapRect.tsx b/server/sonar-web/src/main/js/components/charts/TreeMapRect.tsx
index 40ac38666fa..1ef42c2e899 100644
--- a/server/sonar-web/src/main/js/components/charts/TreeMapRect.tsx
+++ b/server/sonar-web/src/main/js/components/charts/TreeMapRect.tsx
@@ -25,10 +25,7 @@ import Link from '../common/Link';
import Tooltip, { Placement } from '../controls/Tooltip';
import LinkIcon from '../icons/LinkIcon';
-const SIZE_SCALE = scaleLinear()
- .domain([3, 15])
- .range([11, 18])
- .clamp(true);
+const SIZE_SCALE = scaleLinear().domain([3, 15]).range([11, 18]).clamp(true);
interface Props {
fill?: string;
@@ -88,7 +85,7 @@ export default class TreeMapRect extends React.PureComponent<Props> {
backgroundSize: '12px 12px',
fontSize: SIZE_SCALE(this.props.width / this.props.label.length),
lineHeight: `${this.props.height}px`,
- cursor: this.props.onClick != null ? 'pointer' : 'default'
+ cursor: this.props.onClick != null ? 'pointer' : 'default',
};
const isTextVisible =
this.props.width >= TEXT_VISIBLE_AT_WIDTH && this.props.height >= TEXT_VISIBLE_AT_HEIGHT;
@@ -101,7 +98,8 @@ export default class TreeMapRect extends React.PureComponent<Props> {
onClick={this.handleRectClick}
role="treeitem"
style={cellStyles}
- tabIndex={0}>
+ tabIndex={0}
+ >
{isTextVisible && (
<div className="treemap-inner" style={{ maxWidth: this.props.width }}>
{this.props.prefix || this.props.value ? (
diff --git a/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.tsx b/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.tsx
index 01e9951d87e..1a46ea54772 100644
--- a/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.tsx
+++ b/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.tsx
@@ -59,7 +59,7 @@ type YScale = any;
export default class ZoomTimeLine extends React.PureComponent<Props, State> {
static defaultProps = {
padding: [0, 0, 18, 0],
- showXTicks: true
+ showXTicks: true,
};
constructor(props: Props) {
@@ -69,15 +69,11 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
}
getRatingScale = (availableHeight: number) => {
- return scalePoint<number>()
- .domain([5, 4, 3, 2, 1])
- .range([availableHeight, 0]);
+ return scalePoint<number>().domain([5, 4, 3, 2, 1]).range([availableHeight, 0]);
};
getLevelScale = (availableHeight: number) => {
- return scalePoint()
- .domain(['ERROR', 'WARN', 'OK'])
- .range([availableHeight, 0]);
+ return scalePoint().domain(['ERROR', 'WARN', 'OK']).range([availableHeight, 0]);
};
getYScale = (availableHeight: number, flatData: Chart.Point[]): YScale => {
@@ -88,13 +84,13 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
}
return scaleLinear()
.range([availableHeight, 0])
- .domain([0, max(flatData, d => Number(d.y || 0)) as number])
+ .domain([0, max(flatData, (d) => Number(d.y || 0)) as number])
.nice();
};
getXScale = (availableWidth: number, flatData: Chart.Point[]): XScale => {
return scaleTime()
- .domain(extent(flatData, d => d.x) as [Date, Date])
+ .domain(extent(flatData, (d) => d.x) as [Date, Date])
.range([0, availableWidth])
.clamp(true);
};
@@ -102,10 +98,10 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
getScales = () => {
const availableWidth = this.props.width - this.props.padding[1] - this.props.padding[3];
const availableHeight = this.props.height - this.props.padding[0] - this.props.padding[2];
- const flatData = flatten(this.props.series.map(serie => serie.data));
+ const flatData = flatten(this.props.series.map((serie) => serie.data));
return {
xScale: this.getXScale(availableWidth, flatData),
- yScale: this.getYScale(availableHeight, flatData)
+ yScale: this.getYScale(availableHeight, flatData),
};
};
@@ -118,34 +114,29 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
this.handleZoomUpdate(xScale, xDim);
};
- handleSelectionDrag = (xScale: XScale, width: number, xDim: number[], checkDelta = false) => (
- _: MouseEvent,
- data: DraggableData
- ) => {
- if (!checkDelta || data.deltaX) {
- const x = Math.max(xDim[0], Math.min(data.x, xDim[1] - width));
- this.handleZoomUpdate(xScale, [x, width + x]);
- }
- };
+ handleSelectionDrag =
+ (xScale: XScale, width: number, xDim: number[], checkDelta = false) =>
+ (_: MouseEvent, data: DraggableData) => {
+ if (!checkDelta || data.deltaX) {
+ const x = Math.max(xDim[0], Math.min(data.x, xDim[1] - width));
+ this.handleZoomUpdate(xScale, [x, width + x]);
+ }
+ };
- handleSelectionHandleDrag = (
- xScale: XScale,
- fixedX: number,
- xDim: number[],
- handleDirection: string,
- checkDelta = false
- ) => (_: MouseEvent, data: DraggableData) => {
- if (!checkDelta || data.deltaX) {
- const x = Math.max(xDim[0], Math.min(data.x, xDim[1]));
- this.handleZoomUpdate(xScale, handleDirection === 'right' ? [fixedX, x] : [x, fixedX]);
- }
- };
+ handleSelectionHandleDrag =
+ (xScale: XScale, fixedX: number, xDim: number[], handleDirection: string, checkDelta = false) =>
+ (_: MouseEvent, data: DraggableData) => {
+ if (!checkDelta || data.deltaX) {
+ const x = Math.max(xDim[0], Math.min(data.x, xDim[1]));
+ this.handleZoomUpdate(xScale, handleDirection === 'right' ? [fixedX, x] : [x, fixedX]);
+ }
+ };
handleNewZoomDragStart = (xDim: number[]) => (_: MouseEvent, data: DraggableData) => {
const overlayLeftPos = data.node.getBoundingClientRect().left;
this.setState({
overlayLeftPos,
- newZoomStart: Math.round(Math.max(xDim[0], Math.min(data.x - overlayLeftPos, xDim[1])))
+ newZoomStart: Math.round(Math.max(xDim[0], Math.min(data.x - overlayLeftPos, xDim[1]))),
});
};
@@ -159,17 +150,15 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
}
};
- handleNewZoomDragEnd = (xScale: XScale, xDim: number[]) => (
- _: MouseEvent,
- data: DraggableData
- ) => {
- const { newZoomStart, overlayLeftPos } = this.state;
- if (newZoomStart !== undefined && overlayLeftPos !== undefined) {
- const x = Math.round(Math.max(xDim[0], Math.min(data.x - overlayLeftPos, xDim[1])));
- this.handleZoomUpdate(xScale, newZoomStart === x ? xDim : sortBy([newZoomStart, x]));
- this.setState({ newZoomStart: undefined, overlayLeftPos: undefined });
- }
- };
+ handleNewZoomDragEnd =
+ (xScale: XScale, xDim: number[]) => (_: MouseEvent, data: DraggableData) => {
+ const { newZoomStart, overlayLeftPos } = this.state;
+ if (newZoomStart !== undefined && overlayLeftPos !== undefined) {
+ const x = Math.round(Math.max(xDim[0], Math.min(data.x - overlayLeftPos, xDim[1])));
+ this.handleZoomUpdate(xScale, newZoomStart === x ? xDim : sortBy([newZoomStart, x]));
+ this.setState({ newZoomStart: undefined, overlayLeftPos: undefined });
+ }
+ };
handleZoomUpdate = (xScale: XScale, xArray: number[]) => {
const xRange = xScale.range();
@@ -235,9 +224,9 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
renderLines = (xScale: XScale, yScale: YScale) => {
const lineGenerator = d3Line<Chart.Point>()
- .defined(d => Boolean(d.y || d.y === 0))
- .x(d => xScale(d.x))
- .y(d => yScale(d.y));
+ .defined((d) => Boolean(d.y || d.y === 0))
+ .x((d) => xScale(d.x))
+ .y((d) => yScale(d.y));
if (this.props.basisCurve) {
lineGenerator.curve(curveBasis);
}
@@ -256,9 +245,9 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
renderAreas = (xScale: XScale, yScale: YScale) => {
const areaGenerator = area<Chart.Point>()
- .defined(d => Boolean(d.y || d.y === 0))
- .x(d => xScale(d.x))
- .y1(d => yScale(d.y))
+ .defined((d) => Boolean(d.y || d.y === 0))
+ .x((d) => xScale(d.x))
+ .y1((d) => yScale(d.y))
.y0(yScale(0));
if (this.props.basisCurve) {
areaGenerator.curve(curveBasis);
@@ -300,7 +289,8 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
options.xDim,
options.direction
)}
- position={{ x: options.xPos, y: 0 }}>
+ position={{ x: options.xPos, y: 0 }}
+ >
<rect
className="zoom-selection-handle"
height={options.yDim[0] - options.yDim[1] + 1}
@@ -330,7 +320,8 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
<DraggableCore
onDrag={this.handleNewZoomDrag(xScale, xDim)}
onStart={this.handleNewZoomDragStart(xDim)}
- onStop={this.handleNewZoomDragEnd(xScale, xDim)}>
+ onStop={this.handleNewZoomDragEnd(xScale, xDim)}
+ >
<rect
className="zoom-overlay"
height={yDim[0] - yDim[1]}
@@ -345,7 +336,8 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
bounds={{ left: xDim[0], right: Math.floor(xDim[1] - zoomBoxWidth) } as DraggableBounds}
onDrag={this.handleSelectionDrag(xScale, zoomBoxWidth, xDim, true)}
onStop={this.handleSelectionDrag(xScale, zoomBoxWidth, xDim)}
- position={{ x: xArray[0], y: 0 }}>
+ position={{ x: xArray[0], y: 0 }}
+ >
<rect
className="zoom-selection"
height={yDim[0] - yDim[1] + 1}
@@ -363,7 +355,7 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
fixedPos: endX,
xDim,
yDim,
- direction: 'left'
+ direction: 'left',
})}
{showZoomArea &&
this.renderZoomHandle({
@@ -372,7 +364,7 @@ export default class ZoomTimeLine extends React.PureComponent<Props, State> {
fixedPos: startX,
xDim,
yDim,
- direction: 'right'
+ direction: 'right',
})}
</g>
);
diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/AdvancedTimeline-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/AdvancedTimeline-test.tsx
index d9f5beea736..91b9cb80fe1 100644
--- a/server/sonar-web/src/main/js/components/charts/__tests__/AdvancedTimeline-test.tsx
+++ b/server/sonar-web/src/main/js/components/charts/__tests__/AdvancedTimeline-test.tsx
@@ -30,7 +30,7 @@ jest.mock('d3-scale', () => {
return {
...others,
- scaleTime: scaleUtc
+ scaleTime: scaleUtc,
};
});
@@ -44,7 +44,7 @@ it('should render correctly', () => {
expect(shallowRender({ disableZoom: false, updateZoom: () => {} })).toMatchSnapshot(
'Zoom enabled'
);
- expect(shallowRender({ formatYTick: t => `Nicer tick ${t}` })).toMatchSnapshot('format y tick');
+ expect(shallowRender({ formatYTick: (t) => `Nicer tick ${t}` })).toMatchSnapshot('format y tick');
expect(shallowRender({ width: undefined })).toMatchSnapshot('no width');
expect(shallowRender({ height: undefined })).toMatchSnapshot('no height');
expect(shallowRender({ showAreas: undefined })).toMatchSnapshot('no areas');
@@ -61,7 +61,7 @@ it('should render leak correctly', () => {
it('should render leak legend correctly', () => {
const wrapper = shallowRender({
displayNewCodeLegend: true,
- leakPeriodDate: new Date('2019-10-02')
+ leakPeriodDate: new Date('2019-10-02'),
});
const leakNode = wrapper;
@@ -81,8 +81,8 @@ it('should render leak legend correctly for small leak', () => {
mockData(4, '2020-02-04'),
mockData(5, '2020-02-05'),
mockData(6, '2020-02-06'),
- mockData(7, '2020-02-07')
- ]
+ mockData(7, '2020-02-07'),
+ ],
});
const leakNode = wrapper;
@@ -94,7 +94,7 @@ it('should set leakLegendTextWidth correctly', () => {
const wrapper = shallowRender();
wrapper.instance().setLeakLegendTextWidth({
- getBoundingClientRect: () => ({ width: 12 } as DOMRect)
+ getBoundingClientRect: () => ({ width: 12 } as DOMRect),
} as SVGTextElement);
expect(wrapper.state().leakLegendTextWidth).toBe(12);
@@ -155,14 +155,14 @@ it('should handle scroll correcly', () => {
let updateZoom = jest.fn();
let preventDefault = jest.fn();
let wrapper = shallowRender({ updateZoom });
- wrapper.instance().handleWheel(({
+ wrapper.instance().handleWheel({
preventDefault,
deltaX: 1,
deltaY: -2,
deltaZ: 0,
pageX: 100,
pageY: 1,
- currentTarget: ({
+ currentTarget: {
getBoundingClientRect: () => ({
bottom: 0,
height: 100,
@@ -172,17 +172,17 @@ it('should handle scroll correcly', () => {
top: 10,
x: 12,
y: 23,
- toJSON: () => ''
- })
- } as any) as SVGElement
- } as any) as React.WheelEvent<SVGElement>);
+ toJSON: () => '',
+ }),
+ } as any as SVGElement,
+ } as any as React.WheelEvent<SVGElement>);
expect(preventDefault).toHaveBeenCalled();
expect(updateZoom).toHaveBeenCalledWith(new Date('2019-10-01T06:24:00.000Z'), undefined);
updateZoom = jest.fn();
preventDefault = jest.fn();
wrapper = shallowRender({ updateZoom });
- wrapper.instance().handleWheel(({
+ wrapper.instance().handleWheel({
preventDefault,
deltaX: 1,
deltaY: 2,
@@ -190,7 +190,7 @@ it('should handle scroll correcly', () => {
pageX: 100,
pageY: 1,
deltaMode: 25,
- currentTarget: ({
+ currentTarget: {
getBoundingClientRect: () => ({
bottom: 0,
height: 100,
@@ -200,10 +200,10 @@ it('should handle scroll correcly', () => {
top: 10,
x: 12,
y: 23,
- toJSON: () => ''
- })
- } as any) as SVGElement
- } as any) as React.WheelEvent<SVGElement>);
+ toJSON: () => '',
+ }),
+ } as any as SVGElement,
+ } as any as React.WheelEvent<SVGElement>);
expect(preventDefault).toHaveBeenCalled();
expect(updateZoom).toHaveBeenCalledWith(undefined, new Date('2019-10-02T20:48:00.000Z'));
});
@@ -215,7 +215,7 @@ it('should handle mouse out correcly', () => {
mouseOver: true,
selectedDate: new Date(),
selectedDateXPos: 1,
- selectedDateIdx: 1
+ selectedDateIdx: 1,
});
wrapper.instance().handleMouseOut();
expect(wrapper.state().mouseOver).toBe(true);
@@ -257,13 +257,13 @@ function shallowRender(props?: Partial<AdvancedTimeline['props']>) {
data: [
{
x: new Date('2019-10-01'),
- y: 1
+ y: 1,
},
{
x: new Date('2019-10-02'),
- y: 2
- }
- ]
+ y: 2,
+ },
+ ],
},
{
name: 'test-2',
@@ -272,10 +272,10 @@ function shallowRender(props?: Partial<AdvancedTimeline['props']>) {
data: [
{
x: new Date('2019-10-03'),
- y: 3
- }
- ]
- }
+ y: 3,
+ },
+ ],
+ },
]}
width={100}
zoomSpeed={1}
@@ -289,6 +289,6 @@ function mockData(i: number, date: string): Chart.Serie {
name: `t${i}`,
type: 'type',
translatedName: '',
- data: [{ x: new Date(date), y: i }]
+ data: [{ x: new Date(date), y: i }],
};
}
diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx
index 040c7fcd861..371c37ee5d2 100644
--- a/server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx
+++ b/server/sonar-web/src/main/js/components/charts/__tests__/BarChart-test.tsx
@@ -25,7 +25,7 @@ it('should display bars', () => {
const data = [
{ x: 1, y: 10, description: '' },
{ x: 2, y: 30, description: '' },
- { x: 3, y: 20, description: '' }
+ { x: 3, y: 20, description: '' },
];
const chart = shallow(<BarChart barsWidth={20} data={data} height={100} width={100} />);
expect(chart.find('.bar-chart-bar').length).toBe(3);
@@ -35,7 +35,7 @@ it('should display ticks', () => {
const data = [
{ x: 1, y: 10, description: '' },
{ x: 2, y: 30, description: '' },
- { x: 3, y: 20, description: '' }
+ { x: 3, y: 20, description: '' },
];
const ticks = ['A', 'B', 'C'];
const chart = shallow(
@@ -48,7 +48,7 @@ it('should display values', () => {
const data = [
{ x: 1, y: 10, description: '' },
{ x: 2, y: 30, description: '' },
- { x: 3, y: 20, description: '' }
+ { x: 3, y: 20, description: '' },
];
const values = ['A', 'B', 'C'];
const chart = shallow(
@@ -61,7 +61,7 @@ it('should display bars, ticks and values', () => {
const data = [
{ x: 1, y: 10, description: '' },
{ x: 2, y: 30, description: '' },
- { x: 3, y: 20, description: '' }
+ { x: 3, y: 20, description: '' },
];
const ticks = ['A', 'B', 'C'];
const values = ['A', 'B', 'C'];
diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/BubbleChart-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/BubbleChart-test.tsx
index 91bf26bb3ac..69d1fe49fe9 100644
--- a/server/sonar-web/src/main/js/components/charts/__tests__/BubbleChart-test.tsx
+++ b/server/sonar-web/src/main/js/components/charts/__tests__/BubbleChart-test.tsx
@@ -30,17 +30,17 @@ import { ComponentMeasureEnhanced } from '../../../types/types';
import BubbleChart from '../BubbleChart';
jest.mock('react-virtualized/dist/commonjs/AutoSizer', () => ({
- AutoSizer: ({ children }: AutoSizerProps) => children({ width: 100, height: NaN })
+ AutoSizer: ({ children }: AutoSizerProps) => children({ width: 100, height: NaN }),
}));
jest.mock('d3-selection', () => ({
- select: jest.fn().mockReturnValue({ call: jest.fn() })
+ select: jest.fn().mockReturnValue({ call: jest.fn() }),
}));
jest.mock('d3-zoom', () => {
return {
zoomidentity: { k: 1, tx: 0, ty: 0 },
- zoom: jest.fn()
+ zoom: jest.fn(),
};
});
@@ -52,7 +52,7 @@ it('should display bubbles', () => {
.find(AutoSizer)
.dive()
.find('Bubble')
- .forEach(bubble => {
+ .forEach((bubble) => {
expect(bubble.dive()).toMatchSnapshot();
});
});
@@ -61,14 +61,14 @@ it('should render bubble links', () => {
const wrapper = shallowRender({
items: [
{ x: 1, y: 10, size: 7, color: { fill: 'blue', stroke: 'blue' } },
- { x: 2, y: 30, size: 5, color: { fill: 'green', stroke: 'green' } }
- ]
+ { x: 2, y: 30, size: 5, color: { fill: 'green', stroke: 'green' } },
+ ],
});
wrapper
.find(AutoSizer)
.dive()
.find('Bubble')
- .forEach(bubble => {
+ .forEach((bubble) => {
expect(bubble.dive()).toMatchSnapshot();
});
});
@@ -80,7 +80,7 @@ it('should render bubbles with click handlers', () => {
.find(AutoSizer)
.dive()
.find('Bubble')
- .forEach(bubble => {
+ .forEach((bubble) => {
click(bubble.dive().find('a'));
expect(bubble.dive()).toMatchSnapshot();
});
@@ -104,7 +104,7 @@ it('should correctly handle zooming', () => {
const wrapper = shallowRender({ padding: [5, 5, 5, 5] });
wrapper.instance().boundNode(
mockHtmlElement<SVGSVGElement>({
- getBoundingClientRect: () => ({ width: 100, height: 100 } as DOMRect)
+ getBoundingClientRect: () => ({ width: 100, height: 100 } as DOMRect),
})
);
@@ -117,14 +117,11 @@ it('should correctly handle zooming', () => {
expect(wrapper.state().transform).toEqual({
x: 105,
y: 105,
- k: 20
+ k: 20,
});
// Reset Zoom levels.
- const resetZoomClick = wrapper
- .find('div.bubble-chart-zoom')
- .find(Link)
- .props().onClick;
+ const resetZoomClick = wrapper.find('div.bubble-chart-zoom').find(Link).props().onClick;
if (!resetZoomClick) {
reject();
return;
@@ -151,15 +148,15 @@ function shallowRender(props: Partial<BubbleChart<ComponentMeasureEnhanced>['pro
y: 10,
size: 7,
data: mockComponentMeasureEnhanced(),
- color: { fill: 'blue', stroke: 'blue' }
+ color: { fill: 'blue', stroke: 'blue' },
},
{
x: 2,
y: 30,
size: 5,
data: mockComponentMeasureEnhanced(),
- color: { fill: 'red', stroke: 'red' }
- }
+ color: { fill: 'red', stroke: 'red' },
+ },
]}
padding={[0, 0, 0, 0]}
{...props}
diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx
index d9ba675f809..641fe076d2b 100644
--- a/server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx
+++ b/server/sonar-web/src/main/js/components/charts/__tests__/ColorGradientLegend-test.tsx
@@ -26,9 +26,7 @@ import ColorGradientLegend from '../ColorGradientLegend';
const COLORS = [colors.green, colors.lightGreen, colors.yellow, colors.orange, colors.red];
it('should render properly', () => {
- const colorScale = scaleLinear<string, string>()
- .domain([0, 25, 50, 75, 100])
- .range(COLORS);
+ const colorScale = scaleLinear<string, string>().domain([0, 25, 50, 75, 100]).range(COLORS);
const wrapper = shallow(
<ColorGradientLegend
className="measure-details-treemap-legend"
diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx
index 409f712b3e5..d5825eb111b 100644
--- a/server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx
+++ b/server/sonar-web/src/main/js/components/charts/__tests__/DonutChart-test.tsx
@@ -24,12 +24,7 @@ import DonutChart, { DonutChartProps } from '../DonutChart';
it('should render correctly', () => {
const wrapper = shallowRender();
expect(wrapper).toMatchSnapshot();
- expect(
- wrapper
- .find('Sector')
- .first()
- .dive()
- ).toMatchSnapshot();
+ expect(wrapper.find('Sector').first().dive()).toMatchSnapshot();
});
it('should render correctly with padding and pad angle too', () => {
@@ -41,7 +36,7 @@ function shallowRender(props: Partial<DonutChartProps> = {}) {
<DonutChart
data={[
{ fill: '#000000', value: 25 },
- { fill: '#ffffff', value: 75 }
+ { fill: '#ffffff', value: 75 },
]}
height={20}
thickness={2}
diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/Histogram-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/Histogram-test.tsx
index c6d81236294..ddd218eb7d6 100644
--- a/server/sonar-web/src/main/js/components/charts/__tests__/Histogram-test.tsx
+++ b/server/sonar-web/src/main/js/components/charts/__tests__/Histogram-test.tsx
@@ -26,7 +26,7 @@ jest.mock('d3-scale', () => {
const d3 = jest.requireActual('d3-scale');
return {
...d3,
- scaleBand: jest.fn(d3.scaleBand)
+ scaleBand: jest.fn(d3.scaleBand),
};
});
@@ -43,7 +43,7 @@ it('renders correctly', () => {
shallowRender({
yTicks: ['a', 'b', 'c'],
yTooltips: ['a - 100', 'b - 75', 'c - 150'],
- yValues: ['100.0', '75.0', '150.0']
+ yValues: ['100.0', '75.0', '150.0'],
})
).toMatchSnapshot('with yValues, yTicks and yTooltips');
});
@@ -53,7 +53,7 @@ it('correctly handles yScale() returning undefined', () => {
yScale.bandwidth = () => 1;
(scaleBand as jest.Mock).mockReturnValueOnce({
- domain: () => ({ rangeRound: () => yScale })
+ domain: () => ({ rangeRound: () => yScale }),
});
expect(
diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx
index a74ed22ebd5..fcafda1fed5 100644
--- a/server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx
+++ b/server/sonar-web/src/main/js/components/charts/__tests__/LineChart-test.tsx
@@ -25,7 +25,7 @@ it('should display line', () => {
const data = [
{ x: 1, y: 10 },
{ x: 2, y: 30 },
- { x: 3, y: 20 }
+ { x: 3, y: 20 },
];
const chart = shallow(<LineChart data={data} height={100} width={100} />);
expect(chart.find('.line-chart-path').length).toBe(1);
@@ -35,7 +35,7 @@ it('should display ticks', () => {
const data = [
{ x: 1, y: 10 },
{ x: 2, y: 30 },
- { x: 3, y: 20 }
+ { x: 3, y: 20 },
];
const ticks = ['A', 'B', 'C'];
const chart = shallow(<LineChart data={data} height={100} width={100} xTicks={ticks} />);
@@ -46,7 +46,7 @@ it('should display values', () => {
const data = [
{ x: 1, y: 10 },
{ x: 2, y: 30 },
- { x: 3, y: 20 }
+ { x: 3, y: 20 },
];
const values = ['A', 'B', 'C'];
const chart = shallow(<LineChart data={data} height={100} width={100} xValues={values} />);
diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/TreeMap-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/TreeMap-test.tsx
index aa071a54e7f..3526e0c4178 100644
--- a/server/sonar-web/src/main/js/components/charts/__tests__/TreeMap-test.tsx
+++ b/server/sonar-web/src/main/js/components/charts/__tests__/TreeMap-test.tsx
@@ -30,14 +30,14 @@ it('should render correctly', () => {
size: 10,
color: '#777',
label: 'SonarQube :: Server',
- component: mockComponentMeasureEnhanced()
+ component: mockComponentMeasureEnhanced(),
},
{
key: '2',
size: 30,
color: '#777',
label: 'SonarQube :: Web',
- component: mockComponentMeasureEnhanced()
+ component: mockComponentMeasureEnhanced(),
},
{
key: '3',
@@ -45,8 +45,8 @@ it('should render correctly', () => {
gradient: '#777',
label: 'SonarQube :: Search',
metric: { key: 'coverage', type: 'PERCENT' },
- component: mockComponentMeasureEnhanced()
- }
+ component: mockComponentMeasureEnhanced(),
+ },
];
const onRectClick = jest.fn();
const chart = mount(
@@ -56,7 +56,7 @@ it('should render correctly', () => {
expect(rects).toHaveLength(3);
const event: React.MouseEvent<HTMLAnchorElement> = {
- stopPropagation: jest.fn()
+ stopPropagation: jest.fn(),
} as any;
(rects.first().instance() as TreeMapRect).handleLinkClick(event);
diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/ZoomTimeLine-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/ZoomTimeLine-test.tsx
index 458c565546f..4ed8034f17f 100644
--- a/server/sonar-web/src/main/js/components/charts/__tests__/ZoomTimeLine-test.tsx
+++ b/server/sonar-web/src/main/js/components/charts/__tests__/ZoomTimeLine-test.tsx
@@ -28,17 +28,17 @@ const series = [
data: [
{
x: new Date('2020-01-01'),
- y: 'beginning'
+ y: 'beginning',
},
{
x: new Date('2020-02-01'),
- y: 'end'
- }
+ y: 'end',
+ },
],
name: 'foo',
translatedName: 'foo-translated',
- type: 'bar'
- }
+ type: 'bar',
+ },
];
it('should render correctly', () => {
@@ -55,11 +55,7 @@ it('should draw a graph with lines', () => {
});
it('should be zoomable', () => {
- expect(
- shallowRender()
- .find('.chart-zoom')
- .exists()
- ).toBe(true);
+ expect(shallowRender().find('.chart-zoom').exists()).toBe(true);
});
it('should render a leak period', () => {
@@ -71,11 +67,7 @@ it('should render a leak period', () => {
});
it('should render areas under the graph lines', () => {
- expect(
- shallowRender({ showAreas: true })
- .find('.line-chart-area')
- .exists()
- ).toBe(true);
+ expect(shallowRender({ showAreas: true }).find('.line-chart-area').exists()).toBe(true);
});
it('should handle zoom update correctly', () => {
@@ -83,12 +75,9 @@ it('should handle zoom update correctly', () => {
const startDate = new Date('1970-01-01T00:00:00.001Z');
const endDate = new Date('2000-01-01T00:00:00.001Z');
let wrapper = shallowRender({ updateZoom, startDate, endDate });
- wrapper.instance().handleZoomUpdate(
- scaleTime()
- .domain([startDate, endDate])
- .range([0, 150]),
- [3, 50]
- );
+ wrapper
+ .instance()
+ .handleZoomUpdate(scaleTime().domain([startDate, endDate]).range([0, 150]), [3, 50]);
expect(updateZoom).toHaveBeenCalledWith(
new Date('1970-08-08T03:21:36.001Z'),
new Date('1980-01-01T08:00:00.001Z')
@@ -98,12 +87,9 @@ it('should handle zoom update correctly', () => {
// We throttle the handleZoomUpdate so re-render to avoid issue
wrapper = shallowRender({ updateZoom, startDate, endDate });
- wrapper.instance().handleZoomUpdate(
- scaleTime()
- .domain([startDate, endDate])
- .range([0, 150]),
- [-1, 151]
- );
+ wrapper
+ .instance()
+ .handleZoomUpdate(scaleTime().domain([startDate, endDate]).range([0, 150]), [-1, 151]);
expect(updateZoom).toHaveBeenCalledWith(undefined, undefined);
});
diff --git a/server/sonar-web/src/main/js/components/common/ActivityLink.tsx b/server/sonar-web/src/main/js/components/common/ActivityLink.tsx
index 4bccbb4f0e3..fb4be5f134a 100644
--- a/server/sonar-web/src/main/js/components/common/ActivityLink.tsx
+++ b/server/sonar-web/src/main/js/components/common/ActivityLink.tsx
@@ -44,7 +44,8 @@ export default function ActivityLink(props: ActivityLinkProps) {
metric !== undefined && graph !== undefined && isCustomGraph(graph)
? getMeasureHistoryUrl(component, metric, branchLike)
: getActivityUrl(component, branchLike, graph)
- }>
+ }
+ >
<HistoryIcon className="little-spacer-right" size={14} />
<span>{label || translate('portfolio.activity_link')}</span>
</Link>
diff --git a/server/sonar-web/src/main/js/components/common/AnalysisWarningsModal.tsx b/server/sonar-web/src/main/js/components/common/AnalysisWarningsModal.tsx
index c0fd6951d4d..6530c793130 100644
--- a/server/sonar-web/src/main/js/components/common/AnalysisWarningsModal.tsx
+++ b/server/sonar-web/src/main/js/components/common/AnalysisWarningsModal.tsx
@@ -51,7 +51,7 @@ export class AnalysisWarningsModal extends React.PureComponent<Props, State> {
super(props);
this.state = {
loading: !props.warnings,
- warnings: props.warnings || []
+ warnings: props.warnings || [],
};
}
@@ -107,7 +107,7 @@ export class AnalysisWarningsModal extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
loading: false,
- warnings: warnings.map(w => ({ key: w, message: w, dismissable: false }))
+ warnings: warnings.map((w) => ({ key: w, message: w, dismissable: false })),
});
}
} catch (e) {
@@ -138,7 +138,7 @@ export class AnalysisWarningsModal extends React.PureComponent<Props, State> {
<span
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
- __html: sanitizeStringRestricted(message.trim().replace(/\n/g, '<br />'))
+ __html: sanitizeStringRestricted(message.trim().replace(/\n/g, '<br />')),
}}
/>
@@ -148,7 +148,8 @@ export class AnalysisWarningsModal extends React.PureComponent<Props, State> {
disabled={Boolean(dismissedWarning)}
onClick={() => {
this.handleDismissMessage(key);
- }}>
+ }}
+ >
{translate('dismiss_permanently')}
</ButtonLink>
{dismissedWarning === key && <i className="spinner spacer-left" />}
diff --git a/server/sonar-web/src/main/js/components/common/CodeSnippet.tsx b/server/sonar-web/src/main/js/components/common/CodeSnippet.tsx
index b8f284562fc..84482e431e6 100644
--- a/server/sonar-web/src/main/js/components/common/CodeSnippet.tsx
+++ b/server/sonar-web/src/main/js/components/common/CodeSnippet.tsx
@@ -35,7 +35,7 @@ export default function CodeSnippet(props: CodeSnippetProps) {
let finalSnippet: string;
if (Array.isArray(snippet)) {
- finalSnippet = snippet.filter(line => isDefined(line)).join(isOneLine ? ' ' : ' \\\n ');
+ finalSnippet = snippet.filter((line) => isDefined(line)).join(isOneLine ? ' ' : ' \\\n ');
} else {
finalSnippet = snippet;
}
diff --git a/server/sonar-web/src/main/js/components/common/DocLink.tsx b/server/sonar-web/src/main/js/components/common/DocLink.tsx
index 53d9c8c4e78..1ffefce9869 100644
--- a/server/sonar-web/src/main/js/components/common/DocLink.tsx
+++ b/server/sonar-web/src/main/js/components/common/DocLink.tsx
@@ -19,7 +19,7 @@
*/
import * as React from 'react';
import withAppStateContext, {
- WithAppStateContextProps
+ WithAppStateContextProps,
} from '../../app/components/app-state/withAppStateContext';
import { getUrlForDoc } from '../../helpers/docs';
import Link, { LinkProps } from './Link';
diff --git a/server/sonar-web/src/main/js/components/common/DocumentationTooltip.tsx b/server/sonar-web/src/main/js/components/common/DocumentationTooltip.tsx
index c44ca0efd50..da2640af845 100644
--- a/server/sonar-web/src/main/js/components/common/DocumentationTooltip.tsx
+++ b/server/sonar-web/src/main/js/components/common/DocumentationTooltip.tsx
@@ -58,7 +58,8 @@ export default function DocumentationTooltip(props: DocumentationTooltipProps) {
// To prevent the screen reader from reading out the links for no reason (as
// they won't be "clickable"), we hide the whole links section.
// See https://sarahmhigley.com/writing/tooltips-in-wcag-21/
- aria-hidden={true}>
+ aria-hidden={true}
+ >
{doc ? (
<DocLink to={href}>{label}</DocLink>
) : (
@@ -71,7 +72,8 @@ export default function DocumentationTooltip(props: DocumentationTooltipProps) {
</>
)}
</div>
- }>
+ }
+ >
{props.children}
</HelpTooltip>
);
diff --git a/server/sonar-web/src/main/js/components/common/Link.tsx b/server/sonar-web/src/main/js/components/common/Link.tsx
index 527673c6ffd..4ca7e2ec89a 100644
--- a/server/sonar-web/src/main/js/components/common/Link.tsx
+++ b/server/sonar-web/src/main/js/components/common/Link.tsx
@@ -41,7 +41,8 @@ function Link({ children, size, ...props }: LinkProps, ref: React.ForwardedRef<H
ref={ref}
href={to}
rel={anchorProps.target === '_blank' ? 'noopener noreferrer' : undefined}
- {...anchorProps}>
+ {...anchorProps}
+ >
{anchorProps.target === '_blank' && (
<DetachIcon
ariaLabel={translate('opens_in_new_window')}
@@ -58,7 +59,8 @@ function Link({ children, size, ...props }: LinkProps, ref: React.ForwardedRef<H
<ReactRouterDomLink
ref={ref}
rel={props.target === '_blank' ? 'noopener noreferrer' : undefined}
- {...props}>
+ {...props}
+ >
{children}
</ReactRouterDomLink>
);
diff --git a/server/sonar-web/src/main/js/components/common/LocationIndex.tsx b/server/sonar-web/src/main/js/components/common/LocationIndex.tsx
index 349ec46e648..455c93fe1c8 100644
--- a/server/sonar-web/src/main/js/components/common/LocationIndex.tsx
+++ b/server/sonar-web/src/main/js/components/common/LocationIndex.tsx
@@ -37,10 +37,11 @@ export default function LocationIndex(props: Props) {
<div
className={classNames('location-index', {
'is-leading': leading,
- selected
+ selected,
})}
{...clickAttributes}
- {...other}>
+ {...other}
+ >
{children}
</div>
);
diff --git a/server/sonar-web/src/main/js/components/common/MeasuresLink.tsx b/server/sonar-web/src/main/js/components/common/MeasuresLink.tsx
index b2a1f71b1c7..5431f141bfd 100644
--- a/server/sonar-web/src/main/js/components/common/MeasuresLink.tsx
+++ b/server/sonar-web/src/main/js/components/common/MeasuresLink.tsx
@@ -39,7 +39,8 @@ export default function MeasuresLink(props: MeasuresLinkProps) {
return (
<Link
className={classNames('measures-link', className)}
- to={getComponentDrilldownUrl({ branchLike, componentKey: component, metric })}>
+ to={getComponentDrilldownUrl({ branchLike, componentKey: component, metric })}
+ >
<MeasuresIcon className="little-spacer-right" size={14} />
<span>{label || translate('portfolio.measures_link')}</span>
</Link>
diff --git a/server/sonar-web/src/main/js/components/common/MultiSelect.tsx b/server/sonar-web/src/main/js/components/common/MultiSelect.tsx
index efffa6b4851..44501320199 100644
--- a/server/sonar-web/src/main/js/components/common/MultiSelect.tsx
+++ b/server/sonar-web/src/main/js/components/common/MultiSelect.tsx
@@ -62,10 +62,10 @@ export default class MultiSelect extends React.PureComponent<PropsWithDefault, S
static defaultProps: DefaultProps = {
filterSelected: (query: string, selectedElements: string[]) =>
- selectedElements.filter(elem => elem.includes(query)),
+ selectedElements.filter((elem) => elem.includes(query)),
listSize: 0,
renderLabel: (element: string) => element,
- validateSearchInput: (value: string) => value
+ validateSearchInput: (value: string) => value,
};
constructor(props: PropsWithDefault) {
@@ -73,7 +73,7 @@ export default class MultiSelect extends React.PureComponent<PropsWithDefault, S
this.state = {
loading: false,
query: '',
- elements: []
+ elements: [],
};
}
@@ -113,11 +113,11 @@ export default class MultiSelect extends React.PureComponent<PropsWithDefault, S
const newStateElement: Element[] = [
...this.props
.filterSelected(query, this.props.selectedElements)
- .map(e => ({ value: e, selected: true })),
- ...this.props.elements.map(e => ({
+ .map((e) => ({ value: e, selected: true })),
+ ...this.props.elements.map((e) => ({
value: e,
- selected: false
- }))
+ selected: false,
+ })),
];
this.appendCreateElelement(newStateElement, query, props);
@@ -128,20 +128,22 @@ export default class MultiSelect extends React.PureComponent<PropsWithDefault, S
appendCreateElelement(elements: Element[], query: string, props: PropsWithDefault) {
const { allowNewElements = true } = props;
if (this.isNewElement(query, props) && allowNewElements) {
- const create = elements.find(e => e.custom);
+ const create = elements.find((e) => e.custom);
if (create) {
create.value = query;
} else {
elements.push({ value: query, selected: false, custom: true });
}
} else if (!this.isNewElement(query, props) && allowNewElements) {
- remove(elements, e => e.custom);
+ remove(elements, (e) => e.custom);
}
}
handleSelectChange = (selected: boolean, item: string) => {
this.setState(({ elements }) => {
- const newElements = elements.map(e => (e.value === item ? { value: e.value, selected } : e));
+ const newElements = elements.map((e) =>
+ e.value === item ? { value: e.value, selected } : e
+ );
return { elements: newElements };
});
if (selected) {
@@ -162,7 +164,7 @@ export default class MultiSelect extends React.PureComponent<PropsWithDefault, S
if (allowNewElements) {
this.setState({
loading: true,
- query
+ query,
});
}
};
@@ -194,7 +196,7 @@ export default class MultiSelect extends React.PureComponent<PropsWithDefault, S
'menu-vertically-limited': infiniteList,
'spacer-top': infiniteList,
'with-top-separator': infiniteList,
- 'with-bottom-separator': Boolean(footerNode)
+ 'with-bottom-separator': Boolean(footerNode),
});
return (
@@ -211,7 +213,7 @@ export default class MultiSelect extends React.PureComponent<PropsWithDefault, S
</div>
<fieldset aria-label={legend}>
<ul className={listClasses}>
- {elements.map(e => (
+ {elements.map((e) => (
<MultiSelectOption
element={e}
disabled={!allowSelection && !e.selected}
diff --git a/server/sonar-web/src/main/js/components/common/MultiSelectOption.tsx b/server/sonar-web/src/main/js/components/common/MultiSelectOption.tsx
index 70063767fd3..88b4012bc7c 100644
--- a/server/sonar-web/src/main/js/components/common/MultiSelectOption.tsx
+++ b/server/sonar-web/src/main/js/components/common/MultiSelectOption.tsx
@@ -46,17 +46,20 @@ export default function MultiSelectOption(props: MultiSelectOptionProps) {
onFocus={() => setActive(true)}
onBlur={() => setActive(false)}
onMouseLeave={() => setActive(false)}
- onMouseOver={() => setActive(true)}>
+ onMouseOver={() => setActive(true)}
+ >
<Checkbox
checked={element.selected}
className={className}
disabled={disabled}
id={element.value}
- onCheck={props.onSelectChange}>
+ onCheck={props.onSelectChange}
+ >
{element.custom ? (
<span
aria-label={`${translate('create_new_element')}: ${label}`}
- className="little-spacer-left">
+ className="little-spacer-left"
+ >
<span aria-hidden={true} className="little-spacer-right">
+
</span>
diff --git a/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx b/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx
index 7db9134fa73..066dfab50b6 100644
--- a/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx
+++ b/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx
@@ -32,7 +32,7 @@ interface PrivacyBadgeContainerProps {
export default function PrivacyBadgeContainer({
className,
qualifier,
- visibility
+ visibility,
}: PrivacyBadgeContainerProps) {
if (visibility !== 'private') {
return null;
diff --git a/server/sonar-web/src/main/js/components/common/ProjectKeyInput.tsx b/server/sonar-web/src/main/js/components/common/ProjectKeyInput.tsx
index 8ec367e8277..28f344f98ac 100644
--- a/server/sonar-web/src/main/js/components/common/ProjectKeyInput.tsx
+++ b/server/sonar-web/src/main/js/components/common/ProjectKeyInput.tsx
@@ -44,7 +44,7 @@ export default function ProjectKeyInput(props: ProjectKeyInputProps) {
projectKey,
touched,
validating,
- autofocus = false
+ autofocus = false,
} = props;
const isInvalid = touched && error !== undefined;
@@ -60,12 +60,13 @@ export default function ProjectKeyInput(props: ProjectKeyInputProps) {
isInvalid={isInvalid}
isValid={isValid}
label={label}
- required={label !== undefined}>
+ required={label !== undefined}
+ >
<input
autoFocus={autofocus}
className={classNames('input-super-large', {
'is-invalid': isInvalid,
- 'is-valid': isValid
+ 'is-valid': isValid,
})}
id="project-key"
maxLength={PROJECT_KEY_MAX_LEN}
diff --git a/server/sonar-web/src/main/js/components/common/ResetPasswordForm.tsx b/server/sonar-web/src/main/js/components/common/ResetPasswordForm.tsx
index a9f7dd0fa7c..69037ff838e 100644
--- a/server/sonar-web/src/main/js/components/common/ResetPasswordForm.tsx
+++ b/server/sonar-web/src/main/js/components/common/ResetPasswordForm.tsx
@@ -42,7 +42,7 @@ export default class ResetPasswordForm extends React.Component<Props, State> {
password: HTMLInputElement | null = null;
passwordConfirmation: HTMLInputElement | null = null;
state: State = {
- success: false
+ success: false,
};
handleSuccessfulChange = () => {
@@ -112,7 +112,7 @@ export default class ResetPasswordForm extends React.Component<Props, State> {
autoComplete="off"
id="old_password"
name="old_password"
- ref={elem => (this.oldPassword = elem)}
+ ref={(elem) => (this.oldPassword = elem)}
required={true}
type="password"
/>
@@ -126,7 +126,7 @@ export default class ResetPasswordForm extends React.Component<Props, State> {
autoComplete="off"
id="password"
name="password"
- ref={elem => (this.password = elem)}
+ ref={(elem) => (this.password = elem)}
required={true}
type="password"
/>
@@ -140,7 +140,7 @@ export default class ResetPasswordForm extends React.Component<Props, State> {
autoComplete="off"
id="password_confirmation"
name="password_confirmation"
- ref={elem => (this.passwordConfirmation = elem)}
+ ref={(elem) => (this.passwordConfirmation = elem)}
required={true}
type="password"
/>
diff --git a/server/sonar-web/src/main/js/components/common/RestartButton.tsx b/server/sonar-web/src/main/js/components/common/RestartButton.tsx
index 1abbc137843..c6eb8bd0f24 100644
--- a/server/sonar-web/src/main/js/components/common/RestartButton.tsx
+++ b/server/sonar-web/src/main/js/components/common/RestartButton.tsx
@@ -50,12 +50,14 @@ export default class RestartButton extends React.PureComponent<Props> {
</>
}
modalHeader={translate('system.restart_server')}
- onConfirm={this.handleConfirm}>
+ onConfirm={this.handleConfirm}
+ >
{({ onClick }) => (
<Button
className={classNames('button-red', className)}
disabled={systemStatus !== 'UP'}
- onClick={onClick}>
+ onClick={onClick}
+ >
{systemStatus === 'RESTARTING'
? translate('system.restart_in_progress')
: translate('system.restart_server')}
diff --git a/server/sonar-web/src/main/js/components/common/ScreenPositionHelper.tsx b/server/sonar-web/src/main/js/components/common/ScreenPositionHelper.tsx
index 5b06162a1be..5b003bf9508 100644
--- a/server/sonar-web/src/main/js/components/common/ScreenPositionHelper.tsx
+++ b/server/sonar-web/src/main/js/components/common/ScreenPositionHelper.tsx
@@ -50,7 +50,7 @@ export default class ScreenPositionHelper extends React.PureComponent<Props> {
}
return {
top: window.pageYOffset + containerPos.top,
- left: window.pageXOffset + containerPos.left
+ left: window.pageXOffset + containerPos.left,
};
};
@@ -58,7 +58,8 @@ export default class ScreenPositionHelper extends React.PureComponent<Props> {
return (
<div
className={this.props.className}
- ref={container => (this.container = container as HTMLDivElement)}>
+ ref={(container) => (this.container = container as HTMLDivElement)}
+ >
{this.props.children(this.getPosition())}
</div>
);
diff --git a/server/sonar-web/src/main/js/components/common/SelectList.tsx b/server/sonar-web/src/main/js/components/common/SelectList.tsx
index 1ccd8dee6e8..70f14cac0c3 100644
--- a/server/sonar-web/src/main/js/components/common/SelectList.tsx
+++ b/server/sonar-web/src/main/js/components/common/SelectList.tsx
@@ -39,7 +39,7 @@ export default class SelectList extends React.PureComponent<Props, State> {
super(props);
this.state = {
active: props.currentItem,
- selected: props.currentItem
+ selected: props.currentItem,
};
}
@@ -114,7 +114,7 @@ export default class SelectList extends React.PureComponent<Props, State> {
active: this.state.active,
selected: this.state.selected,
onHover: this.handleHover,
- onSelect: this.handleSelect
+ onSelect: this.handleSelect,
});
};
@@ -125,7 +125,7 @@ export default class SelectList extends React.PureComponent<Props, State> {
<ul className={classNames('menu', this.props.className)}>
{hasChildren && React.Children.map(children, this.renderChild)}
{!hasChildren &&
- this.props.items.map(item => (
+ this.props.items.map((item) => (
<SelectListItem
active={this.state.active}
selected={this.state.selected}
diff --git a/server/sonar-web/src/main/js/components/common/SelectListItem.tsx b/server/sonar-web/src/main/js/components/common/SelectListItem.tsx
index b8d2f9200f2..afe33d2b5af 100644
--- a/server/sonar-web/src/main/js/components/common/SelectListItem.tsx
+++ b/server/sonar-web/src/main/js/components/common/SelectListItem.tsx
@@ -55,13 +55,14 @@ export default class SelectListItem extends React.PureComponent<Props> {
className={classNames(
{
active: this.props.active === this.props.item,
- hover: this.props.selected === this.props.item
+ hover: this.props.selected === this.props.item,
},
this.props.className
)}
onClick={this.handleSelect}
onFocus={this.handleHover}
- onMouseOver={this.handleHover}>
+ onMouseOver={this.handleHover}
+ >
{children}
</ButtonPlain>
</li>
diff --git a/server/sonar-web/src/main/js/components/common/StatusIndicator.tsx b/server/sonar-web/src/main/js/components/common/StatusIndicator.tsx
index bd7990183cf..cf63daa7298 100644
--- a/server/sonar-web/src/main/js/components/common/StatusIndicator.tsx
+++ b/server/sonar-web/src/main/js/components/common/StatusIndicator.tsx
@@ -39,7 +39,7 @@ export default function StatusIndicator({ className, color, size }: StatusIndica
color,
{
'small-status-indicator': size === 'small',
- 'big-status-indicator': size === 'big'
+ 'big-status-indicator': size === 'big',
},
className
)}
diff --git a/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx b/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx
index 02e4f1a05b0..623acd658d7 100644
--- a/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx
+++ b/server/sonar-web/src/main/js/components/common/VisibilitySelector.tsx
@@ -35,14 +35,15 @@ export default class VisibilitySelector extends React.PureComponent<Props> {
render() {
return (
<div className={classNames(this.props.className)}>
- {['public', 'private'].map(visibility => (
+ {['public', 'private'].map((visibility) => (
<Radio
className={`huge-spacer-right visibility-${visibility}`}
key={visibility}
value={visibility}
checked={this.props.visibility === visibility}
onCheck={this.props.onChange}
- disabled={visibility === 'private' && !this.props.canTurnToPrivate}>
+ disabled={visibility === 'private' && !this.props.canTurnToPrivate}
+ >
<div>
{translate('visibility', visibility)}
{this.props.showDetails && (
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/AnalysisWarningsModal-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/AnalysisWarningsModal-test.tsx
index 23efe791c4c..6768b29aecd 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/AnalysisWarningsModal-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/AnalysisWarningsModal-test.tsx
@@ -29,8 +29,8 @@ import { AnalysisWarningsModal } from '../AnalysisWarningsModal';
jest.mock('../../../api/ce', () => ({
dismissAnalysisWarning: jest.fn().mockResolvedValue(null),
getTask: jest.fn().mockResolvedValue({
- warnings: ['message foo', 'message-bar', 'multiline message\nsecondline\n third line']
- })
+ warnings: ['message foo', 'message-bar', 'multiline message\nsecondline\n third line'],
+ }),
}));
beforeEach(jest.clearAllMocks);
@@ -43,7 +43,7 @@ it('should render correctly', () => {
expect(
shallowRender({
currentUser: mockCurrentUser({ isLoggedIn: false }),
- warnings: [mockTaskWarning({ dismissable: true })]
+ warnings: [mockTaskWarning({ dismissable: true })],
})
).toMatchSnapshot('do not show dismissable links for anonymous');
});
@@ -65,13 +65,10 @@ it('should correctly handle dismissing warnings', async () => {
const wrapper = shallowRender({
componentKey: 'foo',
onWarningDismiss,
- warnings: [mockTaskWarning({ key: 'bar', dismissable: true })]
+ warnings: [mockTaskWarning({ key: 'bar', dismissable: true })],
});
- const { onClick } = wrapper
- .find(ButtonLink)
- .at(0)
- .props();
+ const { onClick } = wrapper.find(ButtonLink).at(0).props();
if (onClick) {
onClick();
@@ -105,7 +102,7 @@ function shallowRender(props: Partial<AnalysisWarningsModal['props']> = {}) {
onClose={jest.fn()}
warnings={[
mockTaskWarning({ message: 'warning 1' }),
- mockTaskWarning({ message: 'warning 2' })
+ mockTaskWarning({ message: 'warning 2' }),
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/BranchStatus-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/BranchStatus-test.tsx
index 551674c475b..c113a4dad14 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/BranchStatus-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/BranchStatus-test.tsx
@@ -25,12 +25,12 @@ it('should render correctly', () => {
expect(shallowRender().type()).toBeNull();
expect(
shallowRender({
- status: 'OK'
+ status: 'OK',
})
).toMatchSnapshot('Successful');
expect(
shallowRender({
- status: 'ERROR'
+ status: 'ERROR',
})
).toMatchSnapshot('Error');
});
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx
index b7655941a45..057f238116c 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/DisableableSelectOption-test.tsx
@@ -30,7 +30,7 @@ it('should render correctly', () => {
expect(
shallowRender({
option: { label: 'Bar', value: 'bar', isDisabled: true },
- disabledReason: 'bar baz'
+ disabledReason: 'bar baz',
})
).toMatchSnapshot('disabled, with explanation');
});
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/DocumentationTooltip-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/DocumentationTooltip-test.tsx
index 67821c47ea9..33bc5bf3ce3 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/DocumentationTooltip-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/DocumentationTooltip-test.tsx
@@ -28,8 +28,8 @@ it('renders correctly', () => {
links: [
{ href: 'http://link.tosome.place', label: 'external link' },
{ href: '/guide', label: 'internal link' },
- { href: '/projects', label: 'in place', inPlace: true, doc: false }
- ]
+ { href: '/projects', label: 'in place', inPlace: true, doc: false },
+ ],
})
).toMatchSnapshot('with links');
expect(shallowRender({ title: undefined })).toMatchSnapshot('no title');
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/FormattingTips-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/FormattingTips-test.tsx
index a478c20db70..9cf50b9c48a 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/FormattingTips-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/FormattingTips-test.tsx
@@ -27,14 +27,14 @@ const originalOpen = window.open;
beforeAll(() => {
Object.defineProperty(window, 'open', {
writable: true,
- value: jest.fn()
+ value: jest.fn(),
});
});
afterAll(() => {
Object.defineProperty(window, 'open', {
writable: true,
- value: originalOpen
+ value: originalOpen,
});
});
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/FormattingTipsWithLink-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/FormattingTipsWithLink-test.tsx
index 36aa84ab117..91a7c5fa5a0 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/FormattingTipsWithLink-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/FormattingTipsWithLink-test.tsx
@@ -28,14 +28,14 @@ const originalOpen = window.open;
beforeAll(() => {
Object.defineProperty(window, 'open', {
writable: true,
- value: jest.fn()
+ value: jest.fn(),
});
});
afterAll(() => {
Object.defineProperty(window, 'open', {
writable: true,
- value: originalOpen
+ value: originalOpen,
});
});
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/MultiSelect-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/MultiSelect-test.tsx
index bc8fd239ee0..e6032e39dcc 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/MultiSelect-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/MultiSelect-test.tsx
@@ -26,7 +26,7 @@ import MultiSelect from '../MultiSelect';
const ui = {
checkbox: (name: string) => byRole('checkbox', { name }),
search: byRole('searchbox', { name: 'search_verb' }),
- noResult: byText('no_results_for_x.notfound')
+ noResult: byText('no_results_for_x.notfound'),
};
it('should handle selection', async () => {
@@ -41,7 +41,7 @@ it('should handle selection', async () => {
expect(ui.checkbox('create').get()).toBeChecked();
// Custom label
- rerender({ renderLabel: label => `prefxed-${label}` });
+ rerender({ renderLabel: (label) => `prefxed-${label}` });
expect(ui.checkbox('prefxed-create').get()).toBeChecked();
});
@@ -85,20 +85,20 @@ function renderMultiSelect(override?: Partial<MultiSelect['props']>) {
setElements(initial);
setSelected(initialSelected);
} else {
- setElements([...elements.filter(e => e.indexOf(query) !== -1), `${query}-new`]);
- setSelected(selected.filter(e => e.indexOf(query) !== -1));
+ setElements([...elements.filter((e) => e.indexOf(query) !== -1), `${query}-new`]);
+ setSelected(selected.filter((e) => e.indexOf(query) !== -1));
}
return Promise.resolve();
};
const onSelect = (element: string) => {
setSelected([...selected, element]);
- setElements(elements.filter(e => e !== element));
+ setElements(elements.filter((e) => e !== element));
};
const onUnselect = (element: string) => {
setElements([...elements, element]);
- setSelected(selected.filter(e => e !== element));
+ setSelected(selected.filter((e) => e !== element));
};
return (
<MultiSelect
@@ -115,7 +115,7 @@ function renderMultiSelect(override?: Partial<MultiSelect['props']>) {
}
const { rerender } = render(<Parent {...override} />);
- return function(reoverride?: Partial<MultiSelect['props']>) {
+ return function (reoverride?: Partial<MultiSelect['props']>) {
rerender(<Parent {...override} {...reoverride} />);
};
}
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx
index 34e1023031d..4dcaa1e680d 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/ResetPasswordForm-test.tsx
@@ -25,7 +25,7 @@ import { mockEvent, waitAndUpdate } from '../../../helpers/testUtils';
import ResetPasswordForm from '../ResetPasswordForm';
jest.mock('../../../api/users', () => ({
- changePassword: jest.fn().mockResolvedValue({})
+ changePassword: jest.fn().mockResolvedValue({}),
}));
it('should trigger on password change prop', () => {
@@ -66,7 +66,7 @@ it('should trigger password change', async () => {
expect(changePassword).toHaveBeenCalledWith({
login: user.login,
password: 'test',
- previousPassword: 'testold'
+ previousPassword: 'testold',
});
});
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.tsx
index f81935ff561..873b33bc4da 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.tsx
@@ -32,7 +32,7 @@ it('should render correctly without children', () => {
it('should render correctly with children', () => {
const items = ['item', 'seconditem', 'third'];
- const children = items.map(item => (
+ const children = items.map((item) => (
<SelectListItem item={item} key={item}>
<i className="myicon" />
item
@@ -46,7 +46,7 @@ it('should render correctly with children', () => {
it('should correclty handle user actions', () => {
const onSelect = jest.fn();
const items = ['item', 'seconditem', 'third'];
- const children = items.map(item => (
+ const children = items.map((item) => (
<SelectListItem item={item} key={item}>
<i className="myicon" />
item
@@ -73,7 +73,8 @@ function shallowRender(props: Partial<SelectList['props']> = {}, children?: Reac
currentItem="seconditem"
items={['item', 'seconditem', 'third']}
onSelect={jest.fn()}
- {...props}>
+ {...props}
+ >
{children}
</SelectList>
);
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/VisibilitySelector-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/VisibilitySelector-test.tsx
index b16a241f969..d1f6572a078 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/VisibilitySelector-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/VisibilitySelector-test.tsx
@@ -27,21 +27,13 @@ it('changes visibility', () => {
const wrapper = shallowRender({ onChange });
expect(wrapper).toMatchSnapshot();
- wrapper
- .find(Radio)
- .first()
- .props()
- .onCheck('private');
+ wrapper.find(Radio).first().props().onCheck('private');
expect(onChange).toHaveBeenCalledWith('private');
wrapper.setProps({ visibility: 'private' });
expect(wrapper).toMatchSnapshot();
- wrapper
- .find(Radio)
- .first()
- .props()
- .onCheck('public');
+ wrapper.find(Radio).first().props().onCheck('public');
expect(onChange).toHaveBeenCalledWith('public');
});
diff --git a/server/sonar-web/src/main/js/components/controls/ActionsDropdown.tsx b/server/sonar-web/src/main/js/components/controls/ActionsDropdown.tsx
index 371f5c28f3b..980f7c2ab3d 100644
--- a/server/sonar-web/src/main/js/components/controls/ActionsDropdown.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ActionsDropdown.tsx
@@ -43,11 +43,13 @@ export default function ActionsDropdown(props: ActionsDropdownProps) {
className={className}
onOpen={props.onOpen}
overlay={<ul className="menu">{children}</ul>}
- overlayPlacement={overlayPlacement}>
+ overlayPlacement={overlayPlacement}
+ >
<Button
className={classNames('dropdown-toggle', toggleClassName, {
- 'button-small': small
- })}>
+ 'button-small': small,
+ })}
+ >
<SettingsIcon size={small ? 12 : 14} />
<DropdownIcon className="little-spacer-left" />
</Button>
@@ -85,7 +87,8 @@ export class ActionsDropdownItem extends React.PureComponent<ItemProps> {
className={className}
download={this.props.download}
href={this.props.to}
- id={this.props.id}>
+ id={this.props.id}
+ >
{this.props.children}
</a>
</li>
diff --git a/server/sonar-web/src/main/js/components/controls/BackButton.tsx b/server/sonar-web/src/main/js/components/controls/BackButton.tsx
index 5ffe0fa483f..fb9b6b96257 100644
--- a/server/sonar-web/src/main/js/components/controls/BackButton.tsx
+++ b/server/sonar-web/src/main/js/components/controls/BackButton.tsx
@@ -62,7 +62,8 @@ export default class BackButton extends React.PureComponent<Props> {
this.props.className
)}
href="#"
- onClick={this.handleClick}>
+ onClick={this.handleClick}
+ >
{this.renderIcon()}
</a>
</Tooltip>
diff --git a/server/sonar-web/src/main/js/components/controls/BoxedGroupAccordion.tsx b/server/sonar-web/src/main/js/components/controls/BoxedGroupAccordion.tsx
index a7056898971..14e335efcd3 100644
--- a/server/sonar-web/src/main/js/components/controls/BoxedGroupAccordion.tsx
+++ b/server/sonar-web/src/main/js/components/controls/BoxedGroupAccordion.tsx
@@ -46,9 +46,10 @@ export default function BoxedGroupAccordion(props: BoxedGroupAccordionProps) {
<div
className={classNames('boxed-group boxed-group-accordion', className, {
'no-border': noBorder,
- open
+ open,
})}
- role="listitem">
+ role="listitem"
+ >
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
<div onClick={handleClick} className="display-flex-center boxed-group-header">
<ButtonPlain
@@ -57,7 +58,8 @@ export default function BoxedGroupAccordion(props: BoxedGroupAccordionProps) {
onClick={handleClick}
id={`${id}-header`}
aria-controls={`${id}-panel`}
- aria-expanded={open}>
+ aria-expanded={open}
+ >
{title}
</ButtonPlain>
{renderHeader && renderHeader()}
diff --git a/server/sonar-web/src/main/js/components/controls/BoxedTabs.tsx b/server/sonar-web/src/main/js/components/controls/BoxedTabs.tsx
index 7bf88173563..d9ad0562f07 100644
--- a/server/sonar-web/src/main/js/components/controls/BoxedTabs.tsx
+++ b/server/sonar-web/src/main/js/components/controls/BoxedTabs.tsx
@@ -43,7 +43,7 @@ const highlightHoverMixin = () => `
const StyledTab = styled.button<{ active: boolean }>`
position: relative;
- background-color: ${props => (props.active ? 'white' : colors.barBackgroundColor)};
+ background-color: ${(props) => (props.active ? 'white' : colors.barBackgroundColor)};
border-top: ${baseBorder};
border-left: ${baseBorder};
border-right: none;
@@ -51,11 +51,11 @@ const StyledTab = styled.button<{ active: boolean }>`
margin-bottom: -1px;
min-width: 128px;
min-height: 56px;
- ${props => !props.active && 'cursor: pointer;'}
+ ${(props) => !props.active && 'cursor: pointer;'}
outline: 0;
padding: calc(2 * ${sizes.gridSize});
- ${props => (!props.active ? highlightHoverMixin : null)}
+ ${(props) => (!props.active ? highlightHoverMixin : null)}
&:last-child {
border-right: ${baseBorder};
@@ -63,7 +63,7 @@ const StyledTab = styled.button<{ active: boolean }>`
`;
const ActiveBorder = styled.div<{ active: boolean }>`
- display: ${props => (props.active ? 'block' : 'none')};
+ display: ${(props) => (props.active ? 'block' : 'none')};
background-color: ${colors.blue};
height: 3px;
width: 100%;
@@ -86,7 +86,8 @@ export default function BoxedTabs<K extends string | number>(props: BoxedTabsPro
// eslint-disable-next-line react/no-array-index-key
key={i}
onClick={() => selected !== key && props.onSelect(key)}
- role="tab">
+ role="tab"
+ >
<ActiveBorder active={selected === key} />
{label}
</StyledTab>
diff --git a/server/sonar-web/src/main/js/components/controls/ButtonToggle.tsx b/server/sonar-web/src/main/js/components/controls/ButtonToggle.tsx
index 841337734dd..6c5ad5477e3 100644
--- a/server/sonar-web/src/main/js/components/controls/ButtonToggle.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ButtonToggle.tsx
@@ -43,14 +43,15 @@ export default function ButtonToggle(props: ButtonToggleProps) {
return (
<ul aria-label={label} role="group" className="button-toggle">
- {options.map(option => (
+ {options.map((option) => (
<li key={option.value.toString()}>
<Button
onClick={() => option.value !== value && props.onCheck(option.value)}
disabled={disabled}
aria-current={option.value === value}
data-value={option.value}
- className={classNames({ selected: option.value === value })}>
+ className={classNames({ selected: option.value === value })}
+ >
{option.label}
</Button>
</li>
diff --git a/server/sonar-web/src/main/js/components/controls/Checkbox.tsx b/server/sonar-web/src/main/js/components/controls/Checkbox.tsx
index 7573eb1c1ac..b88bdec4ca0 100644
--- a/server/sonar-web/src/main/js/components/controls/Checkbox.tsx
+++ b/server/sonar-web/src/main/js/components/controls/Checkbox.tsx
@@ -41,7 +41,7 @@ interface Props {
export default class Checkbox extends React.PureComponent<Props> {
static defaultProps = {
- thirdState: false
+ thirdState: false,
};
handleClick = (event: React.SyntheticEvent<HTMLElement>) => {
@@ -53,21 +53,12 @@ export default class Checkbox extends React.PureComponent<Props> {
};
render() {
- const {
- checked,
- children,
- disabled,
- id,
- label,
- loading,
- right,
- thirdState,
- title
- } = this.props;
+ const { checked, children, disabled, id, label, loading, right, thirdState, title } =
+ this.props;
const className = classNames('icon-checkbox', {
'icon-checkbox-checked': checked,
'icon-checkbox-single': thirdState,
- 'icon-checkbox-disabled': disabled
+ 'icon-checkbox-disabled': disabled,
});
if (children) {
@@ -77,13 +68,14 @@ export default class Checkbox extends React.PureComponent<Props> {
aria-label={label}
aria-disabled={disabled}
className={classNames('link-checkbox', this.props.className, {
- disabled
+ disabled,
})}
href="#"
id={id}
onClick={this.handleClick}
role="checkbox"
- title={title}>
+ title={title}
+ >
{right && children}
<DeferredSpinner loading={Boolean(loading)}>
<i className={className} />
diff --git a/server/sonar-web/src/main/js/components/controls/ClickEventBoundary.tsx b/server/sonar-web/src/main/js/components/controls/ClickEventBoundary.tsx
index 66a0170a8db..3b471544f8c 100644
--- a/server/sonar-web/src/main/js/components/controls/ClickEventBoundary.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ClickEventBoundary.tsx
@@ -30,6 +30,6 @@ export default function ClickEventBoundary({ children }: ClickEventBoundaryProps
if (typeof children.props.onClick === 'function') {
children.props.onClick(e);
}
- }
+ },
});
}
diff --git a/server/sonar-web/src/main/js/components/controls/ComponentReportActions.tsx b/server/sonar-web/src/main/js/components/controls/ComponentReportActions.tsx
index 38b294b2670..bff07033175 100644
--- a/server/sonar-web/src/main/js/components/controls/ComponentReportActions.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ComponentReportActions.tsx
@@ -21,7 +21,7 @@ import * as React from 'react';
import {
getReportStatus,
subscribeToEmailReport,
- unsubscribeFromEmailReport
+ unsubscribeFromEmailReport,
} from '../../api/component-report';
import withAppStateContext from '../../app/components/app-state/withAppStateContext';
import withCurrentUserContext from '../../app/components/current-user/withCurrentUserContext';
diff --git a/server/sonar-web/src/main/js/components/controls/ComponentReportActionsRenderer.tsx b/server/sonar-web/src/main/js/components/controls/ComponentReportActionsRenderer.tsx
index 5c0717abdea..1ebdce3b8f3 100644
--- a/server/sonar-web/src/main/js/components/controls/ComponentReportActionsRenderer.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ComponentReportActionsRenderer.tsx
@@ -43,11 +43,12 @@ export default function ComponentReportActionsRenderer(props: ComponentReportAct
const renderDownloadButton = (simple = false) => {
return (
<a
- download={[component.name, branch?.name, 'PDF Report.pdf'].filter(s => !!s).join(' - ')}
+ download={[component.name, branch?.name, 'PDF Report.pdf'].filter((s) => !!s).join(' - ')}
href={getReportUrl(component.key, branch?.name)}
target="_blank"
data-test="overview__download-pdf-report-button"
- rel="noopener noreferrer">
+ rel="noopener noreferrer"
+ >
{simple
? translate('download_verb')
: translateWithParameters(
@@ -85,7 +86,8 @@ export default function ComponentReportActionsRenderer(props: ComponentReportAct
<li>{renderDownloadButton(true)}</li>
<li>{renderSubscriptionButton()}</li>
</ul>
- }>
+ }
+ >
<Button className="dropdown-toggle">
{translateWithParameters(
'component_report.report',
diff --git a/server/sonar-web/src/main/js/components/controls/ConfirmButton.tsx b/server/sonar-web/src/main/js/components/controls/ConfirmButton.tsx
index 12f86ba38e5..5eb8fe235b1 100644
--- a/server/sonar-web/src/main/js/components/controls/ConfirmButton.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ConfirmButton.tsx
@@ -34,19 +34,15 @@ interface State {
export default class ConfirmButton<T> extends React.PureComponent<Props<T>, State> {
renderConfirmModal = ({ onClose }: ModalProps) => {
- const {
- children,
- modalBody,
- modalHeader,
- modalHeaderDescription,
- ...confirmModalProps
- } = this.props;
+ const { children, modalBody, modalHeader, modalHeaderDescription, ...confirmModalProps } =
+ this.props;
return (
<ConfirmModal
header={modalHeader}
headerDescription={modalHeaderDescription}
onClose={onClose}
- {...confirmModalProps}>
+ {...confirmModalProps}
+ >
{modalBody}
</ConfirmModal>
);
diff --git a/server/sonar-web/src/main/js/components/controls/ConfirmModal.tsx b/server/sonar-web/src/main/js/components/controls/ConfirmModal.tsx
index 279d535cbea..cea26ceea21 100644
--- a/server/sonar-web/src/main/js/components/controls/ConfirmModal.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ConfirmModal.tsx
@@ -70,7 +70,7 @@ export default class ConfirmModal<T = string> extends React.PureComponent<Props<
header,
headerDescription,
isDestructive,
- cancelButtonText = translate('cancel')
+ cancelButtonText = translate('cancel'),
} = this.props;
return (
<ClickEventBoundary>
@@ -85,7 +85,8 @@ export default class ConfirmModal<T = string> extends React.PureComponent<Props<
<SubmitButton
autoFocus={true}
className={isDestructive ? 'button-red' : undefined}
- disabled={submitting || confirmDisable}>
+ disabled={submitting || confirmDisable}
+ >
{confirmButtonText}
</SubmitButton>
<ResetButtonLink disabled={submitting} onClick={onCloseClick}>
diff --git a/server/sonar-web/src/main/js/components/controls/DateInput.tsx b/server/sonar-web/src/main/js/components/controls/DateInput.tsx
index 67168910d28..a77f0f011f2 100644
--- a/server/sonar-web/src/main/js/components/controls/DateInput.tsx
+++ b/server/sonar-web/src/main/js/components/controls/DateInput.tsx
@@ -32,7 +32,7 @@ import {
getShortMonthName,
getShortWeekDayName,
getWeekDayName,
- translate
+ translate,
} from '../../helpers/l10n';
import './DayPicker.css';
import EscKeydownHandler from './EscKeydownHandler';
@@ -86,7 +86,7 @@ export default class DateInput extends React.PureComponent<Props, State> {
this.setState({
currentMonth: this.props.value || this.props.currentMonth || new Date(),
lastHovered: undefined,
- open: true
+ open: true,
});
};
@@ -110,15 +110,15 @@ export default class DateInput extends React.PureComponent<Props, State> {
};
handleCurrentYearChange = ({ value }: { value: number }) => {
- this.setState(state => ({ currentMonth: setYear(state.currentMonth, value) }));
+ this.setState((state) => ({ currentMonth: setYear(state.currentMonth, value) }));
};
handlePreviousMonthClick = () => {
- this.setState(state => ({ currentMonth: subMonths(state.currentMonth, 1) }));
+ this.setState((state) => ({ currentMonth: subMonths(state.currentMonth, 1) }));
};
handleNextMonthClick = () => {
- this.setState(state => ({ currentMonth: addMonths(state.currentMonth, 1) }));
+ this.setState((state) => ({ currentMonth: addMonths(state.currentMonth, 1) }));
};
render() {
@@ -131,7 +131,7 @@ export default class DateInput extends React.PureComponent<Props, State> {
className,
inputClassName,
id,
- placeholder
+ placeholder,
} = this.props;
const { lastHovered, currentMonth, open } = this.state;
@@ -156,11 +156,11 @@ export default class DateInput extends React.PureComponent<Props, State> {
const weekdaysLong = range(7).map(getWeekDayName) as Week;
const weekdaysShort = range(7).map(getShortWeekDayName) as Week;
- const monthOptions = months.map(month => ({
+ const monthOptions = months.map((month) => ({
label: getShortMonthName(month),
- value: month
+ value: month,
}));
- const yearOptions = years.map(year => ({ label: String(year), value: year }));
+ const yearOptions = years.map((year) => ({ label: String(year), value: year }));
return (
<OutsideClickHandler onClickOutside={this.closeCalendar}>
@@ -168,7 +168,7 @@ export default class DateInput extends React.PureComponent<Props, State> {
<span className={classNames('date-input-control', className)}>
<InputWrapper
className={classNames('date-input-control-input', inputClassName, {
- 'is-filled': value !== undefined
+ 'is-filled': value !== undefined,
})}
id={id}
innerRef={(node: HTMLInputElement | null) => (this.input = node)}
@@ -200,14 +200,14 @@ export default class DateInput extends React.PureComponent<Props, State> {
className="date-input-calender-month-select"
onChange={this.handleCurrentMonthChange}
options={monthOptions}
- value={monthOptions.find(month => month.value === currentMonth.getMonth())}
+ value={monthOptions.find((month) => month.value === currentMonth.getMonth())}
/>
<Select
aria-label={translate('select_year')}
className="date-input-calender-month-select spacer-left"
onChange={this.handleCurrentYearChange}
options={yearOptions}
- value={yearOptions.find(year => year.value === currentMonth.getFullYear())}
+ value={yearOptions.find((year) => year.value === currentMonth.getFullYear())}
/>
</div>
<ButtonIcon className="button-small" onClick={this.handleNextMonthClick}>
diff --git a/server/sonar-web/src/main/js/components/controls/DateRangeInput.tsx b/server/sonar-web/src/main/js/components/controls/DateRangeInput.tsx
index a2f13e9b635..505439ed196 100644
--- a/server/sonar-web/src/main/js/components/controls/DateRangeInput.tsx
+++ b/server/sonar-web/src/main/js/components/controls/DateRangeInput.tsx
@@ -96,7 +96,7 @@ export default class DateRangeInput extends React.PureComponent<Props> {
maxDate={maxDate}
onChange={this.handleToChange}
placeholder={translate('end_date')}
- ref={element => (this.toDateInput = element)}
+ ref={(element) => (this.toDateInput = element)}
value={this.to}
/>
</div>
diff --git a/server/sonar-web/src/main/js/components/controls/Dropdown.tsx b/server/sonar-web/src/main/js/components/controls/Dropdown.tsx
index 0d9ed80584b..308d2e4e395 100644
--- a/server/sonar-web/src/main/js/components/controls/Dropdown.tsx
+++ b/server/sonar-web/src/main/js/components/controls/Dropdown.tsx
@@ -68,13 +68,13 @@ export default class Dropdown extends React.PureComponent<Props, State> {
event.preventDefault();
event.currentTarget.blur();
}
- this.setState(state => ({ open: !state.open }));
+ this.setState((state) => ({ open: !state.open }));
};
render() {
const a11yAttrs = {
'aria-expanded': String(this.state.open),
- 'aria-haspopup': 'true'
+ 'aria-haspopup': 'true',
};
const child = React.isValidElement(this.props.children)
@@ -82,7 +82,7 @@ export default class Dropdown extends React.PureComponent<Props, State> {
: this.props.children({
closeDropdown: this.closeDropdown,
onToggleClick: this.handleToggleClick,
- open: this.state.open
+ open: this.state.open,
});
const { closeOnClick = true, closeOnClickOutside = false } = this.props;
@@ -96,10 +96,12 @@ export default class Dropdown extends React.PureComponent<Props, State> {
overlay={
<DropdownOverlay
noPadding={this.props.noOverlayPadding}
- placement={this.props.overlayPlacement}>
+ placement={this.props.overlayPlacement}
+ >
{this.props.overlay}
</DropdownOverlay>
- }>
+ }
+ >
{child}
</Toggler>
);
@@ -138,7 +140,8 @@ export class DropdownOverlay extends React.Component<OverlayProps> {
leftFix !== undefined && topFix !== undefined
? { marginLeft: `calc(50% + ${leftFix}px)` }
: undefined
- }>
+ }
+ >
{this.props.children}
</Popup>
);
diff --git a/server/sonar-web/src/main/js/components/controls/Favorite.tsx b/server/sonar-web/src/main/js/components/controls/Favorite.tsx
index dff52de6bb3..47aae1ebd70 100644
--- a/server/sonar-web/src/main/js/components/controls/Favorite.tsx
+++ b/server/sonar-web/src/main/js/components/controls/Favorite.tsx
@@ -46,7 +46,7 @@ export default class Favorite extends React.PureComponent<Props, State> {
super(props);
this.state = {
- favorite: props.favorite
+ favorite: props.favorite,
};
}
@@ -94,9 +94,10 @@ export default class Favorite extends React.PureComponent<Props, State> {
return (
<Tooltip overlay={tooltip}>
<ButtonLink
- innerRef={node => (this.buttonNode = node)}
+ innerRef={(node) => (this.buttonNode = node)}
className={classNames('favorite-link', 'link-no-underline', className)}
- onClick={this.toggleFavorite}>
+ onClick={this.toggleFavorite}
+ >
<FavoriteIcon aria-label={tooltip} favorite={favorite} />
</ButtonLink>
</Tooltip>
diff --git a/server/sonar-web/src/main/js/components/controls/HelpTooltip.tsx b/server/sonar-web/src/main/js/components/controls/HelpTooltip.tsx
index 45e312e7cca..523e21b7e6a 100644
--- a/server/sonar-web/src/main/js/components/controls/HelpTooltip.tsx
+++ b/server/sonar-web/src/main/js/components/controls/HelpTooltip.tsx
@@ -49,12 +49,14 @@ export default function HelpTooltip({
className={classNames('help-tooltip', props.className)}
aria-labelledby={ariaLabelledby}
aria-label={ariaLabel}
- role={role}>
+ role={role}
+ >
<Tooltip
mouseLeaveDelay={0.25}
onShow={props.onShow}
overlay={props.overlay}
- placement={props.placement}>
+ placement={props.placement}
+ >
<span className="display-inline-flex-center">
{props.children || <HelpIcon fill={colors.gray60} size={size} />}
</span>
diff --git a/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx b/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx
index 563e250a7c2..80bbca72bcb 100644
--- a/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx
+++ b/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx
@@ -82,7 +82,8 @@ export class HomePageSelect extends React.PureComponent<Props> {
<span
aria-label={tooltip}
className={classNames('display-inline-block', className)}
- role="img">
+ role="img"
+ >
<HomeIcon filled={isChecked} />
</span>
) : (
@@ -90,7 +91,8 @@ export class HomePageSelect extends React.PureComponent<Props> {
aria-label={tooltip}
className={classNames('link-no-underline', 'set-homepage-link', className)}
onClick={isChecked ? this.handleReset : this.handleClick}
- innerRef={node => (this.buttonNode = node)}>
+ innerRef={(node) => (this.buttonNode = node)}
+ >
<HomeIcon filled={isChecked} />
</ButtonLink>
)}
diff --git a/server/sonar-web/src/main/js/components/controls/IdentityProviderLink.tsx b/server/sonar-web/src/main/js/components/controls/IdentityProviderLink.tsx
index c6be4c1900c..b0c292abba1 100644
--- a/server/sonar-web/src/main/js/components/controls/IdentityProviderLink.tsx
+++ b/server/sonar-web/src/main/js/components/controls/IdentityProviderLink.tsx
@@ -42,7 +42,7 @@ export default function IdentityProviderLink({
name,
onClick,
small,
- url
+ url,
}: Props) {
const size = small ? 14 : 20;
@@ -55,7 +55,8 @@ export default function IdentityProviderLink({
)}
href={url}
onClick={onClick}
- style={{ backgroundColor }}>
+ style={{ backgroundColor }}
+ >
<img alt={name} height={size} src={getBaseUrl() + iconPath} width={size} />
{children}
</a>
diff --git a/server/sonar-web/src/main/js/components/controls/ListFooter.tsx b/server/sonar-web/src/main/js/components/controls/ListFooter.tsx
index 81670150f14..bca6af49eba 100644
--- a/server/sonar-web/src/main/js/components/controls/ListFooter.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ListFooter.tsx
@@ -47,7 +47,7 @@ export default function ListFooter(props: ListFooterProps) {
needReload,
total,
pageSize,
- ready = true
+ ready = true,
} = props;
const rootNode = React.useRef<HTMLDivElement>(null);
@@ -83,7 +83,8 @@ export default function ListFooter(props: ListFooterProps) {
className="spacer-left"
disabled={loading}
data-test="show-more"
- onClick={onLoadMore}>
+ onClick={onLoadMore}
+ >
{translate('show_more')}
</Button>
);
@@ -97,7 +98,8 @@ export default function ListFooter(props: ListFooterProps) {
'list-footer spacer-top note text-center',
{ 'new-loading': !ready },
className
- )}>
+ )}
+ >
{total !== undefined
? translateWithParameters(
'x_of_y_shown',
diff --git a/server/sonar-web/src/main/js/components/controls/Modal.tsx b/server/sonar-web/src/main/js/components/controls/Modal.tsx
index 49349f98a37..a7a21041866 100644
--- a/server/sonar-web/src/main/js/components/controls/Modal.tsx
+++ b/server/sonar-web/src/main/js/components/controls/Modal.tsx
@@ -66,7 +66,7 @@ export default function Modal(props: Props) {
className={classNames('modal', {
'modal-small': props.size === 'small',
'modal-medium': props.size === 'medium',
- 'modal-large': props.size === 'large'
+ 'modal-large': props.size === 'large',
})}
isOpen={true}
overlayClassName={classNames('modal-overlay', { 'modal-no-backdrop': props.noBackdrop })}
diff --git a/server/sonar-web/src/main/js/components/controls/ModalButton.tsx b/server/sonar-web/src/main/js/components/controls/ModalButton.tsx
index 18ffeaedede..638d996137f 100644
--- a/server/sonar-web/src/main/js/components/controls/ModalButton.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ModalButton.tsx
@@ -71,7 +71,7 @@ export default class ModalButton extends React.PureComponent<Props, State> {
<>
{this.props.children({
onClick: this.handleButtonClick,
- onFormSubmit: this.handleFormSubmit
+ onFormSubmit: this.handleFormSubmit,
})}
{this.state.modal && this.props.modal({ onClose: this.handleCloseModal })}
</>
diff --git a/server/sonar-web/src/main/js/components/controls/Radio.tsx b/server/sonar-web/src/main/js/components/controls/Radio.tsx
index 08891b07b67..25c4c45ee99 100644
--- a/server/sonar-web/src/main/js/components/controls/Radio.tsx
+++ b/server/sonar-web/src/main/js/components/controls/Radio.tsx
@@ -53,7 +53,8 @@ export default class Radio extends React.PureComponent<Props> {
)}
href="#"
onClick={this.handleClick}
- role="radio">
+ role="radio"
+ >
<i className={classNames('icon-radio', 'spacer-right', { 'is-checked': checked })} />
{children}
</a>
diff --git a/server/sonar-web/src/main/js/components/controls/RadioCard.tsx b/server/sonar-web/src/main/js/components/controls/RadioCard.tsx
index 001ddf02692..7ebf056fe07 100644
--- a/server/sonar-web/src/main/js/components/controls/RadioCard.tsx
+++ b/server/sonar-web/src/main/js/components/controls/RadioCard.tsx
@@ -48,7 +48,7 @@ export default function RadioCard(props: Props) {
recommended,
selected,
titleInfo,
- vertical = false
+ vertical = false,
} = props;
const isActionable = Boolean(onClick);
return (
@@ -60,13 +60,14 @@ export default function RadioCard(props: Props) {
'radio-card-actionable': isActionable,
'radio-card-vertical': vertical,
disabled,
- selected
+ selected,
},
className
)}
onClick={isActionable && !disabled ? onClick : undefined}
role="radio"
- tabIndex={0}>
+ tabIndex={0}
+ >
<h2 className="radio-card-header big-spacer-bottom">
<span className="display-flex-center link-radio">
{isActionable && (
diff --git a/server/sonar-web/src/main/js/components/controls/ReloadButton.tsx b/server/sonar-web/src/main/js/components/controls/ReloadButton.tsx
index 8e19ad5708a..ef0e42fa4a3 100644
--- a/server/sonar-web/src/main/js/components/controls/ReloadButton.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ReloadButton.tsx
@@ -43,7 +43,8 @@ export default class ReloadButton extends React.PureComponent<Props> {
<a
className={classNames('link-no-underline', this.props.className)}
href="#"
- onClick={this.handleClick}>
+ onClick={this.handleClick}
+ >
{
<svg height="24" viewBox="0 0 18 24" width="18">
<path
diff --git a/server/sonar-web/src/main/js/components/controls/SearchBox.tsx b/server/sonar-web/src/main/js/components/controls/SearchBox.tsx
index 285206bda3e..f4f9abec6f9 100644
--- a/server/sonar-web/src/main/js/components/controls/SearchBox.tsx
+++ b/server/sonar-web/src/main/js/components/controls/SearchBox.tsx
@@ -126,7 +126,7 @@ export default class SearchBox extends React.PureComponent<Props, State> {
const { value } = this.state;
const inputClassName = classNames('search-box-input', {
- touched: value.length > 0 && (!minLength || minLength > value.length)
+ touched: value.length > 0 && (!minLength || minLength > value.length),
});
const tooShort = minLength !== undefined && value.length > 0 && value.length < minLength;
@@ -139,7 +139,8 @@ export default class SearchBox extends React.PureComponent<Props, State> {
tooShort && minLength !== undefined
? translateWithParameters('select2.tooShort', minLength)
: ''
- }>
+ }
+ >
<input
aria-label={translate('search_verb')}
autoComplete="off"
diff --git a/server/sonar-web/src/main/js/components/controls/Select.tsx b/server/sonar-web/src/main/js/components/controls/Select.tsx
index 55a994fdd59..ed506b3e37d 100644
--- a/server/sonar-web/src/main/js/components/controls/Select.tsx
+++ b/server/sonar-web/src/main/js/components/controls/Select.tsx
@@ -28,11 +28,11 @@ import ReactSelect, {
NamedProps,
OptionProps,
OptionTypeBase,
- StylesConfig
+ StylesConfig,
} from 'react-select';
import AsyncReactSelect, { AsyncProps } from 'react-select/async';
import AsyncCreatableReactSelect, {
- Props as AsyncCreatableProps
+ Props as AsyncCreatableProps,
} from 'react-select/async-creatable';
import { LoadingIndicatorProps } from 'react-select/src/components/indicators';
import { MultiValueRemoveProps } from 'react-select/src/components/MultiValue';
@@ -119,7 +119,7 @@ export default class Select<
...this.props.components,
DropdownIndicator: dropdownIndicator,
ClearIndicator: clearIndicator,
- MultiValueRemove: multiValueRemove
+ MultiValueRemove: multiValueRemove,
}}
/>
);
@@ -140,7 +140,7 @@ export function CreatableSelect<
DropdownIndicator: dropdownIndicator,
ClearIndicator: clearIndicator,
MultiValueRemove: multiValueRemove,
- LoadingIndicator: loadingIndicator
+ LoadingIndicator: loadingIndicator,
}}
/>
);
@@ -162,7 +162,7 @@ export function SearchSelect<
DropdownIndicator: dropdownIndicator,
ClearIndicator: clearIndicator,
MultiValueRemove: multiValueRemove,
- LoadingIndicator: loadingIndicator
+ LoadingIndicator: loadingIndicator,
}}
/>
);
@@ -182,7 +182,7 @@ export function selectStyle<
verticalAlign: 'middle',
fontSize: '12px',
textAlign: 'left',
- width: '100%'
+ width: '100%',
}),
control: (_provided, state) => ({
position: 'relative',
@@ -198,7 +198,7 @@ export function selectStyle<
color: `${colors.baseFontColor}`,
cursor: 'default',
outline: 'none',
- padding: props?.large ? '4px 0px' : '0'
+ padding: props?.large ? '4px 0px' : '0',
}),
singleValue: () => ({
bottom: 0,
@@ -213,13 +213,13 @@ export function selectStyle<
maxWidth: '100%',
overflow: 'hidden',
textOverflow: 'ellipsis',
- whiteSpace: 'nowrap'
+ whiteSpace: 'nowrap',
}),
valueContainer: (_provided, state) => {
if (state.hasValue && state.isMulti) {
return {
lineHeight: '23px',
- paddingLeft: '1px'
+ paddingLeft: '1px',
};
}
@@ -236,7 +236,7 @@ export function selectStyle<
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
- display: 'flex'
+ display: 'flex',
};
},
indicatorsContainer: (_provided, state) => ({
@@ -246,7 +246,7 @@ export function selectStyle<
verticalAlign: 'middle',
width: '20px',
paddingRight: '5px',
- flex: 1
+ flex: 1,
}),
multiValue: () => ({
display: 'inline-block',
@@ -258,7 +258,7 @@ export function selectStyle<
fontSize: '12px',
lineHeight: '14px',
margin: '1px 4px 1px 1px',
- verticalAlign: 'top'
+ verticalAlign: 'top',
}),
multiValueLabel: () => ({
display: 'inline-block',
@@ -269,7 +269,7 @@ export function selectStyle<
maxWidth: 'calc(200px - 28px)',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
- verticalAlign: 'middle'
+ verticalAlign: 'middle',
}),
multiValueRemove: () => ({
order: '-1',
@@ -279,7 +279,7 @@ export function selectStyle<
padding: '1px 5px',
fontSize: '12px',
lineHeight: '14px',
- display: 'inline-block'
+ display: 'inline-block',
}),
menu: () => ({
borderBottomRightRadius: '4px',
@@ -295,17 +295,17 @@ export function selectStyle<
width: '100%',
zIndex: `${zIndexes.dropdownMenuZIndex}`,
webkitOverflowScrolling: 'touch',
- boxShadow: `${others.defaultShadow}`
+ boxShadow: `${others.defaultShadow}`,
}),
menuList: () => ({
boxSizing: 'border-box',
maxHeight: '198px',
padding: '5px 0',
- overflowY: 'auto'
+ overflowY: 'auto',
}),
placeholder: () => ({
position: 'absolute',
- color: '#666'
+ color: '#666',
}),
option: (_provided, state) => {
let borderLeftColor = 'transparent';
@@ -335,21 +335,21 @@ export function selectStyle<
cursor: state.isDisabled ? 'default' : 'pointer',
whiteSpace: 'nowrap',
overflow: 'hidden',
- textOverflow: 'ellipsis'
+ textOverflow: 'ellipsis',
};
},
input: () => ({
display: 'flex',
- alignItems: 'center'
+ alignItems: 'center',
}),
loadingIndicator: () => ({
position: 'absolute',
padding: '8px',
- fontSize: '4px'
+ fontSize: '4px',
}),
noOptionsMessage: () => ({
color: `${colors.gray60}`,
- padding: '8px 10px'
- })
+ padding: '8px 10px',
+ }),
};
}
diff --git a/server/sonar-web/src/main/js/components/controls/SelectList.tsx b/server/sonar-web/src/main/js/components/controls/SelectList.tsx
index 367e6b499cc..b7191b93de4 100644
--- a/server/sonar-web/src/main/js/components/controls/SelectList.tsx
+++ b/server/sonar-web/src/main/js/components/controls/SelectList.tsx
@@ -28,7 +28,7 @@ import SelectListListContainer from './SelectListListContainer';
export enum SelectListFilter {
All = 'all',
Selected = 'selected',
- Unselected = 'deselected'
+ Unselected = 'deselected',
}
interface Props {
@@ -75,9 +75,9 @@ export default class SelectList extends React.PureComponent<Props, State> {
filter: SelectListFilter.Selected,
page: 1,
pageSize: props.pageSize ? props.pageSize : DEFAULT_PAGE_SIZE,
- query: ''
+ query: '',
},
- loading: false
+ loading: false,
};
}
@@ -103,9 +103,9 @@ export default class SelectList extends React.PureComponent<Props, State> {
search = (searchParams: Partial<SelectListSearchParams>) =>
this.setState(
- prevState => ({
+ (prevState) => ({
loading: true,
- lastSearchParams: { ...prevState.lastSearchParams, ...searchParams }
+ lastSearchParams: { ...prevState.lastSearchParams, ...searchParams },
}),
() =>
this.props
@@ -113,7 +113,7 @@ export default class SelectList extends React.PureComponent<Props, State> {
filter: this.getFilter(),
page: this.props.withPaging ? this.state.lastSearchParams.page : undefined,
pageSize: this.props.withPaging ? this.state.lastSearchParams.pageSize : undefined,
- query: this.state.lastSearchParams.query
+ query: this.state.lastSearchParams.query,
})
.then(this.stopLoading)
.catch(this.stopLoading)
@@ -126,7 +126,7 @@ export default class SelectList extends React.PureComponent<Props, State> {
onLoadMore = () =>
this.search({
page:
- this.state.lastSearchParams.page != null ? this.state.lastSearchParams.page + 1 : undefined
+ this.state.lastSearchParams.page != null ? this.state.lastSearchParams.page + 1 : undefined,
});
onReload = () => this.search({ page: 1 });
@@ -135,7 +135,7 @@ export default class SelectList extends React.PureComponent<Props, State> {
const {
labelSelected = translate('selected'),
labelUnselected = translate('unselected'),
- labelAll = translate('all')
+ labelAll = translate('all'),
} = this.props;
const { filter } = this.state.lastSearchParams;
@@ -151,7 +151,7 @@ export default class SelectList extends React.PureComponent<Props, State> {
options={[
{ label: labelSelected, value: SelectListFilter.Selected },
{ label: labelUnselected, value: SelectListFilter.Unselected },
- { label: labelAll, value: SelectListFilter.All }
+ { label: labelAll, value: SelectListFilter.All },
]}
value={filter}
/>
diff --git a/server/sonar-web/src/main/js/components/controls/SelectListListContainer.tsx b/server/sonar-web/src/main/js/components/controls/SelectListListContainer.tsx
index 8644933ab51..561b831dbbe 100644
--- a/server/sonar-web/src/main/js/components/controls/SelectListListContainer.tsx
+++ b/server/sonar-web/src/main/js/components/controls/SelectListListContainer.tsx
@@ -71,11 +71,11 @@ export default class SelectListListContainer extends React.PureComponent<Props,
handleBulkChange = (checked: boolean) => {
this.setState({ loading: true });
if (checked) {
- Promise.all(this.props.elements.map(element => this.props.onSelect(element)))
+ Promise.all(this.props.elements.map((element) => this.props.onSelect(element)))
.then(this.stopLoading)
.catch(this.stopLoading);
} else {
- Promise.all(this.props.selectedElements.map(element => this.props.onUnselect(element)))
+ Promise.all(this.props.selectedElements.map((element) => this.props.onUnselect(element)))
.then(this.stopLoading)
.catch(this.stopLoading);
}
@@ -90,7 +90,8 @@ export default class SelectListListContainer extends React.PureComponent<Props,
checked={selectedElements.length > 0}
disabled={this.state.loading || readOnly}
onCheck={this.handleBulkChange}
- thirdState={selectedElements.length > 0 && elements.length !== selectedElements.length}>
+ thirdState={selectedElements.length > 0 && elements.length !== selectedElements.length}
+ >
<span className="big-spacer-left">
{translate('bulk_change')}
<DeferredSpinner className="spacer-left" loading={this.state.loading} timeout={10} />
@@ -112,7 +113,7 @@ export default class SelectListListContainer extends React.PureComponent<Props,
elements.length > 0 &&
filter === SelectListFilter.All &&
this.renderBulkSelector()}
- {elements.map(element => (
+ {elements.map((element) => (
<SelectListListElement
disabled={this.isDisabled(element)}
element={element}
diff --git a/server/sonar-web/src/main/js/components/controls/SelectListListElement.tsx b/server/sonar-web/src/main/js/components/controls/SelectListListElement.tsx
index e35d9c8bbf3..0f836b26e98 100644
--- a/server/sonar-web/src/main/js/components/controls/SelectListListElement.tsx
+++ b/server/sonar-web/src/main/js/components/controls/SelectListListElement.tsx
@@ -69,16 +69,18 @@ export default class SelectListListElement extends React.PureComponent<Props, St
return (
<li
className={classNames('display-flex-center', {
- 'select-list-list-disabled': this.props.disabled
- })}>
+ 'select-list-list-disabled': this.props.disabled,
+ })}
+ >
<Checkbox
checked={this.props.selected}
className={classNames('select-list-list-checkbox flex-1', {
- active: this.props.active
+ active: this.props.active,
})}
disabled={this.props.disabled}
loading={this.state.loading}
- onCheck={this.handleCheck}>
+ onCheck={this.handleCheck}
+ >
<span className="little-spacer-left">{item}</span>
</Checkbox>
{extra && <span className="select-list-list-extra">{extra}</span>}
diff --git a/server/sonar-web/src/main/js/components/controls/SimpleModal.tsx b/server/sonar-web/src/main/js/components/controls/SimpleModal.tsx
index e8006252fc6..2be3cd5dc2d 100644
--- a/server/sonar-web/src/main/js/components/controls/SimpleModal.tsx
+++ b/server/sonar-web/src/main/js/components/controls/SimpleModal.tsx
@@ -93,7 +93,7 @@ export default class SimpleModal extends React.Component<Props, State> {
onCloseClick: this.handleCloseClick,
onFormSubmit: this.handleFormSubmit,
onSubmitClick: this.handleSubmitClick,
- submitting: this.state.submitting
+ submitting: this.state.submitting,
})}
</Modal>
);
diff --git a/server/sonar-web/src/main/js/components/controls/Toggle.tsx b/server/sonar-web/src/main/js/components/controls/Toggle.tsx
index da1d5f832a4..cd797edc0ea 100644
--- a/server/sonar-web/src/main/js/components/controls/Toggle.tsx
+++ b/server/sonar-web/src/main/js/components/controls/Toggle.tsx
@@ -54,7 +54,8 @@ export default class Toggle extends React.PureComponent<Props> {
<Button className={className} disabled={disabled} name={name} onClick={this.handleClick}>
<div
aria-label={ariaLabel ?? translate(value ? 'on' : 'off')}
- className="boolean-toggle-handle">
+ className="boolean-toggle-handle"
+ >
<CheckIcon size={12} />
</div>
</Button>
diff --git a/server/sonar-web/src/main/js/components/controls/Toggler.tsx b/server/sonar-web/src/main/js/components/controls/Toggler.tsx
index e824dde5841..3413386cd29 100644
--- a/server/sonar-web/src/main/js/components/controls/Toggler.tsx
+++ b/server/sonar-web/src/main/js/components/controls/Toggler.tsx
@@ -42,7 +42,7 @@ export default class Toggler extends React.Component<Props> {
closeOnEscape = true,
closeOnFocusOut = true,
onRequestClose,
- overlay
+ overlay,
} = this.props;
let renderedOverlay = overlay;
diff --git a/server/sonar-web/src/main/js/components/controls/Tooltip.tsx b/server/sonar-web/src/main/js/components/controls/Tooltip.tsx
index 842184aacef..eafc1dc2099 100644
--- a/server/sonar-web/src/main/js/components/controls/Tooltip.tsx
+++ b/server/sonar-web/src/main/js/components/controls/Tooltip.tsx
@@ -58,7 +58,7 @@ const FLIP_MAP: { [key in Placement]: Placement } = {
left: 'right',
right: 'left',
top: 'bottom',
- bottom: 'top'
+ bottom: 'top',
};
function isMeasured(state: State): state is OwnState & Measurements {
@@ -85,7 +85,7 @@ export class TooltipInner extends React.Component<TooltipProps, State> {
id: string;
static defaultProps = {
- mouseEnterDelay: 0.1
+ mouseEnterDelay: 0.1,
};
constructor(props: TooltipProps) {
@@ -93,7 +93,7 @@ export class TooltipInner extends React.Component<TooltipProps, State> {
this.state = {
flipped: false,
placement: props.placement,
- visible: props.visible !== undefined ? props.visible : false
+ visible: props.visible !== undefined ? props.visible : false,
};
this.id = uniqueId('tooltip-');
this.throttledPositionTooltip = throttle(this.positionTooltip, 10);
@@ -225,7 +225,7 @@ export class TooltipInner extends React.Component<TooltipProps, State> {
left: window.pageXOffset + left,
top: window.pageYOffset + top,
width,
- height
+ height,
});
}
};
@@ -237,7 +237,7 @@ export class TooltipInner extends React.Component<TooltipProps, State> {
top: undefined,
width: undefined,
height: undefined,
- placement: this.props.placement
+ placement: this.props.placement,
});
};
@@ -335,7 +335,7 @@ export class TooltipInner extends React.Component<TooltipProps, State> {
// Set height to undefined to force ScreenPositionFixer to
// re-compute our positioning.
height: undefined,
- placement: FLIP_MAP[placement]
+ placement: FLIP_MAP[placement],
}),
() => {
if (this.state.visible) {
@@ -357,7 +357,7 @@ export class TooltipInner extends React.Component<TooltipProps, State> {
left: this.state.left + leftFix,
top: this.state.top + topFix,
width: this.state.width,
- height: this.state.height
+ height: this.state.height,
}
: undefined;
@@ -367,7 +367,8 @@ export class TooltipInner extends React.Component<TooltipProps, State> {
onPointerEnter={this.handleOverlayMouseEnter}
onPointerLeave={this.handleOverlayMouseLeave}
ref={this.tooltipNodeRef}
- style={style}>
+ style={style}
+ >
<div className={`${classNameSpace}-inner`} id={this.id}>
{this.props.overlay}
</div>
@@ -398,7 +399,7 @@ export class TooltipInner extends React.Component<TooltipProps, State> {
// See https://sarahmhigley.com/writing/tooltips-in-wcag-21/
// See https://css-tricks.com/accessible-svgs/
'aria-describedby': isVisible ? this.id : undefined,
- 'aria-labelledby': isVisible ? this.id : undefined
+ 'aria-labelledby': isVisible ? this.id : undefined,
})}
{isVisible && (
<EscKeydownHandler onKeydown={this.handleBlur}>
diff --git a/server/sonar-web/src/main/js/components/controls/ValidationForm.tsx b/server/sonar-web/src/main/js/components/controls/ValidationForm.tsx
index a958bcea345..257378367c4 100644
--- a/server/sonar-web/src/main/js/components/controls/ValidationForm.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ValidationForm.tsx
@@ -61,7 +61,8 @@ export default class ValidationForm<V extends FormikValues> extends React.Compon
initialValues={this.props.initialValues}
onSubmit={this.handleSubmit}
validate={this.props.validate}
- validateOnMount={true}>
+ validateOnMount={true}
+ >
{({ handleSubmit, ...props }) => (
<form onSubmit={handleSubmit}>{this.props.children(props)}</form>
)}
diff --git a/server/sonar-web/src/main/js/components/controls/ValidationInput.tsx b/server/sonar-web/src/main/js/components/controls/ValidationInput.tsx
index 1bf1fe419df..673db9eea54 100644
--- a/server/sonar-web/src/main/js/components/controls/ValidationInput.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ValidationInput.tsx
@@ -40,7 +40,7 @@ export interface ValidationInputProps {
export enum ValidationInputErrorPlacement {
Right,
- Bottom
+ Bottom,
}
export default function ValidationInput(props: ValidationInputProps) {
@@ -55,7 +55,7 @@ export default function ValidationInput(props: ValidationInputProps) {
isInvalid,
isValid,
label,
- required
+ required,
} = props;
const hasError = isInvalid && error !== undefined;
diff --git a/server/sonar-web/src/main/js/components/controls/ValidationModal.tsx b/server/sonar-web/src/main/js/components/controls/ValidationModal.tsx
index b7ce11c020a..4ad1eb99ceb 100644
--- a/server/sonar-web/src/main/js/components/controls/ValidationModal.tsx
+++ b/server/sonar-web/src/main/js/components/controls/ValidationModal.tsx
@@ -49,12 +49,14 @@ export default class ValidationModal<V extends FormikValues> extends React.PureC
contentLabel={this.props.header}
noBackdrop={this.props.noBackdrop}
onRequestClose={this.props.onClose}
- size={this.props.size}>
+ size={this.props.size}
+ >
<ValidationForm
initialValues={this.props.initialValues}
onSubmit={this.handleSubmit}
- validate={this.props.validate}>
- {props => (
+ validate={this.props.validate}
+ >
+ {(props) => (
<>
<header className="modal-head">
<h2>{this.props.header}</h2>
@@ -66,7 +68,8 @@ export default class ValidationModal<V extends FormikValues> extends React.PureC
<DeferredSpinner className="spacer-right" loading={props.isSubmitting} />
<SubmitButton
className={this.props.isDestructive ? 'button-red' : undefined}
- disabled={props.isSubmitting || !props.isValid || !props.dirty}>
+ disabled={props.isSubmitting || !props.isValid || !props.dirty}
+ >
{this.props.confirmButtonText}
</SubmitButton>
<ResetButtonLink disabled={props.isSubmitting} onClick={this.props.onClose}>
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx
index 60c7d6a00e3..498e42bfc7e 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/ActionsDropdown-test.tsx
@@ -24,7 +24,7 @@ import { PopupPlacement } from '../../ui/popups';
import ActionsDropdown, {
ActionsDropdownDivider,
ActionsDropdownItem,
- ActionsDropdownProps
+ ActionsDropdownProps,
} from '../ActionsDropdown';
describe('ActionsDropdown', () => {
@@ -41,7 +41,8 @@ describe('ActionsDropdown', () => {
overlayPlacement={PopupPlacement.Bottom}
small={true}
toggleClassName="bar"
- {...props}>
+ {...props}
+ >
<span>Hello world</span>
</ActionsDropdown>
);
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/BoxedGroupAccordion-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/BoxedGroupAccordion-test.tsx
index 11092c58b2d..9631e02ac5c 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/BoxedGroupAccordion-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/BoxedGroupAccordion-test.tsx
@@ -45,7 +45,8 @@ function renderDeliveryAccordion(renderHeader?: () => React.ReactNode) {
onClick={() => setOpen(!open)}
open={open}
title="test"
- renderHeader={renderHeader}>
+ renderHeader={renderHeader}
+ >
<div>children</div>
</BoxedGroupAccordion>
);
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx
index a2cab636bb4..f8fbc3fb301 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/BoxedTabs-test.tsx
@@ -29,10 +29,7 @@ it('should call onSelect when a tab is clicked', () => {
const onSelect = jest.fn();
const wrapper = shallowRender({ onSelect });
- wrapper
- .find('Styled(button)')
- .get(1)
- .props.onClick();
+ wrapper.find('Styled(button)').get(1).props.onClick();
expect(onSelect).toHaveBeenCalledWith('b');
});
@@ -60,8 +57,8 @@ function dom(overrides: Partial<BoxedTabsProps<string>>) {
<span>
Complex label <strong>!!!</strong>
</span>
- )
- }
+ ),
+ },
]}
{...overrides}
/>
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ButtonToggle-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ButtonToggle-test.tsx
index 0c0727c20db..21c80ba7464 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/ButtonToggle-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/ButtonToggle-test.tsx
@@ -56,7 +56,7 @@ function render(props?: Partial<ButtonToggleProps>) {
options={[
{ value: 'one', label: 'first' },
{ value: 'two', label: 'second' },
- { value: 'tree', label: 'third' }
+ { value: 'tree', label: 'third' },
]}
value="two"
{...props}
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Checkbox-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Checkbox-test.tsx
index 0bce5a8b967..910aa532e64 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/Checkbox-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/Checkbox-test.tsx
@@ -26,7 +26,7 @@ import Checkbox from '../Checkbox';
describe.each([
{ children: null, describtion: 'with no children' },
- { children: <a>child</a>, describtion: 'with children' }
+ { children: <a>child</a>, describtion: 'with children' },
])('Checkbox $describtion', ({ children }) => {
it('should call check function', async () => {
const user = userEvent.setup();
@@ -36,7 +36,7 @@ describe.each([
children,
onCheck,
checked: false,
- title: 'title'
+ title: 'title',
});
await user.click(screen.getByRole('checkbox', { name: 'me' }));
expect(onCheck).toHaveBeenCalledWith(true, undefined);
@@ -69,7 +69,7 @@ function renderCheckbox(override?: Partial<Checkbox['props']>) {
const { rerender } = renderComponent(
<Checkbox checked={true} onCheck={jest.fn()} {...override} />
);
- return function(reoverride?: Partial<Checkbox['props']>) {
+ return function (reoverride?: Partial<Checkbox['props']>) {
rerender(<Checkbox checked={true} onCheck={jest.fn()} {...override} {...reoverride} />);
};
}
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActions-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActions-test.tsx
index 6bade668517..b4db523e774 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActions-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActions-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import {
getReportStatus,
subscribeToEmailReport,
- unsubscribeFromEmailReport
+ unsubscribeFromEmailReport,
} from '../../../api/component-report';
import { addGlobalSuccessMessage } from '../../../helpers/globalMessages';
import { mockBranch } from '../../../helpers/mocks/branch-like';
@@ -41,16 +41,16 @@ jest.mock('../../../api/component-report', () => ({
jest.requireActual('../../../helpers/mocks/component-report').mockComponentReportStatus()
),
subscribeToEmailReport: jest.fn().mockResolvedValue(undefined),
- unsubscribeFromEmailReport: jest.fn().mockResolvedValue(undefined)
+ unsubscribeFromEmailReport: jest.fn().mockResolvedValue(undefined),
}));
jest.mock('../../../helpers/system', () => ({
...jest.requireActual('../../../helpers/system'),
- getBaseUrl: jest.fn().mockReturnValue('baseUrl')
+ getBaseUrl: jest.fn().mockReturnValue('baseUrl'),
}));
jest.mock('../../../helpers/globalMessages', () => ({
- addGlobalSuccessMessage: jest.fn()
+ addGlobalSuccessMessage: jest.fn(),
}));
beforeEach(jest.clearAllMocks);
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActionsRenderer-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActionsRenderer-test.tsx
index 3388abbaadd..b73bd5ee98f 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActionsRenderer-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/ComponentReportActionsRenderer-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { mockComponent } from '../../../helpers/mocks/component';
import { ComponentQualifier } from '../../../types/component';
import ComponentReportActionsRenderer, {
- ComponentReportActionsRendererProps
+ ComponentReportActionsRendererProps,
} from '../ComponentReportActionsRenderer';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ConfirmButton-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ConfirmButton-test.tsx
index 2707a807ec7..abf04c16270 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/ConfirmButton-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/ConfirmButton-test.tsx
@@ -27,9 +27,7 @@ it('should display a modal button', () => {
it('should display a confirm modal', () => {
expect(
- shallowRender()
- .find('ModalButton')
- .prop<Function>('modal')({ onClose: jest.fn() })
+ shallowRender().find('ModalButton').prop<Function>('modal')({ onClose: jest.fn() })
).toMatchSnapshot();
});
@@ -39,7 +37,8 @@ function shallowRender() {
confirmButtonText="submit"
modalBody={<div />}
modalHeader="title"
- onConfirm={jest.fn()}>
+ onConfirm={jest.fn()}
+ >
{() => 'Confirm button'}
</ConfirmButton>
);
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ConfirmModal-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ConfirmModal-test.tsx
index 8a7ca0ccd4e..8fcfe25a931 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/ConfirmModal-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/ConfirmModal-test.tsx
@@ -29,7 +29,8 @@ it('should render correctly', () => {
confirmData="data"
header="title"
onClose={jest.fn()}
- onConfirm={jest.fn()}>
+ onConfirm={jest.fn()}
+ >
<p>My confirm message</p>
</ConfirmModal>
);
@@ -46,7 +47,8 @@ it('should confirm and close after confirm', async () => {
confirmData="data"
header="title"
onClose={onClose}
- onConfirm={onConfirm}>
+ onConfirm={onConfirm}
+ >
<p>My confirm message</p>
</ConfirmModal>
);
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Favorite-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Favorite-test.tsx
index cfb77afaab3..1595c420663 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/Favorite-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/Favorite-test.tsx
@@ -26,7 +26,7 @@ import Favorite from '../Favorite';
jest.mock('../../../api/favorites', () => ({
addFavorite: jest.fn().mockResolvedValue(null),
- removeFavorite: jest.fn().mockResolvedValue(null)
+ removeFavorite: jest.fn().mockResolvedValue(null),
}));
it('renders and behaves correctly', async () => {
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/HomePageSelect-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/HomePageSelect-test.tsx
index 2dca15c10d9..58f508c5b5d 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/HomePageSelect-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/HomePageSelect-test.tsx
@@ -25,7 +25,7 @@ import { renderComponent } from '../../../helpers/testReactTestingUtils';
import { DEFAULT_HOMEPAGE, HomePageSelect } from '../HomePageSelect';
jest.mock('../../../api/users', () => ({
- setHomePage: jest.fn().mockResolvedValue(null)
+ setHomePage: jest.fn().mockResolvedValue(null),
}));
it('renders and behaves correctly', async () => {
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/IdentityProviderLink-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/IdentityProviderLink-test.tsx
index f0677f7cd57..1003b2a5f5b 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/IdentityProviderLink-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/IdentityProviderLink-test.tsx
@@ -25,7 +25,7 @@ const identityProvider = {
backgroundColor: '#000',
iconPath: '/some/path',
key: 'foo',
- name: 'Foo'
+ name: 'Foo',
};
it('should render correctly', () => {
@@ -35,7 +35,8 @@ it('should render correctly', () => {
backgroundColor={identityProvider.backgroundColor}
iconPath={identityProvider.iconPath}
name={identityProvider.name}
- url="/url/foo/bar">
+ url="/url/foo/bar"
+ >
Link text
</IdentityProviderLink>
)
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ListFooter-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ListFooter-test.tsx
index 24264836697..aad0490217c 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/ListFooter-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/ListFooter-test.tsx
@@ -44,7 +44,7 @@ it.each([
[undefined, 60, 30, true],
[undefined, 45, 30, false],
[undefined, 60, undefined, false],
- [60, 60, 30, false]
+ [60, 60, 30, false],
])(
'handle showing load more button based on total, count and pageSize',
(total, count, pageSize, expected) => {
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ModalValidationField-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ModalValidationField-test.tsx
index a5f98a7c83d..dcdeb6f480d 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/ModalValidationField-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/ModalValidationField-test.tsx
@@ -42,7 +42,8 @@ function getWrapper(props = {}) {
// eslint-disable-next-line jsx-a11y/label-has-associated-control
label={<label>Foo</label>}
touched={true}
- {...props}>
+ {...props}
+ >
{({ className }) => <input className={className} type="text" />}
</ModalValidationField>
);
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/RadioCard-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/RadioCard-test.tsx
index 97b17b4e971..0e6341e6700 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/RadioCard-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/RadioCard-test.tsx
@@ -37,7 +37,8 @@ it('should render correctly', () => {
recommended="Recommended for you"
title="Radio Card Vertical"
titleInfo="info"
- vertical={true}>
+ vertical={true}
+ >
<div>content</div>
</RadioCard>
)
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx
index 02f61738769..9d563714386 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx
@@ -29,7 +29,7 @@ jest.mock('lodash', () => {
});
jest.mock('react-dom', () => ({
- findDOMNode: jest.fn()
+ findDOMNode: jest.fn(),
}));
beforeEach(() => {
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Select-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Select-test.tsx
index 3360ccd64a1..de32f747f2c 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/Select-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/Select-test.tsx
@@ -24,7 +24,7 @@ import {
GroupTypeBase,
InputProps,
OptionTypeBase,
- Props as ReactSelectProps
+ Props as ReactSelectProps,
} from 'react-select';
import { LoadingIndicatorProps } from 'react-select/src/components/indicators';
import { MultiValueRemoveProps } from 'react-select/src/components/MultiValue';
@@ -35,7 +35,7 @@ import Select, {
dropdownIndicator,
loadingIndicator,
multiValueRemove,
- SearchSelect
+ SearchSelect,
} from '../Select';
describe('Select', () => {
@@ -53,8 +53,8 @@ describe('Select', () => {
isClearable: true,
isLoading: true,
components: {
- Input: inputRenderer
- }
+ Input: inputRenderer,
+ },
})
).toMatchSnapshot('other props');
});
@@ -91,7 +91,7 @@ describe('Select', () => {
it.each([
['CreatableSelect', CreatableSelect],
- ['SearchSelect', SearchSelect]
+ ['SearchSelect', SearchSelect],
])('should render %s correctly', (_name, Component) => {
expect(
shallow(<Component />)
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/SelectList-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/SelectList-test.tsx
index 2d5ff57b332..2ca12230b5c 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/SelectList-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/SelectList-test.tsx
@@ -43,7 +43,7 @@ it('should display properly with advanced features', async () => {
elementsTotalCount: 125,
pageSize: 10,
readOnly: true,
- withPaging: true
+ withPaging: true,
});
await waitAndUpdate(wrapper);
@@ -73,7 +73,7 @@ it('should cancel filter selection when search is active', async () => {
query: '',
filter: SelectListFilter.Unselected,
page: undefined,
- pageSize: undefined
+ pageSize: undefined,
});
expect(wrapper).toMatchSnapshot();
@@ -83,7 +83,7 @@ it('should cancel filter selection when search is active', async () => {
query,
filter: SelectListFilter.All,
page: undefined,
- pageSize: undefined
+ pageSize: undefined,
});
await waitAndUpdate(wrapper);
@@ -94,7 +94,7 @@ it('should cancel filter selection when search is active', async () => {
query: '',
filter: SelectListFilter.Unselected,
page: undefined,
- pageSize: undefined
+ pageSize: undefined,
});
await waitAndUpdate(wrapper);
@@ -109,7 +109,7 @@ it('should display pagination element properly and call search method with corre
query: '',
filter: SelectListFilter.Selected,
page: 1,
- pageSize: 100
+ pageSize: 100,
}); // Basic default call
wrapper.instance().onLoadMore();
@@ -117,7 +117,7 @@ it('should display pagination element properly and call search method with corre
query: '',
filter: SelectListFilter.Selected,
page: 2,
- pageSize: 100
+ pageSize: 100,
}); // Load more call
wrapper.instance().onReload();
@@ -125,7 +125,7 @@ it('should display pagination element properly and call search method with corre
query: '',
filter: SelectListFilter.Selected,
page: 1,
- pageSize: 100
+ pageSize: 100,
}); // Reload call
wrapper.setProps({ needToReload: true });
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/SelectListListElement-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/SelectListListElement-test.tsx
index bf6ac84422b..ebfe54248a0 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/SelectListListElement-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/SelectListListElement-test.tsx
@@ -37,7 +37,7 @@ it('should display a loader when checking', async () => {
it('should correctly handle a render callback that returns 2 elements', () => {
const wrapper = shallowRender({
- renderElement: (foo: string) => [foo, 'extra info']
+ renderElement: (foo: string) => [foo, 'extra info'],
});
expect(wrapper.find('.select-list-list-extra').exists()).toBe(true);
});
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Toggler-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Toggler-test.tsx
index 4286593997b..9b5bb533153 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/Toggler-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/Toggler-test.tsx
@@ -34,7 +34,7 @@ afterAll(() => {
const ui = {
toggleButton: byRole('button', { name: 'toggle' }),
outButton: byRole('button', { name: 'out' }),
- overlayButton: byRole('button', { name: 'overlay' })
+ overlayButton: byRole('button', { name: 'overlay' }),
};
async function openToggler(user: UserEvent) {
@@ -58,7 +58,7 @@ it('should handle escape correclty', async () => {
closeOnEscape: true,
closeOnClick: false,
closeOnClickOutside: false,
- closeOnFocusOut: false
+ closeOnFocusOut: false,
});
await openToggler(user);
@@ -79,7 +79,7 @@ it('should handle focus correctly', async () => {
closeOnEscape: false,
closeOnClick: false,
closeOnClickOutside: false,
- closeOnFocusOut: true
+ closeOnFocusOut: true,
});
await openToggler(user);
@@ -100,7 +100,7 @@ it('should handle click correctly', async () => {
closeOnEscape: false,
closeOnClick: true,
closeOnClickOutside: false,
- closeOnFocusOut: false
+ closeOnFocusOut: false,
});
await openToggler(user);
@@ -126,7 +126,7 @@ it('should handle click outside correctly', async () => {
closeOnEscape: false,
closeOnClick: false,
closeOnClickOutside: true,
- closeOnFocusOut: false
+ closeOnFocusOut: false,
});
await openToggler(user);
@@ -184,7 +184,8 @@ function renderToggler(override?: Partial<Toggler['props']>) {
onRequestClose={() => setOpen(false)}
open={open}
overlay={<button type="button">overlay</button>}
- {...props}>
+ {...props}
+ >
<button onClick={() => setOpen(true)} type="button">
toggle
</button>
@@ -195,7 +196,7 @@ function renderToggler(override?: Partial<Toggler['props']>) {
}
const { rerender } = render(<App {...override} />);
- return function(reoverride: Partial<Toggler['props']>) {
+ return function (reoverride: Partial<Toggler['props']>) {
return rerender(<App {...override} {...reoverride} />);
};
}
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/Tooltip-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/Tooltip-test.tsx
index b4fc7e2ec11..252dd1c9b03 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/Tooltip-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/Tooltip-test.tsx
@@ -33,14 +33,14 @@ afterAll(() => {
jest.mock('react-dom', () => {
const actual = jest.requireActual('react-dom');
return Object.assign({}, actual, {
- findDOMNode: jest.fn().mockReturnValue(undefined)
+ findDOMNode: jest.fn().mockReturnValue(undefined),
});
});
jest.mock('lodash', () => {
const actual = jest.requireActual('lodash');
return Object.assign({}, actual, {
- uniqueId: jest.fn(prefix => `${prefix}1`)
+ uniqueId: jest.fn((prefix) => `${prefix}1`),
});
});
@@ -114,16 +114,16 @@ it('should adjust arrow position', () => {
const wrapper = shallowRenderTooltipInner();
expect(wrapper.instance().adjustArrowPosition('left', { leftFix: 10, topFix: 20 })).toEqual({
- marginTop: -20
+ marginTop: -20,
});
expect(wrapper.instance().adjustArrowPosition('right', { leftFix: 10, topFix: 20 })).toEqual({
- marginTop: -20
+ marginTop: -20,
});
expect(wrapper.instance().adjustArrowPosition('top', { leftFix: 10, topFix: 20 })).toEqual({
- marginLeft: -10
+ marginLeft: -10,
});
expect(wrapper.instance().adjustArrowPosition('bottom', { leftFix: 10, topFix: 20 })).toEqual({
- marginLeft: -10
+ marginLeft: -10,
});
});
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationInput-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ValidationInput-test.tsx
index 6fbb8f8c87a..e3eaa5b7cf9 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationInput-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/ValidationInput-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import ValidationInput, {
ValidationInputErrorPlacement,
- ValidationInputProps
+ ValidationInputProps,
} from '../ValidationInput';
it('should render correctly', () => {
@@ -33,7 +33,7 @@ it('should render correctly', () => {
error: 'Field error message',
isInvalid: true,
isValid: false,
- required: false
+ required: false,
})
).toMatchSnapshot('with error');
expect(
@@ -41,7 +41,7 @@ it('should render correctly', () => {
error: 'Field error message',
errorPlacement: ValidationInputErrorPlacement.Bottom,
isInvalid: true,
- isValid: false
+ isValid: false,
})
).toMatchSnapshot('error under the input');
expect(shallowRender({ id: undefined, label: undefined })).toMatchSnapshot('no label');
@@ -57,7 +57,8 @@ function shallowRender(props: Partial<ValidationInputProps> = {}) {
isValid={true}
label="Field label"
required={true}
- {...props}>
+ {...props}
+ >
<div />
</ValidationInput>
);
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx
index 1be93af16b6..0c4b7fef5e6 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx
@@ -26,12 +26,7 @@ import ValidationModal from '../ValidationModal';
it('should render correctly', () => {
const wrapper = shallowRender();
expect(wrapper).toMatchSnapshot();
- expect(
- wrapper
- .find(ValidationForm)
- .dive()
- .dive()
- ).toMatchSnapshot();
+ expect(wrapper.find(ValidationForm).dive().dive()).toMatchSnapshot();
});
it('should handle submit', async () => {
@@ -57,8 +52,9 @@ function shallowRender(props: Partial<ValidationModal<{ field: string }>['props'
onClose={jest.fn()}
onSubmit={jest.fn()}
validate={jest.fn()}
- {...props}>
- {props => (
+ {...props}
+ >
+ {(props) => (
<input
name="field"
onBlur={props.handleBlur}
diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/clipboard-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/clipboard-test.tsx
index 075406a6a44..57544e2a986 100644
--- a/server/sonar-web/src/main/js/components/controls/__tests__/clipboard-test.tsx
+++ b/server/sonar-web/src/main/js/components/controls/__tests__/clipboard-test.tsx
@@ -25,7 +25,7 @@ import {
ClipboardButton,
ClipboardButtonProps,
ClipboardIconButton,
- ClipboardIconButtonProps
+ ClipboardIconButtonProps,
} from '../clipboard';
beforeAll(() => {
diff --git a/server/sonar-web/src/main/js/components/controls/clipboard.tsx b/server/sonar-web/src/main/js/components/controls/clipboard.tsx
index 34fe96012bd..9fabfa1844a 100644
--- a/server/sonar-web/src/main/js/components/controls/clipboard.tsx
+++ b/server/sonar-web/src/main/js/components/controls/clipboard.tsx
@@ -90,7 +90,7 @@ export class ClipboardBase extends React.PureComponent<Props, State> {
render() {
return this.props.children({
setCopyButton: this.setCopyButton,
- copySuccess: this.state.copySuccess
+ copySuccess: this.state.copySuccess,
});
}
}
@@ -106,7 +106,7 @@ export function ClipboardButton({
className,
children,
copyValue,
- 'aria-label': ariaLabel
+ 'aria-label': ariaLabel,
}: ClipboardButtonProps) {
return (
<ClipboardBase>
@@ -116,7 +116,8 @@ export function ClipboardButton({
className={classNames('no-select', className)}
data-clipboard-text={copyValue}
innerRef={setCopyButton}
- aria-label={ariaLabel ?? translate('copy_to_clipboard')}>
+ aria-label={ariaLabel ?? translate('copy_to_clipboard')}
+ >
{children || (
<>
<CopyIcon className="little-spacer-right" />
@@ -148,7 +149,8 @@ export function ClipboardIconButton(props: ClipboardIconButtonProps) {
data-clipboard-text={copyValue}
innerRef={setCopyButton}
tooltip={translate(copySuccess ? 'copied_action' : 'copy_to_clipboard')}
- tooltipProps={copySuccess ? { visible: copySuccess } : undefined}>
+ tooltipProps={copySuccess ? { visible: copySuccess } : undefined}
+ >
<CopyIcon />
</ButtonIcon>
);
diff --git a/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx
index d1d5c932654..ccf35a87fae 100644
--- a/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx
+++ b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx
@@ -66,7 +66,8 @@ export default class EmbedDocsPopup extends React.PureComponent<Props> {
<DocLink
innerRef={i === 0 ? this.focusFirstItem : undefined}
onClick={this.props.onClose}
- to={suggestion.link}>
+ to={suggestion.link}
+ >
{suggestion.text}
</DocLink>
</li>
@@ -111,7 +112,8 @@ export default class EmbedDocsPopup extends React.PureComponent<Props> {
<Link
className="display-flex-center"
to="https://community.sonarsource.com/"
- target="_blank">
+ target="_blank"
+ >
{translate('docs.get_help')}
</Link>
</li>
diff --git a/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopupHelper.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopupHelper.tsx
index b78665a57aa..b71013a6b1d 100644
--- a/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopupHelper.tsx
+++ b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopupHelper.tsx
@@ -41,7 +41,7 @@ export default class EmbedDocsPopupHelper extends React.PureComponent<{}, State>
};
toggleHelp = () => {
- this.setState(state => {
+ this.setState((state) => {
return { helpOpen: !state.helpOpen };
});
};
@@ -56,13 +56,15 @@ export default class EmbedDocsPopupHelper extends React.PureComponent<{}, State>
<Toggler
onRequestClose={this.closeHelp}
open={this.state.helpOpen}
- overlay={<EmbedDocsPopup onClose={this.closeHelp} />}>
+ overlay={<EmbedDocsPopup onClose={this.closeHelp} />}
+ >
<ButtonLink
aria-expanded={this.state.helpOpen}
aria-haspopup={true}
className="navbar-help navbar-icon"
onClick={this.handleClick}
- title={translate('help')}>
+ title={translate('help')}
+ >
<HelpIcon />
</ButtonLink>
</Toggler>
diff --git a/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsContext.ts b/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsContext.ts
index e389713676b..793dfc3dced 100644
--- a/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsContext.ts
+++ b/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsContext.ts
@@ -33,5 +33,5 @@ export const SuggestionsContext = createContext<SuggestionsContextShape>({
removeSuggestions: () => {
/* Implemented by Provider */
},
- suggestions: []
+ suggestions: [],
});
diff --git a/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsProvider.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsProvider.tsx
index 70ec0da9d51..4ee84c01bb2 100644
--- a/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsProvider.tsx
+++ b/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsProvider.tsx
@@ -35,7 +35,7 @@ export default class SuggestionsProvider extends React.Component<{}, State> {
fetchSuggestions = () => {
const jsonList = suggestionsJson as SuggestionsJson;
let suggestions: SuggestionLink[] = [];
- this.keys.forEach(key => {
+ this.keys.forEach((key) => {
if (jsonList[key]) {
suggestions = [...jsonList[key], ...suggestions];
}
@@ -50,7 +50,7 @@ export default class SuggestionsProvider extends React.Component<{}, State> {
};
removeSuggestions = (oldKey: string) => {
- this.keys = this.keys.filter(key => key !== oldKey);
+ this.keys = this.keys.filter((key) => key !== oldKey);
this.fetchSuggestions();
};
@@ -60,8 +60,9 @@ export default class SuggestionsProvider extends React.Component<{}, State> {
value={{
addSuggestions: this.addSuggestions,
removeSuggestions: this.removeSuggestions,
- suggestions: this.state.suggestions
- }}>
+ suggestions: this.state.suggestions,
+ }}
+ >
{this.props.children}
</SuggestionsContext.Provider>
);
diff --git a/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/EmbedDocsPopup-test.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/EmbedDocsPopup-test.tsx
index c410eea978d..d404fdfdcec 100644
--- a/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/EmbedDocsPopup-test.tsx
+++ b/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/EmbedDocsPopup-test.tsx
@@ -34,7 +34,7 @@ it('should render with no suggestions', () => {
it('should render with suggestions', () => {
renderEmbedDocsPopup([
{ link: '/docs/awesome-doc', text: 'mindblowing' },
- { link: '/docs/whocares', text: 'boring' }
+ { link: '/docs/whocares', text: 'boring' },
]);
expect(screen.getAllByRole('link')).toHaveLength(7);
@@ -44,7 +44,8 @@ it('should render with suggestions', () => {
function renderEmbedDocsPopup(suggestions: SuggestionLink[] = []) {
return renderComponent(
<SuggestionsContext.Provider
- value={{ addSuggestions: jest.fn(), removeSuggestions: jest.fn(), suggestions }}>
+ value={{ addSuggestions: jest.fn(), removeSuggestions: jest.fn(), suggestions }}
+ >
<EmbedDocsPopup onClose={jest.fn()} />
</SuggestionsContext.Provider>
);
diff --git a/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx
index 28a914dcee1..2ff0c162e19 100644
--- a/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx
+++ b/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx
@@ -25,7 +25,7 @@ jest.mock(
'../EmbedDocsSuggestions.json',
() => ({
pageA: [{ link: '/foo', text: 'Foo' }],
- pageB: [{ link: '/qux', text: 'Qux' }]
+ pageB: [{ link: '/qux', text: 'Qux' }],
}),
{ virtual: true }
);
@@ -45,7 +45,7 @@ it('should add & remove suggestions', () => {
instance.addSuggestions('pageB');
expect(wrapper.state('suggestions')).toEqual([
{ link: '/qux', text: 'Qux' },
- { link: '/foo', text: 'Foo' }
+ { link: '/foo', text: 'Foo' },
]);
instance.removeSuggestions('pageA');
diff --git a/server/sonar-web/src/main/js/components/facet/FacetBox.tsx b/server/sonar-web/src/main/js/components/facet/FacetBox.tsx
index 859ebbe3b9e..2927ec71476 100644
--- a/server/sonar-web/src/main/js/components/facet/FacetBox.tsx
+++ b/server/sonar-web/src/main/js/components/facet/FacetBox.tsx
@@ -30,7 +30,8 @@ export default function FacetBox(props: FacetBoxProps) {
return (
<div
className={classNames('search-navigator-facet-box', props.className)}
- data-property={props.property}>
+ data-property={props.property}
+ >
{props.children}
</div>
);
diff --git a/server/sonar-web/src/main/js/components/facet/FacetHeader.tsx b/server/sonar-web/src/main/js/components/facet/FacetHeader.tsx
index ee06de65751..529cdb602c7 100644
--- a/server/sonar-web/src/main/js/components/facet/FacetHeader.tsx
+++ b/server/sonar-web/src/main/js/components/facet/FacetHeader.tsx
@@ -87,7 +87,8 @@ export default class FacetHeader extends React.PureComponent<Props> {
type="button"
onClick={this.handleClick}
aria-expanded={open}
- tabIndex={0}>
+ tabIndex={0}
+ >
<OpenCloseIcon className="little-spacer-right" open={open} />
{header}
</button>
@@ -116,7 +117,8 @@ export default class FacetHeader extends React.PureComponent<Props> {
<Button
className="search-navigator-facet-header-button button-small button-red"
aria-label={translateWithParameters('clear_x_filter', name)}
- onClick={this.props.onClear}>
+ onClick={this.props.onClear}
+ >
{translate('clear')}
</Button>
)}
diff --git a/server/sonar-web/src/main/js/components/facet/FacetItem.tsx b/server/sonar-web/src/main/js/components/facet/FacetItem.tsx
index e9bcbb40469..6f1426173e0 100644
--- a/server/sonar-web/src/main/js/components/facet/FacetItem.tsx
+++ b/server/sonar-web/src/main/js/components/facet/FacetItem.tsx
@@ -35,7 +35,7 @@ export interface Props {
export default class FacetItem extends React.PureComponent<Props> {
static defaultProps = {
halfWidth: false,
- loading: false
+ loading: false,
};
handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
@@ -54,7 +54,7 @@ export default class FacetItem extends React.PureComponent<Props> {
render() {
const { name, halfWidth, active, value, tooltip } = this.props;
const className = classNames('search-navigator-facet button-link', this.props.className, {
- active
+ active,
});
return (
@@ -67,7 +67,8 @@ export default class FacetItem extends React.PureComponent<Props> {
tabIndex={0}
title={tooltip}
role="checkbox"
- type="button">
+ type="button"
+ >
<span className="facet-name">{name}</span>
{this.renderValue()}
</button>
diff --git a/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx b/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx
index 206df6595be..c8df919b5a2 100644
--- a/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx
+++ b/server/sonar-web/src/main/js/components/facet/ListStyleFacet.tsx
@@ -86,7 +86,7 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
static defaultProps = {
maxInitialItems: 15,
maxItems: 100,
- minSearchLength: 2
+ minSearchLength: 2,
};
state: State<S> = {
@@ -94,7 +94,7 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
query: '',
searching: false,
searchResultsCounts: {},
- showFullList: false
+ showFullList: false,
};
componentDidMount() {
@@ -116,7 +116,7 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
searchResults: undefined,
searching: false,
searchResultsCounts: {},
- showFullList: false
+ showFullList: false,
});
} else if (
prevProps.stats !== this.props.stats &&
@@ -143,7 +143,7 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
this.props.onChange({ [this.props.property]: newValue });
} else {
this.props.onChange({
- [this.props.property]: values.includes(itemValue) && values.length < 2 ? [] : [itemValue]
+ [this.props.property]: values.includes(itemValue) && values.length < 2 ? [] : [itemValue],
});
}
}
@@ -175,12 +175,12 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
.then(this.loadCountsForSearchResults)
.then(({ maxResults, paging, results, stats }) => {
if (this.mounted) {
- this.setState(state => ({
+ this.setState((state) => ({
searching: false,
searchMaxResults: maxResults,
searchResults: results,
searchPaging: paging,
- searchResultsCounts: { ...state.searchResultsCounts, ...stats }
+ searchResultsCounts: { ...state.searchResultsCounts, ...stats },
}));
}
})
@@ -199,11 +199,11 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
.then(this.loadCountsForSearchResults)
.then(({ paging, results, stats }) => {
if (this.mounted) {
- this.setState(state => ({
+ this.setState((state) => ({
searching: false,
searchResults: [...searchResults, ...results],
searchPaging: paging,
- searchResultsCounts: { ...state.searchResultsCounts, ...stats }
+ searchResultsCounts: { ...state.searchResultsCounts, ...stats },
}));
}
})
@@ -213,12 +213,12 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
loadCountsForSearchResults = (response: SearchResponse<S>) => {
const { loadSearchResultCount = () => Promise.resolve({}) } = this.props;
- const resultsToLoad = response.results.filter(result => {
+ const resultsToLoad = response.results.filter((result) => {
const key = this.props.getSearchResultKey(result);
return this.getStat(key) === undefined && this.state.searchResultsCounts[key] === undefined;
});
if (resultsToLoad.length > 0) {
- return loadSearchResultCount(resultsToLoad).then(stats => ({ ...response, stats }));
+ return loadSearchResultCount(resultsToLoad).then((stats) => ({ ...response, stats }));
} else {
return { ...response, stats: {} };
}
@@ -248,8 +248,8 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
? this.props.getSortedItems()
: sortBy(
Object.keys(stats),
- key => -stats[key],
- key => this.props.getFacetItemText(key)
+ (key) => -stats[key],
+ (key) => this.props.getFacetItemText(key)
);
const limitedList = this.state.showFullList
@@ -261,14 +261,14 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
? []
: sortedItems
.slice(this.props.maxInitialItems)
- .filter(item => this.props.values.includes(item));
+ .filter((item) => this.props.values.includes(item));
const mightHaveMoreResults = sortedItems.length >= this.props.maxItems;
return (
<>
<FacetItemsList>
- {limitedList.map(item => (
+ {limitedList.map((item) => (
<FacetItem
active={this.props.values.includes(item)}
key={item}
@@ -284,7 +284,7 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
<>
<div className="note spacer-bottom text-center">⋯</div>
<FacetItemsList>
- {selectedBelowLimit.map(item => (
+ {selectedBelowLimit.map((item) => (
<FacetItem
active={true}
key={item}
@@ -342,7 +342,7 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
return (
<>
<FacetItemsList>
- {searchResults.map(result => this.renderSearchResult(result))}
+ {searchResults.map((result) => this.renderSearchResult(result))}
</FacetItemsList>
{searchMaxResults && (
<Alert className="spacer-top" variant="warning">
@@ -382,16 +382,17 @@ export default class ListStyleFacet<S> extends React.Component<Props<S>, State<S
render() {
const { disabled, stats = {} } = this.props;
const { query, searching, searchResults } = this.state;
- const values = this.props.values.map(item => this.props.getFacetItemText(item));
+ const values = this.props.values.map((item) => this.props.getFacetItemText(item));
const loadingResults =
query !== '' && searching && (searchResults === undefined || searchResults.length === 0);
const showList = !query || loadingResults;
return (
<FacetBox
className={classNames(this.props.className, {
- 'search-navigator-facet-box-forbidden': disabled
+ 'search-navigator-facet-box-forbidden': disabled,
})}
- property={this.props.property}>
+ property={this.props.property}
+ >
<FacetHeader
fetching={this.props.fetching}
name={this.props.facetHeader}
diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx b/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx
index a6c9e7430be..78854e10df3 100644
--- a/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx
+++ b/server/sonar-web/src/main/js/components/facet/__tests__/ListStyleFacet-test.tsx
@@ -74,7 +74,7 @@ it('should clear', () => {
it('should search', async () => {
const onSearch = jest.fn().mockResolvedValue({
results: ['d', 'e'],
- paging: { pageIndex: 1, pageSize: 2, total: 3 }
+ paging: { pageIndex: 1, pageSize: 2, total: 3 },
});
const loadSearchResultCount = jest.fn().mockResolvedValue({ d: 7, e: 3 });
const wrapper = shallowRender({ loadSearchResultCount, onSearch });
@@ -89,7 +89,7 @@ it('should search', async () => {
// load more results
onSearch.mockResolvedValue({
results: ['f'],
- paging: { pageIndex: 2, pageSize: 2, total: 3 }
+ paging: { pageIndex: 2, pageSize: 2, total: 3 },
});
loadSearchResultCount.mockResolvedValue({ f: 5 });
wrapper.find('ListFooter').prop<Function>('loadMore')();
@@ -149,7 +149,7 @@ it('should reset state when closes', () => {
query: 'foobar',
searchResults: ['foo', 'bar'],
searching: true,
- showFullList: true
+ showFullList: true,
});
wrapper.setProps({ open: false });
@@ -175,7 +175,7 @@ it('should display all selected items', () => {
const wrapper = shallowRender({
maxInitialItems: 2,
stats: { a: 10, b: 5, c: 3 },
- values: ['a', 'b', 'c']
+ values: ['a', 'b', 'c'],
});
expect(wrapper).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx b/server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx
index 4a74abbefe1..76668cadfc5 100644
--- a/server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx
+++ b/server/sonar-web/src/main/js/components/facet/__tests__/MultipleSelectionHint-test.tsx
@@ -24,7 +24,7 @@ import MultipleSelectionHint from '../MultipleSelectionHint';
it('should render for mac', () => {
Object.defineProperty(navigator, 'userAgent', {
configurable: true,
- value: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4)'
+ value: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4)',
});
expect(shallow(<MultipleSelectionHint options={3} values={1} />)).toMatchSnapshot();
});
@@ -32,7 +32,7 @@ it('should render for mac', () => {
it('should render for windows', () => {
Object.defineProperty(navigator, 'userAgent', {
configurable: true,
- value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'
+ value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)',
});
expect(shallow(<MultipleSelectionHint options={3} values={1} />)).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx
index 3f4c0d904a7..626875582db 100644
--- a/server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/__tests__/whenLoggedIn-test.tsx
@@ -44,11 +44,7 @@ it('should not render for anonymous user', () => {
});
function getRenderedType(wrapper: ShallowWrapper) {
- return wrapper
- .dive()
- .dive()
- .dive()
- .type();
+ return wrapper.dive().dive().dive().type();
}
function shallowRender(isLoggedIn = true) {
@@ -57,8 +53,9 @@ function shallowRender(isLoggedIn = true) {
value={{
currentUser: { isLoggedIn, dismissedNotices: {} },
updateCurrentUserHomepage: () => {},
- updateDismissedNotices: () => {}
- }}>
+ updateDismissedNotices: () => {},
+ }}
+ >
<UnderTest />
</CurrentUserContext.Provider>
);
diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx
index 0a68721016e..9c596aae4be 100644
--- a/server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/__tests__/withCLanguageFeature-test.tsx
@@ -26,8 +26,8 @@ jest.mock('../../../app/components/languages/LanguagesContext', () => {
LanguagesContext: {
Consumer: ({ children }: { children: (props: {}) => React.ReactNode }) => {
return children({ c: { key: 'c', name: 'c' } });
- }
- }
+ },
+ },
};
});
diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx
index 626625b01a4..1b9484f4f0f 100644
--- a/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationContext-test.tsx
@@ -25,7 +25,7 @@ import withIndexationContext, { WithIndexationContextProps } from '../withIndexa
it('should render correctly', () => {
const indexationContext: IndexationContextInterface = {
- status: { isCompleted: true, percentCompleted: 87, hasFailures: false }
+ status: { isCompleted: true, percentCompleted: 87, hasFailures: false },
};
const wrapper = mountRender(indexationContext);
@@ -38,8 +38,9 @@ function mountRender(indexationContext?: Partial<IndexationContextInterface>) {
<IndexationContext.Provider
value={{
status: { isCompleted: false, percentCompleted: 23, hasFailures: false },
- ...indexationContext
- }}>
+ ...indexationContext,
+ }}
+ >
<TestComponentWithIndexationContext />
</IndexationContext.Provider>
);
diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationGuard-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationGuard-test.tsx
index 0b41b37b38f..9708493c619 100644
--- a/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationGuard-test.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/__tests__/withIndexationGuard-test.tsx
@@ -31,14 +31,14 @@ it('should not render children because indexation is in progress', () => {
it('should not render children because indexation has failures', () => {
const wrapper = mountRender({
- status: { isCompleted: true, percentCompleted: 100, hasFailures: true }
+ status: { isCompleted: true, percentCompleted: 100, hasFailures: true },
});
expect(wrapper.find(TestComponent).exists()).toBe(false);
});
it('should render children because indexation is completed without failures', () => {
const wrapper = mountRender({
- status: { isCompleted: true, percentCompleted: 100, hasFailures: false }
+ status: { isCompleted: true, percentCompleted: 100, hasFailures: false },
});
expect(wrapper.find(TestComponent).exists()).toBe(true);
});
@@ -48,8 +48,9 @@ function mountRender(context?: Partial<IndexationContextInterface>) {
<IndexationContext.Provider
value={{
status: { isCompleted: false, percentCompleted: 23, hasFailures: false },
- ...context
- }}>
+ ...context,
+ }}
+ >
<TestComponentWithGuard />
</IndexationContext.Provider>
);
diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx
index d1b0c500b03..2d0c573ca28 100644
--- a/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/__tests__/withKeyboardNavigation-test.tsx
@@ -39,7 +39,7 @@ const WrappedComponent = withKeyboardNavigation(X);
const COMPONENTS = [
mockComponent({ key: 'file-1' }),
mockComponent({ key: 'file-2' }),
- mockComponent({ key: 'file-3' })
+ mockComponent({ key: 'file-3' }),
];
it('should wrap component correctly', () => {
@@ -49,7 +49,7 @@ it('should wrap component correctly', () => {
it('should correctly bind key events for component navigation', () => {
const onGoToParent = jest.fn();
- const onHighlight = jest.fn(selected => {
+ const onHighlight = jest.fn((selected) => {
wrapper.setProps({ selected });
});
const onSelect = jest.fn();
@@ -60,7 +60,7 @@ it('should correctly bind key events for component navigation', () => {
onGoToParent,
onHighlight,
onSelect,
- selected: COMPONENTS[1]
+ selected: COMPONENTS[1],
})
);
@@ -95,14 +95,14 @@ it('should correctly bind key events for component navigation', () => {
it('should support not cycling through elements, and triggering a callback on reaching the last element', () => {
const onEndOfList = jest.fn();
- const onHighlight = jest.fn(selected => {
+ const onHighlight = jest.fn((selected) => {
wrapper.setProps({ selected });
});
const wrapper = mount(
applyProps({
onEndOfList,
- onHighlight
+ onHighlight,
})
);
@@ -132,7 +132,7 @@ it('should correctly bind key events for codeview navigation', () => {
onGoToParent,
onHighlight,
onSelect,
- selected: COMPONENTS[1]
+ selected: COMPONENTS[1],
})
);
diff --git a/server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx b/server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx
index c29439d7f6e..caf14b2dd34 100644
--- a/server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/__tests__/withNotifications-test.tsx
@@ -34,25 +34,25 @@ jest.mock('../../../api/notifications', () => ({
channel: 'channel1',
type: 'type-global',
project: 'foo',
- projectName: 'Foo'
+ projectName: 'Foo',
},
{
channel: 'channel1',
type: 'type-common',
project: 'bar',
- projectName: 'Bar'
+ projectName: 'Bar',
},
{
channel: 'channel2',
type: 'type-common',
project: 'qux',
- projectName: 'Qux'
- }
+ projectName: 'Qux',
+ },
],
- perProjectTypes: ['type-common']
+ perProjectTypes: ['type-common'],
})
),
- removeNotification: jest.fn().mockResolvedValue({})
+ removeNotification: jest.fn().mockResolvedValue({}),
}));
class X extends React.Component<WithNotificationsProps> {
@@ -77,7 +77,7 @@ it('should add and remove a notification', () => {
const notification = {
channel: 'EmailNotificationChannel',
project: 'foo',
- type: 'SQ-MyNewIssues'
+ type: 'SQ-MyNewIssues',
};
wrapper.prop('addNotification')(notification);
diff --git a/server/sonar-web/src/main/js/components/hoc/withCLanguageFeature.tsx b/server/sonar-web/src/main/js/components/hoc/withCLanguageFeature.tsx
index 4b9150b82ef..0a07ecebaeb 100644
--- a/server/sonar-web/src/main/js/components/hoc/withCLanguageFeature.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/withCLanguageFeature.tsx
@@ -30,7 +30,7 @@ export function withCLanguageFeature<P>(
render() {
return (
<LanguagesContext.Consumer>
- {languages => {
+ {(languages) => {
const hasCLanguageFeature = languages['c'] !== undefined;
return (
diff --git a/server/sonar-web/src/main/js/components/hoc/withIndexationContext.tsx b/server/sonar-web/src/main/js/components/hoc/withIndexationContext.tsx
index 6ea0f892882..c071c554616 100644
--- a/server/sonar-web/src/main/js/components/hoc/withIndexationContext.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/withIndexationContext.tsx
@@ -37,7 +37,7 @@ export default function withIndexationContext<P>(
render() {
return (
<IndexationContext.Consumer>
- {indexationContext => {
+ {(indexationContext) => {
if (indexationContext) {
return (
<WrappedComponent indexationContext={indexationContext} {...(this.props as P)} />
diff --git a/server/sonar-web/src/main/js/components/hoc/withIndexationGuard.tsx b/server/sonar-web/src/main/js/components/hoc/withIndexationGuard.tsx
index d757389e0e2..28305aac05b 100644
--- a/server/sonar-web/src/main/js/components/hoc/withIndexationGuard.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/withIndexationGuard.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import { IndexationContext } from '../../app/components/indexation/IndexationContext';
import PageUnavailableDueToIndexation, {
- PageContext
+ PageContext,
} from '../../app/components/indexation/PageUnavailableDueToIndexation';
export default function withIndexationGuard<P>(
@@ -31,7 +31,7 @@ export default function withIndexationGuard<P>(
render() {
return (
<IndexationContext.Consumer>
- {context =>
+ {(context) =>
context?.status.isCompleted && !context?.status.hasFailures ? (
<WrappedComponent {...this.props} />
) : (
diff --git a/server/sonar-web/src/main/js/components/hoc/withKeyboardNavigation.tsx b/server/sonar-web/src/main/js/components/hoc/withKeyboardNavigation.tsx
index ecfacd0054f..f475e8805a4 100644
--- a/server/sonar-web/src/main/js/components/hoc/withKeyboardNavigation.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/withKeyboardNavigation.tsx
@@ -71,7 +71,7 @@ export default function withKeyboardNavigation<P>(
const { selected, components = [] } = this.props;
return selected
? components.findIndex(
- component =>
+ (component) =>
getComponentMeasureUniqueKey(component) === getComponentMeasureUniqueKey(selected)
)
: -1;
diff --git a/server/sonar-web/src/main/js/components/hoc/withNotifications.tsx b/server/sonar-web/src/main/js/components/hoc/withNotifications.tsx
index 2b85d1ad84d..1ab261350f5 100644
--- a/server/sonar-web/src/main/js/components/hoc/withNotifications.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/withNotifications.tsx
@@ -53,7 +53,7 @@ export function withNotifications<P>(
globalTypes: [],
loading: true,
notifications: [],
- perProjectTypes: []
+ perProjectTypes: [],
};
componentDidMount() {
@@ -67,14 +67,14 @@ export function withNotifications<P>(
fetchNotifications = () => {
getNotifications().then(
- response => {
+ (response) => {
if (this.mounted) {
this.setState({
channels: response.channels,
globalTypes: response.globalTypes,
loading: false,
notifications: response.notifications,
- perProjectTypes: response.perProjectTypes
+ perProjectTypes: response.perProjectTypes,
});
}
},
@@ -87,16 +87,16 @@ export function withNotifications<P>(
};
addNotificationToState = (added: Notification) => {
- this.setState(state => {
+ this.setState((state) => {
const notifications = uniqWith([...state.notifications, added], this.areNotificationsEqual);
return { notifications };
});
};
removeNotificationFromState = (removed: Notification) => {
- this.setState(state => {
+ this.setState((state) => {
const notifications = state.notifications.filter(
- notification => !this.areNotificationsEqual(notification, removed)
+ (notification) => !this.areNotificationsEqual(notification, removed)
);
return { notifications };
});
diff --git a/server/sonar-web/src/main/js/components/hoc/withRouter.tsx b/server/sonar-web/src/main/js/components/hoc/withRouter.tsx
index 650d6db725c..67d700de2d2 100644
--- a/server/sonar-web/src/main/js/components/hoc/withRouter.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/withRouter.tsx
@@ -24,7 +24,7 @@ import {
useLocation as useLocationRouter,
useNavigate,
useParams,
- useSearchParams
+ useSearchParams,
} from 'react-router-dom';
import { queryToSearch, searchParamsToQuery } from '../../helpers/urls';
import { RawQuery } from '../../types/types';
@@ -67,14 +67,14 @@ export function withRouter<P extends Partial<WithRouterProps>>(
path.search = queryToSearch((path as Location).query);
}
navigate(path);
- }
+ },
}),
[navigate]
);
const location = {
...locationRouter,
- query: searchParamsToQuery(searchParams)
+ query: searchParamsToQuery(searchParams),
};
return <WrappedComponent {...props} location={location} params={params} router={router} />;
diff --git a/server/sonar-web/src/main/js/components/hoc/withScrollTo.tsx b/server/sonar-web/src/main/js/components/hoc/withScrollTo.tsx
index a25cd9f8b05..4166be9e339 100644
--- a/server/sonar-web/src/main/js/components/hoc/withScrollTo.tsx
+++ b/server/sonar-web/src/main/js/components/hoc/withScrollTo.tsx
@@ -73,7 +73,7 @@ export function withScrollTo<P>(WrappedComponent: React.ComponentClass<P>) {
return (
<WrappedComponent
{...this.props}
- ref={ref => {
+ ref={(ref) => {
this.componentRef = ref;
}}
/>
diff --git a/server/sonar-web/src/main/js/components/icons/DropdownIcon.tsx b/server/sonar-web/src/main/js/components/icons/DropdownIcon.tsx
index 298462ab8b8..59aa894003b 100644
--- a/server/sonar-web/src/main/js/components/icons/DropdownIcon.tsx
+++ b/server/sonar-web/src/main/js/components/icons/DropdownIcon.tsx
@@ -36,7 +36,8 @@ export default function DropdownIcon({
style={turned ? { transform: 'rotate(180deg)' } : undefined}
viewBox="0 0 7 16"
width={(size / 16) * 7}
- {...iconProps}>
+ {...iconProps}
+ >
<path
d="M7 6.469a.42.42 0 0 1-.13.307L3.808 9.84a.42.42 0 0 1-.308.13.42.42 0 0 1-.308-.13L.13 6.776A.42.42 0 0 1 0 6.47a.42.42 0 0 1 .13-.308.42.42 0 0 1 .307-.13h6.126a.42.42 0 0 1 .307.13.42.42 0 0 1 .13.308z"
style={{ fill }}
diff --git a/server/sonar-web/src/main/js/components/icons/FavoriteIcon.tsx b/server/sonar-web/src/main/js/components/icons/FavoriteIcon.tsx
index d9518fe96d9..6e64585661e 100644
--- a/server/sonar-web/src/main/js/components/icons/FavoriteIcon.tsx
+++ b/server/sonar-web/src/main/js/components/icons/FavoriteIcon.tsx
@@ -31,7 +31,8 @@ export default function FavoriteIcon({ className, favorite, fill, ...iconProps }
<Icon
className={classNames('icon-outline', { 'is-filled': favorite }, className)}
style={{ color: fill || colors.favoriteColor }}
- {...iconProps}>
+ {...iconProps}
+ >
<g transform="matrix(0.988024,0,0,0.988024,0.0957953,0.717719)">
<path d="M15.428,5.777C15.428,5.908 15.35,6.051 15.195,6.205L11.954,9.366L12.722,13.83C12.728,13.872 12.731,13.932 12.731,14.009C12.731,14.134 12.7,14.24 12.637,14.326C12.575,14.412 12.484,14.455 12.365,14.455C12.252,14.455 12.133,14.42 12.008,14.348L7.999,12.241L3.99,14.348C3.859,14.42 3.74,14.455 3.633,14.455C3.508,14.455 3.414,14.412 3.352,14.326C3.289,14.24 3.258,14.134 3.258,14.009C3.258,13.973 3.264,13.914 3.276,13.83L4.044,9.366L0.794,6.205C0.645,6.045 0.57,5.902 0.57,5.777C0.57,5.557 0.737,5.42 1.07,5.366L5.552,4.714L7.561,0.652C7.674,0.408 7.82,0.286 7.999,0.286C8.177,0.286 8.323,0.408 8.436,0.652L10.445,4.714L14.927,5.366C15.261,5.42 15.427,5.557 15.427,5.777L15.428,5.777Z" />
</g>
diff --git a/server/sonar-web/src/main/js/components/icons/HomeIcon.tsx b/server/sonar-web/src/main/js/components/icons/HomeIcon.tsx
index 57fe5bf9d0a..e5e2fcc6030 100644
--- a/server/sonar-web/src/main/js/components/icons/HomeIcon.tsx
+++ b/server/sonar-web/src/main/js/components/icons/HomeIcon.tsx
@@ -31,7 +31,8 @@ export default function HomeIcon({ className, fill, filled = false, ...iconProps
<Icon
className={classNames(className, 'icon-outline', { 'is-filled': filled })}
style={{ color: fill || colors.homepageColor }}
- {...iconProps}>
+ {...iconProps}
+ >
<g transform="matrix(0.870918,0,0,0.870918,0.978227,0.978227)">
<path d="M15.9,7.8L8.2,0.1C8.1,0 7.9,0 7.8,0.1L0.1,7.8C0,7.9 0,8.1 0.1,8.2C0.2,8.3 0.2,8.3 0.3,8.3L2.2,8.3L2.2,15.8C2.2,15.9 2.2,15.9 2.3,16C2.3,16 2.4,16.1 2.5,16.1L6.2,16.1C6.3,16.1 6.5,16 6.5,15.8L6.5,10.5L9.7,10.5L9.7,15.8C9.7,15.9 9.8,16.1 10,16.1L13.7,16.1C13.8,16.1 14,16 14,15.8L14,8.2L15.9,8.2C16,8.2 16,8.2 16.1,8.1C16,8 16.1,7.9 15.9,7.8Z" />
</g>
diff --git a/server/sonar-web/src/main/js/components/icons/Icon.tsx b/server/sonar-web/src/main/js/components/icons/Icon.tsx
index 4dd2393d3f1..e852e82c9b4 100644
--- a/server/sonar-web/src/main/js/components/icons/Icon.tsx
+++ b/server/sonar-web/src/main/js/components/icons/Icon.tsx
@@ -60,14 +60,15 @@ export default function Icon({
clipRule: 'evenodd',
strokeLinejoin: 'round',
strokeMiterlimit: 1.41421,
- ...style
+ ...style,
}}
version="1.1"
viewBox={viewBox}
width={width}
xmlnsXlink="http://www.w3.org/1999/xlink"
xmlSpace="preserve"
- {...iconProps}>
+ {...iconProps}
+ >
{children}
</svg>
);
diff --git a/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx b/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx
index 05ba3b5c163..e2cc024cc83 100644
--- a/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx
+++ b/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx
@@ -31,7 +31,7 @@ const qualifierIcons: Dict<(props: IconProps) => React.ReactElement> = {
svw: SubPortfolioIcon,
trk: ProjectIcon,
uts: UnitTestIcon,
- vw: PortfolioIcon
+ vw: PortfolioIcon,
};
interface QualifierIconProps extends IconProps {
diff --git a/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx b/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx
index bb943acf587..979367419c0 100644
--- a/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx
+++ b/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx
@@ -31,7 +31,7 @@ const severityIcons: Dict<(props: IconProps) => React.ReactElement> = {
critical: CriticalSeverityIcon,
major: MajorSeverityIcon,
minor: MinorSeverityIcon,
- info: InfoSeverityIcon
+ info: InfoSeverityIcon,
};
export default function SeverityIcon({ severity, ...iconProps }: Props) {
diff --git a/server/sonar-web/src/main/js/components/icons/StatusIcon.tsx b/server/sonar-web/src/main/js/components/icons/StatusIcon.tsx
index 5f94f5a6991..6c99dda0275 100644
--- a/server/sonar-web/src/main/js/components/icons/StatusIcon.tsx
+++ b/server/sonar-web/src/main/js/components/icons/StatusIcon.tsx
@@ -34,7 +34,7 @@ const statusIcons: Dict<(props: IconProps) => React.ReactElement> = {
closed: ClosedStatusIcon,
to_review: OpenStatusIcon,
in_review: ConfirmedStatusIcon,
- reviewed: ResolvedStatusIcon
+ reviewed: ResolvedStatusIcon,
};
export default function StatusIcon({ status, ...iconProps }: Props) {
diff --git a/server/sonar-web/src/main/js/components/icons/TestStatusIcon.tsx b/server/sonar-web/src/main/js/components/icons/TestStatusIcon.tsx
index 0e0968aa038..0cd9a779401 100644
--- a/server/sonar-web/src/main/js/components/icons/TestStatusIcon.tsx
+++ b/server/sonar-web/src/main/js/components/icons/TestStatusIcon.tsx
@@ -30,7 +30,7 @@ const statusIcons: Dict<(props: IconProps) => React.ReactElement> = {
ok: OkTestStatusIcon,
failure: FailureTestStatusIcon,
error: ErrorTestStatusIcon,
- skipped: SkippedTestStatusIcon
+ skipped: SkippedTestStatusIcon,
};
export default function TestStatusIcon({ status, ...iconProps }: Props) {
diff --git a/server/sonar-web/src/main/js/components/intl/DateFormatter.tsx b/server/sonar-web/src/main/js/components/intl/DateFormatter.tsx
index 9d4df9c579d..2d23f06fd71 100644
--- a/server/sonar-web/src/main/js/components/intl/DateFormatter.tsx
+++ b/server/sonar-web/src/main/js/components/intl/DateFormatter.tsx
@@ -31,13 +31,13 @@ export interface DateFormatterProps {
export const formatterOption: FormatDateOptions = {
year: 'numeric',
month: 'short',
- day: '2-digit'
+ day: '2-digit',
};
export const longFormatterOption: FormatDateOptions = {
year: 'numeric',
month: 'long',
- day: 'numeric'
+ day: 'numeric',
};
export default function DateFormatter({ children, date, long }: DateFormatterProps) {
diff --git a/server/sonar-web/src/main/js/components/intl/DateFromNow.tsx b/server/sonar-web/src/main/js/components/intl/DateFromNow.tsx
index 76ec0f6ce55..9328c4d8d48 100644
--- a/server/sonar-web/src/main/js/components/intl/DateFromNow.tsx
+++ b/server/sonar-web/src/main/js/components/intl/DateFromNow.tsx
@@ -55,7 +55,7 @@ export default function DateFromNow(props: DateFromNowProps) {
return (
<DateTimeFormatter date={parsedDate}>
- {formattedDate => (
+ {(formattedDate) => (
<span title={formattedDate}>
<FormattedRelativeTime {...relativeTimeProps}>
{children as FormattedRelativeTime['props']['children']}
diff --git a/server/sonar-web/src/main/js/components/intl/DateTimeFormatter.tsx b/server/sonar-web/src/main/js/components/intl/DateTimeFormatter.tsx
index cccb3c7dfe2..5caf0999db0 100644
--- a/server/sonar-web/src/main/js/components/intl/DateTimeFormatter.tsx
+++ b/server/sonar-web/src/main/js/components/intl/DateTimeFormatter.tsx
@@ -32,7 +32,7 @@ export const formatterOption: FormatDateOptions = {
month: 'long',
day: 'numeric',
hour: 'numeric',
- minute: 'numeric'
+ minute: 'numeric',
};
export default function DateTimeFormatter({ children, date }: Props) {
diff --git a/server/sonar-web/src/main/js/components/intl/TimeFormatter.tsx b/server/sonar-web/src/main/js/components/intl/TimeFormatter.tsx
index 4ed40f8ca0d..22c4646dffc 100644
--- a/server/sonar-web/src/main/js/components/intl/TimeFormatter.tsx
+++ b/server/sonar-web/src/main/js/components/intl/TimeFormatter.tsx
@@ -33,7 +33,7 @@ export const formatterOption: FormatDateOptions = { hour: 'numeric', minute: 'nu
export const longFormatterOption: FormatDateOptions = {
hour: 'numeric',
minute: 'numeric',
- second: 'numeric'
+ second: 'numeric',
};
export default function TimeFormatter({ children, date, long }: TimeFormatterProps) {
diff --git a/server/sonar-web/src/main/js/components/intl/__tests__/DateFormatter-test.tsx b/server/sonar-web/src/main/js/components/intl/__tests__/DateFormatter-test.tsx
index fa97babf962..d59fc2bf3af 100644
--- a/server/sonar-web/src/main/js/components/intl/__tests__/DateFormatter-test.tsx
+++ b/server/sonar-web/src/main/js/components/intl/__tests__/DateFormatter-test.tsx
@@ -29,7 +29,7 @@ it('should render correctly', () => {
function shallowRender(overrides: Partial<DateFormatterProps> = {}) {
return shallow(
<DateFormatter date={new Date('2020-02-20T20:20:20Z')} {...overrides}>
- {formatted => <span>{formatted}</span>}
+ {(formatted) => <span>{formatted}</span>}
</DateFormatter>
);
}
diff --git a/server/sonar-web/src/main/js/components/intl/__tests__/DateFromNow-test.tsx b/server/sonar-web/src/main/js/components/intl/__tests__/DateFromNow-test.tsx
index 2f00d4ed33a..fb81801aafc 100644
--- a/server/sonar-web/src/main/js/components/intl/__tests__/DateFromNow-test.tsx
+++ b/server/sonar-web/src/main/js/components/intl/__tests__/DateFromNow-test.tsx
@@ -26,7 +26,7 @@ import DateTimeFormatter from '../DateTimeFormatter';
const date = '2020-02-20T20:20:20Z';
jest.mock('../dateUtils', () => ({
- getRelativeTimeProps: jest.fn().mockReturnValue({ value: -1, unit: 'year' })
+ getRelativeTimeProps: jest.fn().mockReturnValue({ value: -1, unit: 'year' }),
}));
it('should render correctly', () => {
@@ -49,7 +49,7 @@ it('should render correctly when the date is less than one hour in the past', ()
veryCloseDate.setMinutes(veryCloseDate.getMinutes() - 10);
const mockDateNow = jest
.spyOn(Date, 'now')
- .mockImplementation(() => (new Date(date) as unknown) as number);
+ .mockImplementation(() => new Date(date) as unknown as number);
const children = jest.fn();
shallowRender({ date: veryCloseDate, hourPrecision: true }, children)
@@ -67,7 +67,7 @@ function shallowRender(overrides: Partial<DateFromNowProps> = {}, children: jest
return shallow(
<IntlProvider defaultLocale="en-US" locale="en">
<DateFromNow date={date} {...overrides}>
- {formattedDate => children(formattedDate)}
+ {(formattedDate) => children(formattedDate)}
</DateFromNow>
</IntlProvider>
)
diff --git a/server/sonar-web/src/main/js/components/intl/__tests__/DateTimeFormatter-test.tsx b/server/sonar-web/src/main/js/components/intl/__tests__/DateTimeFormatter-test.tsx
index 8a7df0a948e..67ffd80d532 100644
--- a/server/sonar-web/src/main/js/components/intl/__tests__/DateTimeFormatter-test.tsx
+++ b/server/sonar-web/src/main/js/components/intl/__tests__/DateTimeFormatter-test.tsx
@@ -28,7 +28,7 @@ it('should render correctly', () => {
function shallowRender() {
return shallow(
<DateTimeFormatter date={new Date('2020-02-20T20:20:20Z')}>
- {formatted => <span>{formatted}</span>}
+ {(formatted) => <span>{formatted}</span>}
</DateTimeFormatter>
);
}
diff --git a/server/sonar-web/src/main/js/components/intl/__tests__/TimeFormatter-test.tsx b/server/sonar-web/src/main/js/components/intl/__tests__/TimeFormatter-test.tsx
index fa66dd8f3c1..a8e897d89d6 100644
--- a/server/sonar-web/src/main/js/components/intl/__tests__/TimeFormatter-test.tsx
+++ b/server/sonar-web/src/main/js/components/intl/__tests__/TimeFormatter-test.tsx
@@ -29,7 +29,7 @@ it('should render correctly', () => {
function shallowRender(overrides: Partial<TimeFormatterProps> = {}) {
return shallow(
<TimeFormatter date={new Date('2020-02-20T20:20:20Z')} {...overrides}>
- {formatted => <span>{formatted}</span>}
+ {(formatted) => <span>{formatted}</span>}
</TimeFormatter>
);
}
diff --git a/server/sonar-web/src/main/js/components/intl/__tests__/__snapshots__/dateUtils-test.ts b/server/sonar-web/src/main/js/components/intl/__tests__/__snapshots__/dateUtils-test.ts
index 633f2ac0300..3abbc216391 100644
--- a/server/sonar-web/src/main/js/components/intl/__tests__/__snapshots__/dateUtils-test.ts
+++ b/server/sonar-web/src/main/js/components/intl/__tests__/__snapshots__/dateUtils-test.ts
@@ -27,7 +27,7 @@ describe('getRelativeTimeProps', () => {
it.each([
['year', '2020-02-19T20:20:20Z', -1],
['month', '2020-11-18T20:20:20Z', -3],
- ['day', '2021-02-18T18:20:20Z', -2]
+ ['day', '2021-02-18T18:20:20Z', -2],
])('should return the correct props for dates older than a %s', (unit, date, value) => {
expect(getRelativeTimeProps(date)).toEqual({ value, unit });
});
@@ -36,7 +36,7 @@ describe('getRelativeTimeProps', () => {
expect(getRelativeTimeProps('2021-02-20T20:19:45Z')).toEqual({
value: -35,
unit: 'second',
- updateIntervalInSeconds: 10
+ updateIntervalInSeconds: 10,
});
});
});
diff --git a/server/sonar-web/src/main/js/components/intl/dateUtils.ts b/server/sonar-web/src/main/js/components/intl/dateUtils.ts
index 75a24b16561..232b2359f73 100644
--- a/server/sonar-web/src/main/js/components/intl/dateUtils.ts
+++ b/server/sonar-web/src/main/js/components/intl/dateUtils.ts
@@ -21,7 +21,7 @@ import {
differenceInDays,
differenceInMonths,
differenceInSeconds,
- differenceInYears
+ differenceInYears,
} from 'date-fns';
import { FormattedRelativeTime } from 'react-intl';
import { parseDate } from '../../helpers/dates';
@@ -52,6 +52,6 @@ export function getRelativeTimeProps(
return {
value: differenceInSeconds(date, Date.now()),
unit: 'second',
- updateIntervalInSeconds: UPDATE_INTERVAL_IN_SECONDS
+ updateIntervalInSeconds: UPDATE_INTERVAL_IN_SECONDS,
};
}
diff --git a/server/sonar-web/src/main/js/components/issue/Issue.tsx b/server/sonar-web/src/main/js/components/issue/Issue.tsx
index 5f48a1612c5..79d7e8f560a 100644
--- a/server/sonar-web/src/main/js/components/issue/Issue.tsx
+++ b/server/sonar-web/src/main/js/components/issue/Issue.tsx
@@ -46,7 +46,7 @@ interface Props {
export default class Issue extends React.PureComponent<Props> {
static defaultProps = {
- selected: false
+ selected: false,
};
componentDidMount() {
diff --git a/server/sonar-web/src/main/js/components/issue/IssueMessageBox.tsx b/server/sonar-web/src/main/js/components/issue/IssueMessageBox.tsx
index bc29f721dc6..2abe1d8da8e 100644
--- a/server/sonar-web/src/main/js/components/issue/IssueMessageBox.tsx
+++ b/server/sonar-web/src/main/js/components/issue/IssueMessageBox.tsx
@@ -37,13 +37,14 @@ export function IssueMessageBox(props: IssueMessageBoxProps, ref: React.Forwarde
<div
className={classNames('issue-message-box display-flex-row display-flex-center padded-right', {
'selected big-padded-top big-padded-bottom text-bold': selected,
- 'secondary-issue padded-top padded-bottom': !selected
+ 'secondary-issue padded-top padded-bottom': !selected,
})}
key={issue.key}
onClick={() => props.onClick(issue.key)}
role="region"
ref={ref}
- aria-label={issue.message}>
+ aria-label={issue.message}
+ >
<IssueTypeIcon
className="big-spacer-right spacer-left"
fill={colors.baseFontColor}
diff --git a/server/sonar-web/src/main/js/components/issue/IssueView.tsx b/server/sonar-web/src/main/js/components/issue/IssueView.tsx
index b01c9e69c4f..d95dd6fd87f 100644
--- a/server/sonar-web/src/main/js/components/issue/IssueView.tsx
+++ b/server/sonar-web/src/main/js/components/issue/IssueView.tsx
@@ -76,7 +76,7 @@ export default class IssueView extends React.PureComponent<Props> {
currentPopup,
displayWhyIsThisAnIssue,
displayLocationsLink,
- displayLocationsCount
+ displayLocationsCount,
} = this.props;
const hasCheckbox = this.props.onCheck != null;
@@ -85,7 +85,7 @@ export default class IssueView extends React.PureComponent<Props> {
'no-click': this.props.onClick === undefined,
hotspot: issue.type === 'SECURITY_HOTSPOT',
'issue-with-checkbox': hasCheckbox,
- selected: this.props.selected
+ selected: this.props.selected,
});
return (
@@ -93,7 +93,8 @@ export default class IssueView extends React.PureComponent<Props> {
className={issueClass}
onClick={this.handleClick}
role="region"
- aria-label={issue.message}>
+ aria-label={issue.message}
+ >
{hasCheckbox && (
<Checkbox
checked={checked || false}
@@ -123,7 +124,7 @@ export default class IssueView extends React.PureComponent<Props> {
/>
{issue.comments && issue.comments.length > 0 && (
<div className="issue-comments">
- {issue.comments.map(comment => (
+ {issue.comments.map((comment) => (
<IssueCommentLine
comment={comment}
key={comment.key}
diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/IssueView-test.tsx b/server/sonar-web/src/main/js/components/issue/__tests__/IssueView-test.tsx
index 8af5f2827d4..af1bb48f42e 100644
--- a/server/sonar-web/src/main/js/components/issue/__tests__/IssueView-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/__tests__/IssueView-test.tsx
@@ -47,9 +47,9 @@ function shallowRender(props: Partial<IssueView['props']> = {}) {
authorLogin: 'admin',
authorName: 'Admin',
authorAvatar: 'admin-avatar',
- authorActive: true
- }
- ]
+ authorActive: true,
+ },
+ ],
})}
onAssign={jest.fn()}
onChange={jest.fn()}
diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/actions-test.ts b/server/sonar-web/src/main/js/components/issue/__tests__/actions-test.ts
index 44aa7a71e40..1257f89f587 100644
--- a/server/sonar-web/src/main/js/components/issue/__tests__/actions-test.ts
+++ b/server/sonar-web/src/main/js/components/issue/__tests__/actions-test.ts
@@ -26,7 +26,7 @@ import { updateIssue } from '../actions';
jest.mock('../../../helpers/error', () => ({ throwGlobalError: jest.fn() }));
jest.mock('../../../helpers/issues', () => ({
- parseIssueFromResponse: jest.fn()
+ parseIssueFromResponse: jest.fn(),
}));
describe('updateIssue', () => {
@@ -36,7 +36,7 @@ describe('updateIssue', () => {
const parsedIssue = mockIssue(false, { key: 'parsed' });
const successPromise = jest.fn().mockResolvedValue({
issue: mockIssue(),
- components: [mockComponent()]
+ components: [mockComponent()],
});
const errorPromise = jest.fn().mockRejectedValue(null);
(parseIssueFromResponse as jest.Mock).mockReturnValue(parsedIssue);
diff --git a/server/sonar-web/src/main/js/components/issue/__tests__/issue-test.tsx b/server/sonar-web/src/main/js/components/issue/__tests__/issue-test.tsx
index b99f62cb3e7..fdc82bfb546 100644
--- a/server/sonar-web/src/main/js/components/issue/__tests__/issue-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/__tests__/issue-test.tsx
@@ -43,10 +43,10 @@ it('should call the proper function with the proper props when pressing shortcut
authorLogin: 'admin',
authorName: 'Admin',
authorAvatar: 'admin-avatar',
- authorActive: true
- }
+ authorActive: true,
+ },
],
- actions: ['assign']
+ actions: ['assign'],
});
shallowRender({ onPopupToggle, issue, onCheck });
@@ -97,9 +97,9 @@ function shallowRender(props: Partial<Issue['props']> = {}) {
authorLogin: 'admin',
authorName: 'Admin',
authorAvatar: 'admin-avatar',
- authorActive: true
- }
- ]
+ authorActive: true,
+ },
+ ],
})}
onChange={jest.fn()}
onCheck={jest.fn()}
diff --git a/server/sonar-web/src/main/js/components/issue/actions.ts b/server/sonar-web/src/main/js/components/issue/actions.ts
index e84b3a5fcd7..f716c11614d 100644
--- a/server/sonar-web/src/main/js/components/issue/actions.ts
+++ b/server/sonar-web/src/main/js/components/issue/actions.ts
@@ -34,7 +34,7 @@ export const updateIssue = (
}
resultPromise.then(
- response => {
+ (response) => {
if (!optimisticUpdate) {
const issue = parseIssueFromResponse(
response.issue,
@@ -45,7 +45,7 @@ export const updateIssue = (
onChange(issue);
}
},
- param => {
+ (param) => {
if (optimisticUpdate) {
onChange(oldIssue!);
}
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx
index 3a59bc53f32..35f9da37dce 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.tsx
@@ -48,7 +48,7 @@ interface State {
export default class IssueActionsBar extends React.PureComponent<Props, State> {
state: State = {
commentAutoTriggered: false,
- commentPlaceholder: ''
+ commentPlaceholder: '',
};
setIssueProperty = (
@@ -73,7 +73,7 @@ export default class IssueActionsBar extends React.PureComponent<Props, State> {
toggleComment = (open: boolean | undefined, placeholder = '', autoTriggered = false) => {
this.setState({
commentPlaceholder: placeholder,
- commentAutoTriggered: autoTriggered
+ commentAutoTriggered: autoTriggered,
});
this.props.togglePopup('comment', open);
};
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx
index a73c45bd463..a03206aac1b 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueAssign.tsx
@@ -77,7 +77,8 @@ export default class IssueAssign extends React.PureComponent<Props> {
closeOnEscape={true}
onRequestClose={this.handleClose}
open={isOpen}
- overlay={<SetAssigneePopup onSelect={this.props.onAssign} />}>
+ overlay={<SetAssigneePopup onSelect={this.props.onAssign} />}
+ >
<Tooltip overlay={assigneeName}>
<ButtonLink
aria-expanded={isOpen}
@@ -90,7 +91,8 @@ export default class IssueAssign extends React.PureComponent<Props> {
: translate('issue.assign.unassigned_click_to_assign')
}
className="issue-action issue-action-with-options js-issue-assign"
- onClick={this.toggleAssign}>
+ onClick={this.toggleAssign}
+ >
{this.renderAssignee()}
<DropdownIcon className="little-spacer-left" />
</ButtonLink>
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx
index f6e1a007a5d..2b6c1da8d4c 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueChangelog.tsx
@@ -51,11 +51,13 @@ export default class IssueChangelog extends React.PureComponent<Props> {
<Toggler
onRequestClose={this.handleClose}
open={this.props.isOpen}
- overlay={<ChangelogPopup issue={this.props.issue} />}>
+ overlay={<ChangelogPopup issue={this.props.issue} />}
+ >
<ButtonLink
aria-expanded={this.props.isOpen}
className="issue-action issue-action-with-options js-issue-show-changelog"
- onClick={this.handleClick}>
+ onClick={this.handleClick}
+ >
<span className="issue-meta-label">
<DateFromNow date={this.props.creationDate} />
</span>
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx
index c49eae1847c..67c80ec2c81 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueCommentAction.tsx
@@ -92,12 +92,14 @@ export default class IssueCommentAction extends React.PureComponent<Props> {
toggleComment={this.props.toggleComment}
/>
)
- }>
+ }
+ >
<ButtonLink
aria-expanded={this.props.currentPopup === 'comment'}
aria-label={translate('issue.comment.add_comment')}
className="issue-action js-issue-comment"
- onClick={this.handleCommentClick}>
+ onClick={this.handleCommentClick}
+ >
<span className="issue-meta-label">
{showCommentsInPopup && comments && (
<span>
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx
index ef92ab77262..8cd3cd98ad5 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.tsx
@@ -41,7 +41,7 @@ interface State {
export default class IssueCommentLine extends React.PureComponent<Props, State> {
state: State = {
- openPopup: ''
+ openPopup: '',
};
handleEdit = (text: string) => {
@@ -55,7 +55,7 @@ export default class IssueCommentLine extends React.PureComponent<Props, State>
};
togglePopup = (popupName: string, force?: boolean) => {
- this.setState(prevState => {
+ this.setState((prevState) => {
if (prevState.openPopup !== popupName && force !== false) {
return { openPopup: popupName };
} else if (prevState.openPopup === popupName && force !== true) {
@@ -119,7 +119,8 @@ export default class IssueCommentLine extends React.PureComponent<Props, State>
placement={PopupPlacement.BottomRight}
toggleComment={this.toggleEditPopup}
/>
- }>
+ }
+ >
<EditButton
aria-label={translate('issue.comment.edit')}
className="js-issue-comment-edit button-small"
@@ -133,7 +134,8 @@ export default class IssueCommentLine extends React.PureComponent<Props, State>
<Toggler
onRequestClose={this.closePopups}
open={this.state.openPopup === 'delete'}
- overlay={<CommentDeletePopup onDelete={this.handleDelete} />}>
+ overlay={<CommentDeletePopup onDelete={this.handleDelete} />}
+ >
<DeleteButton
aria-label={translate('issue.comment.delete')}
className="js-issue-comment-delete button-small"
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueMessage.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueMessage.tsx
index df6c0798b3c..c692a2f01ae 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueMessage.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueMessage.tsx
@@ -34,14 +34,8 @@ export interface IssueMessageProps {
}
export default function IssueMessage(props: IssueMessageProps) {
- const {
- engine,
- quickFixAvailable,
- message,
- ruleKey,
- ruleStatus,
- displayWhyIsThisAnIssue
- } = props;
+ const { engine, quickFixAvailable, message, ruleKey, ruleStatus, displayWhyIsThisAnIssue } =
+ props;
const { openRule } = React.useContext(WorkspaceContext);
@@ -61,9 +55,10 @@ export default function IssueMessage(props: IssueMessageProps) {
className="issue-see-rule spacer-right text-baseline"
onClick={() =>
openRule({
- key: ruleKey
+ key: ruleKey,
})
- }>
+ }
+ >
{translate('issue.why_this_issue')}
</ButtonLink>
)}
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueMessageTags.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueMessageTags.tsx
index 77e20ad10a7..6cc8d1599fa 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueMessageTags.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueMessageTags.tsx
@@ -51,14 +51,16 @@ export default function IssueMessageTags(props: IssueMessageTagsProps) {
link: (
<Link
to="https://www.sonarqube.org/sonarlint/?referrer=sonarqube-quick-fix"
- target="_blank">
+ target="_blank"
+ >
SonarLint
</Link>
- )
+ ),
}}
/>
}
- mouseLeaveDelay={0.5}>
+ mouseLeaveDelay={0.5}
+ >
<SonarLintIcon
className="it__issues-sonarlint-quick-fix spacer-right"
size={15}
@@ -73,9 +75,10 @@ export default function IssueMessageTags(props: IssueMessageTagsProps) {
links={[
{
href: '/user-guide/rules/',
- label: translateWithParameters('see_x', translate('rules'))
- }
- ]}>
+ label: translateWithParameters('see_x', translate('rules')),
+ },
+ ]}
+ >
<span className="spacer-right badge badge-error">
{translate('issue.resolution.badge', ruleStatus)}
</span>
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx
index 80541df4723..08cf4414d7d 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueSeverity.tsx
@@ -62,7 +62,8 @@ export default class IssueSeverity extends React.PureComponent<Props> {
<Toggler
onRequestClose={this.handleClose}
open={this.props.isOpen && this.props.canSetSeverity}
- overlay={<SetSeverityPopup issue={issue} onSelect={this.setSeverity} />}>
+ overlay={<SetSeverityPopup issue={issue} onSelect={this.setSeverity} />}
+ >
<ButtonLink
aria-label={translateWithParameters(
'issue.severity.severity_x_click_to_change',
@@ -70,7 +71,8 @@ export default class IssueSeverity extends React.PureComponent<Props> {
)}
aria-expanded={this.props.isOpen}
className="issue-action issue-action-with-options js-issue-set-severity"
- onClick={this.toggleSetSeverity}>
+ onClick={this.toggleSetSeverity}
+ >
<SeverityHelper className="issue-meta-label" severity={issue.severity} />
<DropdownIcon className="little-spacer-left" />
</ButtonLink>
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx
index 0f47eba80e0..6dfefa827f0 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueTags.tsx
@@ -65,11 +65,13 @@ export default class IssueTags extends React.PureComponent<Props> {
<Toggler
onRequestClose={this.handleClose}
open={this.props.isOpen}
- overlay={<SetIssueTagsPopup selectedTags={tags} setTags={this.setTags} />}>
+ overlay={<SetIssueTagsPopup selectedTags={tags} setTags={this.setTags} />}
+ >
<ButtonLink
aria-expanded={this.props.isOpen}
className="issue-action issue-action-with-options js-issue-edit-tags"
- onClick={this.toggleSetTags}>
+ onClick={this.toggleSetTags}
+ >
<TagsList
allowUpdate={this.props.canSetTags}
tags={
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx
index 75fc9e1b3bc..3fb1ec8dae3 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx
@@ -58,7 +58,8 @@ export default function IssueTitleBar(props: IssueTitleBarProps) {
overlay={translateWithParameters(
'issue.this_issue_involves_x_code_locations',
formatMeasure(locationsCount, 'INT')
- )}>
+ )}
+ >
<LocationIndex>{locationsCount}</LocationIndex>
</Tooltip>
);
@@ -69,7 +70,7 @@ export default function IssueTitleBar(props: IssueTitleBarProps) {
...getBranchLikeQuery(props.branchLike),
issues: issue.key,
open: issue.key,
- types: issue.type === 'SECURITY_HOTSPOT' ? issue.type : undefined
+ types: issue.type === 'SECURITY_HOTSPOT' ? issue.type : undefined,
});
return (
@@ -115,7 +116,8 @@ export default function IssueTitleBar(props: IssueTitleBarProps) {
className="js-issue-permalink link-no-underline"
target="_blank"
title={translate('permalink')}
- to={issueUrl}>
+ to={issueUrl}
+ >
<LinkIcon />
</Link>
</div>
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx
index 254b36eb5a2..93fc4fc5499 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueTransition.tsx
@@ -64,7 +64,8 @@ export default class IssueTransition extends React.PureComponent<Props> {
open={this.props.isOpen && this.props.hasTransitions}
overlay={
<SetTransitionPopup onSelect={this.setTransition} transitions={issue.transitions} />
- }>
+ }
+ >
<ButtonLink
aria-label={translateWithParameters(
'issue.transition.status_x_click_to_change',
@@ -72,7 +73,8 @@ export default class IssueTransition extends React.PureComponent<Props> {
)}
aria-expanded={this.props.isOpen}
className="issue-action issue-action-with-options js-issue-transition"
- onClick={this.toggleSetTransition}>
+ onClick={this.toggleSetTransition}
+ >
<StatusHelper
className="issue-meta-label"
resolution={issue.resolution}
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx
index 7170c0a09ac..1e304a52a51 100644
--- a/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/IssueType.tsx
@@ -63,7 +63,8 @@ export default class IssueType extends React.PureComponent<Props> {
<Toggler
onRequestClose={this.handleClose}
open={this.props.isOpen && this.props.canSetType}
- overlay={<SetTypePopup issue={issue} onSelect={this.setType} />}>
+ overlay={<SetTypePopup issue={issue} onSelect={this.setType} />}
+ >
<ButtonLink
aria-label={translateWithParameters(
'issue.type.type_x_click_to_change',
@@ -71,7 +72,8 @@ export default class IssueType extends React.PureComponent<Props> {
)}
aria-expanded={this.props.isOpen}
className="issue-action issue-action-with-options js-issue-set-type"
- onClick={this.toggleSetType}>
+ onClick={this.toggleSetType}
+ >
<IssueTypeIcon
className="little-spacer-right"
fill={colors.baseFontColor}
diff --git a/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx b/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx
index 23c710a18c6..3179b6c96cd 100644
--- a/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.tsx
@@ -55,13 +55,15 @@ export default class SimilarIssuesFilter extends React.PureComponent<Props> {
<Toggler
onRequestClose={this.handleClose}
open={this.props.isOpen}
- overlay={<SimilarIssuesPopup issue={this.props.issue} onFilter={this.handleFilter} />}>
+ overlay={<SimilarIssuesPopup issue={this.props.issue} onFilter={this.handleFilter} />}
+ >
<ButtonLink
aria-label={translate('issue.filter_similar_issues')}
aria-expanded={this.props.isOpen}
className="issue-action issue-action-with-options js-issue-filter"
onClick={this.togglePopup}
- title={translate('issue.filter_similar_issues')}>
+ title={translate('issue.filter_similar_issues')}
+ >
<FilterIcon />
<DropdownIcon />
</ButtonLink>
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueAssign-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueAssign-test.tsx
index c6d1c95f5a5..b2315504fec 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueAssign-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueAssign-test.tsx
@@ -26,7 +26,7 @@ import IssueAssign from '../IssueAssign';
const issue = mockIssue(false, {
assignee: 'john',
assigneeAvatar: 'gravatarhash',
- assigneeName: 'John Doe'
+ assigneeName: 'John Doe',
});
it('should render without the action when the correct rights are missing', () => {
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueChangelog-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueChangelog-test.tsx
index 5a6239cfb82..5f5c1b841fd 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueChangelog-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueChangelog-test.tsx
@@ -25,7 +25,7 @@ import IssueChangelog from '../IssueChangelog';
const issue = {
key: 'issuekey',
author: 'john.david.dalton@gmail.com',
- creationDate: '2017-03-01T09:36:01+0100'
+ creationDate: '2017-03-01T09:36:01+0100',
};
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueChangelogDiff-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueChangelogDiff-test.tsx
index 6bb80241d49..5710a4a030d 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueChangelogDiff-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueChangelogDiff-test.tsx
@@ -39,8 +39,8 @@ it('should render correctly branch diff', () => {
// Legacy key
key: 'from_long_branch',
oldValue: 'foo',
- newValue: 'bar'
- }
+ newValue: 'bar',
+ },
})
).toMatchSnapshot();
@@ -50,8 +50,8 @@ it('should render correctly branch diff', () => {
// Legacy key
key: 'from_short_branch',
oldValue: 'foo',
- newValue: 'bar'
- }
+ newValue: 'bar',
+ },
})
).toMatchSnapshot();
@@ -60,8 +60,8 @@ it('should render correctly branch diff', () => {
diff: {
key: 'from_branch',
oldValue: 'foo',
- newValue: 'bar'
- }
+ newValue: 'bar',
+ },
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx
index f1792a2a5a3..1f0fdbdaec5 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueCommentLine-test.tsx
@@ -32,7 +32,7 @@ const comment: IssueComment = {
htmlText: '<b>test</b>',
key: 'comment-key',
markdown: '*test*',
- updatable: true
+ updatable: true,
};
it('should render correctly a comment that is updatable', () => {
@@ -56,7 +56,7 @@ it('should open the right popups when the buttons are clicked', () => {
it('should render correctly a comment with a deleted author', () => {
expect(
shallowRender({
- comment: { ...comment, authorActive: false, authorName: undefined }
+ comment: { ...comment, authorActive: false, authorName: undefined },
}).find('.issue-comment-author')
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.tsx
index 2ca70c90b5a..e78337e65dd 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.tsx
@@ -28,7 +28,7 @@ jest.mock('react', () => {
...jest.requireActual('react'),
useContext: jest
.fn()
- .mockImplementation(() => ({ externalRulesRepoNames: {}, openRule: jest.fn() }))
+ .mockImplementation(() => ({ externalRulesRepoNames: {}, openRule: jest.fn() })),
};
});
@@ -49,7 +49,7 @@ it('should open why is this an issue workspace', () => {
const openRule = jest.fn();
(React.useContext as jest.Mock).mockImplementationOnce(() => ({
externalRulesRepoNames: {},
- openRule
+ openRule,
}));
const wrapper = shallowRender();
wrapper.find(ButtonLink).simulate('click');
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx
index 7178fa1a17a..b2e3bd837d7 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.tsx
@@ -34,7 +34,7 @@ it('should render correctly', () => {
branchLike: mockBranch(),
displayLocationsCount: true,
displayLocationsLink: true,
- issue: mockIssue(true)
+ issue: mockIssue(true),
})
).toMatchSnapshot('with multi locations and link');
});
diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTransition-test.tsx b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTransition-test.tsx
index 52277de1b71..2e283261425 100644
--- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTransition-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTransition-test.tsx
@@ -25,14 +25,14 @@ const issue: IssueTransition['props']['issue'] = {
key: 'foo1234',
transitions: ['confirm', 'resolve', 'falsepositive', 'wontfix'],
status: 'OPEN',
- type: 'BUG'
+ type: 'BUG',
};
it('should render without the action when there is no transitions', () => {
expect(
shallowRender({
hasTransitions: false,
- issue: { key: 'foo1234', transitions: [], status: 'CLOSED', type: 'BUG' }
+ issue: { key: 'foo1234', transitions: [], status: 'CLOSED', type: 'BUG' },
})
).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx
index c2ad03648ed..0f36df70577 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.tsx
@@ -105,7 +105,7 @@ export default class ChangelogPopup extends React.PureComponent<Props, State> {
item.webhookSource
)}
</p>
- {item.diffs.map(diff => (
+ {item.diffs.map((diff) => (
<IssueChangelogDiff diff={diff} key={diff.key} />
))}
</td>
diff --git a/server/sonar-web/src/main/js/components/issue/popups/CommentForm.tsx b/server/sonar-web/src/main/js/components/issue/popups/CommentForm.tsx
index e6edbaac200..f5369c3d0fe 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/CommentForm.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/CommentForm.tsx
@@ -71,7 +71,8 @@ export default function CommentForm(props: CommentFormProps) {
onClick={() => {
props.onSaveComment(editComment);
setEditComment('');
- }}>
+ }}
+ >
{comment ? translate('save') : translate('issue.comment.submit')}
</Button>
{showCancelButton && (
@@ -82,7 +83,8 @@ export default function CommentForm(props: CommentFormProps) {
? translate('issue.comment.edit.cancel')
: translate('issue.comment.add_comment.cancel')
}
- onClick={() => props.onCancel()}>
+ onClick={() => props.onCancel()}
+ >
{autoTriggered ? translate('skip') : translate('cancel')}
</ResetButtonLink>
)}
diff --git a/server/sonar-web/src/main/js/components/issue/popups/CommentList.tsx b/server/sonar-web/src/main/js/components/issue/popups/CommentList.tsx
index 5f387d52fb4..3dda0a946db 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/CommentList.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/CommentList.tsx
@@ -43,7 +43,7 @@ export default function CommentList(props: CommentListProps) {
);
return (
<div className="issue-comment-list-wrapper spacer-bottom">
- {sortedComments?.map(c => (
+ {sortedComments?.map((c) => (
<CommentTile
comment={c}
key={c.key}
diff --git a/server/sonar-web/src/main/js/components/issue/popups/CommentTile.tsx b/server/sonar-web/src/main/js/components/issue/popups/CommentTile.tsx
index 63cd62e1fb8..7445b1e18c8 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/CommentTile.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/CommentTile.tsx
@@ -38,7 +38,7 @@ interface CommentTileState {
export default class CommentTile extends React.PureComponent<CommentTileProps, CommentTileState> {
state = {
- showEditArea: false
+ showEditArea: false,
};
handleEditClick = () => {
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx
index 28260c4d74d..62bc84c82e4 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SetAssigneePopup.tsx
@@ -56,7 +56,7 @@ export class SetAssigneePopup extends React.PureComponent<Props, State> {
this.state = {
query: '',
users: this.defaultUsersArray,
- currentUser: this.defaultUsersArray.length > 0 ? this.defaultUsersArray[0].login : ''
+ currentUser: this.defaultUsersArray.length > 0 ? this.defaultUsersArray[0].login : '',
};
}
@@ -68,7 +68,7 @@ export class SetAssigneePopup extends React.PureComponent<Props, State> {
const activeUsers = users.filter(isUserActive);
this.setState({
users: activeUsers,
- currentUser: activeUsers.length > 0 ? activeUsers[0].login : ''
+ currentUser: activeUsers.length > 0 ? activeUsers[0].login : '',
});
};
@@ -77,7 +77,7 @@ export class SetAssigneePopup extends React.PureComponent<Props, State> {
this.setState({
query,
users: this.defaultUsersArray,
- currentUser: this.defaultUsersArray[0].login
+ currentUser: this.defaultUsersArray[0].login,
});
} else {
this.setState({ query });
@@ -102,8 +102,9 @@ export class SetAssigneePopup extends React.PureComponent<Props, State> {
<SelectList
currentItem={this.state.currentUser}
items={map(this.state.users, 'login')}
- onSelect={this.props.onSelect}>
- {this.state.users.map(user => (
+ onSelect={this.props.onSelect}
+ >
+ {this.state.users.map((user) => (
<SelectListItem item={user.login} key={user.login}>
{!!user.login && (
<Avatar className="spacer-right" hash={user.avatar} name={user.name} size={16} />
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetIssueTagsPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetIssueTagsPopup.tsx
index 4f9092e80e9..9b6da294e82 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SetIssueTagsPopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SetIssueTagsPopup.tsx
@@ -52,7 +52,7 @@ export default class SetIssueTagsPopup extends React.PureComponent<Props, State>
return searchIssueTags({
all: true,
q: query,
- ps: Math.min(this.props.selectedTags.length - 1 + LIST_SIZE, MAX_LIST_SIZE)
+ ps: Math.min(this.props.selectedTags.length - 1 + LIST_SIZE, MAX_LIST_SIZE),
}).then(
(tags: string[]) => {
if (this.mounted) {
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx
index 26e3714bbf5..4f3e95e424f 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SetSeverityPopup.tsx
@@ -36,7 +36,7 @@ export default function SetSeverityPopup({ issue, onSelect }: Props) {
return (
<DropdownOverlay>
<SelectList currentItem={issue.severity} items={SEVERITY} onSelect={onSelect}>
- {SEVERITY.map(severity => (
+ {SEVERITY.map((severity) => (
<SelectListItem className="display-flex-center" item={severity} key={severity}>
<SeverityIcon className="little-spacer-right" severity={severity} />
{translate('severity', severity)}
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetTransitionPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetTransitionPopup.tsx
index 7105e258d82..6dffa95f462 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SetTransitionPopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SetTransitionPopup.tsx
@@ -34,7 +34,7 @@ export default function SetTransitionPopup({ onSelect, transitions }: Props) {
return (
<DropdownOverlay>
<SelectList currentItem={transitions[0]} items={transitions} onSelect={onSelect}>
- {transitions.map(transition => {
+ {transitions.map((transition) => {
const [name, description] = translateTransition(transition);
return (
<SelectListItem item={transition} key={transition} title={description}>
@@ -59,8 +59,8 @@ function translateTransition(transition: string) {
<Link to="https://community.sonarsource.com/" target="_blank">
{translate('issue.transition.community_plug_link')}
</Link>
- )
+ ),
}}
- />
+ />,
];
}
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx
index 075a032fc95..02524b57716 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SetTypePopup.tsx
@@ -36,7 +36,7 @@ export default function SetTypePopup({ issue, onSelect }: Props) {
return (
<DropdownOverlay>
<SelectList currentItem={issue.type} items={TYPES} onSelect={onSelect}>
- {TYPES.map(type => (
+ {TYPES.map((type) => (
<SelectListItem className="display-flex-center" item={type} key={type}>
<IssueTypeIcon className="little-spacer-right" query={type} />
{translate('issue.type', type)}
diff --git a/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx
index 1f24dd5d81a..303cff9478f 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/SimilarIssuesPopup.tsx
@@ -51,10 +51,10 @@ export default class SimilarIssuesPopup extends React.PureComponent<Props> {
'resolution',
'assignee',
'rule',
- ...(issue.tags || []).map(tag => `tag###${tag}`),
+ ...(issue.tags || []).map((tag) => `tag###${tag}`),
'project',
- 'file'
- ].filter(item => item) as string[];
+ 'file',
+ ].filter((item) => item) as string[];
const assignee = issue.assigneeName || issue.assignee;
@@ -68,7 +68,8 @@ export default class SimilarIssuesPopup extends React.PureComponent<Props> {
className="issues-similar-issues-menu"
currentItem={items[0]}
items={items}
- onSelect={this.handleSelect}>
+ onSelect={this.handleSelect}
+ >
<SelectListItem className="display-flex-center" item="type">
<IssueTypeIcon className="little-spacer-right" query={issue.type} />
{translate('issue.type', issue.type)}
@@ -116,7 +117,7 @@ export default class SimilarIssuesPopup extends React.PureComponent<Props> {
<SelectListItem item="rule">{limitComponentName(issue.ruleName)}</SelectListItem>
{issue.tags != null &&
- issue.tags.map(tag => (
+ issue.tags.map((tag) => (
<SelectListItem item={`tag###${tag}`} key={`tag###${tag}`}>
<TagsIcon className="little-spacer-right text-middle" />
<span className="text-middle">{tag}</span>
diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/ChangelogPopup-test.tsx b/server/sonar-web/src/main/js/components/issue/popups/__tests__/ChangelogPopup-test.tsx
index f4dc2d36a8e..c7f905e36b8 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/ChangelogPopup-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/ChangelogPopup-test.tsx
@@ -32,10 +32,10 @@ jest.mock('../../../../api/issues', () => ({
isUserActive: true,
userName: 'John Doe',
avatar: 'gravatarhash',
- diffs: [{ key: 'severity', newValue: 'MINOR', oldValue: 'CRITICAL' }]
- }
- ]
- })
+ diffs: [{ key: 'severity', newValue: 'MINOR', oldValue: 'CRITICAL' }],
+ },
+ ],
+ }),
}));
beforeEach(() => {
@@ -56,9 +56,9 @@ it('should render the changelog popup when we have a deleted user', async () =>
creationDate: '2017-03-01T09:36:01+0100',
user: 'john.doe',
isUserActive: false,
- diffs: [{ key: 'severity', newValue: 'MINOR', oldValue: 'CRITICAL' }]
- }
- ]
+ diffs: [{ key: 'severity', newValue: 'MINOR', oldValue: 'CRITICAL' }],
+ },
+ ],
});
const wrapper = shallowRender();
await waitAndUpdate(wrapper);
@@ -74,9 +74,9 @@ it('should render the changelog popup when change was triggered by a webhook wit
isUserActive: false,
diffs: [{ key: 'severity', newValue: 'MINOR', oldValue: 'CRITICAL' }],
webhookSource: 'GitHub',
- externalUser: 'toto@github.com'
- }
- ]
+ externalUser: 'toto@github.com',
+ },
+ ],
});
const wrapper = shallowRender();
await waitAndUpdate(wrapper);
@@ -91,9 +91,9 @@ it('should render the changelog popup when change was triggered by a webhook wit
user: null,
isUserActive: false,
diffs: [{ key: 'severity', newValue: 'MINOR', oldValue: 'CRITICAL' }],
- webhookSource: 'GitHub'
- }
- ]
+ webhookSource: 'GitHub',
+ },
+ ],
});
const wrapper = shallowRender();
await waitAndUpdate(wrapper);
@@ -109,9 +109,9 @@ it('should render the changelog popup with SQ user when both SQ and external use
isUserActive: false,
diffs: [{ key: 'severity', newValue: 'MINOR', oldValue: 'CRITICAL' }],
webhookSource: 'GitHub',
- externalUser: 'toto@github.com'
- }
- ]
+ externalUser: 'toto@github.com',
+ },
+ ],
});
const wrapper = shallowRender();
await waitAndUpdate(wrapper);
@@ -124,7 +124,7 @@ function shallowRender(props: Partial<ChangelogPopup['props']> = {}) {
issue={{
key: 'issuekey',
author: 'john.david.dalton@gmail.com',
- creationDate: '2017-03-01T09:36:01+0100'
+ creationDate: '2017-03-01T09:36:01+0100',
}}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/SimilarIssuesPopup-test.tsx b/server/sonar-web/src/main/js/components/issue/popups/__tests__/SimilarIssuesPopup-test.tsx
index 66bbeb8e55e..6e3e7e65a8a 100644
--- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/SimilarIssuesPopup-test.tsx
+++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/SimilarIssuesPopup-test.tsx
@@ -29,7 +29,7 @@ it('should render correctly', () => {
it('should render correctly when assigned', () => {
expect(
shallowRender({
- issue: mockIssue(false, { assignee: 'luke', assigneeName: 'Luke Skywalker' })
+ issue: mockIssue(false, { assignee: 'luke', assigneeName: 'Luke Skywalker' }),
}).find('SelectListItem[item="assignee"]')
).toMatchSnapshot();
diff --git a/server/sonar-web/src/main/js/components/locations/CrossFileLocationNavigator.tsx b/server/sonar-web/src/main/js/components/locations/CrossFileLocationNavigator.tsx
index a724789cd44..cb6581f1b3b 100644
--- a/server/sonar-web/src/main/js/components/locations/CrossFileLocationNavigator.tsx
+++ b/server/sonar-web/src/main/js/components/locations/CrossFileLocationNavigator.tsx
@@ -83,7 +83,7 @@ export default class CrossFileLocationNavigator extends React.PureComponent<Prop
component: currentComponent,
componentName: currentComponentName,
firstLocationIndex: currentFirstLocationIndex,
- locations: currentLocations
+ locations: currentLocations,
});
}
currentLocations = [location];
@@ -98,7 +98,7 @@ export default class CrossFileLocationNavigator extends React.PureComponent<Prop
component: currentComponent,
componentName: currentComponentName,
firstLocationIndex: currentFirstLocationIndex,
- locations: currentLocations
+ locations: currentLocations,
});
}
diff --git a/server/sonar-web/src/main/js/components/locations/FlowsList.tsx b/server/sonar-web/src/main/js/components/locations/FlowsList.tsx
index 40646365fb8..088ef497a2f 100644
--- a/server/sonar-web/src/main/js/components/locations/FlowsList.tsx
+++ b/server/sonar-web/src/main/js/components/locations/FlowsList.tsx
@@ -27,7 +27,7 @@ import SingleFileLocationNavigator from './SingleFileLocationNavigator';
const FLOW_ORDER_MAP = {
[FlowType.DATA]: 0,
- [FlowType.EXECUTION]: 1
+ [FlowType.EXECUTION]: 1,
};
export interface Props {
flows: Flow[];
@@ -65,7 +65,8 @@ export default function FlowsList(props: Props) {
flow={true}
selected={open}
/>
- )}>
+ )}
+ >
<ul>
{flow.locations.map((location, locIndex) => (
// eslint-disable-next-line react/no-array-index-key
diff --git a/server/sonar-web/src/main/js/components/locations/LocationsList.tsx b/server/sonar-web/src/main/js/components/locations/LocationsList.tsx
index 043de9d030a..635095b65af 100644
--- a/server/sonar-web/src/main/js/components/locations/LocationsList.tsx
+++ b/server/sonar-web/src/main/js/components/locations/LocationsList.tsx
@@ -35,10 +35,10 @@ export default class LocationsList extends React.PureComponent<Props> {
render() {
const { locations, componentKey, selectedLocationIndex, showCrossFile = true } = this.props;
- const locationComponents = [componentKey, ...locations.map(location => location.component)];
+ const locationComponents = [componentKey, ...locations.map((location) => location.component)];
const isCrossFile = uniq(locationComponents).length > 1;
- if (!locations || locations.length === 0 || locations.every(location => !location.msg)) {
+ if (!locations || locations.length === 0 || locations.every((location) => !location.msg)) {
return null;
}
diff --git a/server/sonar-web/src/main/js/components/locations/SingleFileLocationNavigator.tsx b/server/sonar-web/src/main/js/components/locations/SingleFileLocationNavigator.tsx
index 54be15b43ff..5a7e2819f52 100644
--- a/server/sonar-web/src/main/js/components/locations/SingleFileLocationNavigator.tsx
+++ b/server/sonar-web/src/main/js/components/locations/SingleFileLocationNavigator.tsx
@@ -39,7 +39,7 @@ export default class SingleFileLocationNavigator extends React.PureComponent<Pro
this.node.scrollIntoView({
behavior: 'smooth',
block: 'center',
- inline: 'center'
+ inline: 'center',
});
}
}
@@ -49,7 +49,7 @@ export default class SingleFileLocationNavigator extends React.PureComponent<Pro
this.node.scrollIntoView({
behavior: 'smooth',
block: 'center',
- inline: 'center'
+ inline: 'center',
});
}
}
@@ -67,10 +67,11 @@ export default class SingleFileLocationNavigator extends React.PureComponent<Pro
stopPropagation={true}
aria-current={selected ? 'location' : false}
className={classNames('locations-navigator', { selected })}
- innerRef={node => {
+ innerRef={(node) => {
this.node = node;
}}
- onClick={this.handleClick}>
+ onClick={this.handleClick}
+ >
<LocationIndex>{index + 1}</LocationIndex>
<LocationMessage>{message}</LocationMessage>
</ButtonPlain>
diff --git a/server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx b/server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx
index 26ce5f7e0d0..ab7007a8b4c 100644
--- a/server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx
+++ b/server/sonar-web/src/main/js/components/locations/__tests__/CrossFileLocationsNavigator-test.tsx
@@ -28,21 +28,21 @@ const location1: FlowLocation = {
component: 'foo',
componentName: 'src/foo.js',
msg: 'Do not use foo',
- textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 }
+ textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 },
};
const location2: FlowLocation = {
component: 'foo',
componentName: 'src/foo.js',
msg: 'Do not use foo',
- textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 5 }
+ textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 5 },
};
const location3: FlowLocation = {
component: 'bar',
componentName: 'src/bar.js',
msg: 'Do not use bar',
- textRange: { startLine: 15, endLine: 16, startOffset: 4, endOffset: 6 }
+ textRange: { startLine: 15, endLine: 16, startOffset: 4, endOffset: 6 },
};
it('should render with no locations', () => {
diff --git a/server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx b/server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx
index 74ca4eaa5ee..b0afc1663d4 100644
--- a/server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx
+++ b/server/sonar-web/src/main/js/components/locations/__tests__/LocationsList-test.tsx
@@ -27,14 +27,14 @@ const location1: FlowLocation = {
component: 'foo',
componentName: 'src/foo.js',
msg: 'Do not use foo',
- textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 }
+ textRange: { startLine: 7, endLine: 7, startOffset: 5, endOffset: 8 },
};
const location2: FlowLocation = {
component: 'foo',
componentName: 'src/foo.js',
msg: 'Do not use foo',
- textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 5 }
+ textRange: { startLine: 8, endLine: 8, startOffset: 0, endOffset: 5 },
};
it('should render locations in the same file', () => {
diff --git a/server/sonar-web/src/main/js/components/measure/Measure.tsx b/server/sonar-web/src/main/js/components/measure/Measure.tsx
index 8abc4e62781..b3d99084a10 100644
--- a/server/sonar-web/src/main/js/components/measure/Measure.tsx
+++ b/server/sonar-web/src/main/js/components/measure/Measure.tsx
@@ -39,7 +39,7 @@ export default function Measure({
metricKey,
metricType,
small,
- value
+ value,
}: Props) {
if (value === undefined) {
return <span className={className}>–</span>;
@@ -52,7 +52,7 @@ export default function Measure({
if (metricType !== 'RATING') {
const formattedValue = formatMeasure(value, metricType, {
decimals,
- omitExtraDecimalZeros: metricType === 'PERCENT'
+ omitExtraDecimalZeros: metricType === 'PERCENT',
});
return <span className={className}>{formattedValue != null ? formattedValue : '–'}</span>;
}
diff --git a/server/sonar-web/src/main/js/components/measure/RatingTooltipContent.tsx b/server/sonar-web/src/main/js/components/measure/RatingTooltipContent.tsx
index 855449adc3a..20328aaa1c2 100644
--- a/server/sonar-web/src/main/js/components/measure/RatingTooltipContent.tsx
+++ b/server/sonar-web/src/main/js/components/measure/RatingTooltipContent.tsx
@@ -41,8 +41,8 @@ export interface RatingTooltipContentProps {
function getMaintainabilityGrid(ratingGridSetting: string) {
const numbers = ratingGridSetting
.split(',')
- .map(s => parseFloat(s))
- .filter(n => !isNaN(n));
+ .map((s) => parseFloat(s))
+ .filter((n) => !isNaN(n));
return numbers.length === RATING_GRID_SIZE ? numbers : [0, 0, 0, 0];
}
@@ -51,7 +51,7 @@ export function RatingTooltipContent(props: RatingTooltipContentProps) {
const {
appState: { settings },
metricKey,
- value
+ value,
} = props;
const finalMetricKey = isDiffMetric(metricKey)
diff --git a/server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx b/server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx
index 4a490d6481f..9c1c92c6cfc 100644
--- a/server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx
+++ b/server/sonar-web/src/main/js/components/measure/__tests__/RatingTooltipContent-test.tsx
@@ -32,7 +32,7 @@ it('should render maintainability correctly', () => {
);
expect(
shallowRender({
- appState: mockAppState({ settings: { [GlobalSettingKeys.RatingGrid]: '0,0.1' } })
+ appState: mockAppState({ settings: { [GlobalSettingKeys.RatingGrid]: '0,0.1' } }),
})
).toMatchSnapshot('sqale rating wrong grid');
});
diff --git a/server/sonar-web/src/main/js/components/measure/utils.ts b/server/sonar-web/src/main/js/components/measure/utils.ts
index 8fb375bc9a0..90be2e58f5d 100644
--- a/server/sonar-web/src/main/js/components/measure/utils.ts
+++ b/server/sonar-web/src/main/js/components/measure/utils.ts
@@ -24,14 +24,14 @@ export const KNOWN_RATINGS = [
'maintainability_rating', // Needed to provide the label for "new_maintainability_rating"
'reliability_rating',
'security_rating',
- 'security_review_rating'
+ 'security_review_rating',
];
export function enhanceMeasure(measure: Measure, metrics: Dict<Metric>): MeasureEnhanced {
return {
...measure,
metric: metrics[measure.metric],
- leak: getLeakValue(measure)
+ leak: getLeakValue(measure),
};
}
diff --git a/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx b/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx
index ff25f1a316f..ea09ca23a3f 100644
--- a/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx
+++ b/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx
@@ -37,7 +37,7 @@ interface Props {
const EDUCATION_PRINCIPLES_MAP: Dict<React.ComponentType> = {
defense_in_depth: DefenseInDepth,
- never_trust_user_input: NeverTrustUserInput
+ never_trust_user_input: NeverTrustUserInput,
};
export default class MoreInfoRuleDescription extends React.PureComponent<Props, {}> {
handleNotificationScroll = () => {
@@ -52,7 +52,7 @@ export default class MoreInfoRuleDescription extends React.PureComponent<Props,
displayEducationalPrinciplesNotification,
sections = [],
educationPrinciples = [],
- educationPrinciplesRef
+ educationPrinciplesRef,
} = this.props;
return (
<div className="padded rule-desc">
@@ -64,7 +64,8 @@ export default class MoreInfoRuleDescription extends React.PureComponent<Props,
<ButtonLink
onClick={() => {
this.handleNotificationScroll();
- }}>
+ }}
+ >
{translate('coding_rules.more_info.scroll_message')}
</ButtonLink>
</Alert>
@@ -81,7 +82,7 @@ export default class MoreInfoRuleDescription extends React.PureComponent<Props,
<h2 ref={educationPrinciplesRef}>
{translate('coding_rules.more_info.education_principles.title')}
</h2>
- {educationPrinciples.map(key => {
+ {educationPrinciples.map((key) => {
const Concept = EDUCATION_PRINCIPLES_MAP[key];
if (Concept === undefined) {
return null;
diff --git a/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx b/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx
index d4d4a060829..7241f235641 100644
--- a/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx
+++ b/server/sonar-web/src/main/js/components/rules/OtherContextOption.tsx
@@ -43,7 +43,8 @@ export default function OtherContextOption() {
<p>{translate('coding_rules.context.others.feedback_description_1')}</p>
<Link
to="https://portal.productboard.com/sonarsource/3-sonarqube/submit-idea"
- target="_blank">
+ target="_blank"
+ >
{translate('coding_rules.context.others.feedback_description.link')}
</Link>
<p>{translate('coding_rules.context.others.feedback_description_2')}</p>
diff --git a/server/sonar-web/src/main/js/components/rules/RuleDescription.tsx b/server/sonar-web/src/main/js/components/rules/RuleDescription.tsx
index 90767868178..ed1dbc28115 100644
--- a/server/sonar-web/src/main/js/components/rules/RuleDescription.tsx
+++ b/server/sonar-web/src/main/js/components/rules/RuleDescription.tsx
@@ -72,10 +72,10 @@ export default class RuleDescription extends React.PureComponent<Props, State> {
): section is RuleDescriptionSection & Required<Pick<RuleDescriptionSection, 'context'>> =>
section.context != null
)
- .map(section => ({
+ .map((section) => ({
displayName: section.context.displayName || section.context.key,
content: section.content,
- key: section.context.key
+ key: section.context.key,
}))
.sort((a, b) => a.displayName.localeCompare(b.displayName));
@@ -83,27 +83,27 @@ export default class RuleDescription extends React.PureComponent<Props, State> {
contexts.push({
displayName: translate('coding_rules.description_context.other'),
content: '',
- key: OTHERS_KEY
+ key: OTHERS_KEY,
});
}
let defaultContext: RuleDescriptionContextDisplay | undefined;
if (defaultContextKey) {
- defaultContext = contexts.find(context => context.key === defaultContextKey);
+ defaultContext = contexts.find((context) => context.key === defaultContextKey);
}
return {
contexts,
defaultContext,
- selectedContext: defaultContext ?? contexts[0]
+ selectedContext: defaultContext ?? contexts[0],
};
};
handleToggleContext = (value: string) => {
const { contexts } = this.state;
- const selected = contexts.find(ctxt => ctxt.displayName === value);
+ const selected = contexts.find((ctxt) => ctxt.displayName === value);
if (selected) {
this.setState({ selectedContext: selected });
}
@@ -113,9 +113,9 @@ export default class RuleDescription extends React.PureComponent<Props, State> {
const { className, sections, isDefault } = this.props;
const { contexts, defaultContext, selectedContext } = this.state;
- const options = contexts.map(ctxt => ({
+ const options = contexts.map((ctxt) => ({
label: ctxt.displayName,
- value: ctxt.displayName
+ value: ctxt.displayName,
}));
if (contexts.length > 0 && selectedContext) {
@@ -123,11 +123,12 @@ export default class RuleDescription extends React.PureComponent<Props, State> {
<div
className={classNames(className, {
markdown: isDefault,
- 'rule-desc': !isDefault
+ 'rule-desc': !isDefault,
})}
- ref={node => {
+ ref={(node) => {
applyCodeDifferences(node);
- }}>
+ }}
+ >
<div className="rules-context-description">
<h2 className="rule-contexts-title">
{translate('coding_rules.description_context.title')}
@@ -173,14 +174,14 @@ export default class RuleDescription extends React.PureComponent<Props, State> {
<div
className={classNames(className, {
markdown: isDefault,
- 'rule-desc': !isDefault
+ 'rule-desc': !isDefault,
})}
- ref={node => {
+ ref={(node) => {
applyCodeDifferences(node);
}}
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
- __html: sanitizeString(sections[0].content)
+ __html: sanitizeString(sections[0].content),
}}
/>
);
diff --git a/server/sonar-web/src/main/js/components/rules/RuleTabViewer.tsx b/server/sonar-web/src/main/js/components/rules/RuleTabViewer.tsx
index 35bfee5a846..930c6354f18 100644
--- a/server/sonar-web/src/main/js/components/rules/RuleTabViewer.tsx
+++ b/server/sonar-web/src/main/js/components/rules/RuleTabViewer.tsx
@@ -58,14 +58,14 @@ export enum TabKeys {
WhyIsThisAnIssue = 'why',
HowToFixIt = 'how_to_fix',
AssessTheIssue = 'assess_the_problem',
- MoreInfo = 'more_info'
+ MoreInfo = 'more_info',
}
const DEBOUNCE_FOR_SCROLL = 250;
export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State> {
state: State = {
- tabs: []
+ tabs: [],
};
educationPrinciplesRef: React.RefObject<HTMLDivElement>;
@@ -80,7 +80,7 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
}
componentDidMount() {
- this.setState(prevState => this.computeState(prevState));
+ this.setState((prevState) => this.computeState(prevState));
this.attachScrollEvent();
}
@@ -94,7 +94,7 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
prevProps.codeTabContent !== codeTabContent ||
prevProps.currentUser !== currentUser
) {
- this.setState(pState =>
+ this.setState((pState) =>
this.computeState(
pState,
prevProps.ruleDetails !== ruleDetails || prevProps.codeTabContent !== codeTabContent
@@ -122,7 +122,7 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
computeState = (prevState: State, resetSelectedTab = false) => {
const {
ruleDetails,
- currentUser: { isLoggedIn, dismissedNotices }
+ currentUser: { isLoggedIn, dismissedNotices },
} = this.props;
const displayEducationalPrinciplesNotification =
@@ -135,7 +135,7 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
return {
tabs,
selectedTab: resetSelectedTab || !prevState.selectedTab ? tabs[0] : prevState.selectedTab,
- displayEducationalPrinciplesNotification
+ displayEducationalPrinciplesNotification,
};
};
@@ -144,12 +144,12 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
codeTabContent,
ruleDetails: { descriptionSections, educationPrinciples, type: ruleType },
ruleDescriptionContextKey,
- extendedDescription
+ extendedDescription,
} = this.props;
// As we might tamper with the description later on, we clone to avoid any side effect
const descriptionSectionsByKey = cloneDeep(
- groupBy(descriptionSections, section => section.key)
+ groupBy(descriptionSections, (section) => section.key)
);
if (extendedDescription) {
@@ -162,8 +162,8 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
descriptionSectionsByKey[RuleDescriptionSections.RESOURCES] = [
{
key: RuleDescriptionSections.RESOURCES,
- content: extendedDescription
- }
+ content: extendedDescription,
+ },
];
}
}
@@ -186,7 +186,7 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
isDefault={descriptionSectionsByKey[RuleDescriptionSections.DEFAULT] !== undefined}
defaultContextKey={ruleDescriptionContextKey}
/>
- )
+ ),
},
{
key: TabKeys.AssessTheIssue,
@@ -196,7 +196,7 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
className="padded"
sections={descriptionSectionsByKey[RuleDescriptionSections.ASSESS_THE_PROBLEM]}
/>
- )
+ ),
},
{
key: TabKeys.HowToFixIt,
@@ -207,7 +207,7 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
sections={descriptionSectionsByKey[RuleDescriptionSections.HOW_TO_FIX]}
defaultContextKey={ruleDescriptionContextKey}
/>
- )
+ ),
},
{
key: TabKeys.MoreInfo,
@@ -225,37 +225,37 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
displayEducationalPrinciplesNotification={displayEducationalPrinciplesNotification}
educationPrinciplesRef={this.educationPrinciplesRef}
/>
- )
- }
+ ),
+ },
];
if (codeTabContent !== undefined) {
tabs.unshift({
key: TabKeys.Code,
label: translate('issue.tabs', TabKeys.Code),
- content: codeTabContent
+ content: codeTabContent,
});
}
- return tabs.filter(tab => tab.content);
+ return tabs.filter((tab) => tab.content);
};
attachScrollEvent = () => {
document.addEventListener('scroll', this.checkIfEducationPrinciplesAreVisible, {
- capture: true
+ capture: true,
});
};
detachScrollEvent = () => {
document.removeEventListener('scroll', this.checkIfEducationPrinciplesAreVisible, {
- capture: true
+ capture: true,
});
};
checkIfEducationPrinciplesAreVisible = () => {
const {
displayEducationalPrinciplesNotification,
- educationalPrinciplesNotificationHasBeenDismissed
+ educationalPrinciplesNotificationHasBeenDismissed,
} = this.state;
if (this.educationPrinciplesRef.current) {
@@ -281,7 +281,7 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
handleSelectTabs = (currentTabKey: TabKeys) => {
this.setState(({ tabs }) => ({
- selectedTab: tabs.find(tab => tab.key === currentTabKey) || tabs[0]
+ selectedTab: tabs.find((tab) => tab.key === currentTabKey) || tabs[0],
}));
};
@@ -293,7 +293,7 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
return null;
}
- const tabContent = tabs.find(t => t.key === selectedTab.key)?.content;
+ const tabContent = tabs.find((t) => t.key === selectedTab.key)?.content;
return (
<>
@@ -310,12 +310,13 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State
<div
style={{
// We substract the footer height with padding (80) and the main layout padding (20)
- maxHeight: scrollInTab ? `calc(100vh - ${top + 100}px)` : 'initial'
+ maxHeight: scrollInTab ? `calc(100vh - ${top + 100}px)` : 'initial',
}}
className="bordered display-flex-column"
role="tabpanel"
aria-labelledby={getTabId(selectedTab.key)}
- id={getTabPanelId(selectedTab.key)}>
+ id={getTabPanelId(selectedTab.key)}
+ >
{/* Adding a key to force re-rendering of the tab container, so that it resets the scroll position */}
<div className="overflow-y-auto spacer" key={selectedTab.key}>
{tabContent}
diff --git a/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx b/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx
index 7d7a6bf9740..9848193a566 100644
--- a/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx
+++ b/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx
@@ -47,7 +47,7 @@ const ISSUE_MEASURES = [
MetricKey.bugs,
MetricKey.new_bugs,
MetricKey.vulnerabilities,
- MetricKey.new_vulnerabilities
+ MetricKey.new_vulnerabilities,
];
const issueParamsPerMetric: Dict<Dict<string>> = {
@@ -70,7 +70,7 @@ const issueParamsPerMetric: Dict<Dict<string>> = {
[MetricKey.bugs]: { resolved: 'false', types: 'BUG' },
[MetricKey.new_bugs]: { resolved: 'false', types: 'BUG' },
[MetricKey.vulnerabilities]: { resolved: 'false', types: 'VULNERABILITY' },
- [MetricKey.new_vulnerabilities]: { resolved: 'false', types: 'VULNERABILITY' }
+ [MetricKey.new_vulnerabilities]: { resolved: 'false', types: 'VULNERABILITY' },
};
interface Props {
@@ -90,7 +90,7 @@ export default class DrilldownLink extends React.PureComponent<Props> {
propsToIssueParams = () => {
const params: Dict<string | boolean> = {
- ...(issueParamsPerMetric[this.props.metric] || { resolved: 'false' })
+ ...(issueParamsPerMetric[this.props.metric] || { resolved: 'false' }),
};
if (this.props.inNewCodePeriod) {
@@ -105,7 +105,7 @@ export default class DrilldownLink extends React.PureComponent<Props> {
const url = getComponentIssuesUrl(component, {
...this.propsToIssueParams(),
- ...getBranchLikeQuery(branchLike)
+ ...getBranchLikeQuery(branchLike),
});
return (
@@ -125,7 +125,7 @@ export default class DrilldownLink extends React.PureComponent<Props> {
componentKey: component,
metric,
branchLike,
- listView: true
+ listView: true,
});
return (
<Link aria-label={ariaLabel} className={className} to={url}>
diff --git a/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx b/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx
index 4d7e2c2863b..1af6f51d3c3 100644
--- a/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx
+++ b/server/sonar-web/src/main/js/components/shared/__tests__/DrilldownLink-test.tsx
@@ -40,7 +40,7 @@ describe('propsToIssueParams', () => {
const wrapper = shallowRender({ metric: 'false_positive_issues', inNewCodePeriod: true });
expect(wrapper.instance().propsToIssueParams()).toEqual({
resolutions: 'FALSE-POSITIVE',
- inNewCodePeriod: true
+ inNewCodePeriod: true,
});
});
});
diff --git a/server/sonar-web/src/main/js/components/tags/TagsList.tsx b/server/sonar-web/src/main/js/components/tags/TagsList.tsx
index 1910de6c2ef..02fd0b088db 100644
--- a/server/sonar-web/src/main/js/components/tags/TagsList.tsx
+++ b/server/sonar-web/src/main/js/components/tags/TagsList.tsx
@@ -35,7 +35,8 @@ export default function TagsList({ allowUpdate = false, className, tags }: Props
<span
aria-label={translateWithParameters('tags_list_x', tags.join(', '))}
role="note"
- className={classNames('tags-list', className)}>
+ className={classNames('tags-list', className)}
+ >
<TagsIcon className="text-middle" />
<span aria-hidden={true} className="text-ellipsis text-middle" title={tags.join(', ')}>
{tags.join(', ')}
diff --git a/server/sonar-web/src/main/js/components/tags/__tests__/TagsSelector-test.tsx b/server/sonar-web/src/main/js/components/tags/__tests__/TagsSelector-test.tsx
index 23710560efe..176aaea3301 100644
--- a/server/sonar-web/src/main/js/components/tags/__tests__/TagsSelector-test.tsx
+++ b/server/sonar-web/src/main/js/components/tags/__tests__/TagsSelector-test.tsx
@@ -29,7 +29,7 @@ const props = {
renderLabel: (element: string) => element,
position: { right: 0, top: 0 },
selectedTags: ['bar'],
- tags: ['foo', 'bar', 'baz']
+ tags: ['foo', 'bar', 'baz'],
};
it('should render with selected tags', () => {
diff --git a/server/sonar-web/src/main/js/components/tutorials/TutorialSelection.tsx b/server/sonar-web/src/main/js/components/tutorials/TutorialSelection.tsx
index 661ef43a318..3e33a66f6a9 100644
--- a/server/sonar-web/src/main/js/components/tutorials/TutorialSelection.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/TutorialSelection.tsx
@@ -58,7 +58,7 @@ export class TutorialSelection extends React.PureComponent<Props, State> {
state: State = {
currentUserCanScanProject: false,
baseUrl: getHostUrl(),
- loading: true
+ loading: true,
};
async componentDidMount() {
@@ -85,7 +85,7 @@ export class TutorialSelection extends React.PureComponent<Props, State> {
const { projects } = await getScannableProjects();
this.setState({
- currentUserCanScanProject: projects.find(p => p.key === component.key) !== undefined
+ currentUserCanScanProject: projects.find((p) => p.key === component.key) !== undefined,
});
return Promise.resolve();
@@ -99,7 +99,7 @@ export class TutorialSelection extends React.PureComponent<Props, State> {
if (this.mounted) {
let almBinding;
if (almSettings !== undefined) {
- almBinding = almSettings.find(d => d.key === projectBinding.key);
+ almBinding = almSettings.find((d) => d.key === projectBinding.key);
}
this.setState({ almBinding });
}
@@ -117,23 +117,18 @@ export class TutorialSelection extends React.PureComponent<Props, State> {
handleSelectTutorial = (selectedTutorial: TutorialModes) => {
const {
router,
- location: { pathname, query }
+ location: { pathname, query },
} = this.props;
router.push({
pathname,
- query: { ...query, selectedTutorial }
+ query: { ...query, selectedTutorial },
});
};
render() {
- const {
- component,
- currentUser,
- location,
- projectBinding,
- willRefreshAutomatically
- } = this.props;
+ const { component, currentUser, location, projectBinding, willRefreshAutomatically } =
+ this.props;
const { almBinding, baseUrl, currentUserCanScanProject, loading } = this.state;
const selectedTutorial: TutorialModes | undefined = location.query?.selectedTutorial;
@@ -149,7 +144,7 @@ export class TutorialSelection extends React.PureComponent<Props, State> {
currentUserCanScanProject={currentUserCanScanProject}
loading={loading}
mainBranchName={
- (branchLikes.find(b => isMainBranch(b)) as MainBranch | undefined)?.name ||
+ (branchLikes.find((b) => isMainBranch(b)) as MainBranch | undefined)?.name ||
DEFAULT_MAIN_BRANCH_NAME
}
onSelectTutorial={this.handleSelectTutorial}
diff --git a/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx b/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx
index 6a08e543646..000f5e87ed6 100644
--- a/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/TutorialSelectionRenderer.tsx
@@ -61,7 +61,8 @@ function renderButton(
// Currently, OtherCI is the same tutorial as Manual. We might update it to its own stand-alone
// tutorial in the future.
onClick={() => onSelectTutorial(mode)}
- type="button">
+ type="button"
+ >
{icon}
<div className="medium big-spacer-top">
{translate('onboarding.tutorial.choose_method', mode)}
@@ -81,7 +82,7 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender
mainBranchName,
projectBinding,
selectedTutorial,
- willRefreshAutomatically
+ willRefreshAutomatically,
} = props;
if (loading) {
@@ -107,7 +108,7 @@ export default function TutorialSelectionRenderer(props: TutorialSelectionRender
AlmKeys.BitbucketCloud,
AlmKeys.BitbucketServer,
AlmKeys.GitHub,
- AlmKeys.GitLab
+ AlmKeys.GitLab,
].includes(projectBinding.alm);
}
diff --git a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx
index b2c685971f1..7d5e092b7b7 100644
--- a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx
@@ -28,7 +28,7 @@ import SettingsServiceMock from '../../../api/mocks/SettingsServiceMock';
import UserTokensMock from '../../../api/mocks/UserTokensMock';
import {
mockGithubBindingDefinition,
- mockProjectAlmBindingResponse
+ mockProjectAlmBindingResponse,
} from '../../../helpers/mocks/alm-settings';
import { mockComponent } from '../../../helpers/mocks/component';
import { mockLoggedInUser } from '../../../helpers/testMocks';
@@ -46,15 +46,15 @@ jest.mock('../../../api/user-tokens');
jest.mock('../../../helpers/urls', () => ({
...jest.requireActual('../../../helpers/urls'),
- getHostUrl: jest.fn().mockReturnValue('http://host.url')
+ getHostUrl: jest.fn().mockReturnValue('http://host.url'),
}));
jest.mock('../../../api/alm-settings', () => ({
- getAlmSettingsNoCatch: jest.fn().mockRejectedValue(null)
+ getAlmSettingsNoCatch: jest.fn().mockRejectedValue(null),
}));
jest.mock('../../../api/components', () => ({
- getScannableProjects: jest.fn().mockResolvedValue({ projects: [] })
+ getScannableProjects: jest.fn().mockResolvedValue({ projects: [] }),
}));
let settingsMock: SettingsServiceMock;
@@ -76,7 +76,7 @@ const ui = {
loading: byLabelText('loading'),
noScanRights: byText('onboarding.tutorial.no_scan_rights'),
chooseTutorialBtn: (mode: TutorialModes) =>
- byRole('button', { name: `onboarding.tutorial.choose_method.${mode}` })
+ byRole('button', { name: `onboarding.tutorial.choose_method.${mode}` }),
};
it.each([
@@ -84,12 +84,12 @@ it.each([
[TutorialModes.AzurePipelines, 'onboarding.tutorial.with.azure_pipelines.title'],
[
TutorialModes.BitbucketPipelines,
- 'onboarding.tutorial.with.bitbucket_pipelines.create_secret.title'
+ 'onboarding.tutorial.with.bitbucket_pipelines.create_secret.title',
],
[TutorialModes.GitHubActions, 'onboarding.tutorial.with.github_action.create_secret.title'],
[TutorialModes.GitLabCI, 'onboarding.tutorial.with.gitlab_ci.title'],
[TutorialModes.Local, 'onboarding.project_analysis.header'],
- [TutorialModes.OtherCI, 'onboarding.project_analysis.header']
+ [TutorialModes.OtherCI, 'onboarding.project_analysis.header'],
])('should behave correctly for %s', async (mode, title) => {
const user = userEvent.setup();
renderTutorialSelection();
@@ -104,26 +104,26 @@ it.each([
it.each([
[
AlmKeys.GitHub,
- [TutorialModes.GitHubActions, TutorialModes.Jenkins, TutorialModes.AzurePipelines]
+ [TutorialModes.GitHubActions, TutorialModes.Jenkins, TutorialModes.AzurePipelines],
],
[AlmKeys.GitLab, [TutorialModes.GitLabCI, TutorialModes.Jenkins]],
[AlmKeys.Azure, [TutorialModes.AzurePipelines]],
[AlmKeys.BitbucketServer, [TutorialModes.Jenkins]],
- [AlmKeys.BitbucketCloud, [TutorialModes.BitbucketPipelines, TutorialModes.Jenkins]]
+ [AlmKeys.BitbucketCloud, [TutorialModes.BitbucketPipelines, TutorialModes.Jenkins]],
])('should show correct buttons if project is bound to %s', async (alm, modes) => {
renderTutorialSelection({ projectBinding: mockProjectAlmBindingResponse({ alm }) });
await waitOnDataLoaded();
- modes.forEach(mode => expect(ui.chooseTutorialBtn(mode).get()).toBeInTheDocument());
+ modes.forEach((mode) => expect(ui.chooseTutorialBtn(mode).get()).toBeInTheDocument());
});
it('should correctly fetch the corresponding ALM setting', async () => {
(getAlmSettingsNoCatch as jest.Mock).mockResolvedValueOnce([
- mockGithubBindingDefinition({ key: 'binding', url: 'https://enterprise.github.com' })
+ mockGithubBindingDefinition({ key: 'binding', url: 'https://enterprise.github.com' }),
]);
const user = userEvent.setup();
renderTutorialSelection({
- projectBinding: mockProjectAlmBindingResponse({ alm: AlmKeys.GitHub, key: 'binding' })
+ projectBinding: mockProjectAlmBindingResponse({ alm: AlmKeys.GitHub, key: 'binding' }),
});
await waitOnDataLoaded();
diff --git a/server/sonar-web/src/main/js/components/tutorials/__tests__/utils-test.ts b/server/sonar-web/src/main/js/components/tutorials/__tests__/utils-test.ts
index 58b79c76352..d2d2a2fd00e 100644
--- a/server/sonar-web/src/main/js/components/tutorials/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/components/tutorials/__tests__/utils-test.ts
@@ -20,7 +20,7 @@
import {
mockAlmSettingsInstance,
mockProjectBitbucketCloudBindingResponse,
- mockProjectGithubBindingResponse
+ mockProjectGithubBindingResponse,
} from '../../../helpers/mocks/alm-settings';
import { mockUserToken } from '../../../helpers/mocks/token';
import { UserToken } from '../../../types/token';
@@ -44,7 +44,7 @@ describe('getUniqueTokenName', () => {
it('should generate a unique token when the name already exists', () => {
const userTokens = [
mockUserToken({ name: initialTokenName }),
- mockUserToken({ name: `${initialTokenName} 1` })
+ mockUserToken({ name: `${initialTokenName} 1` }),
];
expect(getUniqueTokenName(userTokens, initialTokenName)).toBe('Analyze "lightsaber" 2');
diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/AzurePipelinesTutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/AzurePipelinesTutorial.tsx
index 5f07e2347aa..7ec569f2042 100644
--- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/AzurePipelinesTutorial.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/AzurePipelinesTutorial.tsx
@@ -42,7 +42,7 @@ export enum Steps {
ExtensionInstallation,
ServiceEndpoint,
BranchAnalysis,
- AllSet
+ AllSet,
}
interface Step {
@@ -67,18 +67,18 @@ export default function AzurePipelinesTutorial(props: AzurePipelinesTutorialProp
component={component}
currentUser={currentUser}
/>
- )
+ ),
},
{
step: Steps.BranchAnalysis,
content: (
<BranchAnalysisStepContent
component={component}
- onStepValidationChange={isValid => setIsCurrentStepValid(isValid)}
+ onStepValidationChange={(isValid) => setIsCurrentStepValid(isValid)}
/>
),
- checkValidity: true
- }
+ checkValidity: true,
+ },
];
const switchCurrentStep = (step: Steps) => {
@@ -115,7 +115,8 @@ export default function AzurePipelinesTutorial(props: AzurePipelinesTutorialProp
) : (
<Button
className="big-spacer-top spacer-bottom"
- onClick={() => switchCurrentStep(step.step + 1)}>
+ onClick={() => switchCurrentStep(step.step + 1)}
+ >
{translate('continue')}
</Button>
))}
diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/BranchAnalysisStepContent.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/BranchAnalysisStepContent.tsx
index 70200e4d080..48a662876f2 100644
--- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/BranchAnalysisStepContent.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/BranchAnalysisStepContent.tsx
@@ -38,7 +38,7 @@ const BUILD_TOOLS_ORDERED: Array<BuildTools> = [
BuildTools.Maven,
BuildTools.Gradle,
BuildTools.CFamily,
- BuildTools.Other
+ BuildTools.Other,
];
export function BranchAnalysisStepContent(props: BranchesAnalysisStepProps) {
@@ -47,14 +47,14 @@ export function BranchAnalysisStepContent(props: BranchesAnalysisStepProps) {
const [buildTechnology, setBuildTechnology] = React.useState<BuildTools | undefined>();
const buildToolsList = languages['c']
? BUILD_TOOLS_ORDERED
- : BUILD_TOOLS_ORDERED.filter(t => t !== BuildTools.CFamily);
+ : BUILD_TOOLS_ORDERED.filter((t) => t !== BuildTools.CFamily);
return (
<>
<span>{translate('onboarding.build')}</span>
<RenderOptions
label={translate('onboarding.build')}
checked={buildTechnology}
- onCheck={value => setBuildTechnology(value as BuildTools)}
+ onCheck={(value) => setBuildTechnology(value as BuildTools)}
optionLabelKey="onboarding.build"
options={buildToolsList}
/>
diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ExtensionInstallationStepContent.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ExtensionInstallationStepContent.tsx
index eff9bb3e535..7e032937cab 100644
--- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ExtensionInstallationStepContent.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ExtensionInstallationStepContent.tsx
@@ -34,7 +34,8 @@ export default function ExtensionInstallationStepContent() {
link: (
<Link
to="https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube"
- target="_blank">
+ target="_blank"
+ >
{translate(
'onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.sentence.link'
)}
@@ -46,7 +47,7 @@ export default function ExtensionInstallationStepContent() {
'onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.sentence.button'
)}
</strong>
- )
+ ),
}}
/>
</span>
diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/JavaToolInstallation.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/JavaToolInstallation.tsx
index e0b6ea70883..44101379d07 100644
--- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/JavaToolInstallation.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/JavaToolInstallation.tsx
@@ -34,7 +34,7 @@ function renderSentenceWithFieldAndValue(props: {
)}
values={{
field: <strong>{field}</strong>,
- value: <strong>{value}</strong>
+ value: <strong>{value}</strong>,
}}
/>
);
@@ -50,7 +50,7 @@ export default function JavaToolInstallation() {
field: translate(
'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.java_version'
),
- value: '11'
+ value: '11',
})}
{' ' /* explicit space between the two strings */}
{translate(
@@ -62,7 +62,7 @@ export default function JavaToolInstallation() {
field: translate(
'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.java_architecture'
),
- value: 'x64'
+ value: 'x64',
})}
</li>
<li>
@@ -72,7 +72,7 @@ export default function JavaToolInstallation() {
),
value: translate(
'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.java_installer.pre-installed'
- )
+ ),
})}
</li>
</ul>
diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ServiceEndpointStepContent.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ServiceEndpointStepContent.tsx
index 885db5a45fa..6590d6c2a44 100644
--- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ServiceEndpointStepContent.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/ServiceEndpointStepContent.tsx
@@ -62,7 +62,7 @@ export default function ServiceEndpointStepContent(props: ServiceEndpointStepPro
id="onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.step3.sentence"
values={{
url: <code className="rule">{baseUrl}</code>,
- button: <ClipboardIconButton copyValue={baseUrl} />
+ button: <ClipboardIconButton copyValue={baseUrl} />,
}}
/>
</li>
diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/AzurePipelinesTutorial-it.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/AzurePipelinesTutorial-it.tsx
index 98fb021231f..1bee33330c2 100644
--- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/AzurePipelinesTutorial-it.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/__tests__/AzurePipelinesTutorial-it.tsx
@@ -33,7 +33,7 @@ import AzurePipelinesTutorial, { AzurePipelinesTutorialProps } from '../AzurePip
jest.mock('../../../../api/user-tokens');
jest.mock('../../../../api/settings', () => ({
- getAllValues: jest.fn().mockResolvedValue([])
+ getAllValues: jest.fn().mockResolvedValue([]),
}));
let tokenMock: UserTokensMock;
@@ -96,7 +96,7 @@ it('should render correctly and allow navigating between the different steps', a
await clickButton(user, 'onboarding.build.cfamily');
// OS's
- [OSs.Linux, OSs.Windows, OSs.MacOS].forEach(async os => {
+ [OSs.Linux, OSs.Windows, OSs.MacOS].forEach(async (os) => {
await clickButton(user, `onboarding.build.other.os.${os}`);
assertCFamilyStepIsCorrectlyRendered(os);
});
@@ -117,7 +117,7 @@ it('allows to navigate back to a previous step', async () => {
// No clickable steps.
expect(
screen.queryByRole('button', {
- name: '1 onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.title'
+ name: '1 onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.title',
})
).not.toBeInTheDocument();
@@ -128,12 +128,12 @@ it('allows to navigate back to a previous step', async () => {
// The first 2 steps become clickable.
expect(
screen.getByRole('button', {
- name: '1 onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.title'
+ name: '1 onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.title',
})
).toBeInTheDocument();
expect(
screen.getByRole('button', {
- name: '2 onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.title'
+ name: '2 onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.title',
})
).toBeInTheDocument();
@@ -143,7 +143,7 @@ it('allows to navigate back to a previous step', async () => {
// No more clickable steps.
expect(
screen.queryByRole('button', {
- name: '1 onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.title'
+ name: '1 onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.title',
})
).not.toBeInTheDocument();
});
@@ -165,7 +165,7 @@ it('should not offer CFamily analysis if the language is not available', async (
function assertDefaultStepIsCorrectlyRendered() {
expect(
screen.getByRole('heading', {
- name: 'onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.title'
+ name: 'onboarding.tutorial.with.azure_pipelines.ExtensionInstallation.title',
})
).toBeInTheDocument();
}
@@ -173,7 +173,7 @@ function assertDefaultStepIsCorrectlyRendered() {
function assertServiceEndpointStepIsCorrectlyRendered() {
expect(
screen.getByRole('heading', {
- name: 'onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.title'
+ name: 'onboarding.tutorial.with.azure_pipelines.ServiceEndpoint.title',
})
).toBeInTheDocument();
expect(getCopyToClipboardValue()).toBe('https://sonarqube.example.com/');
@@ -185,7 +185,7 @@ function assertServiceEndpointStepIsCorrectlyRendered() {
function assertDotNetStepIsCorrectlyRendered() {
expect(
screen.getByRole('heading', {
- name: 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.title'
+ name: 'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.title',
})
).toBeInTheDocument();
expect(getCopyToClipboardValue()).toBe('foo');
@@ -213,7 +213,7 @@ function assertOtherStepIsCorrectlyRendered() {
function assertFinishStepIsCorrectlyRendered() {
expect(
screen.getByRole('heading', {
- name: 'onboarding.tutorial.ci_outro.all_set.title'
+ name: 'onboarding.tutorial.ci_outro.all_set.title',
})
).toBeInTheDocument();
}
diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/AlertClassicEditor.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/AlertClassicEditor.tsx
index b334f5373cd..e25f0fa81c3 100644
--- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/AlertClassicEditor.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/AlertClassicEditor.tsx
@@ -36,7 +36,7 @@ export default function AlertClassicEditor() {
<DocLink to={ALM_DOCUMENTATION_PATHS[AlmKeys.Azure]}>
{translate('onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info.doc_link')}
</DocLink>
- )
+ ),
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/ClangGCC.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/ClangGCC.tsx
index 49073dfef02..5947d867ec7 100644
--- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/ClangGCC.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/ClangGCC.tsx
@@ -55,7 +55,7 @@ unzip build-wrapper.zip`,
highlightScriptKey:
'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.build_wrapper.ccpp.nix',
scriptBuild:
- './build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output <your build command here>'
+ './build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output <your build command here>',
},
[OSs.Windows]: {
script: `Invoke-WebRequest -Uri '${host}/static/cpp/build-wrapper-win-x86.zip' -OutFile 'build-wrapper.zip'
@@ -63,7 +63,7 @@ Expand-Archive -Path 'build-wrapper.zip' -DestinationPath '.'`,
highlightScriptKey:
'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.build_wrapper.ccpp.win',
scriptBuild:
- 'build-wrapper-win-x86/build-wrapper-win-x86-64.exe --out-dir bw-output <your build command here>'
+ 'build-wrapper-win-x86/build-wrapper-win-x86-64.exe --out-dir bw-output <your build command here>',
},
[OSs.MacOS]: {
script: `curl '${host}/static/cpp/build-wrapper-macosx-x86.zip' --output build-wrapper.zip
@@ -71,8 +71,8 @@ unzip build-wrapper.zip`,
highlightScriptKey:
'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.build_wrapper.ccpp.nix',
scriptBuild:
- './build-wrapper-macos-x86/build-wrapper-macos-x86 --out-dir bw-output <your build command here>'
- }
+ './build-wrapper-macos-x86/build-wrapper-macos-x86 --out-dir bw-output <your build command here>',
+ },
};
React.useEffect(() => {
diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PrepareAnalysisCommand.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PrepareAnalysisCommand.tsx
index 589fc637457..60bf5e1520c 100644
--- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PrepareAnalysisCommand.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PrepareAnalysisCommand.tsx
@@ -28,7 +28,7 @@ import { BuildTools } from '../../types';
export enum PrepareType {
JavaMavenGradle,
StandAlone,
- MSBuild
+ MSBuild,
}
export interface PrepareAnalysisCommandProps {
@@ -76,7 +76,7 @@ sonar.projectKey=${projectKey}`;
buildTool
)}
</strong>
- )
+ ),
}}
/>
</li>
@@ -105,7 +105,7 @@ sonar.projectKey=${projectKey}`;
</b>
),
key: <code className="rule">{projectKey}</code>,
- button: <ClipboardIconButton copyValue={projectKey} />
+ button: <ClipboardIconButton copyValue={projectKey} />,
}}
/>
</li>
@@ -132,7 +132,7 @@ sonar.projectKey=${projectKey}`;
</b>
),
property: <code className="rule">{ADDITIONAL_PROPERTY}</code>,
- button: <ClipboardIconButton copyValue={ADDITIONAL_PROPERTY} />
+ button: <ClipboardIconButton copyValue={ADDITIONAL_PROPERTY} />,
}}
/>
</li>
@@ -166,7 +166,7 @@ sonar.projectKey=${projectKey}`;
</b>
),
key: <code className="rule">{projectKey}</code>,
- button: <ClipboardIconButton copyValue={projectKey} />
+ button: <ClipboardIconButton copyValue={projectKey} />,
}}
/>
</li>
diff --git a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PublishSteps.tsx b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PublishSteps.tsx
index 20852c0405a..a8acaf81e25 100644
--- a/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PublishSteps.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/azure-pipelines/commands/PublishSteps.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../../app/components/available-features/withAvailableFeatures';
import { Alert } from '../../../../components/ui/Alert';
import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants';
@@ -72,7 +72,7 @@ export function PublishSteps(props: PublishStepsProps) {
'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.branch_protection.link'
)}
</DocLink>
- )
+ ),
}}
/>
</>
diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/AnalysisCommand.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/AnalysisCommand.tsx
index b29b219c0f5..073368b1bf9 100644
--- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/AnalysisCommand.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/AnalysisCommand.tsx
@@ -20,7 +20,7 @@
import { Dictionary } from 'lodash';
import * as React from 'react';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import { Feature } from '../../../types/features';
import { Component } from '../../../types/types';
@@ -40,16 +40,14 @@ export interface AnalysisCommandProps extends WithAvailableFeaturesProps {
component: Component;
}
-const YamlTemplate: Dictionary<(
- branchesEnabled?: boolean,
- mainBranchName?: string,
- projectKey?: string
-) => string> = {
+const YamlTemplate: Dictionary<
+ (branchesEnabled?: boolean, mainBranchName?: string, projectKey?: string) => string
+> = {
[BuildTools.Gradle]: gradleExample,
[BuildTools.Maven]: mavenExample,
[BuildTools.DotNet]: dotNetExample,
[BuildTools.CFamily]: cFamilyExample,
- [BuildTools.Other]: othersExample
+ [BuildTools.Other]: othersExample,
};
export function AnalysisCommand(props: AnalysisCommandProps) {
diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/BitbucketPipelinesTutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/BitbucketPipelinesTutorial.tsx
index dfaee042ab7..16dbb9a3841 100644
--- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/BitbucketPipelinesTutorial.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/BitbucketPipelinesTutorial.tsx
@@ -22,7 +22,7 @@ import { translate } from '../../../helpers/l10n';
import {
AlmKeys,
AlmSettingsInstance,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../../../types/alm-settings';
import { Component } from '../../../types/types';
import { LoggedInUser } from '../../../types/users';
@@ -38,7 +38,7 @@ import RepositoryVariables from './RepositoryVariables';
export enum Steps {
REPOSITORY_VARIABLES = 1,
YAML = 2,
- ALL_SET = 3
+ ALL_SET = 3,
}
export interface BitbucketPipelinesTutorialProps {
@@ -59,7 +59,7 @@ export default function BitbucketPipelinesTutorial(props: BitbucketPipelinesTuto
component,
projectBinding,
willRefreshAutomatically,
- mainBranchName
+ mainBranchName,
} = props;
const [step, setStep] = React.useState<Steps>(Steps.REPOSITORY_VARIABLES);
@@ -88,7 +88,7 @@ export default function BitbucketPipelinesTutorial(props: BitbucketPipelinesTuto
open={step === Steps.YAML}
renderForm={() => (
<YamlFileStep>
- {buildTool => (
+ {(buildTool) => (
<>
{buildTool === BuildTools.CFamily && (
<GithubCFamilyExampleRepositories
diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/PreambuleYaml.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/PreambuleYaml.tsx
index fa0e6824eab..23605ea8eae 100644
--- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/PreambuleYaml.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/PreambuleYaml.tsx
@@ -48,7 +48,7 @@ export function PreambuleYaml(props: PreambuleYamlProps) {
<ClipboardIconButton copyValue="build.gradle" />
</>
),
- sq: <code className="rule">org.sonarqube</code>
+ sq: <code className="rule">org.sonarqube</code>,
}}
/>
<CodeSnippet snippet={buildGradleSnippet(component.key)} />
diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/RepositoryVariables.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/RepositoryVariables.tsx
index 9fa7e0f5b7a..230c33946ad 100644
--- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/RepositoryVariables.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/RepositoryVariables.tsx
@@ -55,14 +55,15 @@ export default function RepositoryVariables(props: RepositoryVariablesProps) {
projectBinding
)}/admin/addon/admin/pipelines/repository-variables`}
target="_blank"
- rel="noopener noreferrer">
+ rel="noopener noreferrer"
+ >
{translate('onboarding.tutorial.with.bitbucket_pipelines.variables.intro.link')}
</a>
) : (
<strong>
{translate('onboarding.tutorial.with.bitbucket_pipelines.variables.intro.link')}
</strong>
- )
+ ),
}}
/>
</p>
@@ -109,7 +110,7 @@ export default function RepositoryVariables(props: RepositoryVariablesProps) {
values={{
extra: <ClipboardIconButton copyValue={baseUrl} />,
field: <strong>{translate('onboarding.tutorial.env_variables.field')}</strong>,
- value: <code className="rule">{baseUrl}</code>
+ value: <code className="rule">{baseUrl}</code>,
}}
/>
</li>
diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx
index 50253295ec2..9d471c1443e 100644
--- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/AnalysisCommand-test.tsx
@@ -28,8 +28,8 @@ it.each([
[BuildTools.DotNet],
[BuildTools.Gradle],
[BuildTools.Maven],
- [BuildTools.Other]
-])('should render correctly for %s', buildTool => {
+ [BuildTools.Other],
+])('should render correctly for %s', (buildTool) => {
expect(shallowRender({ buildTool })).toMatchSnapshot();
expect(shallowRender({ hasFeature: () => true, buildTool })).toMatchSnapshot(
'with branch enabled'
diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx
index 11c2961ddb9..b5b54f61e22 100644
--- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/BitbucketPipelinesTutorial-test.tsx
@@ -21,14 +21,14 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
mockAlmSettingsInstance,
- mockProjectBitbucketCloudBindingResponse
+ mockProjectBitbucketCloudBindingResponse,
} from '../../../../helpers/mocks/alm-settings';
import { mockComponent } from '../../../../helpers/mocks/component';
import { mockLoggedInUser } from '../../../../helpers/testMocks';
import Step from '../../components/Step';
import { renderStepContent } from '../../test-utils';
import BitbucketPipelinesTutorial, {
- BitbucketPipelinesTutorialProps
+ BitbucketPipelinesTutorialProps,
} from '../BitbucketPipelinesTutorial';
it('should render correctly', () => {
@@ -41,35 +41,12 @@ it('should render correctly', () => {
it('should correctly navigate through the steps', () => {
const wrapper = shallowRender();
- expect(
- wrapper
- .find(Step)
- .at(0)
- .props().open
- ).toBe(true);
- expect(
- wrapper
- .find(Step)
- .at(1)
- .props().open
- ).toBe(false);
+ expect(wrapper.find(Step).at(0).props().open).toBe(true);
+ expect(wrapper.find(Step).at(1).props().open).toBe(false);
- wrapper
- .find(Step)
- .at(1)
- .simulate('open');
- expect(
- wrapper
- .find(Step)
- .at(0)
- .props().open
- ).toBe(false);
- expect(
- wrapper
- .find(Step)
- .at(1)
- .props().open
- ).toBe(true);
+ wrapper.find(Step).at(1).simulate('open');
+ expect(wrapper.find(Step).at(0).props().open).toBe(false);
+ expect(wrapper.find(Step).at(1).props().open).toBe(true);
});
function shallowRender(props: Partial<BitbucketPipelinesTutorialProps> = {}) {
diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx
index ee57dd67785..60953c916f7 100644
--- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/PreambuleYaml-test.tsx
@@ -25,7 +25,7 @@ import { PreambuleYaml, PreambuleYamlProps } from '../PreambuleYaml';
it.each([[BuildTools.DotNet], [BuildTools.Gradle], [BuildTools.CFamily], [BuildTools.Other]])(
'should render correctly for %s',
- buildTool => {
+ (buildTool) => {
expect(shallowRender({ buildTool })).toMatchSnapshot();
}
);
diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx
index 2a479482be9..53f378377ce 100644
--- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/RepositoryVariables-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
mockAlmSettingsInstance,
- mockProjectBitbucketCloudBindingResponse
+ mockProjectBitbucketCloudBindingResponse,
} from '../../../../helpers/mocks/alm-settings';
import { mockComponent } from '../../../../helpers/mocks/component';
import { mockLoggedInUser } from '../../../../helpers/testMocks';
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/AllSet.tsx b/server/sonar-web/src/main/js/components/tutorials/components/AllSet.tsx
index df12b20c962..68c49629f48 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/AllSet.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/AllSet.tsx
@@ -19,7 +19,7 @@
*/
import * as React from 'react';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import { translate } from '../../../helpers/l10n';
import { getBaseUrl } from '../../../helpers/system';
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/CompilationInfo.tsx b/server/sonar-web/src/main/js/components/tutorials/components/CompilationInfo.tsx
index 0753cec1c97..c6930a6bd81 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/CompilationInfo.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/CompilationInfo.tsx
@@ -39,7 +39,7 @@ export function CompilationInfo({ className = 'spacer-top spacer-bottom' }: Comp
<DocLink to="/analysis/languages/cfamily/">
{translate('onboarding.tutorial.cfamilly.compilation_database_info.link')}
</DocLink>
- )
+ ),
}}
/>
</p>
@@ -52,7 +52,7 @@ export function CompilationInfo({ className = 'spacer-top spacer-bottom' }: Comp
<DocLink to="/analysis/languages/cfamily/#analysis-cache">
{translate('onboarding.tutorial.cfamilly.speed_caching.link')}
</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx b/server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx
index 86acd44bde4..497901e8d26 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/CreateYmlFile.tsx
@@ -41,7 +41,7 @@ export default function CreateYmlFile(props: CreateYmlFileProps) {
<code className="rule">{yamlFileName}</code>
<ClipboardIconButton copyValue={yamlFileName} />
</>
- )
+ ),
}}
/>
<CodeSnippet snippet={yamlTemplate} />
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/EditTokenModal.tsx b/server/sonar-web/src/main/js/components/tutorials/components/EditTokenModal.tsx
index 29dd00f8ec9..5bd1ee3e96f 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/EditTokenModal.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/EditTokenModal.tsx
@@ -29,7 +29,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n';
import {
computeTokenExpirationDate,
EXPIRATION_OPTIONS,
- getAvailableExpirationOptions
+ getAvailableExpirationOptions,
} from '../../../helpers/tokens';
import { hasGlobalPermission } from '../../../helpers/users';
import { Permissions } from '../../../types/permissions';
@@ -62,7 +62,7 @@ export default class EditTokenModal extends React.PureComponent<Props, State> {
loading: true,
tokenName: '',
tokenExpiration: TokenExpiration.OneMonth,
- tokenExpirationOptions: EXPIRATION_OPTIONS
+ tokenExpirationOptions: EXPIRATION_OPTIONS,
};
componentDidMount() {
@@ -83,7 +83,7 @@ export default class EditTokenModal extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
loading: false,
- tokenName: getUniqueTokenName(tokens, `Analyze "${component.name}"`)
+ tokenName: getUniqueTokenName(tokens, `Analyze "${component.name}"`),
});
}
};
@@ -97,7 +97,7 @@ export default class EditTokenModal extends React.PureComponent<Props, State> {
getNewToken = async () => {
const {
- component: { key }
+ component: { key },
} = this.props;
const { tokenName, tokenExpiration } = this.state;
@@ -108,14 +108,14 @@ export default class EditTokenModal extends React.PureComponent<Props, State> {
type,
projectKey: key,
...(tokenExpiration !== TokenExpiration.NoExpiration && {
- expirationDate: computeTokenExpirationDate(tokenExpiration)
- })
+ expirationDate: computeTokenExpirationDate(tokenExpiration),
+ }),
});
if (this.mounted) {
this.setState({
token,
- tokenName
+ tokenName,
});
}
};
@@ -131,7 +131,7 @@ export default class EditTokenModal extends React.PureComponent<Props, State> {
handleTokenNameChange = (event: React.ChangeEvent<HTMLInputElement>) => {
this.setState({
- tokenName: event.target.value
+ tokenName: event.target.value,
});
};
@@ -148,7 +148,7 @@ export default class EditTokenModal extends React.PureComponent<Props, State> {
if (this.mounted) {
this.setState({
token: '',
- tokenName: ''
+ tokenName: '',
});
}
}
@@ -179,7 +179,7 @@ export default class EditTokenModal extends React.PureComponent<Props, State> {
<Link target="_blank" to="/account/security">
{translate('onboarding.token.text.user_account')}
</Link>
- )
+ ),
}}
/>
</p>
@@ -229,7 +229,8 @@ export default class EditTokenModal extends React.PureComponent<Props, State> {
<div className="display-flex-column">
<label
className="text-bold little-spacer-bottom"
- htmlFor="token-expiration">
+ htmlFor="token-expiration"
+ >
{translate('users.tokens.expires_in')}
</label>
<div className="display-flex-center">
@@ -240,13 +241,14 @@ export default class EditTokenModal extends React.PureComponent<Props, State> {
onChange={this.handleTokenExpirationChange}
options={tokenExpirationOptions}
value={tokenExpirationOptions.find(
- option => option.value === tokenExpiration
+ (option) => option.value === tokenExpiration
)}
/>
<Button
className="text-middle"
disabled={!tokenName}
- onClick={this.getNewToken}>
+ onClick={this.getNewToken}
+ >
{translate('onboarding.token.generate')}
</Button>
</div>
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx b/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx
index f9f41a4bd2b..fb56f303801 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/GithubCFamilyExampleRepositories.tsx
@@ -34,7 +34,7 @@ export interface GithubCFamilyExampleRepositoriesProps {
const OS_SEARCH_MAP = {
[OSs.Linux]: 'linux',
[OSs.Windows]: 'windows',
- [OSs.MacOS]: 'macos'
+ [OSs.MacOS]: 'macos',
};
const CI_SEARCH_MAP = {
@@ -44,7 +44,7 @@ const CI_SEARCH_MAP = {
[TutorialModes.GitLabCI]: 'gitlab',
[TutorialModes.BitbucketPipelines]: 'bitbucket',
[TutorialModes.Local]: 'otherci',
- [TutorialModes.OtherCI]: 'otherci'
+ [TutorialModes.OtherCI]: 'otherci',
};
export default function GithubCFamilyExampleRepositories(
@@ -52,7 +52,7 @@ export default function GithubCFamilyExampleRepositories(
) {
const { className, os, ci } = props;
const queryParams = ['sq', os ? OS_SEARCH_MAP[os] : undefined, ci ? CI_SEARCH_MAP[ci] : undefined]
- .filter(s => !!s)
+ .filter((s) => !!s)
.join('+');
const link = `https://github.com/orgs/sonarsource-cfamily-examples/repositories?q=${queryParams}`;
@@ -61,7 +61,8 @@ export default function GithubCFamilyExampleRepositories(
className={classNames(
'github-cfamily-example-repositories-box big-padded boxed-group',
className
- )}>
+ )}
+ >
<div className="display-flex-center">
<img
alt="" // Should be ignored by screen readers
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/ProjectTokenScopeInfo.tsx b/server/sonar-web/src/main/js/components/tutorials/components/ProjectTokenScopeInfo.tsx
index d7cd473c8c8..b3246dfbe01 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/ProjectTokenScopeInfo.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/ProjectTokenScopeInfo.tsx
@@ -41,7 +41,7 @@ export default function ProjectTokenScopeInfo({ className }: ProjectTokenScopeIn
{translate('onboarding.token.text.user_account')}
</Link>
),
- doc_link: <DocLink to="/user-guide/user-token/">{translate('documentation')}</DocLink>
+ doc_link: <DocLink to="/user-guide/user-token/">{translate('documentation')}</DocLink>,
}}
/>
</Alert>
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/RenderOptions.tsx b/server/sonar-web/src/main/js/components/tutorials/components/RenderOptions.tsx
index 44e23a9d26d..1f10592a957 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/RenderOptions.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/RenderOptions.tsx
@@ -36,7 +36,7 @@ export default function RenderOptions({
onCheck,
optionLabelKey,
options,
- titleLabelKey
+ titleLabelKey,
}: RenderOptionsProps) {
return (
<div className="big-spacer-top">
@@ -45,9 +45,9 @@ export default function RenderOptions({
<ButtonToggle
label={label}
onCheck={onCheck}
- options={options.map(build => ({
+ options={options.map((build) => ({
label: translate(optionLabelKey, build),
- value: build
+ value: build,
}))}
value={checked}
/>
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/SentenceWithFilename.tsx b/server/sonar-web/src/main/js/components/tutorials/components/SentenceWithFilename.tsx
index 3870d9c4f14..8c0b052eda2 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/SentenceWithFilename.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/SentenceWithFilename.tsx
@@ -28,7 +28,7 @@ export interface SentenceWithFilenameProps {
export default function SentenceWithFilename({
filename,
- translationKey
+ translationKey,
}: SentenceWithFilenameProps) {
return (
<span className="markdown">
@@ -36,7 +36,7 @@ export default function SentenceWithFilename({
defaultMessage={translate(translationKey, 'sentence')}
id={`${translationKey}.sentence`}
values={{
- file: <code>{filename}</code>
+ file: <code>{filename}</code>,
}}
/>
</span>
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/SentenceWithHighlights.tsx b/server/sonar-web/src/main/js/components/tutorials/components/SentenceWithHighlights.tsx
index 16cdd9d2834..e53cf613fa0 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/SentenceWithHighlights.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/SentenceWithHighlights.tsx
@@ -31,12 +31,12 @@ export interface SentenceWithHighlightsProps {
export default function SentenceWithHighlights({
highlightKeys,
translationKey,
- highlightPrefixKeys
+ highlightPrefixKeys,
}: SentenceWithHighlightsProps) {
const values: Dict<JSX.Element> = {};
const transhighlightPrefixKeys = highlightPrefixKeys || translationKey;
- highlightKeys.forEach(key => {
+ highlightKeys.forEach((key) => {
values[key] = <strong>{translate(transhighlightPrefixKeys, 'sentence', key)}</strong>;
});
return (
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/Step.tsx b/server/sonar-web/src/main/js/components/tutorials/components/Step.tsx
index 5b43bab425f..a9a1da820ba 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/Step.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/Step.tsx
@@ -37,7 +37,7 @@ export default function Step(props: Props) {
const className = classNames('boxed-group', 'onboarding-step', {
'is-open': open,
'is-finished': finished,
- 'no-step-number': stepNumber === undefined
+ 'no-step-number': stepNumber === undefined,
});
const clickable = !open && finished && props.onOpen !== undefined;
@@ -54,7 +54,8 @@ export default function Step(props: Props) {
className={className}
onClick={clickable ? handleClick : undefined}
role={clickable ? 'button' : undefined}
- tabIndex={clickable ? 0 : undefined}>
+ tabIndex={clickable ? 0 : undefined}
+ >
{stepNumber !== undefined && <div className="onboarding-step-number">{stepNumber}</div>}
{!open && props.renderResult && props.renderResult()}
<div className="boxed-group-header">
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/TokenStepGenerator.tsx b/server/sonar-web/src/main/js/components/tutorials/components/TokenStepGenerator.tsx
index 7529a06b497..82d046717a6 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/TokenStepGenerator.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/TokenStepGenerator.tsx
@@ -34,7 +34,7 @@ export default function TokenStepGenerator(props: TokenStepGeneratorProps) {
const { component, currentUser } = props;
const [isModalVisible, toggleModal] = React.useState(false);
- const toggleTokenModal = () => toggleModal(visible => !visible);
+ const toggleTokenModal = () => toggleModal((visible) => !visible);
const closeTokenModal = () => toggleModal(false);
return (
@@ -50,7 +50,7 @@ export default function TokenStepGenerator(props: TokenStepGeneratorProps) {
</Button>
),
field: <strong>{translate('onboarding.tutorial.env_variables.field')}</strong>,
- value: translate('onboarding.tutorial.env_variables.token_generator.value')
+ value: translate('onboarding.tutorial.env_variables.token_generator.value'),
}}
/>
</li>
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/YamlFileStep.tsx b/server/sonar-web/src/main/js/components/tutorials/components/YamlFileStep.tsx
index f310794296d..7c1fe85918b 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/YamlFileStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/YamlFileStep.tsx
@@ -46,7 +46,7 @@ export function YamlFileStep(props: YamlFileStepProps) {
<RenderOptions
label={translate('onboarding.build')}
checked={buildToolSelected}
- onCheck={value => setBuildToolSelected(value as BuildTools)}
+ onCheck={(value) => setBuildToolSelected(value as BuildTools)}
options={buildTools}
optionLabelKey="onboarding.build"
/>
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/EditTokenModal-test.tsx b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/EditTokenModal-test.tsx
index 7681d5487c8..a9fde6da0cd 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/EditTokenModal-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/EditTokenModal-test.tsx
@@ -34,7 +34,7 @@ import EditTokenModal from '../EditTokenModal';
jest.mock('../../../../api/user-tokens');
jest.mock('../../../../api/settings', () => ({
- getAllValues: jest.fn().mockResolvedValue([])
+ getAllValues: jest.fn().mockResolvedValue([]),
}));
let tokenMock: UserTokensMock;
@@ -88,7 +88,7 @@ it('should behave correctly', async () => {
// Revoke token.
await clickButton(user, 'users.tokens.revoke_token');
- expect(tokenMock.tokens.map(t => t.name)).not.toContain(lastToken.name);
+ expect(tokenMock.tokens.map((t) => t.name)).not.toContain(lastToken.name);
// Generate a new token.
await typeInField(
@@ -112,7 +112,7 @@ it('should behave correctly', async () => {
it('should allow setting a preferred token type', async () => {
renderEditTokenModal({
preferredTokenType: TokenType.Global,
- currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Scan] } })
+ currentUser: mockLoggedInUser({ permissions: { global: [Permissions.Scan] } }),
});
const user = userEvent.setup();
@@ -128,7 +128,7 @@ it('should allow setting a preferred token type', async () => {
it('should fallback to project tokens if the user cannot generate global tokens', async () => {
renderEditTokenModal({
- preferredTokenType: TokenType.Global
+ preferredTokenType: TokenType.Global,
});
const user = userEvent.setup();
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/GithubCFamilyExampleRepositories-test.tsx b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/GithubCFamilyExampleRepositories-test.tsx
index a0ea0aaeec7..9b42c1066f5 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/GithubCFamilyExampleRepositories-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/GithubCFamilyExampleRepositories-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import { OSs, TutorialModes } from '../../types';
import GithubCFamilyExampleRepositories, {
- GithubCFamilyExampleRepositoriesProps
+ GithubCFamilyExampleRepositoriesProps,
} from '../GithubCFamilyExampleRepositories';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/AnalysisCommand.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/AnalysisCommand.tsx
index 823ad58c8b9..0d54449fa60 100644
--- a/server/sonar-web/src/main/js/components/tutorials/github-action/AnalysisCommand.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/github-action/AnalysisCommand.tsx
@@ -19,7 +19,7 @@
*/
import * as React from 'react';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import { Feature } from '../../../types/features';
import { Component } from '../../../types/types';
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx
index 64a8ffd6e6c..7d69445e962 100644
--- a/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/github-action/GitHubActionTutorial.tsx
@@ -22,7 +22,7 @@ import { translate } from '../../../helpers/l10n';
import {
AlmKeys,
AlmSettingsInstance,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../../../types/alm-settings';
import { Component } from '../../../types/types';
import { LoggedInUser } from '../../../types/users';
@@ -35,7 +35,7 @@ import SecretStep from './SecretStep';
export enum Steps {
CREATE_SECRET = 1,
YAML = 2,
- ALL_SET = 3
+ ALL_SET = 3,
}
export interface GitHubActionTutorialProps {
@@ -56,7 +56,7 @@ export default function GitHubActionTutorial(props: GitHubActionTutorialProps) {
component,
projectBinding,
mainBranchName,
- willRefreshAutomatically
+ willRefreshAutomatically,
} = props;
const [step, setStep] = React.useState<Steps>(Steps.CREATE_SECRET);
@@ -85,7 +85,7 @@ export default function GitHubActionTutorial(props: GitHubActionTutorialProps) {
open={step === Steps.YAML}
renderForm={() => (
<YamlFileStep>
- {buildTool => (
+ {(buildTool) => (
<AnalysisCommand
buildTool={buildTool}
mainBranchName={mainBranchName}
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/SecretStep.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/SecretStep.tsx
index 9eb8006ddf4..6738598df29 100644
--- a/server/sonar-web/src/main/js/components/tutorials/github-action/SecretStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/github-action/SecretStep.tsx
@@ -53,14 +53,15 @@ export default function SecretStep(props: SecretStepProps) {
<a
href={`${buildGithubLink(almBinding, projectBinding)}/settings/secrets`}
target="_blank"
- rel="noopener noreferrer">
+ rel="noopener noreferrer"
+ >
{translate('onboarding.tutorial.with.github_action.secret.intro.link')}
</a>
) : (
<strong>
{translate('onboarding.tutorial.with.github_action.secret.intro.link')}
</strong>
- )
+ ),
}}
/>
</p>
@@ -113,7 +114,7 @@ export default function SecretStep(props: SecretStepProps) {
values={{
extra: <ClipboardIconButton copyValue={baseUrl} />,
field: <strong>{translate('onboarding.tutorial.env_variables.field')}</strong>,
- value: <code className="rule">{baseUrl}</code>
+ value: <code className="rule">{baseUrl}</code>,
}}
/>
</li>
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/AnalysisCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/AnalysisCommand-test.tsx
index 47f444fdd9c..1b7211668d9 100644
--- a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/AnalysisCommand-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/AnalysisCommand-test.tsx
@@ -29,8 +29,8 @@ it.each([
BuildTools.DotNet,
BuildTools.Gradle,
BuildTools.Maven,
- BuildTools.Other
-])('should render correctly for %p', buildTool => {
+ BuildTools.Other,
+])('should render correctly for %p', (buildTool) => {
expect(shallowRender({ buildTool })).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx
index e0bde53be19..d7899aee294 100644
--- a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/GitHubActionTutorial-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
mockAlmSettingsInstance,
- mockProjectGithubBindingResponse
+ mockProjectGithubBindingResponse,
} from '../../../../helpers/mocks/alm-settings';
import { mockComponent } from '../../../../helpers/mocks/component';
import { mockLoggedInUser } from '../../../../helpers/testMocks';
@@ -39,35 +39,12 @@ it('should render correctly', () => {
it('should correctly navigate through the steps', () => {
const wrapper = shallowRender();
- expect(
- wrapper
- .find(Step)
- .at(0)
- .props().open
- ).toBe(true);
- expect(
- wrapper
- .find(Step)
- .at(1)
- .props().open
- ).toBe(false);
+ expect(wrapper.find(Step).at(0).props().open).toBe(true);
+ expect(wrapper.find(Step).at(1).props().open).toBe(false);
- wrapper
- .find(Step)
- .at(1)
- .simulate('open');
- expect(
- wrapper
- .find(Step)
- .at(0)
- .props().open
- ).toBe(false);
- expect(
- wrapper
- .find(Step)
- .at(1)
- .props().open
- ).toBe(true);
+ wrapper.find(Step).at(1).simulate('open');
+ expect(wrapper.find(Step).at(0).props().open).toBe(false);
+ expect(wrapper.find(Step).at(1).props().open).toBe(true);
});
function shallowRender(props: Partial<GitHubActionTutorialProps> = {}) {
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/SecretStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/SecretStep-test.tsx
index cf12a5208c3..63e8f270085 100644
--- a/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/SecretStep-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/SecretStep-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
mockAlmSettingsInstance,
- mockProjectGithubBindingResponse
+ mockProjectGithubBindingResponse,
} from '../../../../helpers/mocks/alm-settings';
import { mockComponent } from '../../../../helpers/mocks/component';
import { mockLoggedInUser } from '../../../../helpers/testMocks';
@@ -32,7 +32,7 @@ it('should render correctly', () => {
expect(
shallowRender({
almBinding: mockAlmSettingsInstance({ url: 'http://github.enterprise.com/api/v3' }),
- projectBinding: mockProjectGithubBindingResponse()
+ projectBinding: mockProjectGithubBindingResponse(),
})
).toMatchSnapshot('with binding information');
});
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/CFamily.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/CFamily.tsx
index bccaf877ee4..22c20e0f8b0 100644
--- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/CFamily.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/CFamily.tsx
@@ -113,7 +113,7 @@ const STEPS = {
sonar-scanner.bat "-Dsonar.cfamily.build-wrapper-output=bw-output"
env:
SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
- SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}`
+ SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}`,
};
export default function CFamily(props: CFamilyProps) {
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Gradle.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Gradle.tsx
index e2b8d44eb67..8c690c04d7a 100644
--- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Gradle.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/Gradle.tsx
@@ -76,7 +76,7 @@ export default function Gradle(props: GradleProps) {
<ClipboardIconButton copyValue="build.gradle" />
</>
),
- sq: <code className="rule">org.sonarqube</code>
+ sq: <code className="rule">org.sonarqube</code>,
}}
/>
<CodeSnippet snippet={buildGradleSnippet(component.key)} />
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx
index dc4ea5ec120..58fb049bc63 100644
--- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx
@@ -31,13 +31,10 @@ it('should render correctly', () => {
it.each([
[OSs.Linux, false],
[OSs.MacOS, true],
- [OSs.Windows, true]
+ [OSs.Windows, true],
])('should render correctly for %s', (os: OSs, branchesEnabled: boolean) => {
const wrapper = shallowRender({ branchesEnabled });
- wrapper
- .find(RenderOptions)
- .props()
- .onCheck(os);
+ wrapper.find(RenderOptions).props().onCheck(os);
expect(wrapper).toMatchSnapshot(`branches ${branchesEnabled ? 'enabled' : 'disabled'}`);
});
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/EnvironmentVariablesStep.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/EnvironmentVariablesStep.tsx
index 03506a29536..3580a9bb314 100644
--- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/EnvironmentVariablesStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/EnvironmentVariablesStep.tsx
@@ -59,7 +59,7 @@ export default function EnvironmentVariablesStep(props: EnvironmentVariablesStep
id="onboarding.tutorial.with.gitlab_ci.env_variables.section.description"
values={{
/* This link will be added when the backend provides the project URL */
- link: <strong>{pipelineDescriptionLinkLabel}</strong>
+ link: <strong>{pipelineDescriptionLinkLabel}</strong>,
}}
/>
@@ -75,7 +75,7 @@ export default function EnvironmentVariablesStep(props: EnvironmentVariablesStep
{translate('onboarding.tutorial.with.gitlab_ci.env_variables.step1')}
</strong>
),
- value: <code className="rule">SONAR_TOKEN</code>
+ value: <code className="rule">SONAR_TOKEN</code>,
}}
/>
</li>
@@ -101,7 +101,7 @@ export default function EnvironmentVariablesStep(props: EnvironmentVariablesStep
id="onboarding.tutorial.with.gitlab_ci.env_variables.section2.description"
values={{
/* This link will be added when the backend provides the project URL */
- link: <strong>{pipelineDescriptionLinkLabel}</strong>
+ link: <strong>{pipelineDescriptionLinkLabel}</strong>,
}}
/>
@@ -117,7 +117,7 @@ export default function EnvironmentVariablesStep(props: EnvironmentVariablesStep
{translate('onboarding.tutorial.with.gitlab_ci.env_variables.step1')}
</strong>
),
- value: <code className="rule">SONAR_HOST_URL</code>
+ value: <code className="rule">SONAR_HOST_URL</code>,
}}
/>
</li>
@@ -128,7 +128,7 @@ export default function EnvironmentVariablesStep(props: EnvironmentVariablesStep
values={{
extra: <ClipboardIconButton copyValue={baseUrl} />,
field: <strong>{translate('onboarding.tutorial.env_variables.field')}</strong>,
- value: <code className="rule">{baseUrl}</code>
+ value: <code className="rule">{baseUrl}</code>,
}}
/>
</li>
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/GitLabCITutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/GitLabCITutorial.tsx
index 2c114176b9a..bb5d8f96817 100644
--- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/GitLabCITutorial.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/GitLabCITutorial.tsx
@@ -32,7 +32,7 @@ export enum Steps {
PROJECT_KEY,
ENV_VARIABLES,
YML,
- ALL_SET
+ ALL_SET,
}
export interface GitLabCITutorialProps {
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/ProjectKeyStep.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/ProjectKeyStep.tsx
index 3c3c4970eba..ad6bbbab042 100644
--- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/ProjectKeyStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/ProjectKeyStep.tsx
@@ -64,14 +64,14 @@ const snippetForBuildTool = {
[BuildTools.Maven]: mavenSnippet,
[BuildTools.Gradle]: gradleSnippet,
[BuildTools.CFamily]: otherSnippet,
- [BuildTools.Other]: otherSnippet
+ [BuildTools.Other]: otherSnippet,
};
const filenameForBuildTool = {
[BuildTools.Maven]: 'pom.xml',
[BuildTools.Gradle]: 'build.gradle',
[BuildTools.CFamily]: 'sonar-project.properties',
- [BuildTools.Other]: 'sonar-project.properties'
+ [BuildTools.Other]: 'sonar-project.properties',
};
export function ProjectKeyStep(props: ProjectKeyStepProps) {
@@ -119,7 +119,7 @@ export function ProjectKeyStep(props: ProjectKeyStepProps) {
copyValue={filenameForBuildTool[buildTool]}
/>
</>
- )
+ ),
}}
/>
<CodeSnippet snippet={snippetForBuildTool[buildTool](component.key)} />
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/YmlFileStep.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/YmlFileStep.tsx
index 9d38b844385..f93d0e60e13 100644
--- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/YmlFileStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/YmlFileStep.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import { ClipboardIconButton } from '../../../components/controls/clipboard';
import { translate } from '../../../helpers/l10n';
@@ -72,7 +72,7 @@ export function YmlFileStep(props: YmlFileStepProps) {
copyValue={translate('onboarding.tutorial.with.gitlab_ci.yml.filename')}
/>
</>
- )
+ ),
}}
/>
</div>
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/EnvironmentVariablesStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/EnvironmentVariablesStep-test.tsx
index 4b75babb01c..66e6087aae0 100644
--- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/EnvironmentVariablesStep-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/EnvironmentVariablesStep-test.tsx
@@ -23,7 +23,7 @@ import { mockComponent } from '../../../../helpers/mocks/component';
import { mockLoggedInUser } from '../../../../helpers/testMocks';
import { renderStepContent } from '../../test-utils';
import EnvironmentVariablesStep, {
- EnvironmentVariablesStepProps
+ EnvironmentVariablesStepProps,
} from '../EnvironmentVariablesStep';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/ProjectKeyStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/ProjectKeyStep-test.tsx
index c52d8491ace..f7a3134376a 100644
--- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/ProjectKeyStep-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/ProjectKeyStep-test.tsx
@@ -41,8 +41,8 @@ it.each([
[BuildTools.Gradle],
[BuildTools.DotNet],
[BuildTools.CFamily],
- [BuildTools.Other]
-])('should render correctly for build tool %s', buildTool => {
+ [BuildTools.Other],
+])('should render correctly for build tool %s', (buildTool) => {
expect(renderStepContent(shallowRender({ buildTool }))).toMatchSnapshot();
});
@@ -56,10 +56,7 @@ it('should correctly callback with selected build tool', () => {
function selectBuildTool(wrapper: ShallowWrapper<ProjectKeyStepProps>, tool: BuildTools) {
const content = new ShallowWrapper(renderStepContent(wrapper) as JSX.Element);
- content
- .find(RenderOptions)
- .props()
- .onCheck(tool);
+ content.find(RenderOptions).props().onCheck(tool);
}
function shallowRender(props: Partial<ProjectKeyStepProps> = {}) {
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/YmlFileStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/YmlFileStep-test.tsx
index ac93bffa6cf..35e3715f9a3 100644
--- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/YmlFileStep-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/YmlFileStep-test.tsx
@@ -34,8 +34,8 @@ it.each([
[BuildTools.Gradle],
[BuildTools.DotNet],
[BuildTools.CFamily],
- [BuildTools.Other]
-])('should render correctly for build tool %s', buildTool => {
+ [BuildTools.Other],
+])('should render correctly for build tool %s', (buildTool) => {
expect(renderStepContent(shallowRender({ buildTool }))).toMatchSnapshot('with branch support');
expect(renderStepContent(shallowRender({ hasFeature: () => false, buildTool }))).toMatchSnapshot(
'without branch support'
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommand.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommand.tsx
index 4202cb2cd51..f8a3fabf444 100644
--- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommand.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommand.tsx
@@ -34,7 +34,7 @@ const BUILD_TOOL_SPECIFIC = {
[BuildTools.Maven]: {
image: 'maven:3.6.3-jdk-11',
script: (projectKey: string) => `
- - mvn verify sonar:sonar -Dsonar.projectKey=${projectKey}`
+ - mvn verify sonar:sonar -Dsonar.projectKey=${projectKey}`,
},
[BuildTools.DotNet]: {
image: 'mcr.microsoft.com/dotnet/core/sdk:latest',
@@ -45,15 +45,15 @@ const BUILD_TOOL_SPECIFIC = {
- "export PATH=\\"$PATH:$HOME/.dotnet/tools\\""
- "dotnet sonarscanner begin /k:\\"${projectKey}\\" /d:sonar.login=\\"$SONAR_TOKEN\\" /d:\\"sonar.host.url=$SONAR_HOST_URL\\" "
- "dotnet build"
- - "dotnet sonarscanner end /d:sonar.login=\\"$SONAR_TOKEN\\""`
+ - "dotnet sonarscanner end /d:sonar.login=\\"$SONAR_TOKEN\\""`,
},
[BuildTools.Other]: {
image: `
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]`,
script: () => `
- - sonar-scanner`
- }
+ - sonar-scanner`,
+ },
};
export default function PipeCommand(props: PipeCommandProps) {
diff --git a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommand-test.tsx
index 0304f125f47..f6fbb27c701 100644
--- a/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommand-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/__tests__/PipeCommand-test.tsx
@@ -27,8 +27,8 @@ it.each([
[BuildTools.Gradle],
[BuildTools.DotNet],
[BuildTools.CFamily],
- [BuildTools.Other]
-])('should render correctly for %s', buildTool => {
+ [BuildTools.Other],
+])('should render correctly for %s', (buildTool) => {
expect(
shallow(
<PipeCommand
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsTutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsTutorial.tsx
index 7260a88b189..4430ed5bb24 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsTutorial.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsTutorial.tsx
@@ -19,13 +19,13 @@
*/
import * as React from 'react';
import withAvailableFeatures, {
- WithAvailableFeaturesProps
+ WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import { translate } from '../../../helpers/l10n';
import {
AlmKeys,
AlmSettingsInstance,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../../../types/alm-settings';
import { Feature } from '../../../types/features';
import { Component } from '../../../types/types';
@@ -51,7 +51,7 @@ enum Steps {
MultiBranchPipeline = 2,
Webhook = 3,
Jenkinsfile = 4,
- AllSet = 5
+ AllSet = 5,
}
export function JenkinsTutorial(props: JenkinsTutorialProps) {
@@ -71,7 +71,7 @@ export function JenkinsTutorial(props: JenkinsTutorialProps) {
<SelectAlmStep
alm={alm}
open={step === Steps.SelectAlm}
- onCheck={value => {
+ onCheck={(value) => {
setAlm(value);
setStep(Steps.PreRequisites);
}}
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx
index 318c935d0d1..8cc20945767 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/JenkinsfileStep.tsx
@@ -54,7 +54,7 @@ const BUILDTOOL_COMPONENT_MAP: {
[BuildTools.Gradle]: Gradle,
[BuildTools.DotNet]: DotNet,
[BuildTools.CFamily]: CFamilly,
- [BuildTools.Other]: Other
+ [BuildTools.Other]: Other,
};
export function JenkinsfileStep(props: JenkinsfileStepProps) {
@@ -77,7 +77,7 @@ export function JenkinsfileStep(props: JenkinsfileStepProps) {
<RenderOptions
label={translate('onboarding.build')}
checked={buildTool}
- onCheck={value => setBuildTool(value as BuildTools)}
+ onCheck={(value) => setBuildTool(value as BuildTools)}
optionLabelKey="onboarding.build"
options={buildToolOrder}
/>
@@ -91,7 +91,7 @@ export function JenkinsfileStep(props: JenkinsfileStepProps) {
React.createElement(BUILDTOOL_COMPONENT_MAP[buildTool], {
component,
baseUrl,
- onDone: props.onDone
+ onDone: props.onDone,
})}
</ol>
</div>
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/MultiBranchPipelineStep.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/MultiBranchPipelineStep.tsx
index 5c63212e32a..76d02ea69af 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/MultiBranchPipelineStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/MultiBranchPipelineStep.tsx
@@ -25,7 +25,7 @@ import { translate } from '../../../helpers/l10n';
import {
AlmKeys,
AlmSettingsInstance,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../../../types/alm-settings';
import CodeSnippet from '../../common/CodeSnippet';
import LabelActionPair from '../components/LabelActionPair';
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/PreRequisitesStep.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/PreRequisitesStep.tsx
index 4705527a94f..4b10f0a2bb3 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/PreRequisitesStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/PreRequisitesStep.tsx
@@ -75,7 +75,7 @@ export default function PreRequisitesStep(props: PreRequisitesStepProps) {
<DocLink to="/analysis/jenkins/">
{translate('onboarding.tutorial.with.jenkins.prereqs.step_by_step_guide.link')}
</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/SelectAlmStep.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/SelectAlmStep.tsx
index c7812fba08e..84dde9a38e3 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/SelectAlmStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/SelectAlmStep.tsx
@@ -51,10 +51,10 @@ export default function SelectAlmStep(props: SelectAlmStepProps) {
AlmKeys.BitbucketCloud,
AlmKeys.BitbucketServer,
AlmKeys.GitHub,
- AlmKeys.GitLab
- ].map(almKey => ({
+ AlmKeys.GitLab,
+ ].map((almKey) => ({
label: getAlmLongName(almKey),
- value: almKey
+ value: almKey,
}))}
value={alm}
/>
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStep.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStep.tsx
index 74da63a0228..e140c8fc1dc 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStep.tsx
@@ -29,7 +29,7 @@ import { translate } from '../../../helpers/l10n';
import {
AlmKeys,
AlmSettingsInstance,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../../../types/alm-settings';
import Step from '../components/Step';
import WebhookStepBitbucket from './WebhookStepBitbucket';
@@ -98,7 +98,7 @@ export default function WebhookStep(props: WebhookStepProps) {
<ButtonLink onClick={props.onDone}>
{translate('onboarding.tutorial.with.jenkins.webhook.intro.link')}
</ButtonLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepBitbucket.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepBitbucket.tsx
index 16c635a7421..4be89ad3902 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepBitbucket.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepBitbucket.tsx
@@ -25,7 +25,7 @@ import { stripTrailingSlash } from '../../../helpers/urls';
import {
AlmKeys,
AlmSettingsInstance,
- ProjectAlmBindingResponse
+ ProjectAlmBindingResponse,
} from '../../../types/alm-settings';
import CodeSnippet from '../../common/CodeSnippet';
import Link from '../../common/Link';
@@ -87,7 +87,7 @@ export default function WebhookStepBitbucket(props: WebhookStepBitbucketProps) {
<strong>
{translate('onboarding.tutorial.with.jenkins.webhook', alm, 'step1.link')}
</strong>
- )
+ ),
}}
/>
<ul className="list-styled">
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGitLab.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGitLab.tsx
index bc9337d2717..1b09346919f 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGitLab.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGitLab.tsx
@@ -36,7 +36,7 @@ export default function WebhookStepGitLab({ branchesEnabled }: WebhookStepGitLab
defaultMessage={translate('onboarding.tutorial.with.jenkins.webhook.step1.sentence')}
id="onboarding.tutorial.with.jenkins.webhook.step1.sentence"
values={{
- link: translate('onboarding.tutorial.with.jenkins.webhook.gitlab.step1.link')
+ link: translate('onboarding.tutorial.with.jenkins.webhook.gitlab.step1.link'),
}}
/>
<ul className="list-styled">
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGithub.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGithub.tsx
index 685f8a13b05..73dfa197793 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGithub.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/WebhookStepGithub.tsx
@@ -58,7 +58,7 @@ export default function WebhookStepGithub(props: WebhookStepGithubProps) {
<strong>
{translate('onboarding.tutorial.with.jenkins.webhook.github.step1.link')}
</strong>
- )
+ ),
}}
/>
<ul className="list-styled">
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx
index 7075595e28f..a9bc3c36630 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsTutorial-test.tsx
@@ -44,64 +44,43 @@ it('should correctly navigate between steps', () => {
expect(wrapper.find(JenkinsfileStep).props().open).toBe(false);
// Pre-reqs done.
- wrapper
- .find(PreRequisitesStep)
- .props()
- .onDone();
+ wrapper.find(PreRequisitesStep).props().onDone();
expect(wrapper.find(PreRequisitesStep).props().open).toBe(false);
expect(wrapper.find(MultiBranchPipelineStep).props().open).toBe(true);
expect(wrapper.find(WebhookStep).props().open).toBe(false);
expect(wrapper.find(JenkinsfileStep).props().open).toBe(false);
// Multibranch done.
- wrapper
- .find(MultiBranchPipelineStep)
- .props()
- .onDone();
+ wrapper.find(MultiBranchPipelineStep).props().onDone();
expect(wrapper.find(PreRequisitesStep).props().open).toBe(false);
expect(wrapper.find(MultiBranchPipelineStep).props().open).toBe(false);
expect(wrapper.find(WebhookStep).props().open).toBe(true);
expect(wrapper.find(JenkinsfileStep).props().open).toBe(false);
// Webhook done.
- wrapper
- .find(WebhookStep)
- .props()
- .onDone();
+ wrapper.find(WebhookStep).props().onDone();
expect(wrapper.find(PreRequisitesStep).props().open).toBe(false);
expect(wrapper.find(MultiBranchPipelineStep).props().open).toBe(false);
expect(wrapper.find(WebhookStep).props().open).toBe(false);
expect(wrapper.find(JenkinsfileStep).props().open).toBe(true);
// Open Pre-reqs.
- wrapper
- .find(PreRequisitesStep)
- .props()
- .onOpen();
+ wrapper.find(PreRequisitesStep).props().onOpen();
expect(wrapper.find(PreRequisitesStep).props().open).toBe(true);
// Open Multibranch.
- wrapper
- .find(MultiBranchPipelineStep)
- .props()
- .onOpen();
+ wrapper.find(MultiBranchPipelineStep).props().onOpen();
expect(wrapper.find(MultiBranchPipelineStep).props().open).toBe(true);
// Open Webhook.
- wrapper
- .find(WebhookStep)
- .props()
- .onOpen();
+ wrapper.find(WebhookStep).props().onOpen();
expect(wrapper.find(WebhookStep).props().open).toBe(true);
});
it('should correctly select an ALM if no project is bound', () => {
const wrapper = shallowRender({ projectBinding: undefined });
expect(wrapper.find(PreRequisitesStep).exists()).toBe(false);
- wrapper
- .find(SelectAlmStep)
- .props()
- .onCheck(AlmKeys.BitbucketCloud);
+ wrapper.find(SelectAlmStep).props().onCheck(AlmKeys.BitbucketCloud);
expect(wrapper.find(SelectAlmStep).props().open).toBe(false);
expect(wrapper.find(PreRequisitesStep).exists()).toBe(true);
});
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsfileStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsfileStep-test.tsx
index f72564db4a4..a692e6146b5 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsfileStep-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/JenkinsfileStep-test.tsx
@@ -37,12 +37,7 @@ it('should render correctly', () => {
it('should render correctly for Maven', () => {
const wrapper = shallowRender();
selectBuildTool(wrapper, BuildTools.Maven);
- expect(
- wrapper
- .find(Step)
- .props()
- .renderForm()
- ).toMatchSnapshot();
+ expect(wrapper.find(Step).props().renderForm()).toMatchSnapshot();
});
it('should render correctly for Gradle', () => {
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/MultiBranchPipelineStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/MultiBranchPipelineStep-test.tsx
index ac1cdde7221..d771788aa55 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/MultiBranchPipelineStep-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/MultiBranchPipelineStep-test.tsx
@@ -24,7 +24,7 @@ import {
mockProjectBitbucketBindingResponse,
mockProjectBitbucketCloudBindingResponse,
mockProjectGithubBindingResponse,
- mockProjectGitLabBindingResponse
+ mockProjectGitLabBindingResponse,
} from '../../../../helpers/mocks/alm-settings';
import { AlmKeys } from '../../../../types/alm-settings';
import { renderStepContent } from '../../test-utils';
@@ -42,7 +42,7 @@ it('should render correctly', () => {
shallowRender({
alm: AlmKeys.BitbucketCloud,
almBinding: mockAlmSettingsInstance({ url: 'https://bitbucket.org/workspaceId/' }),
- projectBinding: mockProjectBitbucketCloudBindingResponse()
+ projectBinding: mockProjectBitbucketCloudBindingResponse(),
})
)
).toMatchSnapshot('content for bitbucket cloud');
@@ -50,7 +50,7 @@ it('should render correctly', () => {
renderStepContent(
shallowRender({
alm: AlmKeys.BitbucketCloud,
- projectBinding: undefined
+ projectBinding: undefined,
})
)
).toMatchSnapshot('content for bitbucket cloud, no binding');
@@ -59,14 +59,14 @@ it('should render correctly', () => {
shallowRender({
alm: AlmKeys.GitHub,
almBinding: mockAlmSettingsInstance({ url: 'https://api.github.com/' }),
- projectBinding: mockProjectGithubBindingResponse()
+ projectBinding: mockProjectGithubBindingResponse(),
})
)
).toMatchSnapshot('content for github');
expect(
renderStepContent(
shallowRender({
- alm: AlmKeys.GitHub
+ alm: AlmKeys.GitHub,
})
)
).toMatchSnapshot('content for github, no binding');
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/SelectAlmStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/SelectAlmStep-test.tsx
index cb1fc3fcd67..083945e6742 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/SelectAlmStep-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/SelectAlmStep-test.tsx
@@ -25,32 +25,18 @@ import SelectAlmStep, { SelectAlmStepProps } from '../SelectAlmStep';
jest.mock('../../../../helpers/l10n', () => ({
hasMessage: (_a: string, k: string, _b: string) => k === AlmKeys.BitbucketCloud,
- translate: (...k: string[]) => k.join('.')
+ translate: (...k: string[]) => k.join('.'),
}));
it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot('default');
+ expect(shallowRender().find(Step).props().renderForm()).toMatchSnapshot('form, default');
+ expect(shallowRender({ alm: AlmKeys.Azure }).find(Step).props().renderForm()).toMatchSnapshot(
+ 'form, with alm'
+ );
+ expect(shallowRender().find(Step).props().renderResult!()).toBeUndefined();
expect(
- shallowRender()
- .find(Step)
- .props()
- .renderForm()
- ).toMatchSnapshot('form, default');
- expect(
- shallowRender({ alm: AlmKeys.Azure })
- .find(Step)
- .props()
- .renderForm()
- ).toMatchSnapshot('form, with alm');
- expect(
- shallowRender()
- .find(Step)
- .props().renderResult!()
- ).toBeUndefined();
- expect(
- shallowRender({ alm: AlmKeys.BitbucketCloud })
- .find(Step)
- .props().renderResult!()
+ shallowRender({ alm: AlmKeys.BitbucketCloud }).find(Step).props().renderResult!()
).toMatchSnapshot('result, with alm');
});
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStep-test.tsx
index 100bba0acb5..c81f8d3b545 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStep-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStep-test.tsx
@@ -24,7 +24,7 @@ import {
mockProjectAlmBindingResponse,
mockProjectBitbucketBindingResponse,
mockProjectBitbucketCloudBindingResponse,
- mockProjectGithubBindingResponse
+ mockProjectGithubBindingResponse,
} from '../../../../helpers/mocks/alm-settings';
import { AlmKeys } from '../../../../types/alm-settings';
import { renderStepContent } from '../../test-utils';
@@ -35,7 +35,7 @@ it.each([
[AlmKeys.BitbucketCloud, mockProjectBitbucketCloudBindingResponse()],
[AlmKeys.BitbucketServer, mockProjectBitbucketBindingResponse()],
[AlmKeys.GitHub, mockProjectGithubBindingResponse()],
- [AlmKeys.GitLab, mockProjectAlmBindingResponse({ alm: AlmKeys.GitLab })]
+ [AlmKeys.GitLab, mockProjectAlmBindingResponse({ alm: AlmKeys.GitLab })],
])('should render correctly for %s', (alm, projectBinding) => {
const wrapper = shallowRender({ alm, projectBinding });
expect(wrapper).toMatchSnapshot('wrapper');
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStepBitbucket-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStepBitbucket-test.tsx
index b874e1dec3f..5044579fce0 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStepBitbucket-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStepBitbucket-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import {
mockAlmSettingsInstance,
mockProjectBitbucketBindingResponse,
- mockProjectBitbucketCloudBindingResponse
+ mockProjectBitbucketCloudBindingResponse,
} from '../../../../helpers/mocks/alm-settings';
import { AlmKeys } from '../../../../types/alm-settings';
import WebhookStepBitbucket, { WebhookStepBitbucketProps } from '../WebhookStepBitbucket';
@@ -31,13 +31,13 @@ it.each([
[
AlmKeys.BitbucketServer,
mockProjectBitbucketBindingResponse(),
- mockAlmSettingsInstance({ url: 'http://bbs.enterprise.com' })
+ mockAlmSettingsInstance({ url: 'http://bbs.enterprise.com' }),
],
[
AlmKeys.BitbucketCloud,
mockProjectBitbucketCloudBindingResponse(),
- mockAlmSettingsInstance({ url: 'http://bitbucket.org/workspace/' })
- ]
+ mockAlmSettingsInstance({ url: 'http://bitbucket.org/workspace/' }),
+ ],
])('should render correctly for %s', (alm, projectBinding, almBinding) => {
expect(shallowRender({ alm, projectBinding, almBinding })).toMatchSnapshot();
expect(shallowRender({ alm, projectBinding, almBinding: undefined })).toMatchSnapshot(
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStepGithub-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStepGithub-test.tsx
index 4665adb33ea..069a9791150 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStepGithub-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/WebhookStepGithub-test.tsx
@@ -21,7 +21,7 @@ import { shallow } from 'enzyme';
import * as React from 'react';
import {
mockAlmSettingsInstance,
- mockProjectGithubBindingResponse
+ mockProjectGithubBindingResponse,
} from '../../../../helpers/mocks/alm-settings';
import WebhookStepGithub, { WebhookStepGithubProps } from '../WebhookStepGithub';
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/CFamilly.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/CFamilly.tsx
index 6f2c0c610cc..ffbc5252089 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/CFamilly.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/CFamilly.tsx
@@ -29,7 +29,7 @@ import { LanguageProps } from '../JenkinsfileStep';
import CreateJenkinsfileBulletPoint from './CreateJenkinsfileBulletPoint';
const YAML_MAP: Record<OSs, (baseUrl: string) => string> = {
- [OSs.Linux]: baseUrl => `node {
+ [OSs.Linux]: (baseUrl) => `node {
stage('SCM') {
checkout scm
}
@@ -48,7 +48,7 @@ const YAML_MAP: Record<OSs, (baseUrl: string) => string> = {
}
}
}`,
- [OSs.MacOS]: baseUrl => `node {
+ [OSs.MacOS]: (baseUrl) => `node {
stage('SCM') {
checkout scm
}
@@ -71,7 +71,7 @@ const YAML_MAP: Record<OSs, (baseUrl: string) => string> = {
}
}
}`,
- [OSs.Windows]: baseUrl => `node {
+ [OSs.Windows]: (baseUrl) => `node {
stage('SCM') {
checkout scm
}
@@ -99,7 +99,7 @@ const YAML_MAP: Record<OSs, (baseUrl: string) => string> = {
powershell "\${scannerHome}/bin/sonar-scanner -Dsonar.cfamily.build-wrapper-output=bw-output"
}
}
-}`
+}`,
};
export default function CFamilly(props: LanguageProps) {
@@ -114,7 +114,7 @@ export default function CFamilly(props: LanguageProps) {
label={translate('onboarding.build.other.os')}
checked={os}
optionLabelKey="onboarding.build.other.os"
- onCheck={value => setOs(value as OSs)}
+ onCheck={(value) => setOs(value as OSs)}
options={Object.values(OSs)}
/>
{os && (
@@ -129,7 +129,8 @@ export default function CFamilly(props: LanguageProps) {
<>
<CreateJenkinsfileBulletPoint
alertTranslationKeyPart="onboarding.tutorial.with.jenkins.jenkinsfile.other.step3"
- snippet={YAML_MAP[os](baseUrl)}>
+ snippet={YAML_MAP[os](baseUrl)}
+ >
<CompilationInfo />
</CreateJenkinsfileBulletPoint>
<FinishButton onClick={props.onDone} />
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx
index 0dcb38afd71..325032d4331 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNet.tsx
@@ -38,7 +38,7 @@ const DotNetFlavor = { win_core: DotNetCore, win_msbuild: DotNetFramework, linux
const DotOS: { [key in keyof typeof DotNetFlavor]: OSDotNet } = {
win_core: OSs.Windows,
win_msbuild: OSs.Windows,
- linux_core: OSs.Linux
+ linux_core: OSs.Linux,
};
export default function DotNet(props: LanguageProps) {
@@ -53,7 +53,7 @@ export default function DotNet(props: LanguageProps) {
label={translate('onboarding.tutorial.with.jenkins.jenkinsfile.dotnet.build_agent')}
checked={flavorComponent}
optionLabelKey="onboarding.build.dotnet"
- onCheck={value => setFlavorComponet(value as keyof typeof DotNetFlavor)}
+ onCheck={(value) => setFlavorComponet(value as keyof typeof DotNetFlavor)}
options={Object.keys(DotNetFlavor)}
/>
</li>
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetCore.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetCore.tsx
index 6dfacd72ea1..c3276b88a47 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetCore.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/DotNetCore.tsx
@@ -26,7 +26,7 @@ import DotNetPrereqsScanner from './DotNetPrereqsScanner';
const OSS_DEP: { [key in OSDotNet]: { shell: string; pathSeparator: string } } = {
[OSs.Linux]: { shell: 'sh', pathSeparator: '/' },
- [OSs.Windows]: { shell: 'bat', pathSeparator: '\\\\' }
+ [OSs.Windows]: { shell: 'bat', pathSeparator: '\\\\' },
};
const jenkinsfileSnippet = (key: string, shell: OSDotNet) => `node {
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CFamilly-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CFamilly-test.tsx
index 3b97bc818c9..0d85d3b8c84 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CFamilly-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CFamilly-test.tsx
@@ -29,7 +29,7 @@ it('should render correctly for', () => {
expect(shallowRender()).toMatchSnapshot();
});
-it.each([[OSs.Linux], [OSs.MacOS], [OSs.Windows]])('should render correctly for %s', os => {
+it.each([[OSs.Linux], [OSs.MacOS], [OSs.Windows]])('should render correctly for %s', (os) => {
const wrapper = shallowRender();
wrapper.find(RenderOptions).simulate('check', os);
expect(wrapper).toMatchSnapshot(os);
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CreateJenkinsfileBulletPoint-test.tsx b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CreateJenkinsfileBulletPoint-test.tsx
index e896c7dd7c3..656b8e15338 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CreateJenkinsfileBulletPoint-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/buildtool-steps/__tests__/CreateJenkinsfileBulletPoint-test.tsx
@@ -20,7 +20,7 @@
import { shallow } from 'enzyme';
import * as React from 'react';
import CreateJenkinsfileBulletPoint, {
- CreateJenkinsfileBulletPointProps
+ CreateJenkinsfileBulletPointProps,
} from '../CreateJenkinsfileBulletPoint';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx b/server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx
index 6bff4777b58..d652fe96795 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/BuildToolForm.tsx
@@ -39,7 +39,7 @@ export class BuildToolForm extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
- config: this.props.config || {}
+ config: this.props.config || {},
};
}
@@ -74,9 +74,9 @@ export class BuildToolForm extends React.PureComponent<Props, State> {
<ButtonToggle
label={translate('onboarding.build')}
onCheck={this.handleBuildToolChange}
- options={buildTools.map(tool => ({
+ options={buildTools.map((tool) => ({
label: translate('onboarding.build', tool),
- value: tool
+ value: tool,
}))}
value={config.buildTool}
/>
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx b/server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx
index 920b2695ee5..7c7ad46b40e 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/DoneNextSteps.tsx
@@ -63,7 +63,7 @@ export default function DoneNextSteps({ component }: DoneNextStepsProps) {
'onboarding.analysis.auto_refresh_after_analysis.check_these_links.pr_analysis'
)}
</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/OtherTutorial.tsx b/server/sonar-web/src/main/js/components/tutorials/other/OtherTutorial.tsx
index 3e792e8edc3..58a267aa285 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/OtherTutorial.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/OtherTutorial.tsx
@@ -27,7 +27,7 @@ import TokenStep from './TokenStep';
export enum Steps {
ANALYSIS,
- TOKEN
+ TOKEN,
}
interface Props {
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx b/server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx
index f28be6ea39f..23ef13f14f2 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/TokenStep.tsx
@@ -24,7 +24,7 @@ import { translate } from '../../../helpers/l10n';
import {
computeTokenExpirationDate,
EXPIRATION_OPTIONS,
- getAvailableExpirationOptions
+ getAvailableExpirationOptions,
} from '../../../helpers/tokens';
import { TokenExpiration, TokenType, UserToken } from '../../../types/token';
import { LoggedInUser } from '../../../types/users';
@@ -74,7 +74,7 @@ export default class TokenStep extends React.PureComponent<Props, State> {
selection: 'generate',
tokenName: props.initialTokenName,
tokenExpiration: TokenExpiration.OneMonth,
- tokenExpirationOptions: EXPIRATION_OPTIONS
+ tokenExpirationOptions: EXPIRATION_OPTIONS,
};
}
@@ -137,8 +137,8 @@ export default class TokenStep extends React.PureComponent<Props, State> {
type: TokenType.Project,
projectKey,
...(tokenExpiration !== TokenExpiration.NoExpiration && {
- expirationDate: computeTokenExpirationDate(tokenExpiration)
- })
+ expirationDate: computeTokenExpirationDate(tokenExpiration),
+ }),
});
if (this.mounted) {
this.setState({ loading: false, token });
@@ -183,21 +183,16 @@ export default class TokenStep extends React.PureComponent<Props, State> {
};
renderGenerateOption = () => {
- const {
- loading,
- selection,
- tokens,
- tokenName,
- tokenExpiration,
- tokenExpirationOptions
- } = this.state;
+ const { loading, selection, tokens, tokenName, tokenExpiration, tokenExpirationOptions } =
+ this.state;
return (
<div>
{tokens !== undefined && tokens.length > 0 ? (
<Radio
checked={selection === 'generate'}
onCheck={this.handleModeChange}
- value="generate">
+ value="generate"
+ >
{translate('onboarding.token.generate', TokenType.Project)}
</Radio>
) : (
@@ -215,8 +210,8 @@ export default class TokenStep extends React.PureComponent<Props, State> {
links={[
{
href: '/user-guide/user-token/',
- label: translate('learn_more')
- }
+ label: translate('learn_more'),
+ },
]}
/>
</label>
@@ -241,7 +236,9 @@ export default class TokenStep extends React.PureComponent<Props, State> {
isSearchable={false}
onChange={this.handleTokenExpirationChange}
options={tokenExpirationOptions}
- value={tokenExpirationOptions.find(option => option.value === tokenExpiration)}
+ value={tokenExpirationOptions.find(
+ (option) => option.value === tokenExpiration
+ )}
/>
{loading ? (
@@ -270,7 +267,8 @@ export default class TokenStep extends React.PureComponent<Props, State> {
<Radio
checked={this.state.selection === 'use-existing'}
onCheck={this.handleModeChange}
- value="use-existing">
+ value="use-existing"
+ >
{translate('onboarding.token.use_existing_token')}
</Radio>
{this.state.selection === 'use-existing' && (
@@ -283,8 +281,8 @@ export default class TokenStep extends React.PureComponent<Props, State> {
links={[
{
href: '/user-guide/user-token/',
- label: translate('learn_more')
- }
+ label: translate('learn_more'),
+ },
]}
/>
</label>
@@ -344,7 +342,7 @@ export default class TokenStep extends React.PureComponent<Props, State> {
<Link target="_blank" to="/account/security">
{translate('onboarding.token.text.user_account')}
</Link>
- )
+ ),
}}
/>
</div>
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/TokenStep-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/TokenStep-test.tsx
index d081f981aff..df08af593d6 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/__tests__/TokenStep-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/__tests__/TokenStep-test.tsx
@@ -27,7 +27,7 @@ import TokenStep from '../TokenStep';
jest.mock('../../../../api/user-tokens', () => ({
getTokens: jest.fn().mockResolvedValue([{ name: 'foo' }]),
generateToken: jest.fn().mockResolvedValue({ token: 'abcd1234' }),
- revokeToken: jest.fn().mockResolvedValue(null)
+ revokeToken: jest.fn().mockResolvedValue(null),
}));
jest.mock('../../../../api/settings', () => {
@@ -36,9 +36,9 @@ jest.mock('../../../../api/settings', () => {
getAllValues: jest.fn().mockResolvedValue([
{
key: 'sonar.auth.token.max.allowed.lifetime',
- value: 'No expiration'
- }
- ])
+ value: 'No expiration',
+ },
+ ]),
};
});
@@ -46,12 +46,7 @@ it('sets an initial token name', async () => {
(getTokens as jest.Mock).mockResolvedValueOnce([{ name: 'fôo' }]);
const wrapper = shallowRender({ initialTokenName: 'fôo' });
await waitAndUpdate(wrapper);
- expect(
- wrapper
- .dive()
- .find('input')
- .props().value
- ).toBe('fôo 1');
+ expect(wrapper.dive().find('input').props().value).toBe('fôo 1');
});
it('generates token', async () => {
@@ -70,10 +65,7 @@ it('revokes token', async () => {
await new Promise(setImmediate);
wrapper.setState({ token: 'abcd1234', tokenName: 'my token' });
expect(wrapper.dive()).toMatchSnapshot();
- (wrapper
- .dive()
- .find('DeleteButton')
- .prop('onClick') as Function)();
+ (wrapper.dive().find('DeleteButton').prop('onClick') as Function)();
wrapper.update();
expect(wrapper.dive()).toMatchSnapshot(); // spinner
await waitAndUpdate(wrapper);
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNet.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNet.tsx
index b8daff7cbef..3a12a423bbd 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNet.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNet.tsx
@@ -32,7 +32,7 @@ export interface DotNetProps {
enum Variant {
DotNetCoreVariant = 'dotnet_core',
- DotNetFrameworkVariant = 'dotnet_framework'
+ DotNetFrameworkVariant = 'dotnet_framework',
}
export default function DotNet(props: DotNetProps) {
@@ -44,7 +44,7 @@ export default function DotNet(props: DotNetProps) {
<RenderOptions
label={translate('onboarding.build.other.os')}
checked={variant}
- onCheck={value => setVariant(value as Variant)}
+ onCheck={(value) => setVariant(value as Variant)}
optionLabelKey="onboarding.build.dotnet.variant"
options={['dotnet_core', 'dotnet_framework']}
titleLabelKey="onboarding.build.dotnet.variant"
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetCore.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetCore.tsx
index 81b4441a97b..b26a5be9b74 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetCore.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetCore.tsx
@@ -30,7 +30,7 @@ export default function DotNetCore(props: DotNetProps) {
const commands = [
`dotnet sonarscanner begin /k:"${component.key}" /d:sonar.host.url="${baseUrl}" /d:sonar.login="${token}"`,
'dotnet build',
- `dotnet sonarscanner end /d:sonar.login="${token}"`
+ `dotnet sonarscanner end /d:sonar.login="${token}"`,
];
return (
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx
index 958f2ca6aaa..5bd1ab253b8 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetExecute.tsx
@@ -39,7 +39,7 @@ export default function DotNetExecute({ commands, component }: DotNetExecuteProp
</h4>
<InstanceMessage message={translate('onboarding.analysis.msbuild.execute.text')}>
- {transformedMessage => <p className="spacer-bottom markdown">{transformedMessage}</p>}
+ {(transformedMessage) => <p className="spacer-bottom markdown">{transformedMessage}</p>}
</InstanceMessage>
{commands.map((command, index) => (
<CodeSnippet key={index} snippet={command} />
@@ -53,7 +53,7 @@ export default function DotNetExecute({ commands, component }: DotNetExecuteProp
<DocLink to="/analysis/scan/sonarscanner-for-msbuild/">
{translate('onboarding.analysis.msbuild.docs_link')}
</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx
index 52a94824141..f948dd8ee5a 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx
@@ -30,7 +30,7 @@ export default function DotNetFramework(props: DotNetProps) {
const commands = [
`SonarScanner.MSBuild.exe begin /k:"${component.key}" /d:sonar.host.url="${baseUrl}" /d:sonar.login="${token}"`,
'MsBuild.exe /t:Rebuild',
- `SonarScanner.MSBuild.exe end /d:sonar.login="${token}"`
+ `SonarScanner.MSBuild.exe end /d:sonar.login="${token}"`,
];
return (
@@ -48,10 +48,11 @@ export default function DotNetFramework(props: DotNetProps) {
link: (
<Link
to="https://redirect.sonarsource.com/doc/download-scanner-msbuild.html"
- target="_blank">
+ target="_blank"
+ >
{translate('onboarding.analysis.msbuild.docs_link')}
</Link>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadBuildWrapper.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadBuildWrapper.tsx
index ab989bb4c87..bdd42566ae2 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadBuildWrapper.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadBuildWrapper.tsx
@@ -33,7 +33,7 @@ export interface DownloadBuildWrapperProps {
const FILENAMES: { [x in OSs]: string } = {
win: 'build-wrapper-win-x86',
linux: 'build-wrapper-linux-x86',
- mac: 'build-wrapper-macosx-x86'
+ mac: 'build-wrapper-macosx-x86',
};
export default function DownloadBuildWrapper(props: DownloadBuildWrapperProps) {
@@ -48,7 +48,7 @@ export default function DownloadBuildWrapper(props: DownloadBuildWrapperProps) {
defaultMessage={translate('onboarding.analysis.build_wrapper.text')}
id="onboarding.analysis.build_wrapper.text"
values={{
- env_var: <code>{os === 'win' ? '%PATH%' : 'PATH'}</code>
+ env_var: <code>{os === 'win' ? '%PATH%' : 'PATH'}</code>,
}}
/>
</p>
@@ -58,7 +58,8 @@ export default function DownloadBuildWrapper(props: DownloadBuildWrapperProps) {
download={`${FILENAMES[os]}.zip`}
href={`${getBaseUrl()}/static/cpp/${FILENAMES[os]}.zip`}
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate('download_verb')}
</a>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx
index b9e5ed78304..ce245506876 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/DownloadScanner.tsx
@@ -48,10 +48,11 @@ export default function DownloadScanner(props: DownloadScannerProps) {
link: (
<Link
to="https://redirect.sonarsource.com/doc/download-scanner.html"
- target="_blank">
+ target="_blank"
+ >
{translate('onboarding.analysis.sq_scanner.docs_link')}
</Link>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx
index 9bc2bfe920c..96c5ddcacbc 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecBuildWrapper.tsx
@@ -31,7 +31,7 @@ export interface ExecBuildWrapperProps {
const executables: { [x in OSs]: string } = {
linux: 'build-wrapper-linux-x86-64',
win: 'build-wrapper-win-x86-64.exe',
- mac: 'build-wrapper-macosx-x86'
+ mac: 'build-wrapper-macosx-x86',
};
export default function ExecBuildWrapper(props: ExecBuildWrapperProps) {
@@ -59,7 +59,7 @@ export default function ExecBuildWrapper(props: ExecBuildWrapperProps) {
<DocLink to="/analysis/languages/cfamily/">
{translate('onboarding.analysis.build_wrapper.docs_link')}
</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx
index 646fbd9d1ac..4402371bf11 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx
@@ -47,7 +47,7 @@ export default function ExecScanner(props: ExecScannerProps) {
'-D' + q('sonar.sources=.'),
cfamily ? '-D' + q('sonar.cfamily.build-wrapper-output=bw-output') : undefined,
'-D' + q(`sonar.host.url=${baseUrl}`),
- isLocal ? '-D' + q(`sonar.login=${token}`) : undefined
+ isLocal ? '-D' + q(`sonar.login=${token}`) : undefined,
];
return (
@@ -56,7 +56,7 @@ export default function ExecScanner(props: ExecScannerProps) {
{translate('onboarding.analysis.sq_scanner.execute')}
</h4>
<InstanceMessage message={translate('onboarding.analysis.sq_scanner.execute.text')}>
- {transformedMessage => <p className="spacer-bottom markdown">{transformedMessage}</p>}
+ {(transformedMessage) => <p className="spacer-bottom markdown">{transformedMessage}</p>}
</InstanceMessage>
<CodeSnippet isOneLine={os === OSs.Windows} snippet={command} />
<p className="big-spacer-top markdown">
@@ -68,7 +68,7 @@ export default function ExecScanner(props: ExecScannerProps) {
<DocLink to="/analysis/scan/sonarscanner/">
{translate('onboarding.analysis.sq_scanner.docs_link')}
</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx
index 567ee2ccf28..c53753f360b 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx
@@ -43,21 +43,21 @@ export default function JavaGradle(props: JavaGradleProps) {
'./gradlew sonarqube',
`-Dsonar.projectKey=${component.key}`,
`-Dsonar.host.url=${baseUrl}`,
- `-Dsonar.login=${token}`
+ `-Dsonar.login=${token}`,
];
return (
<div>
<h4 className="spacer-bottom">{translate('onboarding.analysis.java.gradle.header')}</h4>
<InstanceMessage message={translate('onboarding.analysis.java.gradle.text.1')}>
- {transformedMessage => (
+ {(transformedMessage) => (
<p className="spacer-bottom markdown">
<FormattedMessage
defaultMessage={transformedMessage}
id="onboarding.analysis.java.gradle.text.1"
values={{
plugin_code: <code>org.sonarqube</code>,
- filename: <code>build.gradle</code>
+ filename: <code>build.gradle</code>,
}}
/>
</p>
@@ -72,7 +72,7 @@ export default function JavaGradle(props: JavaGradleProps) {
values={{
link: (
<DocLink to="/analysis/scan/sonarscanner-for-gradle/">{translate('here')}</DocLink>
- )
+ ),
}}
/>
</em>
@@ -90,7 +90,7 @@ export default function JavaGradle(props: JavaGradleProps) {
<DocLink to="/analysis/scan/sonarscanner-for-gradle/">
{translate('onboarding.analysis.java.gradle.docs_link')}
</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx
index 90e5464eddf..1d68f2f789e 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx
@@ -38,7 +38,7 @@ export default function JavaMaven(props: JavaMavenProps) {
'mvn clean verify sonar:sonar',
`-Dsonar.projectKey=${component.key}`,
`-Dsonar.host.url=${baseUrl}`,
- `-Dsonar.login=${token}`
+ `-Dsonar.login=${token}`,
];
return (
@@ -57,7 +57,7 @@ export default function JavaMaven(props: JavaMavenProps) {
<DocLink to="/analysis/scan/sonarscanner-for-maven/">
{translate('onboarding.analysis.java.maven.docs_link')}
</DocLink>
- )
+ ),
}}
/>
</p>
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/AnalysisCommand-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/AnalysisCommand-test.tsx
index 058b1004aa2..8536c1a6c3f 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/AnalysisCommand-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/AnalysisCommand-test.tsx
@@ -24,7 +24,7 @@ import { BuildTools, OSs } from '../../../types';
import AnalysisCommand, { AnalysisCommandProps } from '../AnalysisCommand';
jest.mock('../../../../../helpers/urls', () => ({
- getHostUrl: () => 'HOST'
+ getHostUrl: () => 'HOST',
}));
it('renders correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadBuildWrapper-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadBuildWrapper-test.tsx
index 7887e6aafbb..cf1b0ca44f2 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadBuildWrapper-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadBuildWrapper-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { OSs } from '../../../types';
import DownloadBuildWrapper, { DownloadBuildWrapperProps } from '../DownloadBuildWrapper';
-it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('should render correctly for %p', os => {
+it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('should render correctly for %p', (os) => {
expect(shallowRender({ os, isLocal: false })).toMatchSnapshot('remote');
expect(shallowRender({ os })).toMatchSnapshot('local');
});
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadScanner-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadScanner-test.tsx
index 5590f7eef97..3bc9b1affdc 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadScanner-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/DownloadScanner-test.tsx
@@ -22,7 +22,7 @@ import * as React from 'react';
import { OSs } from '../../../types';
import DownloadScanner, { DownloadScannerProps } from '../DownloadScanner';
-it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('should render correctly for %p', os => {
+it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('should render correctly for %p', (os) => {
expect(shallowRender({ isLocal: false, os })).toMatchSnapshot('remote');
expect(shallowRender({ os })).toMatchSnapshot('local');
});
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecBuildWrapper-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecBuildWrapper-test.tsx
index c3dce885e4d..c2de57ae195 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecBuildWrapper-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecBuildWrapper-test.tsx
@@ -22,6 +22,6 @@ import * as React from 'react';
import { OSs } from '../../../types';
import ExecBuildWrapper from '../ExecBuildWrapper';
-it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('Shoud renders for %p correctly', os => {
+it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('Shoud renders for %p correctly', (os) => {
expect(shallow(<ExecBuildWrapper os={os} />)).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecScanner-test.tsx b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecScanner-test.tsx
index 1fbe02bb25f..ef832f32dbd 100644
--- a/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecScanner-test.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/other/commands/__tests__/ExecScanner-test.tsx
@@ -23,7 +23,7 @@ import { mockComponent } from '../../../../../helpers/mocks/component';
import { OSs } from '../../../types';
import ExecScanner, { ExecScannerProps } from '../ExecScanner';
-it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('should render correctly for %p', os => {
+it.each([OSs.Linux, OSs.Windows, OSs.MacOS])('should render correctly for %p', (os) => {
expect(shallowRender({ os })).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/tutorials/test-utils.ts b/server/sonar-web/src/main/js/components/tutorials/test-utils.ts
index 728c32ae79f..56bcb390f35 100644
--- a/server/sonar-web/src/main/js/components/tutorials/test-utils.ts
+++ b/server/sonar-web/src/main/js/components/tutorials/test-utils.ts
@@ -21,9 +21,5 @@ import { ShallowWrapper } from 'enzyme';
import Step from './components/Step';
export function renderStepContent(wrapper: ShallowWrapper<React.ReactNode>, n = 0) {
- return wrapper
- .find(Step)
- .at(n)
- .props()
- .renderForm();
+ return wrapper.find(Step).at(n).props().renderForm();
}
diff --git a/server/sonar-web/src/main/js/components/tutorials/types.ts b/server/sonar-web/src/main/js/components/tutorials/types.ts
index f34c3e012b4..f0084497d34 100644
--- a/server/sonar-web/src/main/js/components/tutorials/types.ts
+++ b/server/sonar-web/src/main/js/components/tutorials/types.ts
@@ -24,7 +24,7 @@ export enum TutorialModes {
GitLabCI = 'gitlab-ci',
GitHubActions = 'github-actions',
AzurePipelines = 'azure-pipelines',
- OtherCI = 'other-ci'
+ OtherCI = 'other-ci',
}
export enum BuildTools {
@@ -32,13 +32,13 @@ export enum BuildTools {
Gradle = 'gradle',
CFamily = 'cfamily',
DotNet = 'dotnet',
- Other = 'other'
+ Other = 'other',
}
export enum OSs {
Linux = 'linux',
Windows = 'win',
- MacOS = 'mac'
+ MacOS = 'mac',
}
export type ManualTutorialConfig =
diff --git a/server/sonar-web/src/main/js/components/tutorials/utils.ts b/server/sonar-web/src/main/js/components/tutorials/utils.ts
index 19f13e7a09c..36a4ec685cf 100644
--- a/server/sonar-web/src/main/js/components/tutorials/utils.ts
+++ b/server/sonar-web/src/main/js/components/tutorials/utils.ts
@@ -39,7 +39,7 @@ sonarqube {
}
export function getUniqueTokenName(tokens: UserToken[], initialTokenName: string) {
- const hasToken = (name: string) => tokens.find(token => token.name === name) !== undefined;
+ const hasToken = (name: string) => tokens.find((token) => token.name === name) !== undefined;
if (!hasToken(initialTokenName)) {
return initialTokenName;
diff --git a/server/sonar-web/src/main/js/components/ui/Alert.tsx b/server/sonar-web/src/main/js/components/ui/Alert.tsx
index e3e0a61b444..48ae60ad5e2 100644
--- a/server/sonar-web/src/main/js/components/ui/Alert.tsx
+++ b/server/sonar-web/src/main/js/components/ui/Alert.tsx
@@ -108,36 +108,36 @@ function getAlertVariantInfo(variant: AlertVariant): AlertVariantInformation {
color: colors.alertTextError,
borderColor: colors.alertBorderError,
backGroundColor: colors.alertBackgroundError,
- role: 'alert'
+ role: 'alert',
},
warning: {
icon: <AlertWarnIcon fill={colors.alertIconWarning} />,
color: colors.alertTextWarning,
borderColor: colors.alertBorderWarning,
backGroundColor: colors.alertBackgroundWarning,
- role: 'alert'
+ role: 'alert',
},
success: {
icon: <AlertSuccessIcon fill={colors.alertIconSuccess} />,
color: colors.alertTextSuccess,
borderColor: colors.alertBorderSuccess,
backGroundColor: colors.alertBackgroundSuccess,
- role: 'status'
+ role: 'status',
},
info: {
icon: <InfoIcon fill={colors.alertIconInfo} />,
color: colors.alertTextInfo,
borderColor: colors.alertBorderInfo,
backGroundColor: colors.alertBackgroundInfo,
- role: 'status'
+ role: 'status',
},
loading: {
icon: <DeferredSpinner timeout={0} />,
color: colors.alertTextInfo,
borderColor: colors.alertBorderInfo,
backGroundColor: colors.alertBackgroundInfo,
- role: 'status'
- }
+ role: 'status',
+ },
};
return variantList[variant];
@@ -156,7 +156,8 @@ export function Alert(props: AlertProps & React.HTMLAttributes<HTMLDivElement>)
role={variantInfo.role}
aria-label={translate('alert.tooltip', variant)}
variantInfo={variantInfo}
- {...domProps}>
+ {...domProps}
+ >
<StyledAlertInner isBanner={isBanner}>
<StyledAlertIcon isBanner={isBanner} variantInfo={variantInfo}>
{variantInfo.icon}
diff --git a/server/sonar-web/src/main/js/components/ui/AutoEllipsis.tsx b/server/sonar-web/src/main/js/components/ui/AutoEllipsis.tsx
index b4bcf52eaa7..da03306cbfe 100644
--- a/server/sonar-web/src/main/js/components/ui/AutoEllipsis.tsx
+++ b/server/sonar-web/src/main/js/components/ui/AutoEllipsis.tsx
@@ -48,7 +48,7 @@ export default function AutoEllipsis(props: Props) {
return React.cloneElement(children, {
className: classNames(children.props.className, { 'text-ellipsis': autoEllispis }),
- ref
+ ref,
});
}
diff --git a/server/sonar-web/src/main/js/components/ui/Avatar.tsx b/server/sonar-web/src/main/js/components/ui/Avatar.tsx
index 82eb5fe5b56..5ccafcde59d 100644
--- a/server/sonar-web/src/main/js/components/ui/Avatar.tsx
+++ b/server/sonar-web/src/main/js/components/ui/Avatar.tsx
@@ -40,7 +40,7 @@ export function Avatar(props: Props) {
className,
hash,
name,
- size
+ size,
} = props;
const enableGravatar = settings[GlobalSettingKeys.EnableGravatar] === 'true';
diff --git a/server/sonar-web/src/main/js/components/ui/CoverageRating.tsx b/server/sonar-web/src/main/js/components/ui/CoverageRating.tsx
index e928884c689..6874892935a 100644
--- a/server/sonar-web/src/main/js/components/ui/CoverageRating.tsx
+++ b/server/sonar-web/src/main/js/components/ui/CoverageRating.tsx
@@ -37,7 +37,7 @@ export interface CoverageRatingProps {
export default function CoverageRating({
muted = false,
size = 'normal',
- value
+ value,
}: CoverageRatingProps) {
let data = [{ value: FULL_PERCENT, fill: colors.gray71 }];
let padAngle = 0;
@@ -46,7 +46,7 @@ export default function CoverageRating({
const numberValue = Number(value);
data = [
{ value: numberValue, fill: muted ? colors.gray71 : colors.success500 },
- { value: FULL_PERCENT - numberValue, fill: muted ? 'transparent' : colors.error500 }
+ { value: FULL_PERCENT - numberValue, fill: muted ? 'transparent' : colors.error500 },
];
if (numberValue !== 0 && numberValue < FULL_PERCENT) {
padAngle = 0.1; // Same for all sizes, because it scales automatically
diff --git a/server/sonar-web/src/main/js/components/ui/DismissableAlert.tsx b/server/sonar-web/src/main/js/components/ui/DismissableAlert.tsx
index 51e6456ff21..db2b287a7a5 100644
--- a/server/sonar-web/src/main/js/components/ui/DismissableAlert.tsx
+++ b/server/sonar-web/src/main/js/components/ui/DismissableAlert.tsx
@@ -59,7 +59,8 @@ export default function DismissableAlert(props: DismissableAlertProps) {
onClick={() => {
hideAlert();
setShow(false);
- }}>
+ }}
+ >
<ClearIcon size={12} thin={true} />
</ButtonIcon>
</div>
diff --git a/server/sonar-web/src/main/js/components/ui/DuplicationsRating.tsx b/server/sonar-web/src/main/js/components/ui/DuplicationsRating.tsx
index 4c7581e0c51..663140e1689 100644
--- a/server/sonar-web/src/main/js/components/ui/DuplicationsRating.tsx
+++ b/server/sonar-web/src/main/js/components/ui/DuplicationsRating.tsx
@@ -38,7 +38,7 @@ export default function DuplicationsRating({ muted = false, size = 'normal', val
'duplications-rating-B': inRange(value || 0, 3, 5),
'duplications-rating-C': inRange(value || 0, 5, 10),
'duplications-rating-D': inRange(value || 0, 10, 20),
- 'duplications-rating-E': (value || 0) >= 20
+ 'duplications-rating-E': (value || 0) >= 20,
});
return <div className={className} />;
diff --git a/server/sonar-web/src/main/js/components/ui/GenericAvatar.tsx b/server/sonar-web/src/main/js/components/ui/GenericAvatar.tsx
index 73210e0d94e..0a3a4496836 100644
--- a/server/sonar-web/src/main/js/components/ui/GenericAvatar.tsx
+++ b/server/sonar-web/src/main/js/components/ui/GenericAvatar.tsx
@@ -32,7 +32,7 @@ export default function GenericAvatar({ className, name, round, size }: Props) {
const color = stringToColor(name);
let text = '';
- const words = name.split(/\s+/).filter(word => word.length > 0);
+ const words = name.split(/\s+/).filter((word) => word.length > 0);
if (words.length >= 2) {
text = words[0][0] + words[1][0];
} else if (name.length > 0) {
@@ -53,8 +53,9 @@ export default function GenericAvatar({ className, name, round, size }: Props) {
lineHeight: `${size}px`,
textAlign: 'center',
verticalAlign: 'top',
- width: size
- }}>
+ width: size,
+ }}
+ >
{text.toUpperCase()}
</div>
);
diff --git a/server/sonar-web/src/main/js/components/ui/Level.tsx b/server/sonar-web/src/main/js/components/ui/Level.tsx
index 322aaf68391..dd4022a2702 100644
--- a/server/sonar-web/src/main/js/components/ui/Level.tsx
+++ b/server/sonar-web/src/main/js/components/ui/Level.tsx
@@ -35,14 +35,15 @@ export default function Level(props: LevelProps) {
const formatted = formatMeasure(props.level, 'LEVEL');
const className = classNames(props.className, 'level', 'level-' + props.level, {
'level-small': props.small,
- 'level-muted': props.muted
+ 'level-muted': props.muted,
});
return (
<span
aria-label={props['aria-label']}
aria-labelledby={props['aria-labelledby']}
- className={className}>
+ className={className}
+ >
{formatted}
</span>
);
diff --git a/server/sonar-web/src/main/js/components/ui/MandatoryFieldMarker.tsx b/server/sonar-web/src/main/js/components/ui/MandatoryFieldMarker.tsx
index 207fe85027c..d07d060594b 100644
--- a/server/sonar-web/src/main/js/components/ui/MandatoryFieldMarker.tsx
+++ b/server/sonar-web/src/main/js/components/ui/MandatoryFieldMarker.tsx
@@ -29,7 +29,8 @@ export default function MandatoryFieldMarker({ className }: MandatoryFieldMarker
return (
<em
aria-label={translate('field_required')}
- className={classNames('mandatory little-spacer-left', className)}>
+ className={classNames('mandatory little-spacer-left', className)}
+ >
*
</em>
);
diff --git a/server/sonar-web/src/main/js/components/ui/NavBar.tsx b/server/sonar-web/src/main/js/components/ui/NavBar.tsx
index d713a0ab8f5..d081a391063 100644
--- a/server/sonar-web/src/main/js/components/ui/NavBar.tsx
+++ b/server/sonar-web/src/main/js/components/ui/NavBar.tsx
@@ -67,7 +67,8 @@ export default class NavBar extends React.PureComponent<
<nav {...other} className={classNames('navbar', className)} style={{ height, top }}>
<div
className={classNames('navbar-inner', { 'navbar-inner-with-notif': notif != null })}
- style={{ height, left: this.state.left }}>
+ style={{ height, left: this.state.left }}
+ >
<div className={classNames('clearfix', { 'navbar-limited': limited })}>{children}</div>
{notif}
</div>
diff --git a/server/sonar-web/src/main/js/components/ui/PageShortcutsTooltip.tsx b/server/sonar-web/src/main/js/components/ui/PageShortcutsTooltip.tsx
index d0303415cfc..d8304bcfd77 100644
--- a/server/sonar-web/src/main/js/components/ui/PageShortcutsTooltip.tsx
+++ b/server/sonar-web/src/main/js/components/ui/PageShortcutsTooltip.tsx
@@ -70,7 +70,8 @@ export default function PageShortcutsTooltip(props: PageShortcutsTooltipProps) {
</div>
)}
</div>
- }>
+ }
+ >
<div
aria-label={`
${translate('shortcuts.on_page.intro')}
@@ -94,7 +95,8 @@ export default function PageShortcutsTooltip(props: PageShortcutsTooltipProps) {
className={classNames(
className,
'page-shortcuts-tooltip note text-center display-inline-block'
- )}>
+ )}
+ >
<div>
<span className="shortcut-button shortcut-button-tiny">↑</span>
</div>
diff --git a/server/sonar-web/src/main/js/components/ui/Rating.tsx b/server/sonar-web/src/main/js/components/ui/Rating.tsx
index f898285625d..dc0fc2a581e 100644
--- a/server/sonar-web/src/main/js/components/ui/Rating.tsx
+++ b/server/sonar-web/src/main/js/components/ui/Rating.tsx
@@ -46,7 +46,8 @@ export default function Rating({
className
)}
aria-label={translate('metric.no_rating')}
- {...ariaAttrs}>
+ {...ariaAttrs}
+ >
</span>
);
@@ -61,7 +62,8 @@ export default function Rating({
{ 'rating-small': small, 'rating-muted': muted },
className
)}
- {...ariaAttrs}>
+ {...ariaAttrs}
+ >
{formatted}
</span>
);
diff --git a/server/sonar-web/src/main/js/components/ui/SizeRating.tsx b/server/sonar-web/src/main/js/components/ui/SizeRating.tsx
index 15c8843e898..1620f95914c 100644
--- a/server/sonar-web/src/main/js/components/ui/SizeRating.tsx
+++ b/server/sonar-web/src/main/js/components/ui/SizeRating.tsx
@@ -48,7 +48,7 @@ export default function SizeRating({ small = false, muted = false, value }: Prop
const className = classNames('size-rating', {
'size-rating-small': small,
- 'size-rating-muted': muted
+ 'size-rating-muted': muted,
});
return (
diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx
index 317afdb842c..787d736a219 100644
--- a/server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx
+++ b/server/sonar-web/src/main/js/components/ui/__tests__/Alert-test.tsx
@@ -27,26 +27,22 @@ it('should render properly', () => {
it('verification of all variants of alert', () => {
const variants: AlertProps['variant'][] = ['error', 'warning', 'success', 'info', 'loading'];
- variants.forEach(variant => {
+ variants.forEach((variant) => {
const wrapper = shallowRender({ variant });
expect(wrapper.prop('variantInfo')).toMatchSnapshot();
});
});
it('should render inline alert', () => {
- expect(
- shallowRender({ display: 'inline' })
- .find('Styled(div)[isInline=true]')
- .exists()
- ).toBe(true);
+ expect(shallowRender({ display: 'inline' }).find('Styled(div)[isInline=true]').exists()).toBe(
+ true
+ );
});
it('should render banner alert', () => {
- expect(
- shallowRender({ display: 'banner' })
- .find('Styled(div)[isBanner=true]')
- .exists()
- ).toBe(true);
+ expect(shallowRender({ display: 'banner' }).find('Styled(div)[isBanner=true]').exists()).toBe(
+ true
+ );
});
it('should render banner alert with correct css', () => {
diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/Avatar-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/Avatar-test.tsx
index b9bb9fec681..5f52661c669 100644
--- a/server/sonar-web/src/main/js/components/ui/__tests__/Avatar-test.tsx
+++ b/server/sonar-web/src/main/js/components/ui/__tests__/Avatar-test.tsx
@@ -31,8 +31,8 @@ it('should be able to render with hash only', () => {
appState={mockAppState({
settings: {
[GlobalSettingKeys.EnableGravatar]: 'true',
- [GlobalSettingKeys.GravatarServerUrl]: gravatarServerUrl
- }
+ [GlobalSettingKeys.GravatarServerUrl]: gravatarServerUrl,
+ },
})}
hash="7daf6c79d4802916d83f6266e24850af"
name="Foo"
diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx
index c2fb9644e56..d1fd101fb15 100644
--- a/server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx
+++ b/server/sonar-web/src/main/js/components/ui/__tests__/CoverageRating-test.tsx
@@ -26,22 +26,19 @@ it('should render correctly', () => {
});
it('should render with muted style', () => {
- expect(
- shallowRender({ muted: true })
- .find('DonutChart')
- .prop('data')
- ).toEqual([
+ expect(shallowRender({ muted: true }).find('DonutChart').prop('data')).toEqual([
{ fill: '#b4b4b4', value: 25 },
- { fill: 'transparent', value: 75 }
+ { fill: 'transparent', value: 75 },
]);
});
it('should render with small size', () => {
- expect(
- shallowRender({ size: 'small' })
- .find('DonutChart')
- .props()
- ).toMatchObject({ height: 20, padAngle: 0.1, thickness: 3, width: 20 });
+ expect(shallowRender({ size: 'small' }).find('DonutChart').props()).toMatchObject({
+ height: 20,
+ padAngle: 0.1,
+ thickness: 3,
+ width: 20,
+ });
});
it('should correctly handle padAngle for 0% and 100% coverage', () => {
diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx
index 93148c340fb..c9d1e99970e 100644
--- a/server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx
+++ b/server/sonar-web/src/main/js/components/ui/__tests__/DismissableAlert-test.tsx
@@ -24,24 +24,24 @@ import { save } from '../../../helpers/storage';
import { click } from '../../../helpers/testUtils';
import DismissableAlert, {
DismissableAlertProps,
- DISMISSED_ALERT_STORAGE_KEY
+ DISMISSED_ALERT_STORAGE_KEY,
} from '../DismissableAlert';
jest.mock('../../../helpers/storage', () => ({
get: jest.fn((_: string, suffix: string) => (suffix === 'bar' ? 'true' : undefined)),
- save: jest.fn()
+ save: jest.fn(),
}));
jest.mock('react', () => {
return {
...jest.requireActual('react'),
- useEffect: jest.fn()
+ useEffect: jest.fn(),
};
});
beforeEach(() => {
jest.clearAllMocks();
- (React.useEffect as jest.Mock).mockImplementationOnce(f => f());
+ (React.useEffect as jest.Mock).mockImplementationOnce((f) => f());
});
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldsExplanation-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldsExplanation-test.tsx
index 97cd17f4445..f4114c0a40f 100644
--- a/server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldsExplanation-test.tsx
+++ b/server/sonar-web/src/main/js/components/ui/__tests__/MandatoryFieldsExplanation-test.tsx
@@ -20,7 +20,7 @@
import { shallow } from 'enzyme';
import * as React from 'react';
import MandatoryFieldsExplanation, {
- MandatoryFieldsExplanationProps
+ MandatoryFieldsExplanationProps,
} from '../MandatoryFieldsExplanation';
it('should render correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/ui/__tests__/popups-test.tsx b/server/sonar-web/src/main/js/components/ui/__tests__/popups-test.tsx
index a8d0fecdbca..1b9e5544c15 100644
--- a/server/sonar-web/src/main/js/components/ui/__tests__/popups-test.tsx
+++ b/server/sonar-web/src/main/js/components/ui/__tests__/popups-test.tsx
@@ -25,7 +25,7 @@ import { Popup, PopupArrow, PopupPlacement, PortalPopup } from '../popups';
jest.mock('react-dom', () => ({
...jest.requireActual('react-dom'),
- findDOMNode: jest.fn().mockReturnValue(undefined)
+ findDOMNode: jest.fn().mockReturnValue(undefined),
}));
describe('Popup', () => {
@@ -70,8 +70,8 @@ describe('PortalPopup', () => {
wrapper.instance().popupNode = {
current: {
- getBoundingClientRect: jest.fn().mockReturnValue({ width: 8, height: 8 })
- } as any
+ getBoundingClientRect: jest.fn().mockReturnValue({ width: 8, height: 8 }),
+ } as any,
};
wrapper.instance().positionPopup();
diff --git a/server/sonar-web/src/main/js/components/ui/popups.tsx b/server/sonar-web/src/main/js/components/ui/popups.tsx
index b8a35716b78..326450f2757 100644
--- a/server/sonar-web/src/main/js/components/ui/popups.tsx
+++ b/server/sonar-web/src/main/js/components/ui/popups.tsx
@@ -44,7 +44,7 @@ export enum PopupPlacement {
LeftTop = 'left-top',
RightTop = 'right-top',
RightBottom = 'right-bottom',
- TopLeft = 'top-left'
+ TopLeft = 'top-left',
}
interface PopupProps {
@@ -68,7 +68,8 @@ function PopupBase(props: PopupProps, ref: React.Ref<HTMLDivElement>) {
props.className
)}
ref={ref || React.createRef()}
- style={props.style}>
+ style={props.style}
+ >
{props.children}
<PopupArrow style={props.arrowStyle} />
</div>
@@ -218,7 +219,7 @@ export class PortalPopup extends React.Component<PortalPopupProps, State> {
left: window.pageXOffset + left,
top: window.pageYOffset + top,
width,
- height
+ height,
});
}
};
@@ -233,7 +234,7 @@ export class PortalPopup extends React.Component<PortalPopupProps, State> {
left: this.state.left + leftFix,
top: this.state.top + topFix,
width: this.state.width,
- height: this.state.height
+ height: this.state.height,
};
arrowStyle = this.adjustArrowPosition(placement, { leftFix, topFix });
}
@@ -245,7 +246,8 @@ export class PortalPopup extends React.Component<PortalPopupProps, State> {
noPadding={noPadding}
placement={placement}
ref={this.popupNode}
- style={style}>
+ style={style}
+ >
{overlay}
</Popup>
);
diff --git a/server/sonar-web/src/main/js/components/ui/update-center/MetaData.tsx b/server/sonar-web/src/main/js/components/ui/update-center/MetaData.tsx
index 7b5ac8f80d2..376324f7090 100644
--- a/server/sonar-web/src/main/js/components/ui/update-center/MetaData.tsx
+++ b/server/sonar-web/src/main/js/components/ui/update-center/MetaData.tsx
@@ -62,7 +62,7 @@ export default class MetaData extends React.Component<Props, State> {
}
return Promise.reject(response);
})
- .then(data => {
+ .then((data) => {
if (this.mounted) {
this.setState({ data });
}
diff --git a/server/sonar-web/src/main/js/components/ui/update-center/MetaDataVersion.tsx b/server/sonar-web/src/main/js/components/ui/update-center/MetaDataVersion.tsx
index 4163e319f66..1b25dda67c5 100644
--- a/server/sonar-web/src/main/js/components/ui/update-center/MetaDataVersion.tsx
+++ b/server/sonar-web/src/main/js/components/ui/update-center/MetaDataVersion.tsx
@@ -34,21 +34,22 @@ export default function MetaDataVersion(props: MetaDataVersionProps) {
date,
description,
downloadURL,
- version
- }
+ version,
+ },
} = props;
const fallbackLabel = 'Download';
const advancedDownloadUrls = isAdvancedDownloadUrlArray(downloadURL)
- ? downloadURL.map(url => ({ ...url, label: url.label || fallbackLabel }))
+ ? downloadURL.map((url) => ({ ...url, label: url.label || fallbackLabel }))
: [{ label: fallbackLabel, url: downloadURL }];
return (
<div
className={classNames('update-center-meta-data-version', {
- 'update-center-meta-data-version-archived': archived
- })}>
+ 'update-center-meta-data-version-archived': archived,
+ })}
+ >
<div className="update-center-meta-data-version-version">{version}</div>
<div className="update-center-meta-data-version-release-info">
diff --git a/server/sonar-web/src/main/js/components/ui/update-center/MetaDataVersions.tsx b/server/sonar-web/src/main/js/components/ui/update-center/MetaDataVersions.tsx
index dc0c442bb52..79faa360b42 100644
--- a/server/sonar-web/src/main/js/components/ui/update-center/MetaDataVersions.tsx
+++ b/server/sonar-web/src/main/js/components/ui/update-center/MetaDataVersions.tsx
@@ -31,7 +31,7 @@ interface State {
export default class MetaDataVersions extends React.Component<Props, State> {
state: State = {
- collapsed: true
+ collapsed: true,
};
componentDidUpdate(prevProps: Props) {
@@ -50,8 +50,8 @@ export default class MetaDataVersions extends React.Component<Props, State> {
const { versions } = this.props;
const { collapsed } = this.state;
- const archivedVersions = versions.filter(version => version.archived);
- const currentVersions = versions.filter(version => !version.archived);
+ const archivedVersions = versions.filter((version) => version.archived);
+ const currentVersions = versions.filter((version) => !version.archived);
return (
<div className="update-center-meta-data-versions">
@@ -59,12 +59,13 @@ export default class MetaDataVersions extends React.Component<Props, State> {
<button
className="update-center-meta-data-versions-show-more"
onClick={this.handleClick}
- type="button">
+ type="button"
+ >
{collapsed ? 'Show more versions' : 'Show fewer versions'}
</button>
)}
- {currentVersions.map(versionInformation => (
+ {currentVersions.map((versionInformation) => (
<MetaDataVersion
key={versionInformation.version}
versionInformation={versionInformation}
@@ -72,7 +73,7 @@ export default class MetaDataVersions extends React.Component<Props, State> {
))}
{!collapsed &&
- archivedVersions.map(archivedVersionInformation => (
+ archivedVersions.map((archivedVersionInformation) => (
<MetaDataVersion
key={archivedVersionInformation.version}
versionInformation={archivedVersionInformation}
diff --git a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaData-test.tsx b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaData-test.tsx
index f65c466f973..815bc5a8a94 100644
--- a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaData-test.tsx
+++ b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaData-test.tsx
@@ -44,7 +44,7 @@ it('should render correctly', async () => {
it('should render correctly with organization', async () => {
const metaDataInfo = mockMetaDataInformation({
- organization: { name: 'test-org', url: 'test-org-url' }
+ organization: { name: 'test-org', url: 'test-org-url' },
});
mockFetchReturnValue(metaDataInfo);
diff --git a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersion-test.tsx b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersion-test.tsx
index ecf8aba4d8b..bc092bc34fd 100644
--- a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersion-test.tsx
+++ b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersion-test.tsx
@@ -27,13 +27,13 @@ it('should render correctly', () => {
expect(
shallowRender({
versionInformation: mockMetaDataVersionInformation({
- downloadURL: [{ label: 'macos 64 bits', url: '' }]
- })
+ downloadURL: [{ label: 'macos 64 bits', url: '' }],
+ }),
})
).toMatchSnapshot('with advanced downloadUrl');
expect(
shallowRender({
- versionInformation: { version: '2.0' }
+ versionInformation: { version: '2.0' },
})
).toMatchSnapshot('with very few info');
});
diff --git a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersions-test.tsx b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersions-test.tsx
index f3720bf4b60..835b718962c 100644
--- a/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersions-test.tsx
+++ b/server/sonar-web/src/main/js/components/ui/update-center/__tests__/MetaDataVersions-test.tsx
@@ -43,7 +43,7 @@ function shallowRender(props?: Partial<MetaDataVersions['props']>) {
versions={[
mockMetaDataVersionInformation({ version: '3.0' }),
mockMetaDataVersionInformation({ version: '2.0', archived: true }),
- mockMetaDataVersionInformation({ version: '1.0', archived: true })
+ mockMetaDataVersionInformation({ version: '1.0', archived: true }),
]}
{...props}
/>
diff --git a/server/sonar-web/src/main/js/components/ui/update-center/mocks/update-center-metadata.ts b/server/sonar-web/src/main/js/components/ui/update-center/mocks/update-center-metadata.ts
index b0561a49d66..b31afc60583 100644
--- a/server/sonar-web/src/main/js/components/ui/update-center/mocks/update-center-metadata.ts
+++ b/server/sonar-web/src/main/js/components/ui/update-center/mocks/update-center-metadata.ts
@@ -29,7 +29,7 @@ export function mockMetaDataVersionInformation(
archived: false,
downloadURL: 'https://example.com/sonar-java-plugin-5.13.0.18197.jar',
changeLogUrl: 'https://example.com/sonar-java-plugin/release',
- ...overrides
+ ...overrides,
};
}
@@ -42,7 +42,7 @@ export function mockMetaDataInformation(
isSonarSourceCommercial: true,
organization: {
name: 'SonarSource',
- url: 'http://www.sonarsource.com/'
+ url: 'http://www.sonarsource.com/',
},
category: 'Languages',
license: 'SonarSource',
@@ -50,8 +50,8 @@ export function mockMetaDataInformation(
sourcesURL: 'https://github.com/SonarSource/sonar-java',
versions: [
mockMetaDataVersionInformation({ version: '2.0' }),
- mockMetaDataVersionInformation({ version: '1.0', archived: true })
+ mockMetaDataVersionInformation({ version: '1.0', archived: true }),
],
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx
index b66d51822bb..9a6791569f8 100644
--- a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx
+++ b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx
@@ -42,7 +42,7 @@ interface Props {
const MAP_ALERT: { [key in UpdateUseCase]?: AlertVariant } = {
[UpdateUseCase.NewPatch]: 'warning',
[UpdateUseCase.PreLTS]: 'warning',
- [UpdateUseCase.PreviousLTS]: 'error'
+ [UpdateUseCase.PreviousLTS]: 'error',
};
interface State {
@@ -64,11 +64,13 @@ export class SystemUpgradeForm extends React.PureComponent<Props, State> {
if (updateUseCase === UpdateUseCase.NewPatch && parsedVersion !== null) {
const [, major, minor] = parsedVersion;
const majoMinorVersion = `${major}.${minor}`;
- patches = flatMap(systemUpgrades, upgrades =>
- filter(upgrades, upgrade => upgrade.version.startsWith(majoMinorVersion))
+ patches = flatMap(systemUpgrades, (upgrades) =>
+ filter(upgrades, (upgrade) => upgrade.version.startsWith(majoMinorVersion))
);
systemUpgradesWithPatch = systemUpgrades
- .map(upgrades => upgrades.filter(upgrade => !upgrade.version.startsWith(majoMinorVersion)))
+ .map((upgrades) =>
+ upgrades.filter((upgrade) => !upgrade.version.startsWith(majoMinorVersion))
+ )
.filter(negate(isEmpty));
systemUpgradesWithPatch.push(patches);
} else {
@@ -76,7 +78,7 @@ export class SystemUpgradeForm extends React.PureComponent<Props, State> {
for (const upgrades of systemUpgrades) {
if (untilLTS === false) {
systemUpgradesWithPatch.push(upgrades);
- untilLTS = upgrades.some(upgrade => upgrade.version.startsWith(latestLTS));
+ untilLTS = upgrades.some((upgrade) => upgrade.version.startsWith(latestLTS));
}
}
}
@@ -93,7 +95,7 @@ export class SystemUpgradeForm extends React.PureComponent<Props, State> {
{translate('admin_notification.update', updateUseCase)}
</Alert>
)}
- {systemUpgradesWithPatch.map(upgrades => (
+ {systemUpgradesWithPatch.map((upgrades) => (
<SystemUpgradeItem
edition={
appState.edition as EditionKey /* TODO: Fix once AppState is no longer ambiant. */
@@ -101,7 +103,7 @@ export class SystemUpgradeForm extends React.PureComponent<Props, State> {
key={upgrades[upgrades.length - 1].version}
systemUpgrades={upgrades}
isPatch={upgrades === patches}
- isLTSVersion={upgrades.some(upgrade => upgrade.version.startsWith(latestLTS))}
+ isLTSVersion={upgrades.some((upgrade) => upgrade.version.startsWith(latestLTS))}
/>
))}
</div>
@@ -110,7 +112,8 @@ export class SystemUpgradeForm extends React.PureComponent<Props, State> {
<Link
className="pull-left link-no-underline display-flex-center"
to="https://www.sonarqube.org/downloads/?referrer=sonarqube"
- target="_blank">
+ target="_blank"
+ >
{translate('system.see_sonarqube_downloads')}
</Link>
<ResetButtonLink onClick={this.props.onClose}>{translate('cancel')}</ResetButtonLink>
diff --git a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeIntermediate.tsx b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeIntermediate.tsx
index d6380e22af3..aee2b7bbf5c 100644
--- a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeIntermediate.tsx
+++ b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeIntermediate.tsx
@@ -37,7 +37,7 @@ export default class SystemUpgradeIntermediate extends React.PureComponent<Props
state: State = { showMore: false };
toggleIntermediatVersions = () => {
- this.setState(state => ({ showMore: !state.showMore }));
+ this.setState((state) => ({ showMore: !state.showMore }));
};
render() {
@@ -56,11 +56,11 @@ export default class SystemUpgradeIntermediate extends React.PureComponent<Props
<DropdownIcon className="little-spacer-left" turned={showMore} />
</ButtonLink>
{showMore &&
- upgrades.map(upgrade => (
+ upgrades.map((upgrade) => (
<div className="note system-upgrade-intermediate" key={upgrade.version}>
{upgrade.releaseDate && (
<DateFormatter date={upgrade.releaseDate} long={true}>
- {formattedDate => (
+ {(formattedDate) => (
<p>
<b className="little-spacer-right">SonarQube {upgrade.version}</b>
{formattedDate}
@@ -69,7 +69,8 @@ export default class SystemUpgradeIntermediate extends React.PureComponent<Props
className="spacer-left"
href={upgrade.changeLogUrl}
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translate('system.release_notes')}
</a>
)}
diff --git a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx
index 7309a165e90..d3d052a2469 100644
--- a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx
+++ b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx
@@ -22,7 +22,7 @@ import { FormattedMessage } from 'react-intl';
import {
getEdition,
getEditionDownloadFilename,
- getEditionDownloadUrl
+ getEditionDownloadUrl,
} from '../../helpers/editions';
import { translate, translateWithParameters } from '../../helpers/l10n';
import { EditionKey } from '../../types/editions';
@@ -60,7 +60,8 @@ export default function SystemUpgradeItem(props: SystemUpgradeItemProps) {
<Link
className="spacer-left medium"
to="https://www.sonarqube.org/whats-new/?referrer=sonarqube"
- target="_blank">
+ target="_blank"
+ >
{translate('system.see_whats_new')}
</Link>
)}
@@ -76,7 +77,7 @@ export default function SystemUpgradeItem(props: SystemUpgradeItemProps) {
<div className="big-spacer-top">
{lastUpgrade.releaseDate && (
<DateFormatter date={lastUpgrade.releaseDate} long={true}>
- {formattedDate => (
+ {(formattedDate) => (
<span>{translateWithParameters('system.released_x', formattedDate)}</span>
)}
</DateFormatter>
@@ -94,13 +95,15 @@ export default function SystemUpgradeItem(props: SystemUpgradeItemProps) {
download={getEditionDownloadFilename(downloadUrl)}
href={downloadUrl}
rel="noopener noreferrer"
- target="_blank">
+ target="_blank"
+ >
{translateWithParameters('system.download_x', lastUpgrade.version)}
</a>
<Link
className="spacer-left"
to="https://redirect.sonarsource.com/doc/upgrading.html"
- target="_blank">
+ target="_blank"
+ >
{translate('system.how_to_upgrade')}
</Link>
</div>
diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeForm-test.tsx b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeForm-test.tsx
index c3e37a9c693..4fd4054021c 100644
--- a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeForm-test.tsx
+++ b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeForm-test.tsx
@@ -32,7 +32,7 @@ const UPGRADES = [
releaseDate: '2017-06-02',
changeLogUrl: 'changelogurl',
downloadUrl: 'downloadurl',
- plugins: {}
+ plugins: {},
},
{
version: '6.3',
@@ -40,8 +40,8 @@ const UPGRADES = [
releaseDate: '2017-05-02',
changeLogUrl: 'changelogurl',
downloadUrl: 'downloadurl',
- plugins: {}
- }
+ plugins: {},
+ },
],
[
{
@@ -50,7 +50,7 @@ const UPGRADES = [
releaseDate: '2017-03-01',
changeLogUrl: 'changelogurl',
downloadUrl: 'downloadurl',
- plugins: {}
+ plugins: {},
},
{
version: '5.6.6',
@@ -58,7 +58,7 @@ const UPGRADES = [
releaseDate: '2017-04-02',
changeLogUrl: 'changelogurl',
downloadUrl: 'downloadurl',
- plugins: {}
+ plugins: {},
},
{
version: '5.6.5',
@@ -66,14 +66,14 @@ const UPGRADES = [
releaseDate: '2017-03-01',
changeLogUrl: 'changelogurl',
downloadUrl: 'downloadurl',
- plugins: {}
- }
- ]
+ plugins: {},
+ },
+ ],
];
it.each([...Object.values(UpdateUseCase), undefined])(
'should display correctly for %s',
- updateUseCase => {
+ (updateUseCase) => {
expect(
shallow(
<SystemUpgradeForm
diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeIntermediate-test.tsx b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeIntermediate-test.tsx
index 5339972200e..2dee570ef8a 100644
--- a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeIntermediate-test.tsx
+++ b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeIntermediate-test.tsx
@@ -29,7 +29,7 @@ const UPGRADES = [
releaseDate: '2017-04-02',
changeLogUrl: 'changelogurl',
downloadUrl: 'downloadurl',
- plugins: {}
+ plugins: {},
},
{
version: '5.6.5',
@@ -37,8 +37,8 @@ const UPGRADES = [
releaseDate: '2017-03-01',
changeLogUrl: 'changelogurl',
downloadUrl: 'downloadurl',
- plugins: {}
- }
+ plugins: {},
+ },
];
it('should display correctly', () => {
diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeItem-test.tsx b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeItem-test.tsx
index 5eafcf10933..74dce40ae20 100644
--- a/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeItem-test.tsx
+++ b/server/sonar-web/src/main/js/components/upgrade/__tests__/SystemUpgradeItem-test.tsx
@@ -38,9 +38,9 @@ it('should display correctly', () => {
description: 'Version 5.6.7 description',
releaseDate: '2017-03-01',
changeLogUrl: 'http://changelog.url/',
- downloadUrl: 'http://download.url/community'
- }
- ]
+ downloadUrl: 'http://download.url/community',
+ },
+ ],
})
).toMatchSnapshot();
});
@@ -58,7 +58,7 @@ function shallowRender(props: Partial<SystemUpgradeItemProps> = {}) {
downloadUrl: 'http://download.url/community',
downloadDeveloperUrl: 'http://download.url/developer',
downloadEnterpriseUrl: 'http://download.url/enterprise',
- downloadDatacenterUrl: 'http://download.url/datacenter'
+ downloadDatacenterUrl: 'http://download.url/datacenter',
},
{
version: '5.6.6',
@@ -66,7 +66,7 @@ function shallowRender(props: Partial<SystemUpgradeItemProps> = {}) {
releaseDate: '2017-04-02',
changeLogUrl: 'http://changelog.url/',
downloadUrl: 'http://download.url/community',
- downloadDeveloperUrl: 'http://download.url/developer'
+ downloadDeveloperUrl: 'http://download.url/developer',
},
{
version: '5.6.5',
@@ -74,8 +74,8 @@ function shallowRender(props: Partial<SystemUpgradeItemProps> = {}) {
releaseDate: '2017-03-01',
changeLogUrl: 'http://changelog.url/',
downloadUrl: 'http://download.url/community',
- downloadDeveloperUrl: 'http://download.url/developer'
- }
+ downloadDeveloperUrl: 'http://download.url/developer',
+ },
]}
isPatch={false}
isLTSVersion={false}
diff --git a/server/sonar-web/src/main/js/components/upgrade/__tests__/utils-test.ts b/server/sonar-web/src/main/js/components/upgrade/__tests__/utils-test.ts
index 7c7fb94a219..e9a9149e2e2 100644
--- a/server/sonar-web/src/main/js/components/upgrade/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/components/upgrade/__tests__/utils-test.ts
@@ -27,7 +27,7 @@ describe('sortUpgrades', () => {
{ version: '5.4.2' },
{ version: '5.10' },
{ version: '5.1' },
- { version: '5.4' }
+ { version: '5.4' },
] as SystemUpgrade[])
).toEqual([{ version: '5.10' }, { version: '5.4.2' }, { version: '5.4' }, { version: '5.1' }]);
expect(
@@ -35,7 +35,7 @@ describe('sortUpgrades', () => {
{ version: '5.10' },
{ version: '5.1.2' },
{ version: '6.0' },
- { version: '6.9' }
+ { version: '6.9' },
] as SystemUpgrade[])
).toEqual([{ version: '6.9' }, { version: '6.0' }, { version: '5.10' }, { version: '5.1.2' }]);
});
@@ -48,10 +48,10 @@ describe('groupUpgrades', () => {
{ version: '5.10' },
{ version: '5.4.2' },
{ version: '5.4' },
- { version: '5.1' }
+ { version: '5.1' },
] as SystemUpgrade[])
).toEqual([
- [{ version: '5.10' }, { version: '5.4.2' }, { version: '5.4' }, { version: '5.1' }]
+ [{ version: '5.10' }, { version: '5.4.2' }, { version: '5.4' }, { version: '5.1' }],
]);
expect(
u.groupUpgrades([
@@ -59,11 +59,11 @@ describe('groupUpgrades', () => {
{ version: '6.7' },
{ version: '6.0' },
{ version: '5.10' },
- { version: '5.4.2' }
+ { version: '5.4.2' },
] as SystemUpgrade[])
).toEqual([
[{ version: '6.9' }, { version: '6.7' }, { version: '6.0' }],
- [{ version: '5.10' }, { version: '5.4.2' }]
+ [{ version: '5.10' }, { version: '5.4.2' }],
]);
});
});
diff --git a/server/sonar-web/src/main/js/components/upgrade/utils.ts b/server/sonar-web/src/main/js/components/upgrade/utils.ts
index 6efe5cdffbd..067ddee6c73 100644
--- a/server/sonar-web/src/main/js/components/upgrade/utils.ts
+++ b/server/sonar-web/src/main/js/components/upgrade/utils.ts
@@ -24,19 +24,19 @@ export enum UpdateUseCase {
NewMinorVersion = 'new_minor_version',
NewPatch = 'new_patch',
PreLTS = 'pre_lts',
- PreviousLTS = 'previous_lts'
+ PreviousLTS = 'previous_lts',
}
export function sortUpgrades(upgrades: SystemUpgrade[]): SystemUpgrade[] {
return sortBy(upgrades, [
(upgrade: SystemUpgrade) => -Number(upgrade.version.split('.')[0]),
(upgrade: SystemUpgrade) => -Number(upgrade.version.split('.')[1] || 0),
- (upgrade: SystemUpgrade) => -Number(upgrade.version.split('.')[2] || 0)
+ (upgrade: SystemUpgrade) => -Number(upgrade.version.split('.')[2] || 0),
]);
}
export function groupUpgrades(upgrades: SystemUpgrade[]): SystemUpgrade[][] {
- const groupedVersions = groupBy(upgrades, upgrade => upgrade.version.split('.')[0]);
- const sortedMajor = sortBy(Object.keys(groupedVersions), key => -Number(key));
- return sortedMajor.map(key => groupedVersions[key]);
+ const groupedVersions = groupBy(upgrades, (upgrade) => upgrade.version.split('.')[0]);
+ const sortedMajor = sortBy(Object.keys(groupedVersions), (key) => -Number(key));
+ return sortedMajor.map((key) => groupedVersions[key]);
}
diff --git a/server/sonar-web/src/main/js/components/workspace/Workspace.tsx b/server/sonar-web/src/main/js/components/workspace/Workspace.tsx
index d8436587217..137d976e9f4 100644
--- a/server/sonar-web/src/main/js/components/workspace/Workspace.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/Workspace.tsx
@@ -46,7 +46,7 @@ export const INITIAL_HEIGHT = 300;
export const TYPE_KEY = '__type__';
export enum WorkspaceTypes {
Rule = 'rule',
- Component = 'component'
+ Component = 'component',
}
export default class Workspace extends React.PureComponent<{}, State> {
@@ -58,7 +58,7 @@ export default class Workspace extends React.PureComponent<{}, State> {
externalRulesRepoNames: {},
height: INITIAL_HEIGHT,
open: {},
- ...this.loadWorkspace()
+ ...this.loadWorkspace(),
};
}
@@ -92,9 +92,9 @@ export default class Workspace extends React.PureComponent<{}, State> {
try {
const data: any[] = JSON.parse(get(WORKSPACE) || '');
const components: ComponentDescriptor[] = data.filter(
- x => x[TYPE_KEY] === WorkspaceTypes.Component
+ (x) => x[TYPE_KEY] === WorkspaceTypes.Component
);
- const rules: RuleDescriptor[] = data.filter(x => x[TYPE_KEY] === WorkspaceTypes.Rule);
+ const rules: RuleDescriptor[] = data.filter((x) => x[TYPE_KEY] === WorkspaceTypes.Rule);
return { components, rules };
} catch {
// Fail silently.
@@ -106,18 +106,18 @@ export default class Workspace extends React.PureComponent<{}, State> {
const data = [
// Do not save line number, next time the file is open, it should be open
// on the first line.
- ...this.state.components.map(x =>
+ ...this.state.components.map((x) =>
omit({ ...x, [TYPE_KEY]: WorkspaceTypes.Component }, 'line')
),
- ...this.state.rules.map(x => ({ ...x, [TYPE_KEY]: WorkspaceTypes.Rule }))
+ ...this.state.rules.map((x) => ({ ...x, [TYPE_KEY]: WorkspaceTypes.Rule })),
];
save(WORKSPACE, JSON.stringify(data));
};
handleOpenComponent = (component: ComponentDescriptor) => {
this.setState((state: State) => ({
- components: uniqBy([...state.components, component], c => c.key),
- open: { component: component.key }
+ components: uniqBy([...state.components, component], (c) => c.key),
+ open: { component: component.key },
}));
};
@@ -128,7 +128,7 @@ export default class Workspace extends React.PureComponent<{}, State> {
handleOpenRule = (rule: RuleDescriptor) => {
this.setState((state: State) => ({
open: { rule: rule.key },
- rules: uniqBy([...state.rules, rule], r => r.key)
+ rules: uniqBy([...state.rules, rule], (r) => r.key),
}));
};
@@ -138,21 +138,21 @@ export default class Workspace extends React.PureComponent<{}, State> {
handleComponentClose = (componentKey: string) => {
this.setState((state: State) => ({
- components: state.components.filter(x => x.key !== componentKey),
+ components: state.components.filter((x) => x.key !== componentKey),
open: {
...state.open,
- component: state.open.component === componentKey ? undefined : state.open.component
- }
+ component: state.open.component === componentKey ? undefined : state.open.component,
+ },
}));
};
handleRuleClose = (ruleKey: string) => {
this.setState((state: State) => ({
- rules: state.rules.filter(x => x.key !== ruleKey),
+ rules: state.rules.filter((x) => x.key !== ruleKey),
open: {
...state.open,
- rule: state.open.rule === ruleKey ? undefined : state.open.rule
- }
+ rule: state.open.rule === ruleKey ? undefined : state.open.rule,
+ },
}));
};
@@ -160,9 +160,9 @@ export default class Workspace extends React.PureComponent<{}, State> {
if (this.mounted) {
const { key, name, qualifier } = details;
this.setState((state: State) => ({
- components: state.components.map(component =>
+ components: state.components.map((component) =>
component.key === key ? { ...component, name, qualifier } : component
- )
+ ),
}));
}
};
@@ -171,7 +171,7 @@ export default class Workspace extends React.PureComponent<{}, State> {
if (this.mounted) {
const { key, name } = details;
this.setState((state: State) => ({
- rules: state.rules.map(rule => (rule.key === key ? { ...rule, name } : rule))
+ rules: state.rules.map((rule) => (rule.key === key ? { ...rule, name } : rule)),
}));
}
};
@@ -192,15 +192,15 @@ export default class Workspace extends React.PureComponent<{}, State> {
const minHeight = window.innerHeight * MIN_HEIGHT;
const maxHeight = window.innerHeight * MAX_HEIGHT;
this.setState((state: State) => ({
- height: Math.min(maxHeight, Math.max(minHeight, state.height - deltaY))
+ height: Math.min(maxHeight, Math.max(minHeight, state.height - deltaY)),
}));
};
render() {
const { components, externalRulesRepoNames, height, maximized, open, rules } = this.state;
- const openComponent = open.component && components.find(x => x.key === open.component);
- const openRule = open.rule && rules.find(x => x.key === open.rule);
+ const openComponent = open.component && components.find((x) => x.key === open.component);
+ const openRule = open.rule && rules.find((x) => x.key === open.rule);
const actualHeight = maximized ? window.innerHeight * MAX_HEIGHT : height;
@@ -209,8 +209,9 @@ export default class Workspace extends React.PureComponent<{}, State> {
value={{
externalRulesRepoNames,
openComponent: this.handleOpenComponent,
- openRule: this.handleOpenRule
- }}>
+ openRule: this.handleOpenRule,
+ }}
+ >
{this.props.children}
<WorkspacePortal>
{(components.length > 0 || rules.length > 0) && (
diff --git a/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentViewer.tsx b/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentViewer.tsx
index d7561d6e604..d80f32b8694 100644
--- a/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentViewer.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentViewer.tsx
@@ -70,7 +70,7 @@ export class WorkspaceComponentViewer extends React.PureComponent<Props> {
this.props.onLoad({
key: this.props.component.key,
name: component.path,
- qualifier: component.q
+ qualifier: component.q,
});
if (this.container && this.props.component.line) {
@@ -82,7 +82,7 @@ export class WorkspaceComponentViewer extends React.PureComponent<Props> {
smooth: false,
parent: this.container,
topOffset: 50,
- bottomOffset: 50
+ bottomOffset: 50,
});
}
}
@@ -114,14 +114,16 @@ export class WorkspaceComponentViewer extends React.PureComponent<Props> {
onCollapse={this.props.onCollapse}
onMaximize={this.props.onMaximize}
onMinimize={this.props.onMinimize}
- onResize={this.props.onResize}>
+ onResize={this.props.onResize}
+ >
<WorkspaceComponentTitle component={component} />
</WorkspaceHeader>
<div
className="workspace-viewer-container"
- ref={node => (this.container = node)}
- style={{ height: this.props.height }}>
+ ref={(node) => (this.container = node)}
+ style={{ height: this.props.height }}
+ >
<SourceViewer
aroundLine={component.line}
branchLike={component.branchLike}
diff --git a/server/sonar-web/src/main/js/components/workspace/WorkspaceHeader.tsx b/server/sonar-web/src/main/js/components/workspace/WorkspaceHeader.tsx
index bd6231f5895..3a9d3bce65a 100644
--- a/server/sonar-web/src/main/js/components/workspace/WorkspaceHeader.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/WorkspaceHeader.tsx
@@ -96,7 +96,8 @@ function WorkspaceHeaderButton({ icon: Icon, onClick, tooltip }: WorkspaceHeader
aria-label={translate(tooltip)}
color="#fff"
onClick={onClick}
- tooltip={translate(tooltip)}>
+ tooltip={translate(tooltip)}
+ >
<Icon fill={undefined} />
</ButtonIcon>
);
diff --git a/server/sonar-web/src/main/js/components/workspace/WorkspaceNav.tsx b/server/sonar-web/src/main/js/components/workspace/WorkspaceNav.tsx
index a871615957a..90b2d1c4ba3 100644
--- a/server/sonar-web/src/main/js/components/workspace/WorkspaceNav.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/WorkspaceNav.tsx
@@ -34,13 +34,13 @@ export interface Props {
export default function WorkspaceNav(props: Props) {
// do not show a tab for the currently open component/rule
- const components = props.components.filter(x => x.key !== props.open.component);
- const rules = props.rules.filter(x => x.key !== props.open.rule);
+ const components = props.components.filter((x) => x.key !== props.open.component);
+ const rules = props.rules.filter((x) => x.key !== props.open.rule);
return (
<nav className="workspace-nav">
<ul className="workspace-nav-list">
- {components.map(component => (
+ {components.map((component) => (
<WorkspaceNavComponent
component={component}
key={`component-${component.key}`}
@@ -49,7 +49,7 @@ export default function WorkspaceNav(props: Props) {
/>
))}
- {rules.map(rule => (
+ {rules.map((rule) => (
<WorkspaceNavRule
key={`rule-${rule.key}`}
onClose={props.onRuleClose}
diff --git a/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleDetails.tsx b/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleDetails.tsx
index da52035ccfe..c617cde57db 100644
--- a/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleDetails.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleDetails.tsx
@@ -64,7 +64,7 @@ export default class WorkspaceRuleDetails extends React.PureComponent<Props, Sta
this.setState({
loading: false,
referencedRepositories: keyBy(repositories, 'key'),
- ruleDetails: rule
+ ruleDetails: rule,
});
this.props.onLoad({ name: rule.name });
}
diff --git a/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleViewer.tsx b/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleViewer.tsx
index 3b4f04aba2f..8d70b796fc7 100644
--- a/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleViewer.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/WorkspaceRuleViewer.tsx
@@ -67,7 +67,8 @@ export default class WorkspaceRuleViewer extends React.PureComponent<Props> {
onCollapse={this.props.onCollapse}
onMaximize={this.props.onMaximize}
onMinimize={this.props.onMinimize}
- onResize={this.props.onResize}>
+ onResize={this.props.onResize}
+ >
<WorkspaceRuleTitle rule={rule} />
</WorkspaceHeader>
@@ -75,7 +76,8 @@ export default class WorkspaceRuleViewer extends React.PureComponent<Props> {
aria-busy={loading}
aria-live="polite"
className="workspace-viewer-container"
- style={{ height: this.props.height }}>
+ style={{ height: this.props.height }}
+ >
<WorkspaceRuleDetails onLoad={this.handleLoaded} ruleKey={rule.key} />
</div>
</div>
diff --git a/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx b/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx
index e0af3862b5b..f4df4309a82 100644
--- a/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx
@@ -28,13 +28,13 @@ import Workspace, {
MAX_HEIGHT,
MIN_HEIGHT,
TYPE_KEY,
- WorkspaceTypes
+ WorkspaceTypes,
} from '../Workspace';
jest.mock('../../../helpers/storage', () => {
return {
get: jest.fn(),
- save: jest.fn()
+ save: jest.fn(),
};
});
@@ -42,9 +42,9 @@ jest.mock('../../../api/rules', () => ({
getRulesApp: jest.fn().mockResolvedValue({
repositories: [
{ key: 'foo', name: 'Foo' },
- { key: 'external_bar', name: 'Bar' }
- ]
- })
+ { key: 'external_bar', name: 'Bar' },
+ ],
+ }),
}));
const WINDOW_HEIGHT = 1000;
@@ -54,7 +54,7 @@ beforeAll(() => {
Object.defineProperty(window, 'innerHeight', {
writable: true,
configurable: true,
- value: WINDOW_HEIGHT
+ value: WINDOW_HEIGHT,
});
});
@@ -62,7 +62,7 @@ afterAll(() => {
Object.defineProperty(window, 'innerHeight', {
writable: true,
configurable: true,
- value: originalHeight
+ value: originalHeight,
});
});
@@ -73,13 +73,13 @@ it('should render correctly', () => {
expect(
shallowRender({
components: [{ branchLike: mockBranch(), key: 'foo' }],
- open: { component: 'foo' }
+ open: { component: 'foo' },
})
).toMatchSnapshot('open component');
expect(
shallowRender({
rules: [{ key: 'foo' }],
- open: { rule: 'foo' }
+ open: { rule: 'foo' },
})
).toMatchSnapshot('open rule');
});
@@ -89,12 +89,12 @@ it('should correctly load data from local storage', () => {
const rule2 = {
[TYPE_KEY]: WorkspaceTypes.Rule,
key: 'baz',
- name: 'Baz'
+ name: 'Baz',
};
const component = {
[TYPE_KEY]: WorkspaceTypes.Component,
branchLike: mockBranch(),
- key: 'foo'
+ key: 'foo',
};
(get as jest.Mock).mockReturnValue(JSON.stringify([rule1, rule2, component]));
@@ -113,7 +113,7 @@ it('should correctly load data from local storage', () => {
it('should correctly store data locally', () => {
const wrapper = shallowRender({
components: [{ branchLike: mockBranch(), key: 'foo' }],
- rules: [{ key: 'foo' }]
+ rules: [{ key: 'foo' }],
});
wrapper.instance().saveWorkspace();
expect((save as jest.Mock).mock.calls[0][1]).toMatchSnapshot();
@@ -130,7 +130,7 @@ it('should allow elements to be loaded and updated', () => {
const rule = { key: 'bar' };
const wrapper = shallowRender({
components: [component],
- rules: [rule]
+ rules: [rule],
});
const instance = wrapper.instance();
@@ -147,7 +147,7 @@ it('should allow elements to be loaded and updated', () => {
instance.handleComponentLoad({ key: 'foo', name: 'Foo', qualifier: ComponentQualifier.File });
expect(wrapper.state().components).toEqual([
- { ...component, name: 'Foo', qualifier: ComponentQualifier.File }
+ { ...component, name: 'Foo', qualifier: ComponentQualifier.File },
]);
});
@@ -178,11 +178,11 @@ it('should be resizable', () => {
it('should be openable/collapsible', () => {
const rule = {
key: 'baz',
- name: 'Baz'
+ name: 'Baz',
};
const component = {
branchLike: mockBranch(),
- key: 'foo'
+ key: 'foo',
};
const wrapper = shallowRender();
const instance = wrapper.instance();
diff --git a/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceComponentViewer-test.tsx b/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceComponentViewer-test.tsx
index b99ef855691..92db51d851a 100644
--- a/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceComponentViewer-test.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceComponentViewer-test.tsx
@@ -26,7 +26,7 @@ import { waitAndUpdate } from '../../../helpers/testUtils';
import { Props, WorkspaceComponentViewer } from '../WorkspaceComponentViewer';
jest.mock('../../../api/components', () => ({
- getParents: jest.fn().mockResolvedValue([{ key: 'bar' }])
+ getParents: jest.fn().mockResolvedValue([{ key: 'bar' }]),
}));
beforeEach(() => {
@@ -50,7 +50,7 @@ it('should call back after load', () => {
wrapper.find('[onLoaded]').prop<Function>('onLoaded')({
key: 'foo',
path: 'src/foo.js',
- q: 'FIL'
+ q: 'FIL',
});
expect(onLoad).toHaveBeenCalledWith({ key: 'foo', name: 'src/foo.js', qualifier: 'FIL' });
});
@@ -60,7 +60,7 @@ it('should refresh branch status if issues are updated', async () => {
const branchLike = mockPullRequest();
const component = {
branchLike,
- key: 'foo'
+ key: 'foo',
};
const wrapper = shallowRender({ component, fetchBranchStatus });
const instance = wrapper.instance();
diff --git a/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceHeader-test.tsx b/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceHeader-test.tsx
index bee32547a64..9cea01ae44d 100644
--- a/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceHeader-test.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceHeader-test.tsx
@@ -40,7 +40,8 @@ function shallowRender(props?: Partial<Props>) {
onMaximize={jest.fn()}
onMinimize={jest.fn()}
onResize={jest.fn()}
- {...props}>
+ {...props}
+ >
<div id="workspace-header-children" />
</WorkspaceHeader>
);
diff --git a/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceNav-test.tsx b/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceNav-test.tsx
index bbffb889d67..e434e85aa6f 100644
--- a/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceNav-test.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceNav-test.tsx
@@ -36,7 +36,7 @@ it('should not render open rule', () => {
function shallowRender(props?: Partial<Props>) {
const components = [
{ branchLike: undefined, key: 'foo' },
- { branchLike: undefined, key: 'bar' }
+ { branchLike: undefined, key: 'bar' },
];
const rules = [{ key: 'qux' }];
return shallow(
diff --git a/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceRuleDetails-test.tsx b/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceRuleDetails-test.tsx
index ea1b1f01ab2..d6bd29cf3db 100644
--- a/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceRuleDetails-test.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceRuleDetails-test.tsx
@@ -26,7 +26,7 @@ jest.mock('../../../api/rules', () => ({
getRulesApp: jest.fn(() =>
Promise.resolve({ repositories: [{ key: 'repo', language: 'xoo', name: 'Xoo Repository' }] })
),
- getRuleDetails: jest.fn(() => Promise.resolve({ rule: { key: 'foo', name: 'Foo' } }))
+ getRuleDetails: jest.fn(() => Promise.resolve({ rule: { key: 'foo', name: 'Foo' } })),
}));
it('should render', async () => {
diff --git a/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceRuleViewer-test.tsx b/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceRuleViewer-test.tsx
index b800108cd59..ddd892b18e3 100644
--- a/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceRuleViewer-test.tsx
+++ b/server/sonar-web/src/main/js/components/workspace/__tests__/WorkspaceRuleViewer-test.tsx
@@ -67,7 +67,7 @@ it('should close', () => {
it('should call back after load', () => {
const onLoad = jest.fn();
const wrapper = shallowRender({ onLoad });
- const details = wrapper.findWhere(w => w.name().includes('WorkspaceRuleDetails'));
+ const details = wrapper.findWhere((w) => w.name().includes('WorkspaceRuleDetails'));
details.prop<Function>('onLoad')({ name: 'Foo' });
expect(onLoad).toHaveBeenCalledWith({ key: 'foo', name: 'Foo' });
});
diff --git a/server/sonar-web/src/main/js/components/workspace/context.ts b/server/sonar-web/src/main/js/components/workspace/context.ts
index 0b84601c52b..8e305610f20 100644
--- a/server/sonar-web/src/main/js/components/workspace/context.ts
+++ b/server/sonar-web/src/main/js/components/workspace/context.ts
@@ -43,5 +43,5 @@ export interface WorkspaceContextShape {
export const WorkspaceContext = createContext<WorkspaceContextShape>({
externalRulesRepoNames: {},
openComponent: () => {},
- openRule: () => {}
+ openRule: () => {},
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts
index 314efb1c3b5..cbadf4e0461 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts
@@ -55,21 +55,21 @@ describe('#getBrancheLikesAsTree', () => {
branch2Pr2,
branch2Pr1,
branch1Pr2,
- branch1Pr1
+ branch1Pr1,
])
).toEqual({
mainBranchTree: {
branch: main,
- pullRequests: [mainPr2, mainPr1]
+ pullRequests: [mainPr2, mainPr1],
},
branchTree: [
{ branch: branch1, pullRequests: [branch1Pr2, branch1Pr1] },
{ branch: branch2, pullRequests: [branch2Pr2, branch2Pr1] },
{ branch: branch3, pullRequests: [] },
- { branch: branch4, pullRequests: [] }
+ { branch: branch4, pullRequests: [] },
],
parentlessPullRequests: [parentlessPR2, parentlessPR1],
- orphanPullRequests: [orphanPR2, orphanPR1]
+ orphanPullRequests: [orphanPR2, orphanPR1],
});
});
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx b/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx
index 098a88cc325..cbb53517335 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx
+++ b/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx
@@ -150,7 +150,7 @@ function renderDom(codeSnippet: string) {
className="markdown"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
- __html: codeSnippet
+ __html: codeSnippet,
}}
/>
);
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts
index b053ff7746f..22ab410531b 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts
@@ -21,7 +21,7 @@ import { throwGlobalError } from '../error';
import { addGlobalErrorMessage } from '../globalMessages';
jest.mock('../../helpers/globalMessages', () => ({
- addGlobalErrorMessage: jest.fn()
+ addGlobalErrorMessage: jest.fn(),
}));
beforeAll(() => {
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/extensions-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/extensions-test.ts
index 4198e8e1241..7d1c05fa62d 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/extensions-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/extensions-test.ts
@@ -25,8 +25,8 @@ jest.mock('../../app/components/extensions/exposeLibraries', () => jest.fn());
beforeEach(() => {
jest.clearAllMocks();
- document.body.childNodes.forEach(node => document.body.removeChild(node));
- document.head.childNodes.forEach(node => document.head.removeChild(node));
+ document.body.childNodes.forEach((node) => document.body.removeChild(node));
+ document.head.childNodes.forEach((node) => document.head.removeChild(node));
});
describe('installScript', () => {
@@ -52,17 +52,14 @@ describe('getExtensionStart', () => {
beforeEach(() => {
Object.defineProperty(document, 'createElement', {
writable: true,
- value: jest
- .fn()
- .mockReturnValueOnce(scriptTag)
- .mockReturnValueOnce(linkTag)
+ value: jest.fn().mockReturnValueOnce(scriptTag).mockReturnValueOnce(linkTag),
});
});
afterEach(() => {
Object.defineProperty(document, 'createElement', {
writable: true,
- value: originalCreateElement
+ value: originalCreateElement,
});
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/extensionsHandler-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/extensionsHandler-test.ts
index 39c4a4b324f..9d5f031a310 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/extensionsHandler-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/extensionsHandler-test.ts
@@ -21,7 +21,7 @@ import {
getExtensionFromCache,
getWebAnalyticsPageHandlerFromCache,
installExtensionsHandler,
- installWebAnalyticsHandler
+ installWebAnalyticsHandler,
} from '../extensionsHandler';
describe('installExtensionsHandler & extensions.getExtensionFromCache', () => {
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts
index afd4a547a5a..f4396eb62a7 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts
@@ -21,7 +21,7 @@ import { MessageLevel } from '../../types/globalMessages';
import {
addGlobalErrorMessage,
addGlobalSuccessMessage,
- registerListener
+ registerListener,
} from '../globalMessages';
it('should work as expected', () => {
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/handleRequiredAuthentication-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/handleRequiredAuthentication-test.ts
index eb637128ec4..713472f3b4f 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/handleRequiredAuthentication-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/handleRequiredAuthentication-test.ts
@@ -29,18 +29,18 @@ beforeAll(() => {
pathname: '/path',
search: '?id=12',
hash: '#tag',
- replace
+ replace,
};
Object.defineProperty(window, 'location', {
writable: true,
- value: location
+ value: location,
});
});
afterAll(() => {
Object.defineProperty(window, 'location', {
writable: true,
- value: originalLocation
+ value: originalLocation,
});
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts
index fa22f0c1d17..75044ae08ce 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts
@@ -39,8 +39,8 @@ it('should populate comments data', () => {
active: true,
avatar: 'c1244e6857f7be3dc4549d9e9d51c631',
login: 'admin',
- name: 'Admin Admin'
- }
+ name: 'Admin Admin',
+ },
];
const issue = {
comments: [
@@ -50,9 +50,9 @@ it('should populate comments data', () => {
key: 'AVtcKbZkQmGLa7yW8J71',
login: 'admin',
markdown: 'comment!',
- updatable: true
- }
- ]
+ updatable: true,
+ },
+ ],
} as any;
expect(parseIssueFromResponse(issue, undefined, users, undefined).comments).toEqual([
{
@@ -66,8 +66,8 @@ it('should populate comments data', () => {
key: 'AVtcKbZkQmGLa7yW8J71',
login: undefined,
markdown: 'comment!',
- updatable: true
- }
+ updatable: true,
+ },
]);
});
@@ -78,60 +78,60 @@ it('orders secondary locations', () => {
locations: [
{
component: 'foo',
- textRange: { startLine: 68, startOffset: 5, endLine: 68, endOffset: 7 }
- }
- ]
+ textRange: { startLine: 68, startOffset: 5, endLine: 68, endOffset: 7 },
+ },
+ ],
},
{
locations: [
{
component: 'unknown',
- textRange: { startLine: 43, startOffset: 8, endLine: 43, endOffset: 12 }
- }
- ]
+ textRange: { startLine: 43, startOffset: 8, endLine: 43, endOffset: 12 },
+ },
+ ],
},
{
locations: [
{
component: 'bar',
- textRange: { startLine: 43, startOffset: 6, endLine: 43, endOffset: 8 }
- }
- ]
+ textRange: { startLine: 43, startOffset: 6, endLine: 43, endOffset: 8 },
+ },
+ ],
},
{
locations: [
{
component: 'foo',
- textRange: { startLine: 70, startOffset: 12, endLine: 70, endOffset: 16 }
- }
- ]
- }
- ]
+ textRange: { startLine: 70, startOffset: 12, endLine: 70, endOffset: 16 },
+ },
+ ],
+ },
+ ],
} as any;
const components = [
{ key: 'foo', name: 'src/foo.js' },
- { key: 'bar', name: 'src/bar.js' }
+ { key: 'bar', name: 'src/bar.js' },
];
expect(parseIssueFromResponse(issue, components).secondaryLocations).toEqual([
{
component: 'bar',
componentName: 'src/bar.js',
- textRange: { endLine: 43, endOffset: 8, startLine: 43, startOffset: 6 }
+ textRange: { endLine: 43, endOffset: 8, startLine: 43, startOffset: 6 },
},
{
component: 'unknown',
componentName: undefined,
- textRange: { endLine: 43, endOffset: 12, startLine: 43, startOffset: 8 }
+ textRange: { endLine: 43, endOffset: 12, startLine: 43, startOffset: 8 },
},
{
component: 'foo',
componentName: 'src/foo.js',
- textRange: { endLine: 68, endOffset: 7, startLine: 68, startOffset: 5 }
+ textRange: { endLine: 68, endOffset: 7, startLine: 68, startOffset: 5 },
},
{
component: 'foo',
componentName: 'src/foo.js',
- textRange: { endLine: 70, endOffset: 16, startLine: 70, startOffset: 12 }
- }
+ textRange: { endLine: 70, endOffset: 16, startLine: 70, startOffset: 12 },
+ },
]);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts
index 346d097dce8..04f09640897 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts
@@ -27,7 +27,7 @@ import {
getWeekDayName,
hasMessage,
translate,
- translateWithParameters
+ translateWithParameters,
} from '../l10n';
import { getMessages } from '../l10nBundle';
@@ -36,7 +36,7 @@ const MSG = 'my_message';
jest.unmock('../l10n');
jest.mock('../l10nBundle', () => ({
- getMessages: jest.fn().mockReturnValue({})
+ getMessages: jest.fn().mockReturnValue({}),
}));
const resetMessages = (messages: Dict<string>) =>
@@ -50,7 +50,7 @@ describe('hasMessage', () => {
it('should return that the message exists', () => {
resetMessages({
foo: 'foo',
- 'foo.bar': 'foobar'
+ 'foo.bar': 'foobar',
});
expect(hasMessage('foo')).toBe(true);
expect(hasMessage('foo', 'bar')).toBe(true);
@@ -101,7 +101,7 @@ describe('translateWithParameters', () => {
it('should translate message with several parameters', () => {
resetMessages({
- x_apples: '{0}: I have {2} apples in my {1} baskets - {3}'
+ x_apples: '{0}: I have {2} apples in my {1} baskets - {3}',
});
expect(translateWithParameters('x_apples', 1, 2, 3, 4)).toBe(
'1: I have 3 apples in my 2 baskets - 4'
@@ -130,7 +130,7 @@ describe('getLocalizedMetricName', () => {
it('should return the metric short name', () => {
resetMessages({
- 'metric.new_code.short_name': 'metric.new_code.short_name_t'
+ 'metric.new_code.short_name': 'metric.new_code.short_name_t',
});
expect(getLocalizedMetricName(metric, true)).toBe('metric.new_code.short_name_t');
});
@@ -152,7 +152,7 @@ describe('getLocalizedMetricName', () => {
describe('getLocalizedCategoryMetricName', () => {
it('should return metric category name translation', () => {
resetMessages({
- 'metric.new_code.extra_short_name': 'metric.new_code.extra_short_name_t'
+ 'metric.new_code.extra_short_name': 'metric.new_code.extra_short_name_t',
});
expect(getLocalizedCategoryMetricName({ key: 'new_code' })).toBe(
'metric.new_code.extra_short_name_t'
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts
index 58c1e603b51..b152187debd 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts
@@ -28,8 +28,8 @@ beforeEach(() => {
jest.mock('../../api/l10n', () => ({
fetchL10nBundle: jest.fn().mockResolvedValue({
effectiveLocale: 'de',
- messages: { foo: 'Foo', 'foo.bar': 'Foo Bar' }
- })
+ messages: { foo: 'Foo', 'foo.bar': 'Foo Bar' },
+ }),
}));
describe('#loadL10nBundle', () => {
@@ -41,7 +41,7 @@ describe('#loadL10nBundle', () => {
it('should ftech bundle without local storage timestamp if locales are different', async () => {
const cachedBundle = { timestamp: 'timestamp', locale: 'fr', messages: { cache: 'cache' } };
- ((window as unknown) as any).sonarQubeL10nBundle = cachedBundle;
+ (window as unknown as any).sonarQubeL10nBundle = cachedBundle;
await loadL10nBundle();
@@ -50,7 +50,7 @@ describe('#loadL10nBundle', () => {
it('should fetch bundle with cached bundle timestamp and browser locale', async () => {
const cachedBundle = { timestamp: 'timestamp', locale: 'de', messages: { cache: 'cache' } };
- ((window as unknown) as any).sonarQubeL10nBundle = cachedBundle;
+ (window as unknown as any).sonarQubeL10nBundle = cachedBundle;
await loadL10nBundle();
@@ -60,7 +60,7 @@ describe('#loadL10nBundle', () => {
it('should fallback to cached bundle if the server respond with 304', async () => {
const cachedBundle = { timestamp: 'timestamp', locale: 'fr', messages: { cache: 'cache' } };
(fetchL10nBundle as jest.Mock).mockRejectedValueOnce({ status: 304 });
- ((window as unknown) as any).sonarQubeL10nBundle = cachedBundle;
+ (window as unknown as any).sonarQubeL10nBundle = cachedBundle;
const bundle = await loadL10nBundle();
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts
index 840d92d4bde..2c7d78e0dd4 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts
@@ -24,7 +24,7 @@ import {
enhanceConditionWithMeasure,
formatMeasure,
getMinDecimalsCountToBeDistinctFromThreshold,
- isPeriodBestValue
+ isPeriodBestValue,
} from '../measures';
import { mockQualityGateStatusCondition } from '../mocks/quality-gates';
import { mockMeasureEnhanced, mockMetric } from '../testMocks';
@@ -33,7 +33,7 @@ jest.unmock('../l10n');
jest.mock('../l10nBundle', () => ({
getCurrentLocale: jest.fn().mockReturnValue('us'),
- getMessages: jest.fn().mockReturnValue({})
+ getMessages: jest.fn().mockReturnValue({}),
}));
const resetMessages = (messages: Dict<string>) =>
@@ -50,7 +50,7 @@ beforeAll(() => {
'metric.level.OK': 'Ok',
'short_number_suffix.g': 'G',
'short_number_suffix.k': 'k',
- 'short_number_suffix.m': 'M'
+ 'short_number_suffix.m': 'M',
});
});
@@ -63,22 +63,22 @@ describe('enhanceConditionWithMeasure', () => {
it('should correctly map enhance conditions with measure data', () => {
const measures = [
mockMeasureEnhanced({ metric: mockMetric({ key: 'bugs' }), period: undefined }),
- mockMeasureEnhanced({ metric: mockMetric({ key: 'new_bugs' }) })
+ mockMeasureEnhanced({ metric: mockMetric({ key: 'new_bugs' }) }),
];
expect(
enhanceConditionWithMeasure(mockQualityGateStatusCondition({ metric: 'bugs' }), measures)
).toMatchObject({
- measure: expect.objectContaining({ metric: expect.objectContaining({ key: 'bugs' }) })
+ measure: expect.objectContaining({ metric: expect.objectContaining({ key: 'bugs' }) }),
});
expect(
enhanceConditionWithMeasure(mockQualityGateStatusCondition({ metric: 'new_bugs' }), measures)
).toMatchObject({
measure: expect.objectContaining({
- metric: expect.objectContaining({ key: 'new_bugs' })
+ metric: expect.objectContaining({ key: 'new_bugs' }),
}),
- period: 1
+ period: 1,
});
});
@@ -261,7 +261,7 @@ describe('getMinDecimalsCountToBeDistinctFromThreshold', () => {
});
it('should return 1 if the delta is larger than 0.1', () => {
- [0.1, 0.15, 0.2, 0.5, 0.8, 1].forEach(delta => {
+ [0.1, 0.15, 0.2, 0.5, 0.8, 1].forEach((delta) => {
expect(getMinDecimalsCountToBeDistinctFromThreshold(2.5 + delta, 2.5)).toBe(1);
expect(getMinDecimalsCountToBeDistinctFromThreshold(2.5 - delta, 2.5)).toBe(1);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/pages-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/pages-test.ts
index e4086984f96..c79eebc57aa 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/pages-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/pages-test.ts
@@ -23,14 +23,14 @@ import {
addWhitePageClass,
removeNoFooterPageClass,
removeSideBarClass,
- removeWhitePageClass
+ removeWhitePageClass,
} from '../pages';
describe('class adders', () => {
it.each([
[addSideBarClass, 'sidebar-page'],
[addNoFooterPageClass, 'no-footer-page'],
- [addWhitePageClass, 'white-page']
+ [addWhitePageClass, 'white-page'],
])('%s should add the class', (fct, cls) => {
const toggle = jest.spyOn(document.body.classList, 'toggle');
fct();
@@ -42,7 +42,7 @@ describe('class removers', () => {
it.each([
[removeSideBarClass, 'sidebar-page'],
[removeNoFooterPageClass, 'no-footer-page'],
- [removeWhitePageClass, 'white-page']
+ [removeWhitePageClass, 'white-page'],
])('%s should add the class', (fct, cls) => {
const toggle = jest.spyOn(document.body.classList, 'toggle');
fct();
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts
index 6f67bde8efe..43c853c0552 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts
@@ -23,7 +23,7 @@ import {
cutLongWords,
fileFromPath,
limitComponentName,
- splitPath
+ splitPath,
} from '../path';
describe('#collapsedDirFromPath()', () => {
@@ -109,7 +109,7 @@ describe('splitPath', () => {
expect(splitPath('my/super/path')).toEqual({ head: 'my/super', tail: 'path' });
expect(splitPath('my/super/very/long/path')).toEqual({
head: 'my/super/very/long',
- tail: 'path'
+ tail: 'path',
});
});
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/periods-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/periods-test.ts
index 05ddee8a84c..1b0aeb6a41c 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/periods-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/periods-test.ts
@@ -20,7 +20,7 @@
import { getPeriodLabel } from '../periods';
import { mockPeriod } from '../testMocks';
-const formatter = jest.fn(v => v);
+const formatter = jest.fn((v) => v);
beforeEach(() => {
formatter.mockClear();
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts
index e54ee2d5a9c..270074f0b4b 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts
@@ -19,11 +19,11 @@
*/
import {
mockQualityGateApplicationStatus,
- mockQualityGateProjectStatus
+ mockQualityGateProjectStatus,
} from '../mocks/quality-gates';
import {
extractStatusConditionsFromApplicationStatusChildProject,
- extractStatusConditionsFromProjectStatus
+ extractStatusConditionsFromProjectStatus,
} from '../qualityGates';
describe('extractStatusConditionsFromProjectStatus', () => {
@@ -35,8 +35,8 @@ describe('extractStatusConditionsFromProjectStatus', () => {
level: 'OK',
metric: 'new_bugs',
op: 'GT',
- period: 1
- }
+ period: 1,
+ },
]);
});
});
@@ -54,7 +54,7 @@ describe('extractStatusConditionsFromApplicationStatusChildProject', () => {
level: 'ERROR',
metric: 'coverage',
op: 'GT',
- period: undefined
+ period: undefined,
},
{
actual: '5',
@@ -62,8 +62,8 @@ describe('extractStatusConditionsFromApplicationStatusChildProject', () => {
level: 'ERROR',
metric: 'new_bugs',
op: 'GT',
- period: 1
- }
+ period: 1,
+ },
]);
});
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/query-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/query-test.ts
index ca05d0dea2a..144718d7437 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/query-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/query-test.ts
@@ -67,7 +67,7 @@ describe('parseAsOptionalArray', () => {
expect(query.parseAsOptionalArray('true,false,false', query.parseAsBoolean)).toEqual([
true,
false,
- false
+ false,
]);
expect(query.parseAsOptionalArray(undefined, query.parseAsString)).toBeUndefined();
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/ratings-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/ratings-test.ts
index 43ba52a543a..43fa5074cbc 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/ratings-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/ratings-test.ts
@@ -23,7 +23,7 @@ import {
getDuplicationsRatingAverageValue,
getDuplicationsRatingLabel,
getSizeRatingAverageValue,
- getSizeRatingLabel
+ getSizeRatingLabel,
} from '../ratings';
describe('getCoverageRatingLabel', () => {
@@ -37,7 +37,7 @@ describe('getCoverageRatingLabel', () => {
[2, '70% - 80%'],
[3, '50% - 70%'],
[4, '30% - 50%'],
- [5, '< 30%']
+ [5, '< 30%'],
])('should return the correct label for %s', (rating, label) => {
expect(getCoverageRatingLabel(rating)).toBe(label);
});
@@ -49,7 +49,7 @@ describe('getCoverageRatingAverageValue', () => {
[2, 75],
[3, 60],
[4, 40],
- [5, 15]
+ [5, 15],
])('should return the correct value', (rating, value) => {
expect(getCoverageRatingAverageValue(rating)).toBe(value);
});
@@ -66,7 +66,7 @@ describe('getDuplicationsRatingLabel', () => {
[2, '3% - 5%'],
[3, '5% - 10%'],
[4, '10% - 20%'],
- [5, '> 20%']
+ [5, '> 20%'],
])('should return the correct label for %s', (rating, label) => {
expect(getDuplicationsRatingLabel(rating)).toBe(label);
});
@@ -78,7 +78,7 @@ describe('getDuplicationsRatingAverageValue', () => {
[2, 4],
[3, 7.5],
[4, 15],
- [5, 30]
+ [5, 30],
])('should return the correct value', (rating, value) => {
expect(getDuplicationsRatingAverageValue(rating)).toBe(value);
});
@@ -95,7 +95,7 @@ describe('getSizeRatingLabel', () => {
[2, '1k - 10k'],
[3, '10k - 100k'],
[4, '100k - 500k'],
- [5, '> 500k']
+ [5, '> 500k'],
])('should return the correct label for %s', (rating, label) => {
expect(getSizeRatingLabel(rating)).toBe(label);
});
@@ -107,7 +107,7 @@ describe('getSizeRatingAverageValue', () => {
[2, 5000],
[3, 50000],
[4, 250000],
- [5, 750000]
+ [5, 750000],
])('should return the correct value', (rating, value) => {
expect(getSizeRatingAverageValue(rating)).toBe(value);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts
index 99be07950fa..3475758f87a 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts
@@ -34,7 +34,7 @@ import {
post,
postJSON,
postJSONBody,
- requestTryAndRepeatUntil
+ requestTryAndRepeatUntil,
} from '../request';
jest.mock('../handleRequiredAuthentication', () => jest.fn());
@@ -89,7 +89,7 @@ describe('getText', () => {
describe('parseError', () => {
it('should parse error and return the message', async () => {
const response = new Response(JSON.stringify({ errors: [{ msg: 'Error1' }] }), {
- status: HttpStatus.BadRequest
+ status: HttpStatus.BadRequest,
});
await expect(parseError(response)).resolves.toBe('Error1');
});
@@ -168,7 +168,7 @@ describe('postJSONBody', () => {
expect.objectContaining({
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
body: '{"nested":{"data":"test","withArray":[1,2]}}',
- method: 'POST'
+ method: 'POST',
})
);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/scrolling-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/scrolling-test.ts
index 47272979ca4..cf224a6255c 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/scrolling-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/scrolling-test.ts
@@ -222,5 +222,5 @@ const mockGetBoundingClientRect = (overrides: Partial<ClientRect>) => () =>
right: 0,
top: 0,
width: 0,
- ...overrides
+ ...overrides,
} as DOMRect);
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts
index 1032221e971..1cf4415e658 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts
@@ -26,18 +26,18 @@ import {
renderPciDss32Category,
renderPciDss40Category,
renderSansTop25Category,
- renderSonarSourceSecurityCategory
+ renderSonarSourceSecurityCategory,
} from '../security-standard';
describe('renderCWECategory', () => {
const standards: Standards = {
cwe: {
'1004': {
- title: "Sensitive Cookie Without 'HttpOnly' Flag"
+ title: "Sensitive Cookie Without 'HttpOnly' Flag",
},
unknown: {
- title: 'No CWE associated'
- }
+ title: 'No CWE associated',
+ },
},
owaspTop10: {},
'owaspTop10-2021': {},
@@ -45,7 +45,7 @@ describe('renderCWECategory', () => {
sonarsourceSecurity: {},
'pciDss-3.2': {},
'pciDss-4.0': {},
- 'owaspAsvs-4.0': {}
+ 'owaspAsvs-4.0': {},
};
it('should render cwe categories correctly', () => {
expect(renderCWECategory(standards, '1004')).toEqual(
@@ -61,15 +61,15 @@ describe('renderOwaspTop10Category', () => {
cwe: {},
owaspTop10: {
a1: {
- title: 'Injection'
- }
+ title: 'Injection',
+ },
},
'owaspTop10-2021': {},
sansTop25: {},
sonarsourceSecurity: {},
'pciDss-3.2': {},
'pciDss-4.0': {},
- 'owaspAsvs-4.0': {}
+ 'owaspAsvs-4.0': {},
};
it('should render owasp categories correctly', () => {
expect(renderOwaspTop10Category(standards, 'a1')).toEqual('A1 - Injection');
@@ -85,14 +85,14 @@ describe('renderOwaspTop102021Category', () => {
owaspTop10: {},
'owaspTop10-2021': {
a1: {
- title: 'Injection'
- }
+ title: 'Injection',
+ },
},
sansTop25: {},
sonarsourceSecurity: {},
'pciDss-3.2': {},
'pciDss-4.0': {},
- 'owaspAsvs-4.0': {}
+ 'owaspAsvs-4.0': {},
};
it('should render owasp categories correctly', () => {
expect(renderOwaspTop102021Category(standards, 'a1')).toEqual('A1 - Injection');
@@ -111,11 +111,11 @@ describe('renderPciDss32Category', () => {
sonarsourceSecurity: {},
'pciDss-3.2': {
'1': {
- title: 'Install and maintain a firewall configuration to protect cardholder data'
- }
+ title: 'Install and maintain a firewall configuration to protect cardholder data',
+ },
},
'pciDss-4.0': {},
- 'owaspAsvs-4.0': {}
+ 'owaspAsvs-4.0': {},
};
it('should render Pci Dss 3.2 correctly', () => {
expect(renderPciDss32Category(standards, '1')).toEqual(
@@ -135,10 +135,10 @@ describe('renderPciDss40Category', () => {
'pciDss-3.2': {},
'pciDss-4.0': {
'1': {
- title: 'Install and maintain a firewall configuration to protect cardholder data'
- }
+ title: 'Install and maintain a firewall configuration to protect cardholder data',
+ },
},
- 'owaspAsvs-4.0': {}
+ 'owaspAsvs-4.0': {},
};
it('should render Pci Dss 4.0 correctly', () => {
expect(renderPciDss40Category(standards, '1')).toEqual(
@@ -159,13 +159,13 @@ describe('renderOwaspAsvs40Category', () => {
'pciDss-4.0': {},
'owaspAsvs-4.0': {
'1': {
- title: 'Main category'
+ title: 'Main category',
},
'1.1': {
title: 'Sub category',
- level: '2'
- }
- }
+ level: '2',
+ },
+ },
};
it('should render OwaspAsvs 4.0 correctly', () => {
expect(renderOwaspAsvs40Category(standards, '1')).toEqual('1 - Main category');
@@ -180,13 +180,13 @@ describe('renderSansTop25Category', () => {
'owaspTop10-2021': {},
sansTop25: {
'insecure-interaction': {
- title: 'Insecure Interaction Between Components'
- }
+ title: 'Insecure Interaction Between Components',
+ },
},
sonarsourceSecurity: {},
'pciDss-3.2': {},
'pciDss-4.0': {},
- 'owaspAsvs-4.0': {}
+ 'owaspAsvs-4.0': {},
};
it('should render sans categories correctly', () => {
expect(renderSansTop25Category(standards, 'insecure-interaction')).toEqual(
@@ -208,15 +208,15 @@ describe('renderSonarSourceSecurityCategory', () => {
sansTop25: {},
sonarsourceSecurity: {
xss: {
- title: 'Cross-Site Scripting (XSS)'
+ title: 'Cross-Site Scripting (XSS)',
},
others: {
- title: 'Others'
- }
+ title: 'Others',
+ },
},
'pciDss-3.2': {},
'pciDss-4.0': {},
- 'owaspAsvs-4.0': {}
+ 'owaspAsvs-4.0': {},
};
it('should render sonarsource categories correctly', () => {
expect(renderSonarSourceSecurityCategory(standards, 'xss')).toEqual(
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts
index bb961c22932..0b1627a11c5 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/sonarlint-test.ts
@@ -24,7 +24,7 @@ import {
openHotspot,
portIsValid,
probeSonarLintServers,
- sendUserToken
+ sendUserToken,
} from '../sonarlint';
describe('buildPortRange', () => {
@@ -79,7 +79,7 @@ describe('portIsValid', () => {
[64120, true],
[64125, true],
[64130, true],
- [64131, false]
+ [64131, false],
])('should validate port %s is within the expected range', (port, expectation) => {
expect(portIsValid(port)).toBe(expectation);
});
@@ -93,7 +93,7 @@ describe('sendUserToken', () => {
createdAt: '12-12-2018',
expirationDate: '17-02-2019',
token: '78gfh78d6gf8h',
- type: TokenType.User
+ type: TokenType.User,
};
const resp = new Response();
@@ -119,7 +119,7 @@ describe('sendUserToken', () => {
createdAt: '12-12-2018',
expirationDate: '17-02-2019',
token: '78gfh78d6gf8h',
- type: TokenType.User
+ type: TokenType.User,
};
const resp = new Response('Meh', { status: HttpStatus.BadRequest, statusText: 'I no likez' });
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts
index ccda3a4150e..aa26829af90 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts
@@ -27,7 +27,7 @@ describe('stringify', () => {
prop3: true,
prop4: '',
prop5: [9, 8, 7],
- prop6: { test: 'test' }
+ prop6: { test: 'test' },
};
expect(stringify(obj)).toEqual(
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts
index 7eb89b9d88a..4f9e9fbb180 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts
@@ -26,7 +26,7 @@ describe('#decodeJwt', () => {
exp: 1541062205,
iat: 1541058605,
iss: 'ari:cloud:bitbucket::app/{327713ed-f1b2-4659-9c91-c8ecf8be7f3e}/sonarcloud-greg',
- qsh: 'a6c93addd971c05d08da1e1669c2640fba529e98fbb5b2b9effadf00bf484277'
+ qsh: 'a6c93addd971c05d08da1e1669c2640fba529e98fbb5b2b9effadf00bf484277',
};
expect(
decodeJwt(
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts
index 8b871e5b839..f09b1c6da07 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts
@@ -27,19 +27,19 @@ import {
computeTokenExpirationDate,
EXPIRATION_OPTIONS,
getAvailableExpirationOptions,
- getNextTokenName
+ getNextTokenName,
} from '../tokens';
jest.mock('../../api/settings', () => {
return {
- getAllValues: jest.fn().mockResolvedValue([])
+ getAllValues: jest.fn().mockResolvedValue([]),
};
});
jest.mock('../dates', () => {
return {
...jest.requireActual('../dates'),
- now: jest.fn(() => new Date('2022-06-01T12:00:00Z'))
+ now: jest.fn(() => new Date('2022-06-01T12:00:00Z')),
};
});
@@ -50,21 +50,21 @@ describe('getAvailableExpirationOptions', () => {
it('should correctly return all options if the max setting is no expiration', async () => {
(getAllValues as jest.Mock).mockResolvedValueOnce([
- mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: 'No expiration' })
+ mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: 'No expiration' }),
]);
expect(await getAvailableExpirationOptions()).toEqual(EXPIRATION_OPTIONS);
});
it('should correctly limit options if the max setting is 1 year', async () => {
(getAllValues as jest.Mock).mockResolvedValueOnce([
- mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '1 year' })
+ mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '1 year' }),
]);
expect(await getAvailableExpirationOptions()).toEqual(
[TokenExpiration.OneMonth, TokenExpiration.ThreeMonths, TokenExpiration.OneYear].map(
- value => {
+ (value) => {
return {
value,
- label: `users.tokens.expiration.${value.toString()}`
+ label: `users.tokens.expiration.${value.toString()}`,
};
}
)
@@ -73,13 +73,13 @@ describe('getAvailableExpirationOptions', () => {
it('should correctly limit options if the max setting is 3 months', async () => {
(getAllValues as jest.Mock).mockResolvedValueOnce([
- mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '90 days' })
+ mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '90 days' }),
]);
expect(await getAvailableExpirationOptions()).toEqual(
- [TokenExpiration.OneMonth, TokenExpiration.ThreeMonths].map(value => {
+ [TokenExpiration.OneMonth, TokenExpiration.ThreeMonths].map((value) => {
return {
value,
- label: `users.tokens.expiration.${value.toString()}`
+ label: `users.tokens.expiration.${value.toString()}`,
};
})
);
@@ -87,13 +87,13 @@ describe('getAvailableExpirationOptions', () => {
it('should correctly limit options if the max setting is 30 days', async () => {
(getAllValues as jest.Mock).mockResolvedValueOnce([
- mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '30 days' })
+ mockSettingValue({ key: SettingsKey.TokenMaxAllowedLifetime, value: '30 days' }),
]);
expect(await getAvailableExpirationOptions()).toEqual([
{
value: TokenExpiration.OneMonth,
- label: `users.tokens.expiration.${TokenExpiration.OneMonth.toString()}`
- }
+ label: `users.tokens.expiration.${TokenExpiration.OneMonth.toString()}`,
+ },
]);
});
});
@@ -102,7 +102,7 @@ describe('computeTokenExpirationDate', () => {
it.each([
[TokenExpiration.OneMonth, '2022-07-01'],
[TokenExpiration.ThreeMonths, '2022-08-30'],
- [TokenExpiration.OneYear, '2023-06-01']
+ [TokenExpiration.OneYear, '2023-06-01'],
])('should correctly compute the proper expiration date for %s days', (days, expected) => {
expect(computeTokenExpirationDate(days)).toBe(expected);
});
@@ -122,7 +122,7 @@ describe('getNextTokenName', () => {
mockUserToken({ name: `${tokenName}` }),
mockUserToken({ name: `${tokenName}-1` }),
mockUserToken({ name: `${tokenName}-2` }),
- mockUserToken({ name: `${tokenName}-4` })
+ mockUserToken({ name: `${tokenName}-4` }),
];
expect(getNextTokenName(tokenName, tokens)).toBe(`${tokenName}-3`);
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts
index 8842d94dfed..2eb3c084b2e 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts
@@ -44,7 +44,7 @@ import {
isRelativeUrl,
queryToSearch,
searchParamsToQuery,
- stripTrailingSlash
+ stripTrailingSlash,
} from '../urls';
const SIMPLE_COMPONENT_KEY = 'sonarqube';
@@ -73,17 +73,17 @@ describe('getComponentAdminUrl', () => {
[
'Portfolio',
ComponentQualifier.Portfolio,
- { pathname: '/project/admin/extension/governance/console', search: '?id=key&qualifier=VW' }
+ { pathname: '/project/admin/extension/governance/console', search: '?id=key&qualifier=VW' },
],
[
'Application',
ComponentQualifier.Application,
{
pathname: '/project/admin/extension/developer-server/application-console',
- search: '?id=key'
- }
+ search: '?id=key',
+ },
],
- ['Project', ComponentQualifier.Project, { pathname: '/dashboard', search: '?id=key' }]
+ ['Project', ComponentQualifier.Project, { pathname: '/dashboard', search: '?id=key' }],
])('should work for %s', (_qualifierName, qualifier, result) => {
expect(getComponentAdminUrl('key', qualifier)).toEqual(result);
});
@@ -94,7 +94,7 @@ describe('#getComponentIssuesUrl', () => {
expect(getComponentIssuesUrl(SIMPLE_COMPONENT_KEY)).toEqual(
expect.objectContaining({
pathname: '/project/issues',
- search: queryToSearch({ id: SIMPLE_COMPONENT_KEY })
+ search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
})
);
});
@@ -103,7 +103,7 @@ describe('#getComponentIssuesUrl', () => {
expect(getComponentIssuesUrl(SIMPLE_COMPONENT_KEY, { resolved: 'false' })).toEqual(
expect.objectContaining({
pathname: '/project/issues',
- search: queryToSearch({ resolved: 'false', id: SIMPLE_COMPONENT_KEY })
+ search: queryToSearch({ resolved: 'false', id: SIMPLE_COMPONENT_KEY }),
})
);
});
@@ -114,7 +114,7 @@ describe('#getComponentSecurityHotspotsUrl', () => {
expect(getComponentSecurityHotspotsUrl(SIMPLE_COMPONENT_KEY)).toEqual(
expect.objectContaining({
pathname: '/security_hotspots',
- search: queryToSearch({ id: SIMPLE_COMPONENT_KEY })
+ search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
})
);
});
@@ -130,7 +130,7 @@ describe('#getComponentSecurityHotspotsUrl', () => {
[SecurityStandard.SONARSOURCE]: 'command-injection',
[SecurityStandard.PCI_DSS_3_2]: '4.2',
[SecurityStandard.PCI_DSS_4_0]: '4.1',
- ignoredParam: '1234'
+ ignoredParam: '1234',
})
).toEqual(
expect.objectContaining({
@@ -144,8 +144,8 @@ describe('#getComponentSecurityHotspotsUrl', () => {
[SecurityStandard.SANS_TOP25]: 'insecure-interaction',
[SecurityStandard.CWE]: '213',
[SecurityStandard.PCI_DSS_3_2]: '4.2',
- [SecurityStandard.PCI_DSS_4_0]: '4.1'
- })
+ [SecurityStandard.PCI_DSS_4_0]: '4.1',
+ }),
})
);
});
@@ -156,7 +156,7 @@ describe('#getComponentOverviewUrl', () => {
expect(getComponentOverviewUrl(SIMPLE_COMPONENT_KEY, ComponentQualifier.Portfolio)).toEqual(
expect.objectContaining({
pathname: '/portfolio',
- search: queryToSearch({ id: SIMPLE_COMPONENT_KEY })
+ search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
})
);
});
@@ -164,7 +164,7 @@ describe('#getComponentOverviewUrl', () => {
expect(getComponentOverviewUrl(SIMPLE_COMPONENT_KEY, ComponentQualifier.SubPortfolio)).toEqual(
expect.objectContaining({
pathname: '/portfolio',
- search: queryToSearch({ id: SIMPLE_COMPONENT_KEY })
+ search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
})
);
});
@@ -172,7 +172,7 @@ describe('#getComponentOverviewUrl', () => {
expect(getComponentOverviewUrl(SIMPLE_COMPONENT_KEY, ComponentQualifier.Project)).toEqual(
expect.objectContaining({
pathname: '/dashboard',
- search: queryToSearch({ id: SIMPLE_COMPONENT_KEY })
+ search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
})
);
});
@@ -187,7 +187,7 @@ describe('#getComponentOverviewUrl', () => {
).toEqual(
expect.objectContaining({
pathname: '/dashboard',
- search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, code_scope: 'new' })
+ search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, code_scope: 'new' }),
})
);
});
@@ -202,7 +202,7 @@ describe('#getComponentOverviewUrl', () => {
).toEqual(
expect.objectContaining({
pathname: '/dashboard',
- search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, code_scope: 'overall' })
+ search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, code_scope: 'overall' }),
})
);
});
@@ -210,7 +210,7 @@ describe('#getComponentOverviewUrl', () => {
expect(getComponentOverviewUrl(SIMPLE_COMPONENT_KEY, ComponentQualifier.Application)).toEqual(
expect.objectContaining({
pathname: '/dashboard',
- search: queryToSearch({ id: SIMPLE_COMPONENT_KEY })
+ search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
})
);
});
@@ -223,7 +223,7 @@ describe('#getComponentDrilldownUrl', () => {
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
- search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, metric: METRIC })
+ search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, metric: METRIC }),
})
);
});
@@ -234,7 +234,7 @@ describe('#getComponentDrilldownUrl', () => {
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
- search: queryToSearch({ id: COMPLEX_COMPONENT_KEY, metric: METRIC })
+ search: queryToSearch({ id: COMPLEX_COMPONENT_KEY, metric: METRIC }),
})
);
});
@@ -245,7 +245,7 @@ describe('#getComponentDrilldownUrl', () => {
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
- search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, metric: METRIC })
+ search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, metric: METRIC }),
})
);
@@ -254,7 +254,7 @@ describe('#getComponentDrilldownUrl', () => {
componentKey: SIMPLE_COMPONENT_KEY,
metric: METRIC,
listView: true,
- asc: false
+ asc: false,
})
).toEqual(
expect.objectContaining({
@@ -263,8 +263,8 @@ describe('#getComponentDrilldownUrl', () => {
id: SIMPLE_COMPONENT_KEY,
metric: METRIC,
view: 'list',
- asc: 'false'
- })
+ asc: 'false',
+ }),
})
);
});
@@ -280,8 +280,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
search: queryToSearch({
id: SIMPLE_COMPONENT_KEY,
metric: METRIC,
- selected: COMPLEX_COMPONENT_KEY
- })
+ selected: COMPLEX_COMPONENT_KEY,
+ }),
})
);
});
@@ -301,8 +301,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
id: SIMPLE_COMPONENT_KEY,
metric: METRIC,
branch: 'foo',
- selected: COMPLEX_COMPONENT_KEY
- })
+ selected: COMPLEX_COMPONENT_KEY,
+ }),
})
);
});
@@ -323,8 +323,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
id: SIMPLE_COMPONENT_KEY,
metric: METRIC,
view: 'list',
- selected: COMPLEX_COMPONENT_KEY
- })
+ selected: COMPLEX_COMPONENT_KEY,
+ }),
})
);
@@ -343,8 +343,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
id: SIMPLE_COMPONENT_KEY,
metric: METRIC,
view: 'treemap',
- selected: COMPLEX_COMPONENT_KEY
- })
+ selected: COMPLEX_COMPONENT_KEY,
+ }),
})
);
@@ -363,8 +363,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
id: SIMPLE_COMPONENT_KEY,
metric: METRIC,
pullRequest: '1',
- selected: COMPLEX_COMPONENT_KEY
- })
+ selected: COMPLEX_COMPONENT_KEY,
+ }),
})
);
});
@@ -374,13 +374,13 @@ describe('getDeprecatedActiveRulesUrl', () => {
it('should include query params', () => {
expect(getDeprecatedActiveRulesUrl({ languages: 'js' })).toEqual({
pathname: '/coding_rules',
- search: '?languages=js&activation=true&statuses=DEPRECATED'
+ search: '?languages=js&activation=true&statuses=DEPRECATED',
});
});
it('should handle empty query', () => {
expect(getDeprecatedActiveRulesUrl()).toEqual({
pathname: '/coding_rules',
- search: '?activation=true&statuses=DEPRECATED'
+ search: '?activation=true&statuses=DEPRECATED',
});
});
});
@@ -397,7 +397,7 @@ describe('#getIssuesUrl', () => {
const type = IssueType.Bug;
expect(getIssuesUrl({ type })).toEqual({
pathname: '/issues',
- search: queryToSearch({ type })
+ search: queryToSearch({ type }),
});
});
});
@@ -406,11 +406,11 @@ describe('#getGlobalSettingsUrl', () => {
it('should work as expected', () => {
expect(getGlobalSettingsUrl('foo')).toEqual({
pathname: '/admin/settings',
- search: queryToSearch({ category: 'foo' })
+ search: queryToSearch({ category: 'foo' }),
});
expect(getGlobalSettingsUrl('foo', { alm: AlmKeys.GitHub })).toEqual({
pathname: '/admin/settings',
- search: queryToSearch({ category: 'foo', alm: AlmKeys.GitHub })
+ search: queryToSearch({ category: 'foo', alm: AlmKeys.GitHub }),
});
});
});
@@ -419,11 +419,11 @@ describe('#getProjectSettingsUrl', () => {
it('should work as expected', () => {
expect(getProjectSettingsUrl('foo')).toEqual({
pathname: '/project/settings',
- search: queryToSearch({ id: 'foo' })
+ search: queryToSearch({ id: 'foo' }),
});
expect(getProjectSettingsUrl('foo', 'bar')).toEqual({
pathname: '/project/settings',
- search: queryToSearch({ id: 'foo', category: 'bar' })
+ search: queryToSearch({ id: 'foo', category: 'bar' }),
});
});
});
@@ -433,7 +433,7 @@ describe('#getPathUrlAsString', () => {
expect(
getPathUrlAsString({
pathname: '/dashboard',
- search: queryToSearch({ id: SIMPLE_COMPONENT_KEY })
+ search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
})
).toBe('/dashboard?id=' + SIMPLE_COMPONENT_KEY);
});
@@ -442,7 +442,7 @@ describe('#getPathUrlAsString', () => {
expect(
getPathUrlAsString({
pathname: '/dashboard',
- search: queryToSearch({ id: COMPLEX_COMPONENT_KEY })
+ search: queryToSearch({ id: COMPLEX_COMPONENT_KEY }),
})
).toBe('/dashboard?id=' + COMPLEX_COMPONENT_KEY_ENCODED);
});
@@ -476,7 +476,7 @@ describe('#getHostUrl', () => {
});
it('should return host url on client side', () => {
jest.mock('../system', () => ({
- getBaseUrl: () => ''
+ getBaseUrl: () => '',
}));
const mockedUrls = require('../urls');
expect(mockedUrls.getHostUrl()).toBe('http://localhost');
@@ -489,7 +489,7 @@ describe('searchParamsToQuery', () => {
['a', 'v1'],
['a', 'v2'],
['b', 'awesome'],
- ['a', 'v3']
+ ['a', 'v3'],
]);
const result = searchParamsToQuery(searchParams);
@@ -506,7 +506,7 @@ describe('queryToSearch', () => {
b2: false,
emptyArray: [],
normalString: 'hello',
- undef: undefined
+ undef: undefined,
};
expect(queryToSearch(query)).toBe(
@@ -523,7 +523,7 @@ describe('convertToTo', () => {
it('should handle locations with a query', () => {
expect(convertToTo(mockLocation({ pathname: '/account', query: { id: 1 } }))).toEqual({
pathname: '/account',
- search: '?id=1'
+ search: '?id=1',
});
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts
index 69575d5b216..d6dda61f4de 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts
@@ -27,12 +27,12 @@ describe('isSameHomePage', () => {
{
type: 'APPLICATION',
branch: 'test-branch',
- component: 'test-component'
+ component: 'test-component',
},
{
type: 'APPLICATION',
branch: 'test-branch',
- component: 'test-component'
+ component: 'test-component',
}
)
).toBe(true);
@@ -42,10 +42,10 @@ describe('isSameHomePage', () => {
{
type: 'APPLICATION',
branch: 'test-branch',
- component: 'test-component'
+ component: 'test-component',
},
{
- type: 'ISSUES'
+ type: 'ISSUES',
}
)
).toBe(false);
@@ -55,12 +55,12 @@ describe('isSameHomePage', () => {
{
type: 'APPLICATION',
branch: 'test-branch',
- component: 'test-component'
+ component: 'test-component',
},
{
type: 'APPLICATION',
branch: 'test-branch-1',
- component: 'test-component'
+ component: 'test-component',
}
)
).toBe(false);
@@ -70,12 +70,12 @@ describe('isSameHomePage', () => {
{
type: 'APPLICATION',
branch: 'test-branch',
- component: 'test-component'
+ component: 'test-component',
},
{
type: 'APPLICATION',
branch: 'test-branch',
- component: 'test-component-1'
+ component: 'test-component-1',
}
)
).toBe(false);
diff --git a/server/sonar-web/src/main/js/helpers/branch-like.ts b/server/sonar-web/src/main/js/helpers/branch-like.ts
index 261bea49cae..2f7a766fc94 100644
--- a/server/sonar-web/src/main/js/helpers/branch-like.ts
+++ b/server/sonar-web/src/main/js/helpers/branch-like.ts
@@ -25,7 +25,7 @@ import {
BranchParameters,
BranchStatusData,
MainBranch,
- PullRequest
+ PullRequest,
} from '../types/branch-like';
import { Dict } from '../types/types';
@@ -38,7 +38,7 @@ export function isMainBranch(branchLike?: BranchLike): branchLike is MainBranch
}
export function sortBranches(branches: Branch[]) {
- return orderBy(branches, [b => b.isMain, b => b.name], ['desc', 'asc']);
+ return orderBy(branches, [(b) => b.isMain, (b) => b.name], ['desc', 'asc']);
}
export function isPullRequest(branchLike?: BranchLike): branchLike is PullRequest {
@@ -46,7 +46,7 @@ export function isPullRequest(branchLike?: BranchLike): branchLike is PullReques
}
export function sortPullRequests(pullRequests: PullRequest[]) {
- return orderBy(pullRequests, pr => getPullRequestDisplayName(pr));
+ return orderBy(pullRequests, (pr) => getPullRequestDisplayName(pr));
}
export function getPullRequestDisplayName(pullRequest: PullRequest) {
@@ -84,34 +84,34 @@ export function isSameBranchLike(a: BranchLike | undefined, b: BranchLike | unde
export function getBrancheLikesAsTree(branchLikes: BranchLike[]): BranchLikeTree {
const mainBranch = branchLikes.find(isMainBranch);
const branches = orderBy(
- branchLikes.filter(isBranch).filter(b => !isMainBranch(b)),
- b => b.name
+ branchLikes.filter(isBranch).filter((b) => !isMainBranch(b)),
+ (b) => b.name
);
- const pullRequests = orderBy(branchLikes.filter(isPullRequest), b => parseInt(b.key, 10), [
- 'desc'
+ const pullRequests = orderBy(branchLikes.filter(isPullRequest), (b) => parseInt(b.key, 10), [
+ 'desc',
]);
const parentlessPullRequests = pullRequests.filter(
- pr => !pr.isOrphan && ![mainBranch, ...branches].find(b => !!b && b.name === pr.base)
+ (pr) => !pr.isOrphan && ![mainBranch, ...branches].find((b) => !!b && b.name === pr.base)
);
- const orphanPullRequests = pullRequests.filter(pr => pr.isOrphan);
+ const orphanPullRequests = pullRequests.filter((pr) => pr.isOrphan);
const tree: BranchLikeTree = {
- branchTree: branches.map(b => ({ branch: b, pullRequests: getPullRequests(b) })),
+ branchTree: branches.map((b) => ({ branch: b, pullRequests: getPullRequests(b) })),
parentlessPullRequests,
- orphanPullRequests
+ orphanPullRequests,
};
if (mainBranch) {
tree.mainBranchTree = {
branch: mainBranch,
- pullRequests: getPullRequests(mainBranch)
+ pullRequests: getPullRequests(mainBranch),
};
}
return tree;
function getPullRequests(branch: Branch) {
- return pullRequests.filter(pr => !pr.isOrphan && pr.base === branch.name);
+ return pullRequests.filter((pr) => !pr.isOrphan && pr.base === branch.name);
}
}
@@ -132,7 +132,7 @@ export function fillBranchLike(
if (branch) {
return {
isMain: false,
- name: branch
+ name: branch,
} as Branch;
} else if (pullRequest) {
return { base: '', branch: '', key: pullRequest, title: '' } as PullRequest;
diff --git a/server/sonar-web/src/main/js/helpers/browser.ts b/server/sonar-web/src/main/js/helpers/browser.ts
index 1b6991bfbe9..a5db26c1fa9 100644
--- a/server/sonar-web/src/main/js/helpers/browser.ts
+++ b/server/sonar-web/src/main/js/helpers/browser.ts
@@ -20,5 +20,5 @@
import { EnhancedWindow } from '../types/browser';
export function getEnhancedWindow() {
- return (window as unknown) as EnhancedWindow;
+ return window as unknown as EnhancedWindow;
}
diff --git a/server/sonar-web/src/main/js/helpers/code-difference.ts b/server/sonar-web/src/main/js/helpers/code-difference.ts
index e190d1b7e92..b57f44e442e 100644
--- a/server/sonar-web/src/main/js/helpers/code-difference.ts
+++ b/server/sonar-web/src/main/js/helpers/code-difference.ts
@@ -52,14 +52,15 @@ function getExamplesFromDom(element: Element) {
return (
Object.values(
groupBy(
- pres.filter(e => e.getAttribute('data-diff-id') !== undefined),
- e => e.getAttribute('data-diff-id')
+ pres.filter((e) => e.getAttribute('data-diff-id') !== undefined),
+ (e) => e.getAttribute('data-diff-id')
)
)
// If we have 1 or 3+ example we can't display any differences
- .filter(diffsBlock => diffsBlock.length === NUMBER_OF_EXAMPLES)
+ .filter((diffsBlock) => diffsBlock.length === NUMBER_OF_EXAMPLES)
.map(
- diffBlock => keyBy(diffBlock, block => block.getAttribute('data-diff-type')) as DiffBlock
+ (diffBlock) =>
+ keyBy(diffBlock, (block) => block.getAttribute('data-diff-type')) as DiffBlock
)
);
}
@@ -70,7 +71,7 @@ function differentiateCode(compliant: string, nonCompliant: string) {
let nonCompliantCode = '';
let compliantCode = '';
- hunks.forEach(hunk => {
+ hunks.forEach((hunk) => {
const value = sanitizeString(hunk.value);
if (!hunk.added && !hunk.removed) {
nonCompliantCode += `<div>${value}</div>`;
diff --git a/server/sonar-web/src/main/js/helpers/component.ts b/server/sonar-web/src/main/js/helpers/component.ts
index 2a5283d0266..9c9d0ee05ba 100644
--- a/server/sonar-web/src/main/js/helpers/component.ts
+++ b/server/sonar-web/src/main/js/helpers/component.ts
@@ -22,5 +22,5 @@ import { ComponentMeasure, ComponentMeasureEnhanced } from '../types/types';
export function getComponentMeasureUniqueKey(
component?: ComponentMeasure | ComponentMeasureEnhanced
) {
- return component ? [component.key, component.branch].filter(s => !!s).join('/') : undefined;
+ return component ? [component.key, component.branch].filter((s) => !!s).join('/') : undefined;
}
diff --git a/server/sonar-web/src/main/js/helpers/constants.ts b/server/sonar-web/src/main/js/helpers/constants.ts
index ea1b9c08df8..bdbe8ef30c5 100644
--- a/server/sonar-web/src/main/js/helpers/constants.ts
+++ b/server/sonar-web/src/main/js/helpers/constants.ts
@@ -29,11 +29,11 @@ export const ISSUE_TYPES: IssueType[] = [
IssueType.Bug,
IssueType.Vulnerability,
IssueType.CodeSmell,
- IssueType.SecurityHotspot
+ IssueType.SecurityHotspot,
];
export const SOURCE_SCOPES = [
{ scope: IssueScope.Main, qualifier: ComponentQualifier.File },
- { scope: IssueScope.Test, qualifier: ComponentQualifier.TestFile }
+ { scope: IssueScope.Test, qualifier: ComponentQualifier.TestFile },
];
export const RULE_TYPES: RuleType[] = ['BUG', 'VULNERABILITY', 'CODE_SMELL', 'SECURITY_HOTSPOT'];
export const RULE_STATUSES = ['READY', 'BETA', 'DEPRECATED'];
@@ -43,15 +43,15 @@ export const RATING_COLORS = [
{
fill: colors.successVariant,
fillTransparent: colors.successVarianta20,
- stroke: colors.successVariantDark
+ stroke: colors.successVariantDark,
},
{
fill: colors.warningVariant,
fillTransparent: colors.warningVarianta20,
- stroke: colors.warningVariantDark
+ stroke: colors.warningVariantDark,
},
{ fill: colors.warningAccent, fillTransparent: colors.warningAccenta20, stroke: colors.warning },
- { fill: colors.error400, fillTransparent: colors.error400a20, stroke: colors.error700 }
+ { fill: colors.error400, fillTransparent: colors.error400a20, stroke: colors.error700 },
];
export const PROJECT_KEY_MAX_LEN = 400;
@@ -61,7 +61,7 @@ export const ALM_DOCUMENTATION_PATHS = {
[AlmKeys.BitbucketServer]: '/analysis/bitbucket-integration/',
[AlmKeys.BitbucketCloud]: '/analysis/bitbucket-cloud-integration/',
[AlmKeys.GitHub]: '/analysis/github-integration/',
- [AlmKeys.GitLab]: '/analysis/gitlab-integration/'
+ [AlmKeys.GitLab]: '/analysis/gitlab-integration/',
};
export const IMPORT_COMPATIBLE_ALMS = [
@@ -69,12 +69,12 @@ export const IMPORT_COMPATIBLE_ALMS = [
AlmKeys.BitbucketServer,
AlmKeys.BitbucketCloud,
AlmKeys.GitHub,
- AlmKeys.GitLab
+ AlmKeys.GitLab,
];
// Count both Bitbuckets as a single ALM.
export const IMPORT_COMPATIBLE_ALM_COUNT = IMPORT_COMPATIBLE_ALMS.filter(
- a => a !== AlmKeys.BitbucketCloud
+ (a) => a !== AlmKeys.BitbucketCloud
).length;
export const GRADLE_SCANNER_VERSION = '3.5.0.2730';
diff --git a/server/sonar-web/src/main/js/helpers/cookies.ts b/server/sonar-web/src/main/js/helpers/cookies.ts
index 8b949b95c22..d0d226abdec 100644
--- a/server/sonar-web/src/main/js/helpers/cookies.ts
+++ b/server/sonar-web/src/main/js/helpers/cookies.ts
@@ -20,17 +20,15 @@
import { memoize } from 'lodash';
import { Dict } from '../types/types';
-const parseCookies = memoize(
- (documentCookie: string): Dict<string> => {
- const rawCookies = documentCookie.split('; ');
- const cookies: Dict<string> = {};
- rawCookies.forEach(candidate => {
- const [key, value] = candidate.split('=');
- cookies[key] = value;
- });
- return cookies;
- }
-);
+const parseCookies = memoize((documentCookie: string): Dict<string> => {
+ const rawCookies = documentCookie.split('; ');
+ const cookies: Dict<string> = {};
+ rawCookies.forEach((candidate) => {
+ const [key, value] = candidate.split('=');
+ cookies[key] = value;
+ });
+ return cookies;
+});
export function getCookie(name: string): string | undefined {
return parseCookies(document.cookie)[name];
diff --git a/server/sonar-web/src/main/js/helpers/editions.ts b/server/sonar-web/src/main/js/helpers/editions.ts
index 359f7d4bebf..5b15741cd82 100644
--- a/server/sonar-web/src/main/js/helpers/editions.ts
+++ b/server/sonar-web/src/main/js/helpers/editions.ts
@@ -26,26 +26,26 @@ const EDITIONS: { [x in EditionKey]: Edition } = {
key: EditionKey.community,
name: 'Community Edition',
homeUrl: 'https://redirect.sonarsource.com/editions/community.html',
- downloadProperty: 'downloadUrl'
+ downloadProperty: 'downloadUrl',
},
developer: {
key: EditionKey.developer,
name: 'Developer Edition',
homeUrl: 'https://redirect.sonarsource.com/editions/developer.html',
- downloadProperty: 'downloadDeveloperUrl'
+ downloadProperty: 'downloadDeveloperUrl',
},
enterprise: {
key: EditionKey.enterprise,
name: 'Enterprise Edition',
homeUrl: 'https://redirect.sonarsource.com/editions/enterprise.html',
- downloadProperty: 'downloadEnterpriseUrl'
+ downloadProperty: 'downloadEnterpriseUrl',
},
datacenter: {
key: EditionKey.datacenter,
name: 'Data Center Edition',
homeUrl: 'https://redirect.sonarsource.com/editions/datacenter.html',
- downloadProperty: 'downloadDatacenterUrl'
- }
+ downloadProperty: 'downloadDatacenterUrl',
+ },
};
export function getEdition(editionKey: EditionKey) {
@@ -54,7 +54,7 @@ export function getEdition(editionKey: EditionKey) {
export function getAllEditionsAbove(currentEdition?: EditionKey) {
const editions = Object.values(EDITIONS);
- const currentEditionIdx = editions.findIndex(edition => edition.key === currentEdition);
+ const currentEditionIdx = editions.findIndex((edition) => edition.key === currentEdition);
return editions.slice(currentEditionIdx + 1);
}
diff --git a/server/sonar-web/src/main/js/helpers/extensions.ts b/server/sonar-web/src/main/js/helpers/extensions.ts
index 886152c2d42..ef1010b402f 100644
--- a/server/sonar-web/src/main/js/helpers/extensions.ts
+++ b/server/sonar-web/src/main/js/helpers/extensions.ts
@@ -24,7 +24,7 @@ import { getExtensionFromCache } from './extensionsHandler';
let librariesExposed = false;
export function installStyles(url: string, target: 'body' | 'head' = 'head'): Promise<any> {
- return new Promise(resolve => {
+ return new Promise((resolve) => {
const linkTag = document.createElement('link');
linkTag.href = `${getBaseUrl()}${url}`;
linkTag.rel = 'stylesheet';
@@ -34,7 +34,7 @@ export function installStyles(url: string, target: 'body' | 'head' = 'head'): Pr
}
export function installScript(url: string, target: 'body' | 'head' = 'body'): Promise<any> {
- return new Promise(resolve => {
+ return new Promise((resolve) => {
const scriptTag = document.createElement('script');
scriptTag.src = `${getBaseUrl()}${url}`;
scriptTag.onload = resolve;
diff --git a/server/sonar-web/src/main/js/helpers/globalMessages.ts b/server/sonar-web/src/main/js/helpers/globalMessages.ts
index dc5f2f02ca5..823eb149130 100644
--- a/server/sonar-web/src/main/js/helpers/globalMessages.ts
+++ b/server/sonar-web/src/main/js/helpers/globalMessages.ts
@@ -37,11 +37,11 @@ export function unregisterListener(callback: (message: Message) => void) {
}
function addMessage(text: string, level: MessageLevel) {
- listeners.forEach(listener =>
+ listeners.forEach((listener) =>
listener({
id: uniqueId('global-message-'),
level,
- text
+ text,
})
);
}
diff --git a/server/sonar-web/src/main/js/helpers/issues.ts b/server/sonar-web/src/main/js/helpers/issues.ts
index 2b0588f46a9..ae3d39f4d52 100644
--- a/server/sonar-web/src/main/js/helpers/issues.ts
+++ b/server/sonar-web/src/main/js/helpers/issues.ts
@@ -36,7 +36,7 @@ interface Component {
}
export function sortByType<T extends Pick<Issue, 'type'>>(issues: T[]): T[] {
- return sortBy(issues, issue => ISSUE_TYPES.indexOf(issue.type as IssueType));
+ return sortBy(issues, (issue) => ISSUE_TYPES.indexOf(issue.type as IssueType));
}
function injectRelational(
@@ -48,9 +48,9 @@ function injectRelational(
const newFields: Dict<any> = {};
const baseValue = issue[baseField];
if (baseValue !== undefined && source !== undefined) {
- const lookupValue = source.find(candidate => candidate[lookupField] === baseValue);
+ const lookupValue = source.find((candidate) => candidate[lookupField] === baseValue);
if (lookupValue != null) {
- Object.keys(lookupValue).forEach(key => {
+ Object.keys(lookupValue).forEach((key) => {
const newKey = baseField + key.charAt(0).toUpperCase() + key.slice(1);
newFields[newKey] = lookupValue[key];
});
@@ -63,11 +63,11 @@ function injectCommentsRelational(issue: RawIssue, users?: UserBase[]) {
if (!issue.comments) {
return {};
}
- const comments = issue.comments.map(comment => {
+ const comments = issue.comments.map((comment) => {
const commentWithAuthor = { ...comment, author: comment.login, login: undefined };
return {
...commentWithAuthor,
- ...injectRelational(commentWithAuthor, users, 'author', 'login')
+ ...injectRelational(commentWithAuthor, users, 'author', 'login'),
};
});
return { comments };
@@ -86,8 +86,8 @@ function ensureTextRange(issue: RawIssue): { textRange?: TextRange } {
startLine: issue.line,
endLine: issue.line,
startOffset: 0,
- endOffset: 999999
- }
+ endOffset: 999999,
+ },
}
: {};
}
@@ -102,40 +102,40 @@ function splitFlows(
issue: RawIssue,
components: Component[] = []
): { secondaryLocations: FlowLocation[]; flows: FlowLocation[][]; flowsWithType: Flow[] } {
- if (issue.flows?.some(flow => flow.type !== undefined)) {
+ if (issue.flows?.some((flow) => flow.type !== undefined)) {
return {
flows: [],
- flowsWithType: issue.flows.filter(flow => flow.type !== undefined) as Flow[],
- secondaryLocations: []
+ flowsWithType: issue.flows.filter((flow) => flow.type !== undefined) as Flow[],
+ secondaryLocations: [],
};
}
const parsedFlows: FlowLocation[][] = (issue.flows || [])
- .filter(flow => flow.locations !== undefined)
- .map(flow => flow.locations!.filter(location => location.textRange != null))
- .map(flow =>
- flow.map(location => {
- const component = components.find(component => component.key === location.component);
+ .filter((flow) => flow.locations !== undefined)
+ .map((flow) => flow.locations!.filter((location) => location.textRange != null))
+ .map((flow) =>
+ flow.map((location) => {
+ const component = components.find((component) => component.key === location.component);
return { ...location, componentName: component && component.name };
})
);
- const onlySecondaryLocations = parsedFlows.every(flow => flow.length === 1);
+ const onlySecondaryLocations = parsedFlows.every((flow) => flow.length === 1);
return onlySecondaryLocations
? { secondaryLocations: orderLocations(flatten(parsedFlows)), flowsWithType: [], flows: [] }
: {
secondaryLocations: [],
flowsWithType: [],
- flows: parsedFlows.map(reverseLocations)
+ flows: parsedFlows.map(reverseLocations),
};
}
function orderLocations(locations: FlowLocation[]) {
return sortBy(
locations,
- location => location.textRange && location.textRange.startLine,
- location => location.textRange && location.textRange.startOffset
+ (location) => location.textRange && location.textRange.startLine,
+ (location) => location.textRange && location.textRange.startOffset
);
}
@@ -154,7 +154,7 @@ export function parseIssueFromResponse(
...injectCommentsRelational(issue, users),
...splitFlows(issue, components),
...prepareClosed(issue),
- ...ensureTextRange(issue)
+ ...ensureTextRange(issue),
} as Issue;
}
@@ -165,7 +165,7 @@ export const ISSUETYPE_METRIC_KEYS_MAP = {
rating: MetricKey.sqale_rating,
newRating: MetricKey.new_maintainability_rating,
ratingName: 'Maintainability',
- iconClass: CodeSmellIcon
+ iconClass: CodeSmellIcon,
},
[IssueType.Vulnerability]: {
metric: MetricKey.vulnerabilities,
@@ -173,7 +173,7 @@ export const ISSUETYPE_METRIC_KEYS_MAP = {
rating: MetricKey.security_rating,
newRating: MetricKey.new_security_rating,
ratingName: 'Security',
- iconClass: VulnerabilityIcon
+ iconClass: VulnerabilityIcon,
},
[IssueType.Bug]: {
metric: MetricKey.bugs,
@@ -181,7 +181,7 @@ export const ISSUETYPE_METRIC_KEYS_MAP = {
rating: MetricKey.reliability_rating,
newRating: MetricKey.new_reliability_rating,
ratingName: 'Reliability',
- iconClass: BugIcon
+ iconClass: BugIcon,
},
[IssueType.SecurityHotspot]: {
metric: MetricKey.security_hotspots,
@@ -189,6 +189,6 @@ export const ISSUETYPE_METRIC_KEYS_MAP = {
rating: MetricKey.security_review_rating,
newRating: MetricKey.new_security_review_rating,
ratingName: 'SecurityReview',
- iconClass: SecurityHotspotIcon
- }
+ iconClass: SecurityHotspotIcon,
+ },
};
diff --git a/server/sonar-web/src/main/js/helpers/keycodes.ts b/server/sonar-web/src/main/js/helpers/keycodes.ts
index bf6c0fc0533..d84f1b79475 100644
--- a/server/sonar-web/src/main/js/helpers/keycodes.ts
+++ b/server/sonar-web/src/main/js/helpers/keycodes.ts
@@ -43,5 +43,5 @@ export enum KeyboardKeys {
KeyC = 'c',
KeyT = 't',
KeyS = 's',
- KeyQuestionMark = '?'
+ KeyQuestionMark = '?',
}
diff --git a/server/sonar-web/src/main/js/helpers/l10n.ts b/server/sonar-web/src/main/js/helpers/l10n.ts
index 149955f2844..bf1a5969784 100644
--- a/server/sonar-web/src/main/js/helpers/l10n.ts
+++ b/server/sonar-web/src/main/js/helpers/l10n.ts
@@ -42,7 +42,7 @@ export function translateWithParameters(
const message = getMessages()[messageKey];
if (message) {
return parameters
- .map(parameter => String(parameter))
+ .map((parameter) => String(parameter))
.reduce((acc, parameter, index) => acc.replace(`{${index}}`, () => parameter), message);
}
if (process.env.NODE_ENV === 'development') {
@@ -88,7 +88,7 @@ export function getShortMonthName(index: number) {
'Sep',
'Oct',
'Nov',
- 'Dec'
+ 'Dec',
];
return translate(months[index]);
}
diff --git a/server/sonar-web/src/main/js/helpers/l10nBundle.ts b/server/sonar-web/src/main/js/helpers/l10nBundle.ts
index fc1a4414d57..0962637f029 100644
--- a/server/sonar-web/src/main/js/helpers/l10nBundle.ts
+++ b/server/sonar-web/src/main/js/helpers/l10nBundle.ts
@@ -25,7 +25,7 @@ import { toNotSoISOString } from './dates';
const DEFAULT_LOCALE = 'en';
const DEFAULT_MESSAGES = {
// eslint-disable-next-line camelcase
- default_error_message: 'The request cannot be processed. Try again later.'
+ default_error_message: 'The request cannot be processed. Try again later.',
};
export function getMessages() {
@@ -59,11 +59,11 @@ export async function loadL10nBundle() {
}
}
- const { effectiveLocale, messages } = await fetchL10nBundle(params).catch(response => {
+ const { effectiveLocale, messages } = await fetchL10nBundle(params).catch((response) => {
if (response && response.status === 304) {
return {
effectiveLocale: cachedBundle.locale || browserLocale || DEFAULT_LOCALE,
- messages: cachedBundle.messages ?? {}
+ messages: cachedBundle.messages ?? {},
};
}
throw new Error(`Unexpected status code: ${response.status}`);
@@ -72,7 +72,7 @@ export async function loadL10nBundle() {
const bundle = {
timestamp: toNotSoISOString(new Date()),
locale: effectiveLocale,
- messages
+ messages,
};
persistL10nBundleInCache(bundle);
@@ -85,9 +85,9 @@ function getPreferredLanguage() {
}
function getL10nBundleFromCache() {
- return ((window as unknown) as any).sonarQubeL10nBundle ?? {};
+ return (window as unknown as any).sonarQubeL10nBundle ?? {};
}
function persistL10nBundleInCache(bundle: L10nBundle) {
- ((window as unknown) as any).sonarQubeL10nBundle = bundle;
+ (window as unknown as any).sonarQubeL10nBundle = bundle;
}
diff --git a/server/sonar-web/src/main/js/helpers/measures.ts b/server/sonar-web/src/main/js/helpers/measures.ts
index 31aca41f983..6580495d6f3 100644
--- a/server/sonar-web/src/main/js/helpers/measures.ts
+++ b/server/sonar-web/src/main/js/helpers/measures.ts
@@ -20,7 +20,7 @@
import { MetricKey } from '../types/metrics';
import {
QualityGateStatusCondition,
- QualityGateStatusConditionEnhanced
+ QualityGateStatusConditionEnhanced,
} from '../types/quality-gates';
import { Dict, Measure, MeasureEnhanced, Metric } from '../types/types';
import { translate, translateWithParameters } from './l10n';
@@ -32,8 +32,8 @@ export function enhanceMeasuresWithMetrics(
metrics: Metric[]
): MeasureEnhanced[] {
return measures
- .map(measure => {
- const metric = metrics.find(metric => metric.key === measure.metric);
+ .map((measure) => {
+ const metric = metrics.find((metric) => metric.key === measure.metric);
return metric && { ...measure, metric };
})
.filter(isDefined);
@@ -43,7 +43,7 @@ export function enhanceConditionWithMeasure(
condition: QualityGateStatusCondition,
measures: MeasureEnhanced[]
): QualityGateStatusConditionEnhanced | undefined {
- const measure = measures.find(m => m.metric.key === condition.metric);
+ const measure = measures.find((m) => m.metric.key === condition.metric);
// Make sure we have a period index. This is necessary when dealing with
// applications.
@@ -65,11 +65,11 @@ export function isDiffMetric(metricKey: MetricKey | string): boolean {
}
export function getDisplayMetrics(metrics: Metric[]) {
- return metrics.filter(metric => !metric.hidden && !['DATA', 'DISTRIB'].includes(metric.type));
+ return metrics.filter((metric) => !metric.hidden && !['DATA', 'DISTRIB'].includes(metric.type));
}
export function findMeasure(measures: MeasureEnhanced[], metric: MetricKey | string) {
- return measures.find(measure => measure.metric.key === metric);
+ return measures.find((measure) => measure.metric.key === metric);
}
const HOURS_IN_DAY = 8;
@@ -145,7 +145,7 @@ function getFormatter(type: string): Formatter {
SHORT_WORK_DUR: shortDurationFormatter,
RATING: ratingFormatter,
LEVEL: levelFormatter,
- MILLISEC: millisecondsFormatter
+ MILLISEC: millisecondsFormatter,
};
return FORMATTERS[type] || noFormatter;
}
@@ -157,7 +157,7 @@ function numberFormatter(
) {
const { format } = new Intl.NumberFormat(getCurrentLocale(), {
minimumFractionDigits,
- maximumFractionDigits
+ maximumFractionDigits,
});
if (typeof value === 'string') {
return format(parseFloat(value));
@@ -179,7 +179,7 @@ const shortIntFormats = [
{ unit: 1e7, formatUnit: 1e6, fraction: 0, suffix: 'short_number_suffix.m' },
{ unit: 1e6, formatUnit: 1e6, fraction: 1, suffix: 'short_number_suffix.m' },
{ unit: 1e4, formatUnit: 1e3, fraction: 0, suffix: 'short_number_suffix.k' },
- { unit: 1e3, formatUnit: 1e3, fraction: 1, suffix: 'short_number_suffix.k' }
+ { unit: 1e3, formatUnit: 1e3, fraction: 1, suffix: 'short_number_suffix.k' },
];
function shortIntFormatter(
diff --git a/server/sonar-web/src/main/js/helpers/mocks/alm-integrations.ts b/server/sonar-web/src/main/js/helpers/mocks/alm-integrations.ts
index 9dd557b606b..5c7178525f6 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/alm-integrations.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/alm-integrations.ts
@@ -24,14 +24,14 @@ import {
BitbucketProject,
BitbucketRepository,
GithubRepository,
- GitlabProject
+ GitlabProject,
} from '../../types/alm-integration';
export function mockAzureProject(overrides: Partial<AzureProject> = {}): AzureProject {
return {
name: 'azure-project-1',
description: 'Azure Project',
- ...overrides
+ ...overrides,
};
}
@@ -39,7 +39,7 @@ export function mockAzureRepository(overrides: Partial<AzureRepository> = {}): A
return {
name: 'Azure repo 1',
projectName: 'Azure Project',
- ...overrides
+ ...overrides,
};
}
@@ -48,7 +48,7 @@ export function mockBitbucketProject(overrides: Partial<BitbucketProject> = {}):
id: 1,
key: 'project',
name: 'Project',
- ...overrides
+ ...overrides,
};
}
@@ -60,7 +60,7 @@ export function mockBitbucketRepository(
slug: 'project__repo',
name: 'Repo',
projectKey: 'project',
- ...overrides
+ ...overrides,
};
}
@@ -73,7 +73,7 @@ export function mockBitbucketCloudRepository(
name: 'Repo',
projectKey: 'project',
workspace: 'worksapce',
- ...overrides
+ ...overrides,
};
}
@@ -84,7 +84,7 @@ export function mockGitHubRepository(overrides: Partial<GithubRepository> = {}):
name: 'repository 1',
sqProjectKey: '',
url: 'https://github.com/owner/repo1',
- ...overrides
+ ...overrides,
};
}
@@ -97,6 +97,6 @@ export function mockGitlabProject(overrides: Partial<GitlabProject> = {}): Gitla
pathSlug: 'company/best-projects',
sqProjectKey: '',
url: 'https://gitlab.company.com/best-projects/awesome-project-exclamation',
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts b/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts
index 6a18e18b904..d49274ca6da 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts
@@ -34,7 +34,7 @@ import {
ProjectBitbucketBindingResponse,
ProjectBitbucketCloudBindingResponse,
ProjectGitHubBindingResponse,
- ProjectGitLabBindingResponse
+ ProjectGitLabBindingResponse,
} from '../../types/alm-settings';
export function mockAlmSettingsInstance(
@@ -43,7 +43,7 @@ export function mockAlmSettingsInstance(
return {
alm: AlmKeys.GitHub,
key: 'key',
- ...overrides
+ ...overrides,
};
}
@@ -53,7 +53,7 @@ export function mockBitbucketCloudAlmSettingsInstance(
return {
alm: AlmKeys.BitbucketCloud,
key: 'key',
- ...overrides
+ ...overrides,
};
}
@@ -63,7 +63,7 @@ export function mockAzureBindingDefinition(
return {
key: 'key',
personalAccessToken: 'asdf1234',
- ...overrides
+ ...overrides,
};
}
@@ -74,7 +74,7 @@ export function mockBitbucketServerBindingDefinition(
key: 'key',
personalAccessToken: 'asdf1234',
url: 'http://bbs.enterprise.com',
- ...overrides
+ ...overrides,
};
}
@@ -86,7 +86,7 @@ export function mockBitbucketCloudBindingDefinition(
clientId: 'client1',
clientSecret: '**clientsecret**',
workspace: 'workspace',
- ...overrides
+ ...overrides,
};
}
@@ -101,7 +101,7 @@ export function mockGithubBindingDefinition(
clientSecret: '**clientsecret**',
privateKey: 'asdf1234',
webhookSecret: 'verySecretText!!',
- ...overrides
+ ...overrides,
};
}
@@ -111,7 +111,7 @@ export function mockGitlabBindingDefinition(
return {
key: 'foo',
personalAccessToken: 'foobar',
- ...overrides
+ ...overrides,
};
}
@@ -122,7 +122,7 @@ export function mockProjectAlmBindingResponse(
alm: AlmKeys.GitHub,
key: 'foo',
monorepo: false,
- ...overrides
+ ...overrides,
};
}
@@ -135,7 +135,7 @@ export function mockProjectBitbucketBindingResponse(
repository: 'PROJECT_KEY',
slug: 'repo-slug',
monorepo: true,
- ...overrides
+ ...overrides,
};
}
@@ -147,7 +147,7 @@ export function mockProjectBitbucketCloudBindingResponse(
key: 'foo',
repository: 'repo-slug',
monorepo: true,
- ...overrides
+ ...overrides,
};
}
@@ -159,7 +159,7 @@ export function mockProjectGithubBindingResponse(
key: 'foo',
repository: 'PROJECT_KEY',
monorepo: true,
- ...overrides
+ ...overrides,
};
}
@@ -172,7 +172,7 @@ export function mockProjectGitLabBindingResponse(
repository: 'PROJECT_KEY',
url: 'https://gitlab.com/api/v4',
monorepo: true,
- ...overrides
+ ...overrides,
};
}
@@ -186,7 +186,7 @@ export function mockProjectAzureBindingResponse(
repository: 'REPOSITORY_NAME',
url: 'https://ado.my_company.com/mycollection',
monorepo: false,
- ...overrides
+ ...overrides,
};
}
@@ -197,7 +197,7 @@ export function mockAlmSettingsBindingStatus(
alertSuccess: false,
failureMessage: '',
type: AlmSettingsBindingStatusType.Validating,
- ...overrides
+ ...overrides,
};
}
@@ -207,6 +207,6 @@ export function mockProjectAlmBindingConfigurationErrors(
return {
scope: ProjectAlmBindingConfigurationErrorScope.Global,
errors: [{ msg: 'Foo bar is not correct' }, { msg: 'Bar baz has no permissions here' }],
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/application.ts b/server/sonar-web/src/main/js/helpers/mocks/application.ts
index c74b481c16d..c7e83454a02 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/application.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/application.ts
@@ -26,6 +26,6 @@ export function mockApplicationPeriod(
date: '2017-10-01',
project: 'foo',
projectName: 'Foo',
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/branch-like.ts b/server/sonar-web/src/main/js/helpers/mocks/branch-like.ts
index 15a2e52a562..01c97e841cc 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/branch-like.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/branch-like.ts
@@ -25,7 +25,7 @@ export function mockBranch(overrides: Partial<Branch> = {}): Branch {
excludedFromPurge: true,
isMain: false,
name: 'branch-6.7',
- ...overrides
+ ...overrides,
};
}
@@ -33,7 +33,7 @@ export function mockMainBranch(overrides: Partial<MainBranch> = {}): MainBranch
return mockBranch({
isMain: true,
name: 'master',
- ...overrides
+ ...overrides,
}) as MainBranch;
}
@@ -45,7 +45,7 @@ export function mockPullRequest(overrides: Partial<PullRequest> = {}): PullReque
key: '1001',
target: 'master',
title: 'Foo Bar feature',
- ...overrides
+ ...overrides,
};
}
@@ -59,6 +59,6 @@ export function mockSetOfBranchAndPullRequest(): BranchLike[] {
mockPullRequest({ key: '2', title: 'PR-2' }),
mockBranch({ name: 'branch-3' }),
mockBranch({ name: 'branch-2' }),
- mockPullRequest({ key: '2', title: 'PR-2', target: 'llb-100', isOrphan: true })
+ mockPullRequest({ key: '2', title: 'PR-2', target: 'llb-100', isOrphan: true }),
];
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/component-report.ts b/server/sonar-web/src/main/js/helpers/mocks/component-report.ts
index 2db36253ad4..84017a4376a 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/component-report.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/component-report.ts
@@ -30,6 +30,6 @@ export function mockComponentReportStatus(
globalFrequency: '',
globalRecipients: [],
subscribed: false,
- ...props
+ ...props,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/component.ts b/server/sonar-web/src/main/js/helpers/mocks/component.ts
index 4919a31694e..cda74a493d7 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/component.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/component.ts
@@ -34,11 +34,11 @@ export function mockComponent(overrides: Partial<Component> = {}): Component {
deleted: false,
key: 'my-qp',
language: 'ts',
- name: 'Sonar way'
- }
+ name: 'Sonar way',
+ },
],
tags: [],
- ...overrides
+ ...overrides,
};
}
@@ -48,7 +48,7 @@ export function mockTreeComponent(overrides: Partial<TreeComponent>): TreeCompon
qualifier: ComponentQualifier.Project,
name: 'component',
visibility: Visibility.Public,
- ...overrides
+ ...overrides,
};
}
@@ -63,7 +63,7 @@ export function mockComponentMeasure(
qualifier: ComponentQualifier.File,
path: 'src/index.tsx',
measures: [{ metric: MetricKey.bugs, value: '1', bestValue: false }],
- ...overrides
+ ...overrides,
};
}
return {
@@ -71,7 +71,7 @@ export function mockComponentMeasure(
name: 'Foo',
qualifier: ComponentQualifier.Project,
measures: [{ metric: MetricKey.bugs, value: '12', bestValue: false }],
- ...overrides
+ ...overrides,
};
}
@@ -83,6 +83,6 @@ export function mockComponentMeasureEnhanced(
leak: undefined,
measures: [mockMeasureEnhanced()],
value: undefined,
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/dom.ts b/server/sonar-web/src/main/js/helpers/mocks/dom.ts
index e85d59f31c8..8559747c3ff 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/dom.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/dom.ts
@@ -28,8 +28,8 @@ export function mockHtmlElement<T extends Element>(overrides: Partial<T> = {}):
top: 10,
x: 12,
y: 23,
- toJSON: () => ''
+ toJSON: () => '',
}),
- ...overrides
+ ...overrides,
} as T;
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/editions.ts b/server/sonar-web/src/main/js/helpers/mocks/editions.ts
index 58fb0b759cb..806f6db11b1 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/editions.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/editions.ts
@@ -36,6 +36,6 @@ export function mockLicense(override?: Partial<License>) {
remainingLocThreshold: 490000,
serverId: 'AU-TpxcA-iU5OvuD2FL0',
type: 'production',
- ...override
+ ...override,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/issues.ts b/server/sonar-web/src/main/js/helpers/mocks/issues.ts
index d16f82425f2..27e0cc39914 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/issues.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/issues.ts
@@ -24,7 +24,7 @@ export function mockReferencedRule(overrides: Partial<ReferencedRule> = {}): Ref
return {
langName: 'Javascript',
name: 'RuleFoo',
- ...overrides
+ ...overrides,
};
}
@@ -38,9 +38,9 @@ export function mockIssueChangelog(overrides: Partial<IssueChangelog> = {}): Iss
{
key: 'assign',
newValue: 'darth.vader',
- oldValue: 'luke.skywalker'
- }
+ oldValue: 'luke.skywalker',
+ },
],
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/metrics.ts b/server/sonar-web/src/main/js/helpers/mocks/metrics.ts
index 57a8cc82fd3..6cf919fea76 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/metrics.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/metrics.ts
@@ -28,7 +28,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
blocker_violations: {
id: 'AXJMbIl_PAOIsUIE3gtt',
@@ -39,7 +39,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
bugs: {
id: 'AXJMbIl_PAOIsUIE3gt_',
@@ -50,7 +50,7 @@ export const DEFAULT_METRICS = {
domain: 'Reliability',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
classes: {
id: 'AXJMbImPPAOIsUIE3gu5',
@@ -61,7 +61,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
code_smells: {
id: 'AXJMbIl_PAOIsUIE3gt9',
@@ -72,7 +72,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
cognitive_complexity: {
id: 'AXJMbIl9PAOIsUIE3gtZ',
@@ -83,7 +83,7 @@ export const DEFAULT_METRICS = {
domain: 'Complexity',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
comment_lines: {
id: 'AXJMbImPPAOIsUIE3gup',
@@ -94,7 +94,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: 1,
qualitative: false,
- hidden: false
+ hidden: false,
},
comment_lines_data: {
id: 'AXJMbImPPAOIsUIE3guV',
@@ -104,7 +104,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
comment_lines_density: {
id: 'AXJMbImPPAOIsUIE3guq',
@@ -116,7 +116,7 @@ export const DEFAULT_METRICS = {
direction: 1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
class_complexity: {
id: 'AXJMbImPPAOIsUIE3guw',
@@ -128,7 +128,7 @@ export const DEFAULT_METRICS = {
direction: -1,
qualitative: true,
hidden: true,
- decimalScale: 1
+ decimalScale: 1,
},
file_complexity: {
id: 'AXJMbImPPAOIsUIE3guu',
@@ -140,7 +140,7 @@ export const DEFAULT_METRICS = {
direction: -1,
qualitative: true,
hidden: true,
- decimalScale: 1
+ decimalScale: 1,
},
function_complexity: {
id: 'AXJMbImPPAOIsUIE3guy',
@@ -152,7 +152,7 @@ export const DEFAULT_METRICS = {
direction: -1,
qualitative: true,
hidden: true,
- decimalScale: 1
+ decimalScale: 1,
},
complexity_in_classes: {
id: 'AXJMbImPPAOIsUIE3guv',
@@ -163,7 +163,7 @@ export const DEFAULT_METRICS = {
domain: 'Complexity',
direction: -1,
qualitative: false,
- hidden: true
+ hidden: true,
},
complexity_in_functions: {
id: 'AXJMbImPPAOIsUIE3gux',
@@ -174,7 +174,7 @@ export const DEFAULT_METRICS = {
domain: 'Complexity',
direction: -1,
qualitative: false,
- hidden: true
+ hidden: true,
},
branch_coverage: {
id: 'AXJMbIl9PAOIsUIE3gs-',
@@ -186,7 +186,7 @@ export const DEFAULT_METRICS = {
direction: 1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
new_branch_coverage: {
id: 'AXJMbIl9PAOIsUIE3gs_',
@@ -198,7 +198,7 @@ export const DEFAULT_METRICS = {
direction: 1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
conditions_to_cover: {
id: 'AXJMbIl9PAOIsUIE3gqt',
@@ -209,7 +209,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
new_conditions_to_cover: {
id: 'AXJMbIl9PAOIsUIE3gs7',
@@ -220,7 +220,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
confirmed_issues: {
id: 'AXJMbIl_PAOIsUIE3gt8',
@@ -231,7 +231,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
coverage: {
id: 'AXJMbIl9PAOIsUIE3gtg',
@@ -243,7 +243,7 @@ export const DEFAULT_METRICS = {
direction: 1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
new_coverage: {
id: 'AXJMbIl_PAOIsUIE3gth',
@@ -255,7 +255,7 @@ export const DEFAULT_METRICS = {
direction: 1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
critical_violations: {
id: 'AXJMbIl_PAOIsUIE3gtu',
@@ -266,7 +266,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
complexity: {
id: 'AXJMbImPPAOIsUIE3gut',
@@ -277,7 +277,7 @@ export const DEFAULT_METRICS = {
domain: 'Complexity',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
last_commit_date: {
id: 'AXJMbImPPAOIsUIE3gua',
@@ -287,7 +287,7 @@ export const DEFAULT_METRICS = {
domain: 'SCM',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
development_cost: {
id: 'AXJMbIl_PAOIsUIE3guI',
@@ -298,7 +298,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
new_development_cost: {
id: 'AXJMbIl_PAOIsUIE3guJ',
@@ -310,7 +310,7 @@ export const DEFAULT_METRICS = {
direction: -1,
qualitative: true,
hidden: true,
- decimalScale: 1
+ decimalScale: 1,
},
directories: {
id: 'AXJMbImPPAOIsUIE3gu9',
@@ -321,7 +321,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
duplicated_blocks: {
id: 'AXJMbIl9PAOIsUIE3gsu',
@@ -332,7 +332,7 @@ export const DEFAULT_METRICS = {
domain: 'Duplications',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_duplicated_blocks: {
id: 'AXJMbIl_PAOIsUIE3gto',
@@ -343,7 +343,7 @@ export const DEFAULT_METRICS = {
domain: 'Duplications',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
duplicated_files: {
id: 'AXJMbImPPAOIsUIE3gvA',
@@ -354,7 +354,7 @@ export const DEFAULT_METRICS = {
domain: 'Duplications',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
duplicated_lines: {
id: 'AXJMbIl9PAOIsUIE3gss',
@@ -365,7 +365,7 @@ export const DEFAULT_METRICS = {
domain: 'Duplications',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
duplicated_lines_density: {
id: 'AXJMbIl_PAOIsUIE3gtp',
@@ -377,7 +377,7 @@ export const DEFAULT_METRICS = {
direction: -1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
new_duplicated_lines_density: {
id: 'AXJMbIl_PAOIsUIE3gtq',
@@ -389,7 +389,7 @@ export const DEFAULT_METRICS = {
direction: -1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
new_duplicated_lines: {
id: 'AXJMbIl9PAOIsUIE3gst',
@@ -400,7 +400,7 @@ export const DEFAULT_METRICS = {
domain: 'Duplications',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
duplications_data: {
id: 'AXJMbIl_PAOIsUIE3gtr',
@@ -411,7 +411,7 @@ export const DEFAULT_METRICS = {
domain: 'Duplications',
direction: 0,
qualitative: false,
- hidden: false
+ hidden: false,
},
effort_to_reach_maintainability_rating_a: {
id: 'AXJMbIl_PAOIsUIE3guM',
@@ -422,7 +422,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
executable_lines_data: {
id: 'AXJMbImPPAOIsUIE3guW',
@@ -432,7 +432,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
false_positive_issues: {
id: 'AXJMbIl_PAOIsUIE3gt4',
@@ -443,7 +443,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
file_complexity_distribution: {
id: 'AXJMbIl9PAOIsUIE3gtY',
@@ -454,7 +454,7 @@ export const DEFAULT_METRICS = {
domain: 'Complexity',
direction: 0,
qualitative: true,
- hidden: true
+ hidden: true,
},
files: {
id: 'AXJMbImPPAOIsUIE3gu6',
@@ -465,7 +465,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
function_complexity_distribution: {
id: 'AXJMbIl9PAOIsUIE3gtX',
@@ -476,7 +476,7 @@ export const DEFAULT_METRICS = {
domain: 'Complexity',
direction: 0,
qualitative: true,
- hidden: true
+ hidden: true,
},
functions: {
id: 'AXJMbImPPAOIsUIE3gu-',
@@ -487,7 +487,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
generated_lines: {
id: 'AXJMbImPPAOIsUIE3gu0',
@@ -498,7 +498,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
generated_ncloc: {
id: 'AXJMbImPPAOIsUIE3gu4',
@@ -509,7 +509,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
info_violations: {
id: 'AXJMbIl_PAOIsUIE3gtx',
@@ -520,7 +520,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: 0,
qualitative: true,
- hidden: false
+ hidden: false,
},
violations: {
id: 'AXJMbImPPAOIsUIE3gul',
@@ -531,7 +531,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
last_change_on_maintainability_rating: {
id: 'AXJMbImPPAOIsUIE3gud',
@@ -541,7 +541,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
last_change_on_releasability_rating: {
id: 'AXJMbImPPAOIsUIE3gue',
@@ -551,7 +551,7 @@ export const DEFAULT_METRICS = {
domain: 'Releasability',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
last_change_on_reliability_rating: {
id: 'AXJMbImPPAOIsUIE3guf',
@@ -561,7 +561,7 @@ export const DEFAULT_METRICS = {
domain: 'Reliability',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
last_change_on_security_rating: {
id: 'AXJMbImPPAOIsUIE3gug',
@@ -571,7 +571,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
last_change_on_security_review_rating: {
id: 'AXJMbIl9PAOIsUIE3gs4',
@@ -581,7 +581,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
line_coverage: {
id: 'AXJMbIl_PAOIsUIE3gtl',
@@ -593,7 +593,7 @@ export const DEFAULT_METRICS = {
direction: 1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
new_line_coverage: {
id: 'AXJMbIl_PAOIsUIE3gtm',
@@ -605,7 +605,7 @@ export const DEFAULT_METRICS = {
direction: 1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
lines: {
id: 'AXJMbImPPAOIsUIE3guz',
@@ -616,7 +616,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
ncloc: {
id: 'AXJMbImPPAOIsUIE3gu1',
@@ -627,7 +627,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
ncloc_language_distribution: {
id: 'AXJMbImPPAOIsUIE3gu3',
@@ -638,7 +638,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
lines_to_cover: {
id: 'AXJMbImPPAOIsUIE3gu_',
@@ -649,7 +649,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
new_lines_to_cover: {
id: 'AXJMbIl_PAOIsUIE3gti',
@@ -660,7 +660,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
leak_projects: {
id: 'AXJMbImPPAOIsUIE3gvE',
@@ -669,7 +669,7 @@ export const DEFAULT_METRICS = {
name: 'List of technical projects with their leaks',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
sqale_rating: {
id: 'AXJMbIl_PAOIsUIE3guF',
@@ -680,7 +680,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: 0,
qualitative: true,
- hidden: false
+ hidden: false,
},
maintainability_rating_distribution: {
id: 'AX6QkqP7zEziun0YBqmh',
@@ -691,7 +691,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
new_maintainability_rating_distribution: {
id: 'AX6QkqP8zEziun0YBqml',
@@ -702,7 +702,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
new_maintainability_rating: {
id: 'AXJMbIl_PAOIsUIE3guH',
@@ -713,7 +713,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
major_violations: {
id: 'AXJMbIl_PAOIsUIE3gtv',
@@ -724,7 +724,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
minor_violations: {
id: 'AXJMbIl_PAOIsUIE3gtw',
@@ -735,7 +735,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
ncloc_data: {
id: 'AXJMbImPPAOIsUIE3guU',
@@ -745,7 +745,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
new_blocker_violations: {
id: 'AXJMbIl_PAOIsUIE3gtz',
@@ -756,7 +756,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_bugs: {
id: 'AXJMbIl_PAOIsUIE3guA',
@@ -767,7 +767,7 @@ export const DEFAULT_METRICS = {
domain: 'Reliability',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_code_smells: {
id: 'AXJMbIl_PAOIsUIE3gt-',
@@ -778,7 +778,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_critical_violations: {
id: 'AXJMbIl_PAOIsUIE3gt0',
@@ -789,7 +789,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_info_violations: {
id: 'AXJMbIl_PAOIsUIE3gt3',
@@ -800,7 +800,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_violations: {
id: 'AXJMbIl_PAOIsUIE3gty',
@@ -811,7 +811,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_lines: {
id: 'AXJMbImPPAOIsUIE3gu2',
@@ -822,7 +822,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
new_major_violations: {
id: 'AXJMbIl_PAOIsUIE3gt1',
@@ -833,7 +833,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_minor_violations: {
id: 'AXJMbIl_PAOIsUIE3gt2',
@@ -844,7 +844,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_security_hotspots: {
id: 'AXJMbIl9PAOIsUIE3gsw',
@@ -855,7 +855,7 @@ export const DEFAULT_METRICS = {
domain: 'SecurityReview',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_vulnerabilities: {
id: 'AXJMbIl_PAOIsUIE3guC',
@@ -866,7 +866,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
unanalyzed_c: {
id: 'AXTb6RMqLLQlB5osv3xN',
@@ -876,7 +876,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: true
+ hidden: true,
},
unanalyzed_cpp: {
id: 'AXTb6RMtLLQlB5osv3xO',
@@ -886,7 +886,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: true
+ hidden: true,
},
open_issues: {
id: 'AXJMbIl_PAOIsUIE3gt6',
@@ -897,7 +897,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
quality_profiles: {
id: 'AXJMbImPPAOIsUIE3guZ',
@@ -908,7 +908,7 @@ export const DEFAULT_METRICS = {
domain: 'General',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
projects: {
id: 'AXJMbImPPAOIsUIE3guo',
@@ -919,7 +919,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
public_api: {
id: 'AXJMbImPPAOIsUIE3gun',
@@ -930,7 +930,7 @@ export const DEFAULT_METRICS = {
domain: 'Documentation',
direction: -1,
qualitative: false,
- hidden: true
+ hidden: true,
},
public_documented_api_density: {
id: 'AXJMbImPPAOIsUIE3gur',
@@ -942,7 +942,7 @@ export const DEFAULT_METRICS = {
direction: 1,
qualitative: true,
hidden: true,
- decimalScale: 1
+ decimalScale: 1,
},
public_undocumented_api: {
id: 'AXJMbImPPAOIsUIE3gus',
@@ -953,7 +953,7 @@ export const DEFAULT_METRICS = {
domain: 'Documentation',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
quality_gate_details: {
id: 'AXJMbImPPAOIsUIE3guY',
@@ -964,7 +964,7 @@ export const DEFAULT_METRICS = {
domain: 'General',
direction: 0,
qualitative: false,
- hidden: false
+ hidden: false,
},
alert_status: {
id: 'AXJMbImPPAOIsUIE3guX',
@@ -975,7 +975,7 @@ export const DEFAULT_METRICS = {
domain: 'Releasability',
direction: 1,
qualitative: true,
- hidden: false
+ hidden: false,
},
releasability_rating: {
id: 'AXJMbImPPAOIsUIE3guc',
@@ -985,7 +985,7 @@ export const DEFAULT_METRICS = {
domain: 'Releasability',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
releasability_rating_distribution: {
id: 'AX6QkqP7zEziun0YBqmg',
@@ -996,7 +996,7 @@ export const DEFAULT_METRICS = {
domain: 'Releasability',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
reliability_rating: {
id: 'AXJMbIl_PAOIsUIE3guP',
@@ -1007,7 +1007,7 @@ export const DEFAULT_METRICS = {
domain: 'Reliability',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
reliability_rating_distribution: {
id: 'AX6QkqP7zEziun0YBqmi',
@@ -1018,7 +1018,7 @@ export const DEFAULT_METRICS = {
domain: 'Reliability',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
new_reliability_rating_distribution: {
id: 'AX6QkqP8zEziun0YBqmm',
@@ -1029,7 +1029,7 @@ export const DEFAULT_METRICS = {
domain: 'Reliability',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
new_reliability_rating: {
id: 'AXJMbIl_PAOIsUIE3guQ',
@@ -1040,7 +1040,7 @@ export const DEFAULT_METRICS = {
domain: 'Reliability',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
reliability_remediation_effort: {
id: 'AXJMbIl_PAOIsUIE3guN',
@@ -1051,7 +1051,7 @@ export const DEFAULT_METRICS = {
domain: 'Reliability',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_reliability_remediation_effort: {
id: 'AXJMbIl_PAOIsUIE3guO',
@@ -1062,7 +1062,7 @@ export const DEFAULT_METRICS = {
domain: 'Reliability',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
reopened_issues: {
id: 'AXJMbIl_PAOIsUIE3gt7',
@@ -1073,7 +1073,7 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
security_hotspots: {
id: 'AXJMbIl9PAOIsUIE3gsv',
@@ -1084,7 +1084,7 @@ export const DEFAULT_METRICS = {
domain: 'SecurityReview',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
security_hotspots_reviewed: {
id: 'AXJMbIl9PAOIsUIE3gs0',
@@ -1096,7 +1096,7 @@ export const DEFAULT_METRICS = {
direction: 1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
new_security_hotspots_reviewed: {
id: 'AXJMbIl9PAOIsUIE3gs1',
@@ -1108,7 +1108,7 @@ export const DEFAULT_METRICS = {
direction: 1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
security_rating: {
id: 'AXJMbIl_PAOIsUIE3guS',
@@ -1119,7 +1119,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
security_rating_distribution: {
id: 'AX6QkqP7zEziun0YBqmj',
@@ -1130,7 +1130,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
new_security_rating_distribution: {
id: 'AX6QkqP8zEziun0YBqmn',
@@ -1141,7 +1141,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
new_security_rating: {
id: 'AXJMbImPPAOIsUIE3guT',
@@ -1152,7 +1152,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
security_remediation_effort: {
id: 'AXJMbIl_PAOIsUIE3guG',
@@ -1163,7 +1163,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
new_security_remediation_effort: {
id: 'AXJMbIl_PAOIsUIE3guR',
@@ -1174,7 +1174,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
security_review_rating: {
id: 'AXJMbIl9PAOIsUIE3gsx',
@@ -1185,7 +1185,7 @@ export const DEFAULT_METRICS = {
domain: 'SecurityReview',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
security_review_rating_distribution: {
id: 'AX6QkqP8zEziun0YBqmk',
@@ -1196,7 +1196,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
new_security_review_rating_distribution: {
id: 'AX6QkqP8zEziun0YBqmo',
@@ -1207,7 +1207,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
new_security_review_rating: {
id: 'AXJMbIl9PAOIsUIE3gtA',
@@ -1218,7 +1218,7 @@ export const DEFAULT_METRICS = {
domain: 'SecurityReview',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
security_hotspots_reviewed_status: {
id: 'AXJMbIl9PAOIsUIE3gs2',
@@ -1229,7 +1229,7 @@ export const DEFAULT_METRICS = {
domain: 'SecurityReview',
direction: -1,
qualitative: false,
- hidden: true
+ hidden: true,
},
new_security_hotspots_reviewed_status: {
id: 'AXJMbIl9PAOIsUIE3gtB',
@@ -1240,7 +1240,7 @@ export const DEFAULT_METRICS = {
domain: 'SecurityReview',
direction: -1,
qualitative: false,
- hidden: true
+ hidden: true,
},
security_hotspots_to_review_status: {
id: 'AXJMbIl9PAOIsUIE3gs3',
@@ -1251,7 +1251,7 @@ export const DEFAULT_METRICS = {
domain: 'SecurityReview',
direction: -1,
qualitative: false,
- hidden: true
+ hidden: true,
},
new_security_hotspots_to_review_status: {
id: 'AXJMbIl9PAOIsUIE3gs5',
@@ -1262,7 +1262,7 @@ export const DEFAULT_METRICS = {
domain: 'SecurityReview',
direction: -1,
qualitative: false,
- hidden: true
+ hidden: true,
},
skipped_tests: {
id: 'AXJMbIl9PAOIsUIE3gtd',
@@ -1273,7 +1273,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
statements: {
id: 'AXJMbImPPAOIsUIE3gum',
@@ -1284,7 +1284,7 @@ export const DEFAULT_METRICS = {
domain: 'Size',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
sqale_index: {
id: 'AXJMbIl_PAOIsUIE3guD',
@@ -1296,7 +1296,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
sqale_debt_ratio: {
id: 'AXJMbIl_PAOIsUIE3guK',
@@ -1309,7 +1309,7 @@ export const DEFAULT_METRICS = {
direction: -1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
new_sqale_debt_ratio: {
id: 'AXJMbIl_PAOIsUIE3guL',
@@ -1321,7 +1321,7 @@ export const DEFAULT_METRICS = {
direction: -1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
maintainability_rating_effort: {
id: 'AXJMbImPPAOIsUIE3gvD',
@@ -1331,7 +1331,7 @@ export const DEFAULT_METRICS = {
domain: 'Maintainability',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
reliability_rating_effort: {
id: 'AXJMbImPPAOIsUIE3gvC',
@@ -1341,7 +1341,7 @@ export const DEFAULT_METRICS = {
domain: 'Reliability',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
security_rating_effort: {
id: 'AXJMbImPPAOIsUIE3gvB',
@@ -1351,7 +1351,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
security_review_rating_effort: {
id: 'AXJMbIl9PAOIsUIE3gs6',
@@ -1361,7 +1361,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: 0,
qualitative: false,
- hidden: true
+ hidden: true,
},
releasability_effort: {
id: 'AXJMbImPPAOIsUIE3gub',
@@ -1371,7 +1371,7 @@ export const DEFAULT_METRICS = {
domain: 'Releasability',
direction: -1,
qualitative: true,
- hidden: true
+ hidden: true,
},
uncovered_conditions: {
id: 'AXJMbIl9PAOIsUIE3gs8',
@@ -1382,7 +1382,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
new_uncovered_conditions: {
id: 'AXJMbIl9PAOIsUIE3gs9',
@@ -1393,7 +1393,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
uncovered_lines: {
id: 'AXJMbIl_PAOIsUIE3gtj',
@@ -1404,7 +1404,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
new_uncovered_lines: {
id: 'AXJMbIl_PAOIsUIE3gtk',
@@ -1415,7 +1415,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
test_execution_time: {
id: 'AXJMbIl9PAOIsUIE3gtb',
@@ -1426,7 +1426,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
test_errors: {
id: 'AXJMbIl9PAOIsUIE3gtc',
@@ -1437,7 +1437,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
test_failures: {
id: 'AXJMbIl9PAOIsUIE3gte',
@@ -1448,7 +1448,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: -1,
qualitative: true,
- hidden: false
+ hidden: false,
},
tests: {
id: 'AXJMbIl9PAOIsUIE3gta',
@@ -1459,7 +1459,7 @@ export const DEFAULT_METRICS = {
domain: 'Coverage',
direction: 1,
qualitative: false,
- hidden: false
+ hidden: false,
},
test_success_density: {
id: 'AXJMbIl9PAOIsUIE3gtf',
@@ -1471,7 +1471,7 @@ export const DEFAULT_METRICS = {
direction: 1,
qualitative: true,
hidden: false,
- decimalScale: 1
+ decimalScale: 1,
},
vulnerabilities: {
id: 'AXJMbIl_PAOIsUIE3guB',
@@ -1482,7 +1482,7 @@ export const DEFAULT_METRICS = {
domain: 'Security',
direction: -1,
qualitative: false,
- hidden: false
+ hidden: false,
},
wont_fix_issues: {
id: 'AXJMbIl_PAOIsUIE3gt5',
@@ -1493,6 +1493,6 @@ export const DEFAULT_METRICS = {
domain: 'Issues',
direction: -1,
qualitative: false,
- hidden: false
- }
+ hidden: false,
+ },
};
diff --git a/server/sonar-web/src/main/js/helpers/mocks/permissions.ts b/server/sonar-web/src/main/js/helpers/mocks/permissions.ts
index a3fc50e6cfe..594069e3ac1 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/permissions.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/permissions.ts
@@ -24,7 +24,7 @@ export function mockPermissionGroup(overrides: Partial<PermissionGroup> = {}): P
return {
name: 'sonar-admins',
permissions: ['provisioning'],
- ...overrides
+ ...overrides,
};
}
@@ -34,6 +34,6 @@ export function mockPermissionUser(overrides: Partial<PermissionUser> = {}): Per
active: true,
name: 'johndoe',
permissions: ['provisioning'],
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/plugins.ts b/server/sonar-web/src/main/js/helpers/mocks/plugins.ts
index 654cea8d3c4..38d3f93f612 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/plugins.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/plugins.ts
@@ -23,14 +23,14 @@ import {
PendingPlugin,
Plugin,
Release,
- Update
+ Update,
} from '../../types/plugins';
export function mockPlugin(overrides: Partial<Plugin> = {}): Plugin {
return {
key: 'sonar-foo',
name: 'Sonar Foo',
- ...overrides
+ ...overrides,
};
}
@@ -40,7 +40,7 @@ export function mockPendingPlugin(overrides: Partial<PendingPlugin> = {}): Pendi
name: 'Sonar Foo',
version: '1.0',
implementationBuild: '1.0.0.1234',
- ...overrides
+ ...overrides,
};
}
@@ -54,7 +54,7 @@ export function mockInstalledPlugin(overrides: Partial<InstalledPlugin> = {}): I
hash: 'hash',
sonarLintSupported: false,
updatedAt: 100,
- ...overrides
+ ...overrides,
};
}
@@ -63,7 +63,7 @@ export function mockAvailablePlugin(overrides: Partial<AvailablePlugin> = {}): A
release: mockRelease(),
update: mockUpdate(),
...mockPlugin(),
- ...overrides
+ ...overrides,
};
}
@@ -71,7 +71,7 @@ export function mockRelease(overrides: Partial<Release> = {}): Release {
return {
date: '2020-01-01',
version: '8.2',
- ...overrides
+ ...overrides,
};
}
@@ -79,6 +79,6 @@ export function mockUpdate(overrides: Partial<Update> = {}): Update {
return {
status: 'available',
requires: [],
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts b/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts
index c8c366bdea3..2c709a7759c 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts
@@ -23,7 +23,7 @@ import {
AnalysisEvent,
HistoryItem,
MeasureHistory,
- ParsedAnalysis
+ ParsedAnalysis,
} from '../../types/project-activity';
import { parseDate } from '../dates';
@@ -33,7 +33,7 @@ export function mockAnalysis(overrides: Partial<Analysis> = {}): Analysis {
events: [],
key: 'foo',
projectVersion: '1.0',
- ...overrides
+ ...overrides,
};
}
@@ -43,7 +43,7 @@ export function mockParsedAnalysis(overrides: Partial<ParsedAnalysis> = {}): Par
events: [],
key: 'foo',
projectVersion: '1.0',
- ...overrides
+ ...overrides,
};
}
@@ -60,16 +60,16 @@ export function mockAnalysisEvent(overrides: Partial<AnalysisEvent> = {}): Analy
{
key: 'foo',
name: 'Foo',
- branch: 'master'
+ branch: 'master',
},
{
key: 'bar',
name: 'Bar',
- branch: 'feature/bar'
- }
- ]
+ branch: 'feature/bar',
+ },
+ ],
},
- ...overrides
+ ...overrides,
};
}
@@ -79,9 +79,9 @@ export function mockMeasureHistory(overrides: Partial<MeasureHistory> = {}): Mea
history: [
mockHistoryItem(),
mockHistoryItem({ date: parseDate('2018-10-27T12:21:15+0200'), value: '1749' }),
- mockHistoryItem({ date: parseDate('2020-10-27T16:33:50+0200'), value: '500' })
+ mockHistoryItem({ date: parseDate('2020-10-27T16:33:50+0200'), value: '500' }),
],
- ...overrides
+ ...overrides,
};
}
@@ -89,6 +89,6 @@ export function mockHistoryItem(overrides: Partial<HistoryItem> = {}): HistoryIt
return {
date: parseDate('2016-10-26T12:17:29+0200'),
value: '2286',
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/projects.ts b/server/sonar-web/src/main/js/helpers/mocks/projects.ts
index d4c58976920..93b715030f1 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/projects.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/projects.ts
@@ -28,6 +28,6 @@ export function mockProject(overrides: Partial<Project> = {}): Project {
qualifier: ComponentQualifier.Project,
tags: [],
visibility: 'public',
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts b/server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts
index addc3771126..57231e3b603 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/quality-gates.ts
@@ -22,7 +22,7 @@ import {
QualityGateProjectStatus,
QualityGateStatus,
QualityGateStatusCondition,
- QualityGateStatusConditionEnhanced
+ QualityGateStatusConditionEnhanced,
} from '../../types/quality-gates';
import { QualityGate } from '../../types/types';
import { mockMeasureEnhanced, mockMetric } from '../testMocks';
@@ -31,7 +31,7 @@ export function mockQualityGate(overrides: Partial<QualityGate> = {}): QualityGa
return {
id: '1',
name: 'qualitygate',
- ...overrides
+ ...overrides,
};
}
@@ -44,7 +44,7 @@ export function mockQualityGateStatus(
key: 'foo',
name: 'Foo',
status: 'ERROR',
- ...overrides
+ ...overrides,
};
}
@@ -57,7 +57,7 @@ export function mockQualityGateStatusCondition(
level: 'ERROR',
metric: 'foo',
op: 'GT',
- ...overrides
+ ...overrides,
};
}
@@ -71,7 +71,7 @@ export function mockQualityGateStatusConditionEnhanced(
metric: 'foo',
op: 'GT',
measure: mockMeasureEnhanced({ ...(overrides.measure || {}) }),
- ...overrides
+ ...overrides,
};
}
@@ -86,12 +86,12 @@ export function mockQualityGateProjectStatus(
errorThreshold: '1.0',
metricKey: 'new_bugs',
periodIndex: 1,
- status: 'OK'
- }
+ status: 'OK',
+ },
],
ignoredConditions: false,
status: 'OK',
- ...overrides
+ ...overrides,
};
}
@@ -110,7 +110,7 @@ export function mockQualityGateApplicationStatus(
errorThreshold: '1.0',
metric: 'coverage',
status: 'ERROR',
- value: '10'
+ value: '10',
},
{
comparator: 'GT',
@@ -118,10 +118,10 @@ export function mockQualityGateApplicationStatus(
metric: 'new_bugs',
periodIndex: 1,
status: 'ERROR',
- value: '5'
- }
+ value: '5',
+ },
],
- status: 'ERROR'
+ status: 'ERROR',
},
{
key: 'bar',
@@ -133,13 +133,13 @@ export function mockQualityGateApplicationStatus(
metric: 'new_bugs',
periodIndex: 1,
status: 'ERROR',
- value: '15'
- }
+ value: '15',
+ },
],
- status: 'ERROR'
- }
+ status: 'ERROR',
+ },
],
status: 'ERROR',
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/quality-profiles.ts b/server/sonar-web/src/main/js/helpers/mocks/quality-profiles.ts
index 20d2a14a60b..9b85ae0480c 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/quality-profiles.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/quality-profiles.ts
@@ -26,6 +26,6 @@ export function mockProfileOption(overrides: Partial<ProfileOption> = {}): Profi
label: 'Profile 1',
language: 'Java',
isDisabled: false,
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/react-select.ts b/server/sonar-web/src/main/js/helpers/mocks/react-select.ts
index 17f4562c437..6433f8247f7 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/react-select.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/react-select.ts
@@ -23,7 +23,7 @@ import {
IndicatorProps,
InputProps,
OptionProps,
- OptionTypeBase
+ OptionTypeBase,
} from 'react-select';
export function mockReactSelectOptionProps<
@@ -36,7 +36,7 @@ export function mockReactSelectOptionProps<
): OptionProps<OptionType, IsMulti, GroupType> {
return {
...overrides,
- data
+ data,
} as OptionProps<OptionType, IsMulti, GroupType>;
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts b/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts
index 6ce02172949..a23ee491071 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/security-hotspots.ts
@@ -29,7 +29,7 @@ import {
RawHotspot,
ReviewHistoryElement,
ReviewHistoryType,
- RiskExposure
+ RiskExposure,
} from '../../types/security-hotspots';
import { mockFlowLocation, mockUser } from '../testMocks';
@@ -48,7 +48,7 @@ export function mockRawHotspot(overrides: Partial<RawHotspot> = {}): RawHotspot
author: 'Developer 1',
creationDate: '2013-05-13T17:55:39+0200',
updateDate: '2013-05-13T17:55:39+0200',
- ...overrides
+ ...overrides,
};
}
@@ -77,11 +77,11 @@ export function mockHotspot(overrides?: Partial<Hotspot>): Hotspot {
startLine: 142,
endLine: 142,
startOffset: 26,
- endOffset: 83
+ endOffset: 83,
},
updateDate: '2013-05-13T17:55:42+0200',
users: [assigneeUser, authorUser],
- ...overrides
+ ...overrides,
};
}
@@ -92,7 +92,7 @@ export function mockHotspotComponent(overrides?: Partial<HotspotComponent>): Hot
longName: 'Hotspot component long name',
qualifier: ComponentQualifier.File,
path: 'path/to/component',
- ...overrides
+ ...overrides,
};
}
@@ -105,7 +105,7 @@ export function mockHotspotComment(overrides?: Partial<HotspotComment>): Hotspot
updatable: false,
login: 'dude-2',
user: mockUser({ login: 'dude-2' }),
- ...overrides
+ ...overrides,
};
}
@@ -115,7 +115,7 @@ export function mockHotspotRule(overrides?: Partial<HotspotRule>): HotspotRule {
name: 'That rule',
vulnerabilityProbability: RiskExposure.HIGH,
securityCategory: 'sql-injection',
- ...overrides
+ ...overrides,
};
}
@@ -126,7 +126,7 @@ export function mockHotspotReviewHistoryElement(
date: '2019-09-13T17:55:42+0200',
type: ReviewHistoryType.Creation,
user: mockUser(),
- ...overrides
+ ...overrides,
};
}
@@ -134,70 +134,70 @@ export function mockStandards(): Standards {
return {
cwe: {
unknown: {
- title: 'No CWE associated'
+ title: 'No CWE associated',
},
'1004': {
- title: "Sensitive Cookie Without 'HttpOnly' Flag"
- }
+ title: "Sensitive Cookie Without 'HttpOnly' Flag",
+ },
},
owaspTop10: {
a1: {
- title: 'Injection'
+ title: 'Injection',
},
a2: {
- title: 'Broken Authentication'
+ title: 'Broken Authentication',
},
a3: {
- title: 'Sensitive Data Exposure'
- }
+ title: 'Sensitive Data Exposure',
+ },
},
'owaspTop10-2021': {
a1: {
- title: 'Injection'
+ title: 'Injection',
},
a2: {
- title: 'Broken Authentication'
+ title: 'Broken Authentication',
},
a3: {
- title: 'Sensitive Data Exposure'
- }
+ title: 'Sensitive Data Exposure',
+ },
},
sansTop25: {
'insecure-interaction': {
- title: 'Insecure Interaction Between Components'
+ title: 'Insecure Interaction Between Components',
},
'risky-resource': {
- title: 'Risky Resource Management'
+ title: 'Risky Resource Management',
},
'porous-defenses': {
- title: 'Porous Defenses'
- }
+ title: 'Porous Defenses',
+ },
},
sonarsourceSecurity: {
'buffer-overflow': {
- title: 'Buffer Overflow'
+ title: 'Buffer Overflow',
},
'sql-injection': {
- title: 'SQL Injection'
+ title: 'SQL Injection',
},
rce: {
- title: 'Code Injection (RCE)'
- }
+ title: 'Code Injection (RCE)',
+ },
},
'pciDss-3.2': {
'1': {
- title: ' Install and maintain a firewall configuration to protect cardholder data'
- }
+ title: ' Install and maintain a firewall configuration to protect cardholder data',
+ },
},
'pciDss-4.0': {
'2': {
- title: 'This is useless...'
- }
+ title: 'This is useless...',
+ },
},
'owaspAsvs-4.0': {
'1': {
- title: 'New OWASP ASVS cat 1'
- }
- }
+ title: 'New OWASP ASVS cat 1',
+ },
+ },
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/settings.ts b/server/sonar-web/src/main/js/helpers/mocks/settings.ts
index 367b4c0cd95..8d9236c4469 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/settings.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/settings.ts
@@ -22,7 +22,7 @@ import {
Setting,
SettingType,
SettingValue,
- SettingWithCategory
+ SettingWithCategory,
} from '../../types/settings';
export function mockDefinition(
@@ -34,7 +34,7 @@ export function mockDefinition(
fields: [],
options: [],
subCategory: 'foo subCat',
- ...overrides
+ ...overrides,
};
}
@@ -49,16 +49,16 @@ export function mockSetting(overrides: Partial<Setting> = {}): Setting {
name: 'Foo setting',
description: 'When Foo then Bar',
type: SettingType.INTEGER,
- options: []
+ options: [],
},
- ...overrides
+ ...overrides,
};
}
export function mockSettingValue(overrides: Partial<SettingValue> = {}) {
return {
key: 'test',
- ...overrides
+ ...overrides,
};
}
@@ -78,8 +78,8 @@ export function mockSettingWithCategory(
options: [],
category: 'general',
fields: [],
- subCategory: 'email'
+ subCategory: 'email',
},
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/sources.ts b/server/sonar-web/src/main/js/helpers/mocks/sources.ts
index 72523c2add2..0fe4db77452 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/sources.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/sources.ts
@@ -31,7 +31,7 @@ export function mockSourceViewerFile(
coverage: '85.2',
duplicationDensity: '1.0',
issues: '12',
- lines: '56'
+ lines: '56',
},
project,
projectName: 'MyProject',
@@ -43,7 +43,7 @@ export function mockSourceViewerFile(
longName: name,
fav: false,
canMarkAsFavorite: true,
- ...override
+ ...override,
};
}
@@ -58,7 +58,7 @@ export function mockSourceLine(overrides: Partial<SourceLine> = {}): SourceLine
scmDate: '2018-12-11T10:48:39+0100',
duplicated: false,
isNew: true,
- ...overrides
+ ...overrides,
};
}
@@ -73,6 +73,6 @@ export function mockSnippetsByComponent(
}, {});
return {
component: mockSourceViewerFile(file, project),
- sources
+ sources,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts b/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts
index 0c2c61e5ee2..40c6d5715a8 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/system-upgrades.ts
@@ -26,6 +26,6 @@ export function mockSystemUpgrade(override: Partial<SystemUpgrade> = {}): System
releaseDate: '2017-03-01',
changeLogUrl: 'changelogurl',
downloadUrl: 'downloadurl',
- ...override
+ ...override,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/tasks.ts b/server/sonar-web/src/main/js/helpers/mocks/tasks.ts
index cfd8bf6e6fb..8c0e611ed14 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/tasks.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/tasks.ts
@@ -30,7 +30,7 @@ export function mockTask(overrides: Partial<Task> = {}): Task {
status: TaskStatuses.Pending,
submittedAt: '2020-09-11T11:45:35+0200',
type: TaskTypes.Report,
- ...overrides
+ ...overrides,
};
}
@@ -39,6 +39,6 @@ export function mockTaskWarning(overrides: Partial<TaskWarning> = {}): TaskWarni
key: 'foo',
message: 'Lorem ipsum',
dismissable: false,
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/token.ts b/server/sonar-web/src/main/js/helpers/mocks/token.ts
index f7bbecf6e08..c29528bff29 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/token.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/token.ts
@@ -26,6 +26,6 @@ export function mockUserToken(overrides: Partial<UserToken> = {}): UserToken {
createdAt: '2019-06-14T09:45:52+0200',
type: TokenType.User,
isExpired: false,
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/users.ts b/server/sonar-web/src/main/js/helpers/mocks/users.ts
index d184c0ffb8c..ef6fc83884b 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/users.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/users.ts
@@ -22,6 +22,6 @@ import { UserBase } from '../../types/users';
export function mockUserBase(overrides: Partial<UserBase> = {}): UserBase {
return {
login: 'userlogin',
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/webhook.ts b/server/sonar-web/src/main/js/helpers/mocks/webhook.ts
index 3f4859f4708..c536fdc7c89 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/webhook.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/webhook.ts
@@ -28,6 +28,6 @@ export function mockWebhookDelivery(overrides: Partial<WebhookDelivery> = {}): W
httpStatus: HttpStatus.Ok,
id: '1',
success: true,
- ...overrides
+ ...overrides,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/path.ts b/server/sonar-web/src/main/js/helpers/path.ts
index 60252e60593..c04baeb69a0 100644
--- a/server/sonar-web/src/main/js/helpers/path.ts
+++ b/server/sonar-web/src/main/js/helpers/path.ts
@@ -88,14 +88,14 @@ export function splitPath(path: string) {
const tokens = path.split('/');
return {
head: tokens.slice(0, -1).join('/'),
- tail: tokens[tokens.length - 1]
+ tail: tokens[tokens.length - 1],
};
}
export function cutLongWords(str: string, limit = 30) {
return str
.split(' ')
- .map(word => (word.length > limit ? word.substr(0, limit) + '...' : word))
+ .map((word) => (word.length > limit ? word.substr(0, limit) + '...' : word))
.join(' ');
}
diff --git a/server/sonar-web/src/main/js/helpers/projectLinks.ts b/server/sonar-web/src/main/js/helpers/projectLinks.ts
index 07725bf6740..d8af5f9f52e 100644
--- a/server/sonar-web/src/main/js/helpers/projectLinks.ts
+++ b/server/sonar-web/src/main/js/helpers/projectLinks.ts
@@ -31,8 +31,8 @@ export function isProvided(link: Pick<ProjectLink, 'type'>) {
export function orderLinks<T extends NameAndType>(links: T[]) {
const [provided, unknown] = partition<T>(links, isProvided);
return [
- ...sortBy(provided, link => PROVIDED_TYPES.indexOf(link.type)),
- ...sortBy(unknown, link => link.name && link.name.toLowerCase())
+ ...sortBy(provided, (link) => PROVIDED_TYPES.indexOf(link.type)),
+ ...sortBy(unknown, (link) => link.name && link.name.toLowerCase()),
];
}
diff --git a/server/sonar-web/src/main/js/helpers/qualityGates.ts b/server/sonar-web/src/main/js/helpers/qualityGates.ts
index 22ba0141dd5..381866bcbc8 100644
--- a/server/sonar-web/src/main/js/helpers/qualityGates.ts
+++ b/server/sonar-web/src/main/js/helpers/qualityGates.ts
@@ -20,7 +20,7 @@
import {
QualityGateApplicationStatusChildProject,
QualityGateProjectStatus,
- QualityGateStatusCondition
+ QualityGateStatusCondition,
} from '../types/quality-gates';
export function extractStatusConditionsFromProjectStatus(
@@ -28,13 +28,13 @@ export function extractStatusConditionsFromProjectStatus(
): QualityGateStatusCondition[] {
const { conditions } = projectStatus;
return conditions
- ? conditions.map(c => ({
+ ? conditions.map((c) => ({
actual: c.actualValue,
error: c.errorThreshold,
level: c.status,
metric: c.metricKey,
op: c.comparator,
- period: c.periodIndex
+ period: c.periodIndex,
}))
: [];
}
@@ -44,13 +44,13 @@ export function extractStatusConditionsFromApplicationStatusChildProject(
): QualityGateStatusCondition[] {
const { conditions } = projectStatus;
return conditions
- ? conditions.map(c => ({
+ ? conditions.map((c) => ({
actual: c.value,
error: c.errorThreshold,
level: c.status,
metric: c.metric,
op: c.comparator,
- period: c.periodIndex
+ period: c.periodIndex,
}))
: [];
}
diff --git a/server/sonar-web/src/main/js/helpers/query.ts b/server/sonar-web/src/main/js/helpers/query.ts
index 2cadbc21282..85b9347fe9d 100644
--- a/server/sonar-web/src/main/js/helpers/query.ts
+++ b/server/sonar-web/src/main/js/helpers/query.ts
@@ -29,7 +29,7 @@ export function queriesEqual(a: RawQuery, b: RawQuery): boolean {
return false;
}
- return keysA.every(key => isEqual(a[key], b[key]));
+ return keysA.every((key) => isEqual(a[key], b[key]));
}
export function cleanQuery(query: RawQuery): RawQuery {
diff --git a/server/sonar-web/src/main/js/helpers/request.ts b/server/sonar-web/src/main/js/helpers/request.ts
index 569ea04e610..2c0c8eceb8b 100644
--- a/server/sonar-web/src/main/js/helpers/request.ts
+++ b/server/sonar-web/src/main/js/helpers/request.ts
@@ -61,14 +61,14 @@ const DEFAULT_OPTIONS: {
method: string;
} = {
credentials: 'same-origin',
- method: 'GET'
+ method: 'GET',
};
/**
* Default request headers
*/
const DEFAULT_HEADERS = {
- Accept: 'application/json'
+ Accept: 'application/json',
};
/**
@@ -104,7 +104,7 @@ class Request {
options.headers = {
...DEFAULT_HEADERS,
- ...customHeaders
+ ...customHeaders,
};
return { url, options };
}
@@ -141,7 +141,7 @@ export function request(url: string): Request {
export function corsRequest(url: string, mode: RequestMode = 'cors'): Request {
const options: RequestInit = { mode };
const request = new Request(url, options);
- request.submit = function() {
+ request.submit = function () {
const { url, options } = this.getSubmitData();
return window.fetch(url, options);
};
@@ -154,9 +154,7 @@ export function corsRequest(url: string, mode: RequestMode = 'cors'): Request {
export function checkStatus(response: Response, bypassRedirect?: boolean): Promise<Response> {
return new Promise((resolve, reject) => {
if (response.status === HttpStatus.Unauthorized && !bypassRedirect) {
- import('./handleRequiredAuthentication')
- .then(i => i.default())
- .then(reject, reject);
+ import('./handleRequiredAuthentication').then((i) => i.default()).then(reject, reject);
} else if (isSuccessStatus(response.status)) {
resolve(response);
} else {
@@ -196,7 +194,7 @@ export function get(url: string, data?: RequestData, bypassRedirect?: boolean):
return request(url)
.setData(data)
.submit()
- .then(response => checkStatus(response, bypassRedirect));
+ .then((response) => checkStatus(response, bypassRedirect));
}
/**
@@ -224,7 +222,7 @@ export function getCorsJSON(url: string, data?: RequestData): Promise<any> {
return corsRequest(url)
.setData(data)
.submit()
- .then(response => {
+ .then((response) => {
if (isSuccessStatus(response.status)) {
return parseJSON(response);
}
@@ -240,7 +238,7 @@ export function postJSON(url: string, data?: RequestData, bypassRedirect?: boole
.setMethod('POST')
.setData(data)
.submit()
- .then(response => checkStatus(response, bypassRedirect))
+ .then((response) => checkStatus(response, bypassRedirect))
.then(parseJSON);
}
@@ -256,7 +254,7 @@ export function postJSONBody(
.setMethod('POST')
.setData(data, true)
.submit()
- .then(response => checkStatus(response, bypassRedirect))
+ .then((response) => checkStatus(response, bypassRedirect))
.then(parseJSON);
}
@@ -269,7 +267,7 @@ export function post(url: string, data?: RequestData, bypassRedirect?: boolean):
.setMethod('POST')
.setData(data)
.submit()
- .then(response => checkStatus(response, bypassRedirect))
+ .then((response) => checkStatus(response, bypassRedirect))
.then(() => resolve(), reject);
});
}
@@ -283,7 +281,7 @@ function tryRequestAgain<T>(
) {
tries.max--;
if (tries.max !== 0) {
- return new Promise<T>(resolve => {
+ return new Promise<T>((resolve) => {
setTimeout(
() => resolve(requestTryAndRepeatUntil(repeatAPICall, tries, stopRepeat, repeatErrors)),
tries.max > tries.slowThreshold ? 500 : 3000
@@ -300,7 +298,7 @@ export function requestTryAndRepeatUntil<T>(
repeatErrors: number[] = []
) {
return repeatAPICall().then(
- r => {
+ (r) => {
if (stopRepeat(r)) {
return r;
}
@@ -335,5 +333,5 @@ export enum HttpStatus {
NotImplemented = 501,
BadGateway = 502,
ServiceUnavailable = 503,
- GatewayTimeout = 504
+ GatewayTimeout = 504,
}
diff --git a/server/sonar-web/src/main/js/helpers/sanitize.ts b/server/sonar-web/src/main/js/helpers/sanitize.ts
index 2dace31d2d1..75cb96e84f5 100644
--- a/server/sonar-web/src/main/js/helpers/sanitize.ts
+++ b/server/sonar-web/src/main/js/helpers/sanitize.ts
@@ -22,7 +22,7 @@ import { sanitize } from 'dompurify';
export function sanitizeStringRestricted(html: string) {
return sanitize(html, {
ALLOWED_TAGS: ['b', 'br', 'code', 'i', 'li', 'p', 'strong', 'ul', 'a'],
- ALLOWED_ATTR: ['target', 'href']
+ ALLOWED_ATTR: ['target', 'href'],
});
}
diff --git a/server/sonar-web/src/main/js/helpers/scrolling.ts b/server/sonar-web/src/main/js/helpers/scrolling.ts
index 2b80c07da7a..fdf5da0fa05 100644
--- a/server/sonar-web/src/main/js/helpers/scrolling.ts
+++ b/server/sonar-web/src/main/js/helpers/scrolling.ts
@@ -50,7 +50,7 @@ function smoothScroll(
const step = Math.ceil(Math.abs(target - current) / SCROLLING_STEPS);
let stepsDone = 0;
- return new Promise(resolve => {
+ return new Promise((resolve) => {
const interval = setInterval(() => {
if (current === target || SCROLLING_STEPS === stepsDone) {
clearInterval(interval);
@@ -72,12 +72,12 @@ function smoothScroll(
function smoothScrollTop(parent: Element | Window, position: number) {
const scroll = getScroll(parent);
- return smoothScroll(position, scroll.y, position => scrollElement(parent, scroll.x, position));
+ return smoothScroll(position, scroll.y, (position) => scrollElement(parent, scroll.x, position));
}
function smoothScrollLeft(parent: Element | Window, position: number) {
const scroll = getScroll(parent);
- return smoothScroll(position, scroll.x, position => scrollElement(parent, position, scroll.y));
+ return smoothScroll(position, scroll.x, (position) => scrollElement(parent, position, scroll.y));
}
/**
@@ -194,9 +194,7 @@ function processQueue() {
if (queue.length > 0) {
queueRunning = true;
const { fn, element, x, y } = queue.shift()!;
- fn(element, x, y)
- .then(processQueue)
- .catch(processQueue);
+ fn(element, x, y).then(processQueue).catch(processQueue);
} else {
queueRunning = false;
}
diff --git a/server/sonar-web/src/main/js/helpers/security-standard.ts b/server/sonar-web/src/main/js/helpers/security-standard.ts
index ab51b5f107e..5ffbe8e65d9 100644
--- a/server/sonar-web/src/main/js/helpers/security-standard.ts
+++ b/server/sonar-web/src/main/js/helpers/security-standard.ts
@@ -20,7 +20,7 @@
import { Standards } from '../types/security';
export function getStandards(): Promise<Standards> {
- return import('./standards.json').then(x => x.default);
+ return import('./standards.json').then((x) => x.default);
}
export function renderCWECategory(standards: Standards, category: string): string {
diff --git a/server/sonar-web/src/main/js/helpers/sonarlint.ts b/server/sonar-web/src/main/js/helpers/sonarlint.ts
index 640c594462f..978d624bde6 100644
--- a/server/sonar-web/src/main/js/helpers/sonarlint.ts
+++ b/server/sonar-web/src/main/js/helpers/sonarlint.ts
@@ -27,17 +27,17 @@ const SONARLINT_PORT_RANGE = 11;
export async function probeSonarLintServers(): Promise<Array<Ide>> {
const probedPorts = buildPortRange();
- const probeRequests = probedPorts.map(p =>
+ const probeRequests = probedPorts.map((p) =>
fetch(buildSonarLintEndpoint(p, '/status'))
- .then(r => r.json())
- .then(json => {
+ .then((r) => r.json())
+ .then((json) => {
const { ideName, description } = json;
return { port: p, ideName, description } as Ide;
})
.catch(() => undefined)
);
const results = await Promise.all(probeRequests);
- return results.filter(r => r !== undefined) as Ide[];
+ return results.filter((r) => r !== undefined) as Ide[];
}
export function openHotspot(calledPort: number, projectKey: string, hotspotKey: string) {
@@ -61,7 +61,7 @@ export async function sendUserToken(port: number, token: NewUserToken) {
createdAt: token.createdAt,
expirationDate: token.expirationDate,
token: token.token,
- type: token.type
+ type: token.type,
};
const response = await fetch(tokenUrl, { method: 'POST', body: JSON.stringify(data) });
@@ -77,7 +77,7 @@ export async function sendUserToken(port: number, token: NewUserToken) {
* @returns [ start , ... , start + size - 1 ]
*/
export function buildPortRange(start = SONARLINT_PORT_START, size = SONARLINT_PORT_RANGE) {
- return Array.from(Array(size).keys()).map(p => start + p);
+ return Array.from(Array(size).keys()).map((p) => start + p);
}
function buildSonarLintEndpoint(port: number, path: string) {
diff --git a/server/sonar-web/src/main/js/helpers/stringify-queryparams.ts b/server/sonar-web/src/main/js/helpers/stringify-queryparams.ts
index 777d9057022..80a45e76ba4 100644
--- a/server/sonar-web/src/main/js/helpers/stringify-queryparams.ts
+++ b/server/sonar-web/src/main/js/helpers/stringify-queryparams.ts
@@ -63,7 +63,7 @@ export function stringify(obj: any, sep?: any, eq?: any, name?: any) {
if (typeof obj === 'object') {
return Object.keys(obj)
- .map(k => {
+ .map((k) => {
const ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
if (Array.isArray(obj[k])) {
return obj[k]
diff --git a/server/sonar-web/src/main/js/helpers/strings.ts b/server/sonar-web/src/main/js/helpers/strings.ts
index 82d791ba42d..9eb35ec85da 100644
--- a/server/sonar-web/src/main/js/helpers/strings.ts
+++ b/server/sonar-web/src/main/js/helpers/strings.ts
@@ -27,377 +27,377 @@ const defaultDiacriticsRemovalap = [
{
base: 'A',
letters:
- '\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F'
+ '\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F',
},
{
base: 'AA',
- letters: '\uA732'
+ letters: '\uA732',
},
{
base: 'AE',
- letters: '\u00C6\u01FC\u01E2'
+ letters: '\u00C6\u01FC\u01E2',
},
{
base: 'AO',
- letters: '\uA734'
+ letters: '\uA734',
},
{
base: 'AU',
- letters: '\uA736'
+ letters: '\uA736',
},
{
base: 'AV',
- letters: '\uA738\uA73A'
+ letters: '\uA738\uA73A',
},
{
base: 'AY',
- letters: '\uA73C'
+ letters: '\uA73C',
},
{
base: 'B',
- letters: '\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181'
+ letters: '\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181',
},
{
base: 'C',
- letters: '\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E'
+ letters: '\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E',
},
{
base: 'D',
- letters: '\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779'
+ letters: '\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779',
},
{
base: 'DZ',
- letters: '\u01F1\u01C4'
+ letters: '\u01F1\u01C4',
},
{
base: 'Dz',
- letters: '\u01F2\u01C5'
+ letters: '\u01F2\u01C5',
},
{
base: 'E',
letters:
- '\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E'
+ '\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E',
},
{
base: 'F',
- letters: '\u0046\u24BB\uFF26\u1E1E\u0191\uA77B'
+ letters: '\u0046\u24BB\uFF26\u1E1E\u0191\uA77B',
},
{
base: 'G',
letters:
- '\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E'
+ '\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E',
},
{
base: 'H',
- letters: '\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D'
+ letters: '\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D',
},
{
base: 'I',
letters:
- '\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197'
+ '\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197',
},
{
base: 'J',
- letters: '\u004A\u24BF\uFF2A\u0134\u0248'
+ letters: '\u004A\u24BF\uFF2A\u0134\u0248',
},
{
base: 'K',
- letters: '\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2'
+ letters: '\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2',
},
{
base: 'L',
letters:
- '\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780'
+ '\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780',
},
{
base: 'LJ',
- letters: '\u01C7'
+ letters: '\u01C7',
},
{
base: 'Lj',
- letters: '\u01C8'
+ letters: '\u01C8',
},
{
base: 'M',
- letters: '\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C'
+ letters: '\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C',
},
{
base: 'N',
letters:
- '\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4'
+ '\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4',
},
{
base: 'NJ',
- letters: '\u01CA'
+ letters: '\u01CA',
},
{
base: 'Nj',
- letters: '\u01CB'
+ letters: '\u01CB',
},
{
base: 'O',
letters:
- '\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C'
+ '\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C',
},
{
base: 'OI',
- letters: '\u01A2'
+ letters: '\u01A2',
},
{
base: 'OO',
- letters: '\uA74E'
+ letters: '\uA74E',
},
{
base: 'OU',
- letters: '\u0222'
+ letters: '\u0222',
},
{
base: 'OE',
- letters: '\u008C\u0152'
+ letters: '\u008C\u0152',
},
{
base: 'oe',
- letters: '\u009C\u0153'
+ letters: '\u009C\u0153',
},
{
base: 'P',
- letters: '\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754'
+ letters: '\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754',
},
{
base: 'Q',
- letters: '\u0051\u24C6\uFF31\uA756\uA758\u024A'
+ letters: '\u0051\u24C6\uFF31\uA756\uA758\u024A',
},
{
base: 'R',
letters:
- '\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782'
+ '\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782',
},
{
base: 'S',
letters:
- '\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784'
+ '\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784',
},
{
base: 'T',
letters:
- '\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786'
+ '\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786',
},
{
base: 'TZ',
- letters: '\uA728'
+ letters: '\uA728',
},
{
base: 'U',
letters:
- '\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244'
+ '\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244',
},
{
base: 'V',
- letters: '\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245'
+ letters: '\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245',
},
{
base: 'VY',
- letters: '\uA760'
+ letters: '\uA760',
},
{
base: 'W',
- letters: '\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72'
+ letters: '\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72',
},
{
base: 'X',
- letters: '\u0058\u24CD\uFF38\u1E8A\u1E8C'
+ letters: '\u0058\u24CD\uFF38\u1E8A\u1E8C',
},
{
base: 'Y',
letters:
- '\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE'
+ '\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE',
},
{
base: 'Z',
- letters: '\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762'
+ letters: '\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762',
},
{
base: 'a',
letters:
- '\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250'
+ '\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250',
},
{
base: 'aa',
- letters: '\uA733'
+ letters: '\uA733',
},
{
base: 'ae',
- letters: '\u00E6\u01FD\u01E3'
+ letters: '\u00E6\u01FD\u01E3',
},
{
base: 'ao',
- letters: '\uA735'
+ letters: '\uA735',
},
{
base: 'au',
- letters: '\uA737'
+ letters: '\uA737',
},
{
base: 'av',
- letters: '\uA739\uA73B'
+ letters: '\uA739\uA73B',
},
{
base: 'ay',
- letters: '\uA73D'
+ letters: '\uA73D',
},
{
base: 'b',
- letters: '\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253'
+ letters: '\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253',
},
{
base: 'c',
- letters: '\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184'
+ letters: '\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184',
},
{
base: 'd',
- letters: '\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A'
+ letters: '\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A',
},
{
base: 'dz',
- letters: '\u01F3\u01C6'
+ letters: '\u01F3\u01C6',
},
{
base: 'e',
letters:
- '\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD'
+ '\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD',
},
{
base: 'f',
- letters: '\u0066\u24D5\uFF46\u1E1F\u0192\uA77C'
+ letters: '\u0066\u24D5\uFF46\u1E1F\u0192\uA77C',
},
{
base: 'g',
letters:
- '\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F'
+ '\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F',
},
{
base: 'h',
letters:
- '\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265'
+ '\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265',
},
{
base: 'hv',
- letters: '\u0195'
+ letters: '\u0195',
},
{
base: 'i',
letters:
- '\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131'
+ '\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131',
},
{
base: 'j',
- letters: '\u006A\u24D9\uFF4A\u0135\u01F0\u0249'
+ letters: '\u006A\u24D9\uFF4A\u0135\u01F0\u0249',
},
{
base: 'k',
- letters: '\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3'
+ letters: '\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3',
},
{
base: 'l',
letters:
- '\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747'
+ '\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747',
},
{
base: 'lj',
- letters: '\u01C9'
+ letters: '\u01C9',
},
{
base: 'm',
- letters: '\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F'
+ letters: '\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F',
},
{
base: 'n',
letters:
- '\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5'
+ '\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5',
},
{
base: 'nj',
- letters: '\u01CC'
+ letters: '\u01CC',
},
{
base: 'o',
letters:
- '\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275'
+ '\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275',
},
{
base: 'oi',
- letters: '\u01A3'
+ letters: '\u01A3',
},
{
base: 'ou',
- letters: '\u0223'
+ letters: '\u0223',
},
{
base: 'oo',
- letters: '\uA74F'
+ letters: '\uA74F',
},
{
base: 'p',
- letters: '\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755'
+ letters: '\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755',
},
{
base: 'q',
- letters: '\u0071\u24E0\uFF51\u024B\uA757\uA759'
+ letters: '\u0071\u24E0\uFF51\u024B\uA757\uA759',
},
{
base: 'r',
letters:
- '\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783'
+ '\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783',
},
{
base: 's',
letters:
- '\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B'
+ '\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B',
},
{
base: 't',
letters:
- '\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787'
+ '\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787',
},
{
base: 'tz',
- letters: '\uA729'
+ letters: '\uA729',
},
{
base: 'u',
letters:
- '\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289'
+ '\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289',
},
{
base: 'v',
- letters: '\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C'
+ letters: '\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C',
},
{
base: 'vy',
- letters: '\uA761'
+ letters: '\uA761',
},
{
base: 'w',
- letters: '\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73'
+ letters: '\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73',
},
{
base: 'x',
- letters: '\u0078\u24E7\uFF58\u1E8B\u1E8D'
+ letters: '\u0078\u24E7\uFF58\u1E8B\u1E8D',
},
{
base: 'y',
letters:
- '\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF'
+ '\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF',
},
{
base: 'z',
- letters: '\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763'
- }
+ letters: '\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763',
+ },
];
const diacriticsMap: Dict<string> = {};
-defaultDiacriticsRemovalap.forEach(defaultDiacritic =>
- defaultDiacritic.letters.split('').forEach(letter => {
+defaultDiacriticsRemovalap.forEach((defaultDiacritic) =>
+ defaultDiacritic.letters.split('').forEach((letter) => {
diacriticsMap[letter] = defaultDiacritic.base;
})
);
@@ -405,7 +405,7 @@ defaultDiacriticsRemovalap.forEach(defaultDiacritic =>
// "what?" version ... http://jsperf.com/diacritics/12
export function latinize(str: string): string {
// eslint-disable-next-line no-control-regex
- return str.replace(/[^\u0000-\u007E]/g, a => diacriticsMap[a] || a);
+ return str.replace(/[^\u0000-\u007E]/g, (a) => diacriticsMap[a] || a);
}
export function decodeJwt(token: string) {
diff --git a/server/sonar-web/src/main/js/helpers/testMocks.ts b/server/sonar-web/src/main/js/helpers/testMocks.ts
index d089cfcd86a..15d2ff44b02 100644
--- a/server/sonar-web/src/main/js/helpers/testMocks.ts
+++ b/server/sonar-web/src/main/js/helpers/testMocks.ts
@@ -48,7 +48,7 @@ import {
RuleParameter,
SysInfoBase,
SysInfoCluster,
- SysInfoStandalone
+ SysInfoStandalone,
} from '../types/types';
import { CurrentUser, LoggedInUser, User } from '../types/users';
@@ -59,7 +59,7 @@ export function mockAlmApplication(overrides: Partial<AlmApplication> = {}): Alm
installationUrl: 'https://github.com/apps/greg-sonarcloud/installations/new',
key: 'github',
name: 'GitHub',
- ...overrides
+ ...overrides,
};
}
@@ -70,7 +70,7 @@ export function mockAppState(overrides: Partial<AppState> = {}): AppState {
qualifiers: ['TRK'],
settings: {},
version: '1.0',
- ...overrides
+ ...overrides,
};
}
@@ -79,7 +79,7 @@ export function mockBaseSysInfo(overrides: Partial<any> = {}): SysInfoBase {
Health: 'GREEN' as HealthType,
'Health Causes': [],
System: {
- Version: '7.8'
+ Version: '7.8',
},
Database: {
Database: 'PostgreSQL',
@@ -87,18 +87,18 @@ export function mockBaseSysInfo(overrides: Partial<any> = {}): SysInfoBase {
Username: 'sonar',
URL: 'jdbc:postgresql://localhost/sonar',
Driver: 'PostgreSQL JDBC Driver',
- 'Driver Version': '42.2.5'
+ 'Driver Version': '42.2.5',
},
'Compute Engine Tasks': {
'Total Pending': 0,
- 'Total In Progress': 0
+ 'Total In Progress': 0,
},
'Search State': { State: 'GREEN', Nodes: 3 },
'Search Indexes': {
'Index components - Docs': 30445,
- 'Index components - Shards': 10
+ 'Index components - Shards': 10,
},
- ...overrides
+ ...overrides,
};
}
@@ -109,11 +109,11 @@ export function mockClusterSysInfo(overrides: Partial<any> = {}): SysInfoCluster
System: {
...baseInfo.System,
'High Availability': true,
- 'Server ID': 'asd564-asd54a-5dsfg45'
+ 'Server ID': 'asd564-asd54a-5dsfg45',
},
Settings: {
'sonar.cluster.enabled': 'true',
- 'sonar.cluster.node.name': 'server9.example.com'
+ 'sonar.cluster.node.name': 'server9.example.com',
},
'Application Nodes': [
{
@@ -122,42 +122,42 @@ export function mockClusterSysInfo(overrides: Partial<any> = {}): SysInfoCluster
Health: 'GREEN' as HealthType,
'Health Causes': [],
System: {
- Version: '7.8'
+ Version: '7.8',
},
Plugins: {
- java: '5.13.0.17924 [SonarJava]'
+ java: '5.13.0.17924 [SonarJava]',
},
'Web JVM State': {
'Max Memory (MB)': 1024,
- 'Free Memory (MB)': 122
+ 'Free Memory (MB)': 122,
},
'Web Database Connection': {
- 'Pool Active Connections': 1
+ 'Pool Active Connections': 1,
},
'Web Logging': { 'Logs Level': 'DEBUG' },
'Web JVM Properties': {
'file.encoding': 'UTF-8',
- 'file.separator': '/'
+ 'file.separator': '/',
},
'Compute Engine Tasks': {
Pending: 0,
- 'In Progress': 0
+ 'In Progress': 0,
},
'Compute Engine JVM State': {
'Max Memory (MB)': 1024,
- 'Free Memory (MB)': 78
+ 'Free Memory (MB)': 78,
},
'Compute Engine Database Connection': {
'Pool Initial Size': 0,
- 'Pool Active Connections': 0
+ 'Pool Active Connections': 0,
},
'Compute Engine Logging': {
- 'Logs Level': 'INFO'
+ 'Logs Level': 'INFO',
},
'Compute Engine JVM Properties': {
'file.encoding': 'UTF-8',
- 'file.separator': '/'
- }
+ 'file.separator': '/',
+ },
},
{
Name: 'server9.example.com',
@@ -165,44 +165,44 @@ export function mockClusterSysInfo(overrides: Partial<any> = {}): SysInfoCluster
Health: 'GREEN' as HealthType,
'Health Causes': [],
System: {
- Version: '7.8'
+ Version: '7.8',
},
Plugins: {
- java: '5.13.0.17924 [SonarJava]'
+ java: '5.13.0.17924 [SonarJava]',
},
'Web JVM State': {
'Max Memory (MB)': 1024,
- 'Free Memory (MB)': 111
+ 'Free Memory (MB)': 111,
},
'Web Database Connection': {
'Pool Active Connections': 0,
- 'Pool Max Connections': 60
+ 'Pool Max Connections': 60,
},
'Web Logging': { 'Logs Level': 'INFO' },
'Web JVM Properties': {
'file.encoding': 'UTF-8',
- 'file.separator': '/'
+ 'file.separator': '/',
},
'Compute Engine Tasks': {
Pending: 0,
- 'In Progress': 0
+ 'In Progress': 0,
},
'Compute Engine JVM State': {
'Max Memory (MB)': 1024,
- 'Free Memory (MB)': 89
+ 'Free Memory (MB)': 89,
},
'Compute Engine Database Connection': {
'Pool Initial Size': 0,
- 'Pool Active Connections': 0
+ 'Pool Active Connections': 0,
},
'Compute Engine Logging': {
- 'Logs Level': 'INFO'
+ 'Logs Level': 'INFO',
},
'Compute Engine JVM Properties': {
'file.encoding': 'UTF-8',
- 'file.separator': '/'
- }
- }
+ 'file.separator': '/',
+ },
+ },
],
'Search Nodes': [
{
@@ -210,30 +210,30 @@ export function mockClusterSysInfo(overrides: Partial<any> = {}): SysInfoCluster
Host: '10.0.0.0',
'Search State': {
'CPU Usage (%)': 0,
- 'Disk Available': '93 GB'
- }
+ 'Disk Available': '93 GB',
+ },
},
{
Name: 'server.example.com',
Host: '10.0.0.0',
'Search State': {
'CPU Usage (%)': 0,
- 'Disk Available': '93 GB'
- }
+ 'Disk Available': '93 GB',
+ },
},
{
Name: 'server.example.com',
Host: '10.0.0.0',
'Search State': {
'CPU Usage (%)': 0,
- 'Disk Available': '93 GB'
- }
- }
+ 'Disk Available': '93 GB',
+ },
+ },
],
Statistics: {
- ncloc: 989880
+ ncloc: 989880,
},
- ...overrides
+ ...overrides,
};
}
@@ -243,7 +243,7 @@ export function mockCondition(overrides: Partial<Condition> = {}): Condition {
id: '1',
metric: 'coverage',
op: 'LT',
- ...overrides
+ ...overrides,
};
}
@@ -251,9 +251,9 @@ export function mockCurrentUser(overrides: Partial<CurrentUser> = {}): CurrentUs
return {
isLoggedIn: false,
dismissedNotices: {
- educationPrinciples: false
+ educationPrinciples: false,
},
- ...overrides
+ ...overrides,
};
}
@@ -265,9 +265,9 @@ export function mockLoggedInUser(overrides: Partial<LoggedInUser> = {}): LoggedI
name: 'Skywalker',
scmAccounts: [],
dismissedNotices: {
- educationPrinciples: false
+ educationPrinciples: false,
},
- ...overrides
+ ...overrides,
};
}
@@ -276,7 +276,7 @@ export function mockGroup(overrides: Partial<Group> = {}): Group {
id: 1,
membersCount: 1,
name: 'Foo',
- ...overrides
+ ...overrides,
};
}
@@ -292,7 +292,7 @@ export function mockRawIssue(withLocations = false, overrides: Partial<RawIssue>
status: 'OPEN',
textRange: { startLine: 25, endLine: 26, startOffset: 0, endOffset: 15 },
type: IssueType.CodeSmell,
- ...overrides
+ ...overrides,
};
if (withLocations) {
@@ -302,15 +302,15 @@ export function mockRawIssue(withLocations = false, overrides: Partial<RawIssue>
{
locations: [
loc({ component: overrides.component }),
- loc({ component: overrides.component })
- ]
- }
+ loc({ component: overrides.component }),
+ ],
+ },
];
}
return {
...rawIssue,
- ...overrides
+ ...overrides,
};
}
@@ -337,7 +337,7 @@ export function mockIssue(withLocations = false, overrides: Partial<Issue> = {})
status: 'OPEN',
textRange: { startLine: 25, endLine: 26, startOffset: 0, endOffset: 15 },
transitions: [],
- type: 'BUG'
+ type: 'BUG',
};
const loc = mockFlowLocation;
@@ -345,14 +345,14 @@ export function mockIssue(withLocations = false, overrides: Partial<Issue> = {})
if (withLocations) {
issue.flows = [
[loc(), loc(), loc()],
- [loc(), loc()]
+ [loc(), loc()],
];
issue.secondaryLocations = [loc(), loc()];
}
return {
...issue,
- ...overrides
+ ...overrides,
};
}
@@ -364,7 +364,7 @@ export function mockLocation(overrides: Partial<Location> = {}): Location {
query: {},
search: '',
state: {},
- ...overrides
+ ...overrides,
};
}
@@ -376,7 +376,7 @@ export function mockMetric(overrides: Partial<Pick<Metric, 'key' | 'name' | 'typ
id: key,
key,
name,
- type
+ type,
};
}
@@ -387,10 +387,10 @@ export function mockMeasure(overrides: Partial<Measure> = {}): Measure {
period: {
bestValue: true,
index: 1,
- value: '1.0'
+ value: '1.0',
},
value: '1.0',
- ...overrides
+ ...overrides,
};
}
@@ -402,10 +402,10 @@ export function mockMeasureEnhanced(overrides: Partial<MeasureEnhanced> = {}): M
period: {
bestValue: true,
index: 1,
- value: '1.0'
+ value: '1.0',
},
value: '1.0',
- ...overrides
+ ...overrides,
};
}
@@ -414,7 +414,7 @@ export function mockPeriod(overrides: Partial<Period> = {}): Period {
date: '2019-04-23T02:12:32+0100',
index: 0,
mode: 'previous_version',
- ...overrides
+ ...overrides,
};
}
@@ -432,7 +432,7 @@ export function mockQualityProfile(overrides: Partial<Profile> = {}): Profile {
languageName: 'JavaScript',
name: 'name',
projectCount: 3,
- ...overrides
+ ...overrides,
};
}
@@ -445,7 +445,7 @@ export function mockQualityProfileInheritance(
key: 'foo',
name: 'Foo',
overridingRuleCount: 0,
- ...overrides
+ ...overrides,
};
}
@@ -454,11 +454,11 @@ export function mockQualityProfileChangelogEvent(eventOverride?: any) {
action: 'ACTIVATED',
date: '2019-04-23T02:12:32+0100',
params: {
- severity: 'MAJOR'
+ severity: 'MAJOR',
},
ruleKey: 'rule-key',
ruleName: 'rule-name',
- ...eventOverride
+ ...eventOverride,
};
}
@@ -467,7 +467,7 @@ export function mockQualityProfileExporter(override?: Partial<Exporter>): Export
key: 'exporter-key',
name: 'exporter-name',
languages: ['first-lang', 'second-lang'],
- ...override
+ ...override,
};
}
@@ -487,7 +487,7 @@ export function mockRouter(
push: jest.fn(),
replace: jest.fn(),
setRouteLeaveHook: jest.fn(),
- ...overrides
+ ...overrides,
} as Router;
}
@@ -502,7 +502,7 @@ export function mockRule(overrides: Partial<Rule> = {}): Rule {
sysTags: ['a', 'b'],
tags: ['x'],
type: 'CODE_SMELL',
- ...overrides
+ ...overrides,
} as Rule;
}
@@ -513,7 +513,7 @@ export function mockRuleActivation(overrides: Partial<RuleActivation> = {}): Rul
params: [{ key: 'foo', value: 'Bar' }],
qProfile: 'baz',
severity: 'MAJOR',
- ...overrides
+ ...overrides,
};
}
@@ -526,8 +526,8 @@ export function mockRuleDetails(overrides: Partial<RuleDetails> = {}): RuleDetai
descriptionSections: [
{
key: RuleDescriptionSections.DEFAULT,
- content: '<b>Why</b> Because'
- }
+ content: '<b>Why</b> Because',
+ },
],
htmlDesc: '',
mdDesc: '',
@@ -552,7 +552,7 @@ export function mockRuleDetails(overrides: Partial<RuleDetails> = {}): RuleDetai
scope: 'MAIN',
isExternal: false,
type: 'BUG',
- ...overrides
+ ...overrides,
};
}
@@ -562,7 +562,7 @@ export function mockRuleDetailsParameter(overrides: Partial<RuleParameter> = {})
htmlDesc: 'description',
key: '1',
type: 'number',
- ...overrides
+ ...overrides,
};
}
@@ -573,49 +573,49 @@ export function mockStandaloneSysInfo(overrides: Partial<any> = {}): SysInfoStan
System: {
...baseInfo.System,
'High Availability': false,
- 'Server ID': 'asd564-asd54a-5dsfg45'
+ 'Server ID': 'asd564-asd54a-5dsfg45',
},
Settings: {
'sonar.cluster.enabled': 'true',
- 'sonar.cluster.node.name': 'server9.example.com'
+ 'sonar.cluster.node.name': 'server9.example.com',
},
'Web JVM State': {
'Max Memory (MB)': 1024,
- 'Free Memory (MB)': 111
+ 'Free Memory (MB)': 111,
},
'Web Database Connection': {
'Pool Active Connections': 0,
- 'Pool Max Connections': 60
+ 'Pool Max Connections': 60,
},
'Web Logging': { 'Logs Level': 'INFO', 'Logs Dir': '/logs' },
'Web JVM Properties': {
'file.encoding': 'UTF-8',
- 'file.separator': '/'
+ 'file.separator': '/',
},
'Compute Engine Tasks': {
Pending: 0,
- 'In Progress': 0
+ 'In Progress': 0,
},
'Compute Engine JVM State': {
'Max Memory (MB)': 1024,
- 'Free Memory (MB)': 89
+ 'Free Memory (MB)': 89,
},
'Compute Engine Database Connection': {
'Pool Initial Size': 0,
- 'Pool Active Connections': 0
+ 'Pool Active Connections': 0,
},
'Compute Engine Logging': {
'Logs Level': 'DEBUG',
- 'Logs Dir': '/logs'
+ 'Logs Dir': '/logs',
},
'Compute Engine JVM Properties': {
'file.encoding': 'UTF-8',
- 'file.separator': '/'
+ 'file.separator': '/',
},
ALMs: {},
Bundled: {},
Plugins: {},
- ...overrides
+ ...overrides,
};
}
@@ -625,7 +625,7 @@ export function mockUser(overrides: Partial<User> = {}): User {
local: true,
login: 'john.doe',
name: 'John Doe',
- ...overrides
+ ...overrides,
};
}
@@ -655,7 +655,7 @@ export function mockLanguage(overrides: Partial<Language> = {}): Language {
return {
key: 'css',
name: 'CSS',
- ...overrides
+ ...overrides,
};
}
@@ -666,9 +666,9 @@ export function mockFlowLocation(overrides: Partial<FlowLocation> = {}): FlowLoc
startLine: 1,
startOffset: 1,
endLine: 2,
- endOffset: 2
+ endOffset: 2,
},
- ...overrides
+ ...overrides,
};
}
@@ -678,7 +678,7 @@ export function mockIdentityProvider(overrides: Partial<IdentityProvider> = {}):
iconPath: '/path/icon.svg',
key: 'github',
name: 'Github',
- ...overrides
+ ...overrides,
};
}
@@ -688,8 +688,8 @@ export function mockRef(
return {
current: {
getBoundingClientRect: jest.fn(),
- ...overrides.current
- }
+ ...overrides.current,
+ },
} as React.RefObject<HTMLElement>;
}
@@ -698,7 +698,7 @@ export function mockPaging(overrides: Partial<Paging> = {}): Paging {
pageIndex: 1,
pageSize: 100,
total: 1000,
- ...overrides
+ ...overrides,
};
}
@@ -708,7 +708,7 @@ export function mockDumpTask(props: Partial<DumpTask> = {}): DumpTask {
startedAt: '2020-03-12T12:20:20Z',
submittedAt: '2020-03-12T12:15:20Z',
executedAt: '2020-03-12T12:22:20Z',
- ...props
+ ...props,
};
}
@@ -718,7 +718,7 @@ export function mockDumpStatus(props: Partial<DumpStatus> = {}): DumpStatus {
canBeImported: true,
dumpToImport: '',
exportedDump: '',
- ...props
+ ...props,
};
}
diff --git a/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx b/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx
index c92cb3f960c..48e8a0702b6 100644
--- a/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx
+++ b/server/sonar-web/src/main/js/helpers/testReactTestingUtils.tsx
@@ -66,11 +66,12 @@ export function renderAppWithAdminContext(
/*noop*/
},
pendingPlugins: { installing: [], removing: [], updating: [] },
- systemStatus: overrides.systemStatus ?? 'UP'
- }}>
+ systemStatus: overrides.systemStatus ?? 'UP',
+ }}
+ >
<Outlet
context={{
- adminPages: overrides.adminPages ?? []
+ adminPages: overrides.adminPages ?? [],
}}
/>
</AdminContext.Provider>
@@ -115,8 +116,9 @@ export function renderAppWithComponentContext(
branchLikes: [],
onBranchesChange: jest.fn(),
onComponentChange: jest.fn(),
- ...componentContext
- }}>
+ ...componentContext,
+ }}
+ >
<Outlet />
</ComponentContext.Provider>
);
@@ -160,7 +162,7 @@ function renderRoutedApp(
metrics = DEFAULT_METRICS,
appState = mockAppState(),
featureList = [],
- languages = {}
+ languages = {},
}: RenderContext = {}
): RenderResult {
const path = parsePath(navigateTo);
diff --git a/server/sonar-web/src/main/js/helpers/testUtils.ts b/server/sonar-web/src/main/js/helpers/testUtils.ts
index 00d1109cf26..e64b78a18f9 100644
--- a/server/sonar-web/src/main/js/helpers/testUtils.ts
+++ b/server/sonar-web/src/main/js/helpers/testUtils.ts
@@ -26,12 +26,12 @@ export function mockEvent(overrides = {}) {
target: {
blur() {
/* noop */
- }
+ },
},
currentTarget: {
blur() {
/* noop */
- }
+ },
},
preventDefault() {
/* noop */
@@ -42,7 +42,7 @@ export function mockEvent(overrides = {}) {
stopImmediatePropagation() {
/* noop */
},
- ...overrides
+ ...overrides,
} as any;
}
@@ -65,7 +65,7 @@ export function clickOutside(event = {}): void {
export function submit(element: ShallowWrapper | ReactWrapper): void {
element.simulate('submit', {
- preventDefault() {}
+ preventDefault() {},
});
}
@@ -84,7 +84,7 @@ export function change(
element.simulate('change', {
target: { value },
currentTarget: { value },
- ...event
+ ...event,
});
}
}
@@ -94,7 +94,7 @@ export const KEYCODE_MAP: { [code in KeyboardKeys]?: string } = {
[KeyboardKeys.LeftArrow]: 'left',
[KeyboardKeys.UpArrow]: 'up',
[KeyboardKeys.RightArrow]: 'right',
- [KeyboardKeys.DownArrow]: 'down'
+ [KeyboardKeys.DownArrow]: 'down',
};
export function keydown(args: { key?: KeyboardKeys; metaKey?: boolean; ctrlKey?: boolean }): void {
@@ -109,13 +109,13 @@ export function resizeWindowTo(width?: number, height?: number) {
if (width) {
Object.defineProperty(document.documentElement, 'clientWidth', {
configurable: true,
- value: width
+ value: width,
});
}
if (height) {
Object.defineProperty(document.documentElement, 'clientHeight', {
configurable: true,
- value: height
+ value: height,
});
}
@@ -134,13 +134,13 @@ export function setNodeRect({ width = 50, height = 50, left = 0, top = 0 }) {
const { findDOMNode } = require('react-dom');
const element = document.createElement('div');
Object.defineProperty(element, 'getBoundingClientRect', {
- value: () => ({ width, height, left, top })
+ value: () => ({ width, height, left, top }),
});
findDOMNode.mockReturnValue(element);
}
export function doAsync(fn?: Function): Promise<void> {
- return new Promise(resolve => {
+ return new Promise((resolve) => {
setImmediate(() => {
if (fn) {
fn();
diff --git a/server/sonar-web/src/main/js/helpers/tokens.ts b/server/sonar-web/src/main/js/helpers/tokens.ts
index 4c1f981b13d..83ac35d10b6 100644
--- a/server/sonar-web/src/main/js/helpers/tokens.ts
+++ b/server/sonar-web/src/main/js/helpers/tokens.ts
@@ -28,11 +28,11 @@ export const EXPIRATION_OPTIONS = [
TokenExpiration.OneMonth,
TokenExpiration.ThreeMonths,
TokenExpiration.OneYear,
- TokenExpiration.NoExpiration
-].map(value => {
+ TokenExpiration.NoExpiration,
+].map((value) => {
return {
value,
- label: translate('users.tokens.expiration', value.toString())
+ label: translate('users.tokens.expiration', value.toString()),
};
});
@@ -40,7 +40,7 @@ const SETTINGS_EXPIRATION_MAP: { [key: string]: TokenExpiration } = {
'30 days': TokenExpiration.OneMonth,
'90 days': TokenExpiration.ThreeMonths,
'1 year': TokenExpiration.OneYear,
- 'No expiration': TokenExpiration.NoExpiration
+ 'No expiration': TokenExpiration.NoExpiration,
};
export async function getAvailableExpirationOptions() {
@@ -48,7 +48,7 @@ export async function getAvailableExpirationOptions() {
* We intentionally fetch all settings, because fetching a specific setting will
* return it from the DB as a fallback, even if the setting is not defined at startup.
*/
- const setting = (await getAllValues()).find(v => v.key === SettingsKey.TokenMaxAllowedLifetime);
+ const setting = (await getAllValues()).find((v) => v.key === SettingsKey.TokenMaxAllowedLifetime);
if (setting === undefined || setting.value === undefined) {
return EXPIRATION_OPTIONS;
}
@@ -56,7 +56,7 @@ export async function getAvailableExpirationOptions() {
const maxTokenLifetime = setting.value;
if (SETTINGS_EXPIRATION_MAP[maxTokenLifetime] !== TokenExpiration.NoExpiration) {
return EXPIRATION_OPTIONS.filter(
- option =>
+ (option) =>
option.value <= SETTINGS_EXPIRATION_MAP[maxTokenLifetime] &&
option.value !== TokenExpiration.NoExpiration
);
diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts
index e8f4b31b742..763d0552fc6 100644
--- a/server/sonar-web/src/main/js/helpers/urls.ts
+++ b/server/sonar-web/src/main/js/helpers/urls.ts
@@ -38,7 +38,7 @@ export interface Location {
export enum CodeScope {
Overall = 'overall',
- New = 'new'
+ New = 'new',
}
type CodeScopeType = CodeScope.Overall | CodeScope.New;
@@ -68,7 +68,7 @@ export function queryToSearch(query: RawQuery = {}) {
* author=a&author=b
*/
arrayParams.forEach(({ key, values }) => {
- values.forEach(value => {
+ values.forEach((value) => {
searchParams.append(key, value);
});
});
@@ -106,7 +106,7 @@ export function getProjectUrl(
): Partial<Path> {
return {
pathname: PROJECT_BASE_URL,
- search: queryToSearch({ id: project, branch, ...(codeScope && { code_scope: codeScope }) })
+ search: queryToSearch({ id: project, branch, ...(codeScope && { code_scope: codeScope }) }),
};
}
@@ -120,8 +120,8 @@ export function getProjectQueryUrl(
search: queryToSearch({
id: project,
...branchParameters,
- ...(codeScope && { code_scope: codeScope })
- })
+ ...(codeScope && { code_scope: codeScope }),
+ }),
};
}
@@ -132,14 +132,14 @@ export function getPortfolioUrl(key: string): To {
export function getPortfolioAdminUrl(key: string): To {
return {
pathname: '/project/admin/extension/governance/console',
- search: queryToSearch({ id: key, qualifier: ComponentQualifier.Portfolio })
+ search: queryToSearch({ id: key, qualifier: ComponentQualifier.Portfolio }),
};
}
export function getApplicationAdminUrl(key: string): To {
return {
pathname: '/project/admin/extension/developer-server/application-console',
- search: queryToSearch({ id: key })
+ search: queryToSearch({ id: key }),
};
}
@@ -151,7 +151,7 @@ export function getComponentBackgroundTaskUrl(
return {
pathname: '/project/background_tasks',
search: queryToSearch({ id: componentKey, status, taskType }),
- hash: ''
+ hash: '',
};
}
@@ -187,7 +187,7 @@ export function getComponentIssuesUrl(componentKey: string, query?: Query): Path
return {
pathname: '/project/issues',
search: queryToSearch({ ...(query || {}), id: componentKey }),
- hash: ''
+ hash: '',
};
}
@@ -215,10 +215,10 @@ export function getComponentSecurityHotspotsUrl(componentKey: string, query: Que
SecurityStandard.PCI_DSS_3_2,
SecurityStandard.PCI_DSS_4_0,
SecurityStandard.OWASP_ASVS_4_0,
- 'owaspAsvsLevel'
- ])
+ 'owaspAsvsLevel',
+ ]),
}),
- hash: ''
+ hash: '',
};
}
@@ -262,7 +262,7 @@ export function getComponentDrilldownUrlWithSelection(
metric,
branchLike,
treemapView: view === 'treemap',
- listView: view === 'list'
+ listView: view === 'list',
});
}
@@ -273,7 +273,7 @@ export function getMeasureTreemapUrl(componentKey: string, metric: string) {
export function getActivityUrl(component: string, branchLike?: BranchLike, graph?: GraphType) {
return {
pathname: '/project/activity',
- search: queryToSearch({ id: component, graph, ...getBranchLikeQuery(branchLike) })
+ search: queryToSearch({ id: component, graph, ...getBranchLikeQuery(branchLike) }),
};
}
@@ -287,8 +287,8 @@ export function getMeasureHistoryUrl(component: string, metric: string, branchLi
id: component,
graph: 'custom',
custom_metrics: metric,
- ...getBranchLikeQuery(branchLike)
- })
+ ...getBranchLikeQuery(branchLike),
+ }),
};
}
@@ -308,13 +308,13 @@ export function getQualityProfileUrl(name: string, language: string): To {
export function getQualityGateUrl(key: string): To {
return {
- pathname: '/quality_gates/show/' + encodeURIComponent(key)
+ pathname: '/quality_gates/show/' + encodeURIComponent(key),
};
}
export function getQualityGatesUrl(): To {
return {
- pathname: '/quality_gates'
+ pathname: '/quality_gates',
};
}
@@ -324,14 +324,14 @@ export function getGlobalSettingsUrl(
): Partial<Path> {
return {
pathname: '/admin/settings',
- search: queryToSearch({ category, ...query })
+ search: queryToSearch({ category, ...query }),
};
}
export function getProjectSettingsUrl(id: string, category?: string): Partial<Path> {
return {
pathname: '/project/settings',
- search: queryToSearch({ id, category })
+ search: queryToSearch({ id, category }),
};
}
@@ -370,8 +370,8 @@ export function getCodeUrl(
id: project,
...getBranchLikeQuery(branchLike),
selected,
- line: line?.toFixed()
- })
+ line: line?.toFixed(),
+ }),
};
}
diff --git a/server/sonar-web/src/main/js/types/__tests__/alm-settings-test.ts b/server/sonar-web/src/main/js/types/__tests__/alm-settings-test.ts
index d953c20853e..31f2660a550 100644
--- a/server/sonar-web/src/main/js/types/__tests__/alm-settings-test.ts
+++ b/server/sonar-web/src/main/js/types/__tests__/alm-settings-test.ts
@@ -20,7 +20,7 @@
import {
mockBitbucketCloudBindingDefinition,
mockGithubBindingDefinition,
- mockGitlabBindingDefinition
+ mockGitlabBindingDefinition,
} from '../../helpers/mocks/alm-settings';
import { isGitLabBindingDefinition } from '../alm-settings';
diff --git a/server/sonar-web/src/main/js/types/__tests__/component-test.ts b/server/sonar-web/src/main/js/types/__tests__/component-test.ts
index 93d740bc2a0..35b3f13f580 100644
--- a/server/sonar-web/src/main/js/types/__tests__/component-test.ts
+++ b/server/sonar-web/src/main/js/types/__tests__/component-test.ts
@@ -23,7 +23,7 @@ import {
isFile,
isPortfolioLike,
isProject,
- isView
+ isView,
} from '../component';
it.each([[isFile], [isView], [isProject], [isApplication], [isPortfolioLike]])(
diff --git a/server/sonar-web/src/main/js/types/alm-settings.ts b/server/sonar-web/src/main/js/types/alm-settings.ts
index be9c0febc5e..f6609284236 100644
--- a/server/sonar-web/src/main/js/types/alm-settings.ts
+++ b/server/sonar-web/src/main/js/types/alm-settings.ts
@@ -22,7 +22,7 @@ export const enum AlmKeys {
BitbucketServer = 'bitbucket',
BitbucketCloud = 'bitbucketcloud',
GitHub = 'github',
- GitLab = 'gitlab'
+ GitLab = 'gitlab',
}
export type AlmBindingDefinition =
@@ -158,13 +158,13 @@ export enum AlmSettingsBindingStatusType {
Validating,
Success,
Failure,
- Warning
+ Warning,
}
export enum ProjectAlmBindingConfigurationErrorScope {
Global = 'GLOBAL',
Project = 'PROJECT',
- Unknown = 'UNKNOWN'
+ Unknown = 'UNKNOWN',
}
export interface ProjectAlmBindingConfigurationErrors {
diff --git a/server/sonar-web/src/main/js/types/component.ts b/server/sonar-web/src/main/js/types/component.ts
index b1faecc307c..75807a573a4 100644
--- a/server/sonar-web/src/main/js/types/component.ts
+++ b/server/sonar-web/src/main/js/types/component.ts
@@ -23,7 +23,7 @@ import { Component, LightComponent } from './types';
export enum Visibility {
Public = 'public',
- Private = 'private'
+ Private = 'private',
}
export enum ComponentQualifier {
@@ -34,7 +34,7 @@ export enum ComponentQualifier {
Portfolio = 'VW',
Project = 'TRK',
SubPortfolio = 'SVW',
- TestFile = 'UTS'
+ TestFile = 'UTS',
}
export enum ProjectKeyValidationResult {
@@ -42,7 +42,7 @@ export enum ProjectKeyValidationResult {
Empty = 'empty',
TooLong = 'too_long',
InvalidChar = 'invalid_char',
- OnlyDigits = 'only_digits'
+ OnlyDigits = 'only_digits',
}
export interface TreeComponent extends LightComponent {
@@ -66,7 +66,7 @@ export function isPortfolioLike(
componentQualifier &&
[
ComponentQualifier.Portfolio.toString(),
- ComponentQualifier.SubPortfolio.toString()
+ ComponentQualifier.SubPortfolio.toString(),
].includes(componentQualifier)
);
}
@@ -93,7 +93,7 @@ export function isView(componentQualifier?: string | ComponentQualifier): boolea
return [
ComponentQualifier.Portfolio,
ComponentQualifier.SubPortfolio,
- ComponentQualifier.Application
+ ComponentQualifier.Application,
].includes(componentQualifier as ComponentQualifier);
}
diff --git a/server/sonar-web/src/main/js/types/editions.ts b/server/sonar-web/src/main/js/types/editions.ts
index 82098ba4429..2c7fe9952c6 100644
--- a/server/sonar-web/src/main/js/types/editions.ts
+++ b/server/sonar-web/src/main/js/types/editions.ts
@@ -23,7 +23,7 @@ export enum EditionKey {
community = 'community',
developer = 'developer',
enterprise = 'enterprise',
- datacenter = 'datacenter'
+ datacenter = 'datacenter',
}
export interface Edition {
diff --git a/server/sonar-web/src/main/js/types/extension.ts b/server/sonar-web/src/main/js/types/extension.ts
index 96447f110a3..28faad00a18 100644
--- a/server/sonar-web/src/main/js/types/extension.ts
+++ b/server/sonar-web/src/main/js/types/extension.ts
@@ -25,7 +25,7 @@ import { Component, Dict } from './types';
import { CurrentUser, HomePage } from './users';
export enum AdminPageExtension {
- GovernanceConsole = 'governance/views_console'
+ GovernanceConsole = 'governance/views_console',
}
export interface ExtensionRegistryEntry {
diff --git a/server/sonar-web/src/main/js/types/features.ts b/server/sonar-web/src/main/js/types/features.ts
index 48341cdc564..849e868e1e5 100644
--- a/server/sonar-web/src/main/js/types/features.ts
+++ b/server/sonar-web/src/main/js/types/features.ts
@@ -25,5 +25,5 @@ export enum Feature {
MonoRepositoryPullRequestDecoration = 'monorepo',
MultipleAlm = 'multiple-alm',
ProjectImport = 'project-import',
- RegulatoryReport = 'regulatory-reports'
+ RegulatoryReport = 'regulatory-reports',
}
diff --git a/server/sonar-web/src/main/js/types/globalMessages.ts b/server/sonar-web/src/main/js/types/globalMessages.ts
index dec0e9a3c8e..83843aa3161 100644
--- a/server/sonar-web/src/main/js/types/globalMessages.ts
+++ b/server/sonar-web/src/main/js/types/globalMessages.ts
@@ -19,7 +19,7 @@
*/
export enum MessageLevel {
Error = 'ERROR',
- Success = 'SUCCESS'
+ Success = 'SUCCESS',
}
export interface Message {
diff --git a/server/sonar-web/src/main/js/types/indexation.ts b/server/sonar-web/src/main/js/types/indexation.ts
index 84f1534a586..7d466e15d97 100644
--- a/server/sonar-web/src/main/js/types/indexation.ts
+++ b/server/sonar-web/src/main/js/types/indexation.ts
@@ -31,5 +31,5 @@ export enum IndexationNotificationType {
InProgress = 'InProgress',
InProgressWithFailure = 'InProgressWithFailure',
Completed = 'Completed',
- CompletedWithFailure = 'CompletedWithFailure'
+ CompletedWithFailure = 'CompletedWithFailure',
}
diff --git a/server/sonar-web/src/main/js/types/issues.ts b/server/sonar-web/src/main/js/types/issues.ts
index 3ca63bfd492..d94ab952f2d 100644
--- a/server/sonar-web/src/main/js/types/issues.ts
+++ b/server/sonar-web/src/main/js/types/issues.ts
@@ -24,12 +24,12 @@ export enum IssueType {
CodeSmell = 'CODE_SMELL',
Vulnerability = 'VULNERABILITY',
Bug = 'BUG',
- SecurityHotspot = 'SECURITY_HOTSPOT'
+ SecurityHotspot = 'SECURITY_HOTSPOT',
}
export enum IssueScope {
Main = 'MAIN',
- Test = 'TEST'
+ Test = 'TEST',
}
interface Comment {
diff --git a/server/sonar-web/src/main/js/types/metrics.ts b/server/sonar-web/src/main/js/types/metrics.ts
index a9d83be3d55..80aa34eb8c0 100644
--- a/server/sonar-web/src/main/js/types/metrics.ts
+++ b/server/sonar-web/src/main/js/types/metrics.ts
@@ -143,7 +143,7 @@ export enum MetricKey {
uncovered_lines = 'uncovered_lines',
violations = 'violations',
vulnerabilities = 'vulnerabilities',
- wont_fix_issues = 'wont_fix_issues'
+ wont_fix_issues = 'wont_fix_issues',
}
export enum MetricType {
@@ -153,7 +153,7 @@ export enum MetricType {
Level = 'LEVEL',
ShortInteger = 'SHORT_INT',
ShortWorkDuration = 'SHORT_WORK_DUR',
- Data = 'DATA'
+ Data = 'DATA',
}
export function isMetricKey(key: string): key is MetricKey {
diff --git a/server/sonar-web/src/main/js/types/permissions.ts b/server/sonar-web/src/main/js/types/permissions.ts
index f87015df8c1..c0f93a54543 100644
--- a/server/sonar-web/src/main/js/types/permissions.ts
+++ b/server/sonar-web/src/main/js/types/permissions.ts
@@ -22,5 +22,5 @@ export enum Permissions {
ProjectCreation = 'provisioning',
ApplicationCreation = 'applicationcreator',
QualityGateAdmin = 'gateadmin',
- Scan = 'scan'
+ Scan = 'scan',
}
diff --git a/server/sonar-web/src/main/js/types/plugins.ts b/server/sonar-web/src/main/js/types/plugins.ts
index 4f602112647..9d4ae2c3cdd 100644
--- a/server/sonar-web/src/main/js/types/plugins.ts
+++ b/server/sonar-web/src/main/js/types/plugins.ts
@@ -73,13 +73,13 @@ export interface Update {
export enum PluginType {
Bundled = 'BUNDLED',
- External = 'EXTERNAL'
+ External = 'EXTERNAL',
}
export enum RiskConsent {
Accepted = 'ACCEPTED',
NotAccepted = 'NOT_ACCEPTED',
- Required = 'REQUIRED'
+ Required = 'REQUIRED',
}
export function isAvailablePlugin(plugin: Plugin): plugin is AvailablePlugin {
diff --git a/server/sonar-web/src/main/js/types/project-activity.ts b/server/sonar-web/src/main/js/types/project-activity.ts
index 864f9577484..c86179ccf83 100644
--- a/server/sonar-web/src/main/js/types/project-activity.ts
+++ b/server/sonar-web/src/main/js/types/project-activity.ts
@@ -60,7 +60,7 @@ export enum GraphType {
issues = 'issues',
coverage = 'coverage',
duplications = 'duplications',
- custom = 'custom'
+ custom = 'custom',
}
export interface HistoryItem {
diff --git a/server/sonar-web/src/main/js/types/rules.ts b/server/sonar-web/src/main/js/types/rules.ts
index 7d8a9a6f4f3..50a578c652a 100644
--- a/server/sonar-web/src/main/js/types/rules.ts
+++ b/server/sonar-web/src/main/js/types/rules.ts
@@ -21,7 +21,7 @@ export enum RuleStatus {
Ready = 'READY',
Beta = 'BETA',
Deprecated = 'DEPRECATED',
- Removed = 'REMOVED'
+ Removed = 'REMOVED',
}
export interface SearchRulesQuery {
diff --git a/server/sonar-web/src/main/js/types/security-hotspots.ts b/server/sonar-web/src/main/js/types/security-hotspots.ts
index 38b3cb5513c..abf1e09b607 100644
--- a/server/sonar-web/src/main/js/types/security-hotspots.ts
+++ b/server/sonar-web/src/main/js/types/security-hotspots.ts
@@ -24,32 +24,32 @@ import { UserBase } from './users';
export enum RiskExposure {
LOW = 'LOW',
MEDIUM = 'MEDIUM',
- HIGH = 'HIGH'
+ HIGH = 'HIGH',
}
export enum HotspotStatus {
TO_REVIEW = 'TO_REVIEW',
- REVIEWED = 'REVIEWED'
+ REVIEWED = 'REVIEWED',
}
export enum HotspotResolution {
FIXED = 'FIXED',
SAFE = 'SAFE',
- ACKNOWLEDGED = 'ACKNOWLEDGED'
+ ACKNOWLEDGED = 'ACKNOWLEDGED',
}
export enum HotspotStatusFilter {
FIXED = 'FIXED',
SAFE = 'SAFE',
TO_REVIEW = 'TO_REVIEW',
- ACKNOWLEDGED = 'ACKNOWLEDGED'
+ ACKNOWLEDGED = 'ACKNOWLEDGED',
}
export enum HotspotStatusOption {
FIXED = 'FIXED',
SAFE = 'SAFE',
TO_REVIEW = 'TO_REVIEW',
- ACKNOWLEDGED = 'ACKNOWLEDGED'
+ ACKNOWLEDGED = 'ACKNOWLEDGED',
}
export interface HotspotFilters {
@@ -151,7 +151,7 @@ export interface ReviewHistoryElement {
export enum ReviewHistoryType {
Creation,
Diff,
- Comment
+ Comment,
}
export interface HotspotSearchResponse {
diff --git a/server/sonar-web/src/main/js/types/security.ts b/server/sonar-web/src/main/js/types/security.ts
index eb5992ca939..689f58fda4d 100644
--- a/server/sonar-web/src/main/js/types/security.ts
+++ b/server/sonar-web/src/main/js/types/security.ts
@@ -27,7 +27,7 @@ export enum SecurityStandard {
CWE = 'cwe',
PCI_DSS_3_2 = 'pciDss-3.2',
PCI_DSS_4_0 = 'pciDss-4.0',
- OWASP_ASVS_4_0 = 'owaspAsvs-4.0'
+ OWASP_ASVS_4_0 = 'owaspAsvs-4.0',
}
export type StandardType = SecurityStandard;
diff --git a/server/sonar-web/src/main/js/types/settings.ts b/server/sonar-web/src/main/js/types/settings.ts
index d1de09e3f7f..e70f52e12d5 100644
--- a/server/sonar-web/src/main/js/types/settings.ts
+++ b/server/sonar-web/src/main/js/types/settings.ts
@@ -26,7 +26,7 @@ export const enum SettingsKey {
ServerBaseUrl = 'sonar.core.serverBaseURL',
PluginRiskConsent = 'sonar.plugins.risk.consent',
LicenceRemainingLocNotificationThreshold = 'sonar.license.notifications.remainingLocThreshold',
- TokenMaxAllowedLifetime = 'sonar.auth.token.max.allowed.lifetime'
+ TokenMaxAllowedLifetime = 'sonar.auth.token.max.allowed.lifetime',
}
export enum GlobalSettingKeys {
@@ -39,7 +39,7 @@ export enum GlobalSettingKeys {
UpdatecenterActivated = 'sonar.updatecenter.activate',
DisplayAnnouncementMessage = 'sonar.announcement.displayMessage',
AnnouncementMessage = 'sonar.announcement.message',
- MainBranchName = 'sonar.projectCreation.mainBranchName'
+ MainBranchName = 'sonar.projectCreation.mainBranchName',
}
export type SettingDefinitionAndValue = {
@@ -62,7 +62,7 @@ export enum SettingType {
LONG = 'LONG',
SINGLE_SELECT_LIST = 'SINGLE_SELECT_LIST',
PROPERTY_SET = 'PROPERTY_SET',
- FORMATTED_TEXT = 'FORMATTED_TEXT'
+ FORMATTED_TEXT = 'FORMATTED_TEXT',
}
export interface SettingDefinition {
description?: string;
diff --git a/server/sonar-web/src/main/js/types/system.ts b/server/sonar-web/src/main/js/types/system.ts
index 9139c03ae88..6ca0748642a 100644
--- a/server/sonar-web/src/main/js/types/system.ts
+++ b/server/sonar-web/src/main/js/types/system.ts
@@ -33,5 +33,5 @@ export interface SystemUpgrade extends SystemUpgradeDownloadUrls {
export enum InstanceType {
SonarQube = 'SonarQube',
- SonarCloud = 'SonarCloud'
+ SonarCloud = 'SonarCloud',
}
diff --git a/server/sonar-web/src/main/js/types/tasks.ts b/server/sonar-web/src/main/js/types/tasks.ts
index 2de1f71a4dd..be6a834c839 100644
--- a/server/sonar-web/src/main/js/types/tasks.ts
+++ b/server/sonar-web/src/main/js/types/tasks.ts
@@ -25,7 +25,7 @@ export enum TaskTypes {
ProjectExport = 'PROJECT_EXPORT',
ProjectImport = 'PROJECT_IMPORT',
ReportSubmit = 'REPORT_SUBMIT',
- AuditPurge = 'AUDIT_PURGE'
+ AuditPurge = 'AUDIT_PURGE',
}
export enum TaskStatuses {
@@ -33,7 +33,7 @@ export enum TaskStatuses {
InProgress = 'IN_PROGRESS',
Success = 'SUCCESS',
Failed = 'FAILED',
- Canceled = 'CANCELED'
+ Canceled = 'CANCELED',
}
export interface Task {
diff --git a/server/sonar-web/src/main/js/types/token.ts b/server/sonar-web/src/main/js/types/token.ts
index 9a9f3c23ec5..eca9d9ab1c8 100644
--- a/server/sonar-web/src/main/js/types/token.ts
+++ b/server/sonar-web/src/main/js/types/token.ts
@@ -21,14 +21,14 @@
export enum TokenType {
Project = 'PROJECT_ANALYSIS_TOKEN',
Global = 'GLOBAL_ANALYSIS_TOKEN',
- User = 'USER_TOKEN'
+ User = 'USER_TOKEN',
}
export enum TokenExpiration {
OneMonth = 30,
ThreeMonths = 90,
OneYear = 365,
- NoExpiration = 0
+ NoExpiration = 0,
}
export interface UserToken {
diff --git a/server/sonar-web/src/main/js/types/types.ts b/server/sonar-web/src/main/js/types/types.ts
index a6d68a4336c..0d28be640f8 100644
--- a/server/sonar-web/src/main/js/types/types.ts
+++ b/server/sonar-web/src/main/js/types/types.ts
@@ -192,7 +192,7 @@ export interface FacetValue<T = string> {
export enum FlowType {
DATA = 'DATA',
- EXECUTION = 'EXECUTION'
+ EXECUTION = 'EXECUTION',
}
export interface Flow {
diff --git a/server/sonar-web/src/main/js/types/users.ts b/server/sonar-web/src/main/js/types/users.ts
index e8aeae81218..ca50541fbc5 100644
--- a/server/sonar-web/src/main/js/types/users.ts
+++ b/server/sonar-web/src/main/js/types/users.ts
@@ -32,7 +32,7 @@ export interface Notice {
export enum NoticeType {
EDUCATION_PRINCIPLES = 'educationPrinciples',
- SONARLINT_AD = 'sonarlintAd'
+ SONARLINT_AD = 'sonarlintAd',
}
export interface LoggedInUser extends CurrentUser, UserActive {
diff --git a/server/sonar-web/yarn.lock b/server/sonar-web/yarn.lock
index ea8c756f534..78c9e68b4da 100644
--- a/server/sonar-web/yarn.lock
+++ b/server/sonar-web/yarn.lock
@@ -2490,7 +2490,7 @@ __metadata:
path-browserify: 1.0.1
postcss-calc: 7.0.2
postcss-custom-properties: 9.1.1
- prettier: 1.19.1
+ prettier: 2.7.1
react: 16.13.0
react-day-picker: 7.4.10
react-dom: 16.13.0
@@ -8619,12 +8619,12 @@ __metadata:
languageName: node
linkType: hard
-"prettier@npm:1.19.1":
- version: 1.19.1
- resolution: "prettier@npm:1.19.1"
+"prettier@npm:2.7.1":
+ version: 2.7.1
+ resolution: "prettier@npm:2.7.1"
bin:
- prettier: ./bin-prettier.js
- checksum: bc78219e0f8173a808f4c6c8e0a137dd8ebd4fbe013e63fe1a37a82b48612f17b8ae8e18a992adf802ee2cf7428f14f084e7c2846ca5759cf4013c6e54810e1f
+ prettier: bin-prettier.js
+ checksum: 55a4409182260866ab31284d929b3cb961e5fdb91fe0d2e099dac92eaecec890f36e524b4c19e6ceae839c99c6d7195817579cdffc8e2c80da0cb794463a748b
languageName: node
linkType: hard