digitalfabrik/integreat-app

View on GitHub

Showing 163 of 193 total issues

Function getNavigationItems has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const getNavigationItems = (): Array<ReactElement> => {
    const isNewsVisible = buildConfig().featureFlags.newsStream && (localNewsEnabled || tunewsEnabled)
    const isEventsVisible = eventsEnabled
    const isPoisVisible = buildConfig().featureFlags.pois && poisEnabled
    const isOffersVisible = offersEnabled
Severity: Major
Found in web/src/components/CityContentHeader.tsx - About 2 hrs to fix

    File PinchPanImage.tsx has 269 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { ReactElement } from 'react'
    import { Animated, Image, ImageErrorEventData, NativeSyntheticEvent } from 'react-native'
    import {
      PanGestureHandler,
      PinchGestureHandler,
    Severity: Minor
    Found in native/src/components/PinchPanImage.tsx - About 2 hrs to fix

      Function CityContentHeader has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      const CityContentHeader = ({
        cityModel,
        languageCode,
        languageChangePaths,
        route,
      Severity: Minor
      Found in web/src/components/CityContentHeader.tsx - About 2 hrs 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

      Function CityContentSwitcher has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      const CityContentSwitcher = ({ languageCode }: CityContentSwitcherProps): ReactElement => {
        // This component is only opened when there is a cityCode in the route
        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
        const cityCode = useParams().cityCode!
        const { data: city, error, loading } = useLoadFromEndpoint(createCityEndpoint, cmsApiBaseUrl, { city: cityCode })
      Severity: Minor
      Found in web/src/CityContentSwitcher.tsx - About 2 hrs 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

      Function _addChildren has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _addChildren(category: CategoryModel, depth: number): void {
          this._categories.push(category)
      
          if (depth === 0) {
            this._resourceCache[category.path] = {}
      Severity: Major
      Found in shared/api/endpoints/testing/CategoriesMapModelBuilder.ts - About 2 hrs to fix

        Function createTrackingEndpoint has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const createTrackingEndpoint = (url: string = JPAL_TRACKING_ENDPOINT_URL): TrackingEndpointType => {
          const request = async (signal: SignalType) => {
            const pageType = signal.name === OPEN_PAGE_SIGNAL_NAME ? signal.pageType : undefined
            const signalUrl =
              signal.name !== SEND_FEEDBACK_SIGNAL_NAME &&
        Severity: Major
        Found in shared/api/endpoints/createTrackingEndpoint.ts - About 2 hrs to fix

          Function buildAll has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            buildAll(): {
              path: string
              event: EventModel
              resources: PageResourceCacheStateType
            }[] {
          Severity: Major
          Found in shared/api/endpoints/testing/EventModelBuilder.ts - About 2 hrs to fix

            Function navigate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            const navigate = <T extends RoutesType>(
              routeInformation: RouteInformationType,
              navigation: NavigationProps<T>,
              appCityCode: string | null,
              appLanguageCode: string,
            Severity: Minor
            Found in native/src/hooks/useNavigate.ts - About 2 hrs 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

            Function MapView has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            const MapView = ({
              boundingBox,
              features,
              selectedFeature,
              iconPosition,
            Severity: Minor
            Found in native/src/components/MapView.tsx - About 2 hrs 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

            Function EventsPage has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            const EventsPage = ({ city, pathname, languageCode, cityCode }: CityRouteProps): ReactElement | null => {
              const previousPathname = usePreviousProp({ prop: pathname })
              const { eventId } = useParams()
              const { t } = useTranslation('events')
              const navigate = useNavigate()
            Severity: Minor
            Found in web/src/routes/EventsPage.tsx - About 2 hrs 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

            Function retry has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            const retry = async <T>(
              componentImport: () => Promise<{ default: ComponentType<T> }>,
              retriesLeft = DEFAULT_RETRIES,
              interval = DEFAULT_INTERVAL,
            ): Promise<{ default: ComponentType<T> }> => {
            Severity: Minor
            Found in web/src/utils/retryImport.ts - About 2 hrs 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

            Function navigateToDeepLink has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            const navigateToDeepLink = <T extends RoutesType>({
              url,
              navigation,
              navigateTo,
              showSnackbar,
            Severity: Minor
            Found in native/src/hooks/useNavigateToDeepLink.ts - About 2 hrs 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

            Function useLoadTuNews has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            const useLoadTuNews = ({ language }: ParamsType): TuNewsReturnType => {
              const [page, setPage] = useState<number>(FIRST_PAGE_INDEX)
              const [data, setData] = useState<TunewsModel[] | null>(null)
              const [availableLanguages, setAvailableLanguages] = useState<LanguageModel[] | null>(null)
              const [error, setError] = useState<Error | null>(null)
            Severity: Minor
            Found in native/src/hooks/useLoadTuNews.ts - About 2 hrs 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

            Function request has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async request(params: P, overrideUrl?: string): Promise<Payload<T>> {
                if (this.errorOverride) {
                  throw this.errorOverride
                }
            
            
            Severity: Major
            Found in shared/api/Endpoint.ts - About 2 hrs to fix

              Function request has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const request = async (signal: SignalType) => {
                  const pageType = signal.name === OPEN_PAGE_SIGNAL_NAME ? signal.pageType : undefined
                  const signalUrl =
                    signal.name !== SEND_FEEDBACK_SIGNAL_NAME &&
                    signal.name !== RESUME_SIGNAL_NAME &&
              Severity: Major
              Found in shared/api/endpoints/createTrackingEndpoint.ts - About 2 hrs to fix

                Method fetchAsync has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private fun fetchAsync(sourceUrl: String, targetFilePath: String, callback: FetchedCallback) {
                        val targetFile = File(targetFilePath)
                        if (targetFile.exists()) {
                            callback.alreadyExists(sourceUrl, targetFile)
                            return

                  File Tooltip.tsx has 256 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React, { ReactElement, ReactNode, useCallback, useEffect, useState } from 'react'
                  import styled, { css } from 'styled-components'
                  
                  import dimensions from '../constants/dimensions'
                  
                  
                  Severity: Minor
                  Found in web/src/components/Tooltip.tsx - About 2 hrs to fix

                    Function LoadingErrorHandler has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const LoadingErrorHandler = ({
                      children,
                      loading,
                      refresh,
                      error,
                    Severity: Minor
                    Found in native/src/routes/LoadingErrorHandler.tsx - About 2 hrs 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

                    Function loadPois has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      async loadPois(context: DatabaseContext): Promise<Array<PoiModel>> {
                        const path = this.getContentPath('pois', context)
                        const mapPoisJson = (json: ContentPoiJsonType[]) =>
                          json.map(jsonObject => {
                            const jsonLocation = jsonObject.location
                    Severity: Minor
                    Found in native/src/utils/DatabaseConnector.ts - About 2 hrs to fix

                      Function writeJsonFromCsv has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const writeJsonFromCsv = (translations: string, toPath: string, sourceLanguage: string) => {
                        fs.readdir(translations, (err, files) => {
                          if (err) {
                            throw err
                          }
                      Severity: Minor
                      Found in translations/tools/manage.ts - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language