digitalfabrik/integreat-app

View on GitHub

Showing 156 of 190 total issues

Function CityNotCooperating has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CityNotCooperating = (): ReactElement | null => {
  const { t } = useTranslation('cityNotCooperating')
  const [isCopied, setIsCopied] = useState<boolean>(false)
  const template = buildConfig().featureFlags.cityNotCooperatingTemplate
  const CityNotCooperatingIcon = buildConfigAssets().CityNotCooperatingIcon
Severity: Minor
Found in native/src/routes/CityNotCooperating.tsx - About 1 hr to fix

    Function checkCalendarsAndExportEvent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const checkCalendarsAndExportEvent = async (): Promise<void> => {
        const iosPermission = [PERMISSIONS.IOS.CALENDARS]
        const androidPermissions = [PERMISSIONS.ANDROID.READ_CALENDAR, PERMISSIONS.ANDROID.WRITE_CALENDAR]
        const permission = await requestMultiple(Platform.OS === 'ios' ? iosPermission : androidPermissions)
        const permissionDenied = Object.values(permission).some(permission => ['limited', 'blocked'].includes(permission))
    Severity: Minor
    Found in native/src/components/ExportEventButton.tsx - About 1 hr to fix

      Function pathnameFromRouteInformation has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const pathnameFromRouteInformation = (routeInformation: NonNullableRouteInformationType): string => {
        if (
          routeInformation.route === JPAL_TRACKING_ROUTE ||
          routeInformation.route === LICENSES_ROUTE ||
          routeInformation.route === CONSENT_ROUTE
      Severity: Minor
      Found in shared/routes/pathname.ts - About 1 hr to fix

        Function log has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const log = async (message: string, level: SeverityLevel = 'debug'): Promise<void> => {
          try {
            const Sentry = await loadSentry()
            if (sentryEnabled()) {
              Sentry.addBreadcrumb({ message, level })
        Severity: Minor
        Found in web/src/utils/sentry.ts - About 1 hr to fix

          Function moveReleaseNotes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          const moveReleaseNotes = async ({ newVersionName, deliverinoPrivateKey, owner, repo, branch }: Options) => {
            const appOctokit = await authenticate({ deliverinoPrivateKey, owner, repo })
            const {
              data: { commit },
            } = await appOctokit.repos.getBranch({ owner, repo, branch })
          Severity: Minor
          Found in tools/move-release-notes.ts - About 1 hr 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 MobileBanner has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export const MobileBanner = (): ReactElement | null => {
            const { value, updateLocalStorageItem } = useLocalStorage<string | null>({ key: 'showBanner', initialValue: null })
            const isVisible = !value || DateTime.fromISO(value).plus({ months: 3 }) < DateTime.now()
            const [isInstalled] = useState<boolean>(false) // This is always false because we can't know if app is installed or not before running the deep-link
            const { icons, appName, apps, hostName } = buildConfig()
          Severity: Minor
          Found in web/src/components/MobileBanner.tsx - About 1 hr 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 loadWithCache has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          const loadWithCache = async ({
            showSnackbar,
            forceUpdate = false,
          }: {
            forceUpdate?: boolean
          Severity: Minor
          Found in native/src/hooks/useLoadCities.ts - About 1 hr 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 writeMetadata has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const writeMetadata = (appName: string, storeName: string, overrideVersionName?: string) => {
            if (storeName !== 'appstore' && storeName !== 'playstore') {
              throw new Error(`Invalid store name ${storeName} passed!`)
            }
          
          
          Severity: Minor
          Found in tools/manage-metadata.ts - About 1 hr to fix

            Function onShare has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const onShare = async () => {
                if (!shareUrl) {
                  // The share option should only be shown if there is a shareUrl
                  return
                }
            Severity: Minor
            Found in native/src/components/Header.tsx - About 1 hr to fix

              Function loadEvents has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                async loadEvents(context: DatabaseContext): Promise<Array<EventModel>> {
                  const path = this.getContentPath('events', context)
                  const mapEventsJson = (json: ContentEventJsonType[]) =>
                    json.map(jsonObject => {
                      const jsonDate = jsonObject.date
              Severity: Minor
              Found in native/src/utils/DatabaseConnector.ts - About 55 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 PoisPage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              const PoisPage = ({ cityCode, languageCode, city, pathname }: CityRouteProps): ReactElement | null => {
                const params = useParams()
                const slug = params.slug ? normalizePath(params.slug) : undefined
                const { t } = useTranslation('pois')
              
              
              Severity: Minor
              Found in web/src/routes/PoisPage.tsx - About 55 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 DashboardNavigationTiles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              const DashboardNavigationTiles = ({
                cityModel,
                languageCode,
                navigateTo,
              }: DashboardNavigationTilesProps): ReactElement => {
              Severity: Minor
              Found in native/src/components/DashboardNavigationTiles.tsx - About 55 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 Settings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              const Settings = ({ navigation }: SettingsProps): ReactElement => {
                const { settings, updateSettings } = useAppContext()
                const { cityCode, languageCode } = useContext(AppContext)
                const showSnackbar = useSnackbar()
                const { t } = useTranslation('settings')
              Severity: Minor
              Found in native/src/routes/Settings.tsx - About 55 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 parseReleaseNotes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              const parseReleaseNotes = ({ source, ios, android, web, production, language, appName }: ParseOptions): string => {
                const platforms: string[] = [
                  android ? PLATFORM_ANDROID : undefined,
                  ios ? PLATFORM_IOS : undefined,
                  web ? PLATFORM_WEB : undefined,
              Severity: Minor
              Found in tools/manage-metadata.ts - About 55 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 useOnClickOutside has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              const useOnClickOutside = (ref: { current: HTMLElement | null }, callback: () => void): void => {
                useEffect(() => {
                  const isOutside = (target: EventTarget | null) =>
                    target instanceof Node && ref.current && !ref.current.contains(target)
              
              
              Severity: Minor
              Found in web/src/hooks/useOnClickOutside.ts - About 55 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 TuNewsPage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              const TuNewsPage = ({ cityCode, languageCode, city }: CityRouteProps): ReactElement | null => {
                const { t } = useTranslation('news')
                const { viewportSmall } = useWindowDimensions()
              
                const { data: tuNewsLanguages, error } = useLoadFromEndpoint(
              Severity: Minor
              Found in web/src/routes/TuNewsPage.tsx - About 55 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 PoiDetails has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              const PoiDetails = ({ poi, distance, toolbar }: PoiDetailsProps): ReactElement => {
                const navigate = useNavigate()
                const { viewportSmall } = useWindowDimensions()
                const theme = useTheme()
                const { t } = useTranslation('pois')
              Severity: Minor
              Found in web/src/components/PoiDetails.tsx - About 55 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 submitMalteHelpForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              const submitMalteHelpForm = async ({
                pageTitle,
                url,
                cityCode,
                malteHelpFormOffer,
              Severity: Minor
              Found in shared/api/endpoints/submitMalteHelpForm.ts - About 55 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 request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                async request(params: P, overrideUrl?: string): Promise<Payload<T>> {
                  if (this.errorOverride) {
                    throw this.errorOverride
                  }
              
              
              Severity: Minor
              Found in shared/api/Endpoint.ts - About 55 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 Header has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export const Header = ({
                actionItems = [],
                kebabItems = [],
                logoHref,
                navigationItems = [],
              Severity: Minor
              Found in web/src/components/Header.tsx - About 45 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