digitalfabrik/integreat-app

View on GitHub

Showing 189 of 190 total issues

Avoid too many return statements within this function.
Open

  return (
    <CityContentLayout isLoading={false} {...locationLayoutParams}>
      <Helmet pageTitle={pageTitle} languageChangePaths={languageChangePaths} cityModel={city} />
      <NewsTabs
        type={TU_NEWS_TYPE}
Severity: Major
Found in web/src/routes/TuNewsPage.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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        const getOpeningLabel = (isTemporarilyClosed: boolean, isCurrentlyOpened: boolean): string => {
          if (isTemporarilyClosed) {
            return 'temporarilyClosed'
          }
          return isCurrentlyOpened ? 'opened' : 'closed'
        Severity: Minor
        Found in web/src/components/OpeningHours.tsx and 1 other location - About 30 mins to fix
        native/src/components/OpeningHours.tsx on lines 67..72

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        type UsePreviousPropProps<T> = {
          prop: T
          onPropChange?: (newProp: T, oldProp: T) => void
        }
        Severity: Minor
        Found in native/src/hooks/usePreviousProp.ts and 1 other location - About 30 mins to fix
        web/src/hooks/usePreviousProp.ts on lines 3..6

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 7 locations. Consider refactoring.
        Open

              <Layout header={<GeneralHeader languageCode={languageCode} />} footer={<GeneralFooter language={languageCode} />}>
                <FailureSwitcher error={error ?? notFoundError} />
              </Layout>
        Severity: Major
        Found in web/src/CityContentSwitcher.tsx and 6 other locations - About 30 mins to fix
        web/src/CityContentSwitcher.tsx on lines 68..78
        web/src/FixedCityContentSwitcher.tsx on lines 30..32
        web/src/routes/ConsentPage.tsx on lines 45..53
        web/src/routes/LandingPage.tsx on lines 38..40
        web/src/routes/LicensesPage.tsx on lines 36..39
        web/src/routes/MainDisclaimerPage.tsx on lines 19..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 7 locations. Consider refactoring.
        Open

              <Layout header={<GeneralHeader languageCode={languageCode} />} footer={<GeneralFooter language={languageCode} />}>
                <FailureSwitcher error={notFoundError} />
              </Layout>
        Severity: Major
        Found in web/src/FixedCityContentSwitcher.tsx and 6 other locations - About 30 mins to fix
        web/src/CityContentSwitcher.tsx on lines 59..61
        web/src/CityContentSwitcher.tsx on lines 68..78
        web/src/routes/ConsentPage.tsx on lines 45..53
        web/src/routes/LandingPage.tsx on lines 38..40
        web/src/routes/LicensesPage.tsx on lines 36..39
        web/src/routes/MainDisclaimerPage.tsx on lines 19..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 7 locations. Consider refactoring.
        Open

              <Layout header={<GeneralHeader languageCode={languageCode} />} footer={<GeneralFooter language={languageCode} />}>
                <FailureSwitcher error={error ?? new Error('Uknown error')} />
              </Layout>
        Severity: Major
        Found in web/src/routes/LandingPage.tsx and 6 other locations - About 30 mins to fix
        web/src/CityContentSwitcher.tsx on lines 59..61
        web/src/CityContentSwitcher.tsx on lines 68..78
        web/src/FixedCityContentSwitcher.tsx on lines 30..32
        web/src/routes/ConsentPage.tsx on lines 45..53
        web/src/routes/LicensesPage.tsx on lines 36..39
        web/src/routes/MainDisclaimerPage.tsx on lines 19..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 7 locations. Consider refactoring.
        Open

            <Layout header={<GeneralHeader languageCode={languageCode} />} footer={<GeneralFooter language={languageCode} />}>
              <Helmet pageTitle={pageTitle} />
              <div>
                <Caption title='Impressum und Datenschutz' />
                <div
        Severity: Major
        Found in web/src/routes/MainDisclaimerPage.tsx and 6 other locations - About 30 mins to fix
        web/src/CityContentSwitcher.tsx on lines 59..61
        web/src/CityContentSwitcher.tsx on lines 68..78
        web/src/FixedCityContentSwitcher.tsx on lines 30..32
        web/src/routes/ConsentPage.tsx on lines 45..53
        web/src/routes/LandingPage.tsx on lines 38..40
        web/src/routes/LicensesPage.tsx on lines 36..39

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        const getOpeningLabel = (isTemporarilyClosed: boolean, isCurrentlyOpened: boolean): string => {
          if (isTemporarilyClosed) {
            return 'temporarilyClosed'
          }
          return isCurrentlyOpened ? 'opened' : 'closed'
        Severity: Minor
        Found in native/src/components/OpeningHours.tsx and 1 other location - About 30 mins to fix
        web/src/components/OpeningHours.tsx on lines 45..50

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 7 locations. Consider refactoring.
        Open

            <Layout header={<GeneralHeader languageCode={languageCode} />} footer={<GeneralFooter language={languageCode} />}>
              <Caption title={t('settings:openSourceLicenses')} />
              <List items={licenses ?? []} renderItem={renderItem} noItemsMessage={t('licenses:noLicensesMessage')} />
            </Layout>
        Severity: Major
        Found in web/src/routes/LicensesPage.tsx and 6 other locations - About 30 mins to fix
        web/src/CityContentSwitcher.tsx on lines 59..61
        web/src/CityContentSwitcher.tsx on lines 68..78
        web/src/FixedCityContentSwitcher.tsx on lines 30..32
        web/src/routes/ConsentPage.tsx on lines 45..53
        web/src/routes/LandingPage.tsx on lines 38..40
        web/src/routes/MainDisclaimerPage.tsx on lines 19..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 7 locations. Consider refactoring.
        Open

            <Layout header={<GeneralHeader languageCode={languageCode} />} footer={<GeneralFooter language={languageCode} />}>
              <Caption title={t('title')} />
              <Description>{t('description')}</Description>
              <List
                items={buildConfig().supportedIframeSources}
        Severity: Major
        Found in web/src/routes/ConsentPage.tsx and 6 other locations - About 30 mins to fix
        web/src/CityContentSwitcher.tsx on lines 59..61
        web/src/CityContentSwitcher.tsx on lines 68..78
        web/src/FixedCityContentSwitcher.tsx on lines 30..32
        web/src/routes/LandingPage.tsx on lines 38..40
        web/src/routes/LicensesPage.tsx on lines 36..39
        web/src/routes/MainDisclaimerPage.tsx on lines 19..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 7 locations. Consider refactoring.
        Open

              <Layout header={<GeneralHeader languageCode={languageCode} />} footer={<GeneralFooter language={languageCode} />}>
                <LanguageFailure
                  cityModel={city}
                  languageCode={languageCode}
                  languageChangePaths={city.languages.map(({ code, name }) => ({
        Severity: Major
        Found in web/src/CityContentSwitcher.tsx and 6 other locations - About 30 mins to fix
        web/src/CityContentSwitcher.tsx on lines 59..61
        web/src/FixedCityContentSwitcher.tsx on lines 30..32
        web/src/routes/ConsentPage.tsx on lines 45..53
        web/src/routes/LandingPage.tsx on lines 38..40
        web/src/routes/LicensesPage.tsx on lines 36..39
        web/src/routes/MainDisclaimerPage.tsx on lines 19..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        type UsePreviousPropProps<T> = {
          prop: T
          onPropChange?: (newProp: T, oldProp: T) => void
        }
        Severity: Minor
        Found in web/src/hooks/usePreviousProp.ts and 1 other location - About 30 mins to fix
        native/src/hooks/usePreviousProp.ts on lines 3..6

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function useLoadExtraCityContent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const useLoadExtraCityContent = <T extends object>({
          cityCode,
          languageCode,
          createEndpoint,
          load,
        Severity: Minor
        Found in native/src/hooks/useLoadExtraCityContent.ts - About 25 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

        Function sendRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const sendRequest = async (signal: SignalType): Promise<void> => {
          try {
            const { jpalTrackingCode, jpalTrackingEnabled } = await appSettings.loadSettings()
        
            if (buildConfig().featureFlags.jpalTracking && jpalTrackingEnabled && jpalTrackingCode) {
        Severity: Minor
        Found in native/src/utils/sendTrackingSignal.ts - About 25 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

        Function TransparentHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const TransparentHeader = ({ navigation, route }: TransparentHeaderProps): ReactElement | null => {
          const { t } = useTranslation('layout')
          const showSnackbar = useSnackbar()
        
          const shareUrl = (route.params as { shareUrl: string } | undefined)?.shareUrl
        Severity: Minor
        Found in native/src/components/TransparentHeader.tsx - About 25 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

        Function preparePois has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const preparePois = ({ pois: allPois, params }: PreparePoisProps): PreparePoisReturn => {
          const { slug, multipoi, currentlyOpen, poiCategoryId } = params
          const poi = allPois.find(it => it.slug === slug)
        
          const filteredPois = allPois
        Severity: Minor
        Found in shared/utils/pois.ts - About 25 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

        Function _addChildren has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          _addChildren(category: CategoryModel, depth: number): void {
            this._categories.push(category)
        
            if (depth === 0) {
              this._resourceCache[category.path] = {}
        Severity: Minor
        Found in shared/api/endpoints/testing/CategoriesMapModelBuilder.ts - About 25 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

        Function Tile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const Tile = ({ tile }: TileProps): ReactElement => {
          const imageRef = useRef<HTMLImageElement>(null)
        
          const fetchImageWithCaching = (): void => {
            if (tile.thumbnail) {
        Severity: Minor
        Found in web/src/components/Tile.tsx - About 25 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

        Severity
        Category
        Status
        Source
        Language