digitalfabrik/integreat-app

View on GitHub

Showing 189 of 190 total issues

Function NavigationBarScrollContainer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const NavigationBarScrollContainer = ({ children, activeIndex }: NavigationBarScrollContainerProps): ReactElement => {
  const { width } = useWindowDimensions()
  const [scrollPosition, setScrollPosition] = useState<number>(0)
  const scrollToActiveItem = useCallback(
    (ref: RefObject<HTMLDivElement>) => {
Severity: Minor
Found in web/src/components/NavigationBarScrollContainer.tsx - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid too many return statements within this function.
Open

  return constructPathname([LANDING_ROUTE, routeInformation.languageCode])
Severity: Major
Found in shared/routes/pathname.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return
    Severity: Major
    Found in native/src/hooks/useNavigate.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return <Layout>{children}</Layout>
      Severity: Major
      Found in native/src/routes/LoadingErrorHandler.tsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return
        Severity: Major
        Found in native/src/hooks/useNavigate.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return
          Severity: Major
          Found in native/src/hooks/useNavigate.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return (
                <CityContentLayout isLoading={false} {...locationLayoutParams}>
                  <Helmet pageTitle={pageTitle} languageChangePaths={languageChangePaths} cityModel={city} />
                  <NewsTabs
                    type={LOCAL_NEWS_TYPE}
            Severity: Major
            Found in web/src/routes/LocalNewsPage.tsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return
              Severity: Major
              Found in native/src/hooks/useNavigate.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  return event1.title.localeCompare(event2.title)
                Severity: Major
                Found in shared/api/endpoints/createEventsEndpoint.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return (
                      <AspectRatioImage
                        source={cachedSource}
                        resizeMode={resizeMode}
                        style={style}
                  Severity: Major
                  Found in native/src/components/SimpleImage.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return
                    Severity: Major
                    Found in native/src/hooks/useNavigate.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        return (
                          <CityContentLayout isLoading={false} {...locationLayoutParams}>
                            <Helmet pageTitle={pageTitle} languageChangePaths={languageChangePaths} cityModel={city} />
                            <Caption title={t('events')} />
                            <List noItemsMessage={t('currentlyNoEvents')} items={events} renderItem={renderEventListItem} />
                      Severity: Major
                      Found in web/src/routes/EventsPage.tsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                          return (
                            <CityContentLayout isLoading={false} {...locationLayoutParams}>
                              <Helmet
                                pageTitle={pageTitle}
                                metaDescription={metaDescription}
                        Severity: Major
                        Found in web/src/routes/CategoriesPage.tsx - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return
                          Severity: Major
                          Found in native/ios/Integreat/fetcher/FetcherModule.swift - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return (
                                  <LayoutedScrollView refreshControl={<RefreshControl onRefresh={refresh} refreshing={false} />}>
                                    {children}
                                  </LayoutedScrollView>
                                )
                            Severity: Major
                            Found in native/src/routes/LoadingErrorHandler.tsx - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return
                              Severity: Major
                              Found in native/ios/Integreat/fetcher/FetcherModule.swift - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return constructPathname([cityCode, languageCode, routeInformation.route, newsType, newsId?.toString()])
                                Severity: Major
                                Found in shared/routes/pathname.ts - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                    return ErrorCode.UnknownError
                                  Severity: Major
                                  Found in shared/api/ErrorCodes.ts - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                        return
                                    Severity: Major
                                    Found in native/src/hooks/useNavigate.ts - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                          return (
                                            <LayoutedScrollView refreshControl={<RefreshControl onRefresh={refresh} refreshing={false} />}>
                                              <Failure buttonAction={buttonAction} code={errorCode} buttonLabel={buttonLabel} />
                                            </LayoutedScrollView>
                                          )
                                      Severity: Major
                                      Found in native/src/routes/LoadingErrorHandler.tsx - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language