digitalfabrik/integreat-app

View on GitHub

Showing 156 of 190 total issues

Function PoisDesktop has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const PoisDesktop = ({
  panelHeights,
  toolbar,
  data,
  userLocation,
Severity: Minor
Found in web/src/components/PoisDesktop.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 navigateToLink has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const navigateToLink = <T extends RoutesType>(
  url: string,
  navigation: NavigationProps<T>,
  languageCode: string,
  navigateTo: (routeInformation: RouteInformationType) => void,
Severity: Minor
Found in native/src/hooks/useNavigateToLink.ts - About 1 hr to fix

    Function loadCategories has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async loadCategories(context: DatabaseContext): Promise<CategoriesMapModel> {
        const path = this.getContentPath('categories', context)
        const mapCategoriesJson = (json: ContentCategoryJsonType[]) =>
          new CategoriesMapModel(
            json.map(
    Severity: Minor
    Found in native/src/utils/DatabaseConnector.ts - About 1 hr to fix

      Function createJsonLd has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const createJsonLd = (event: EventModel): WithContext<Event> | null => {
        if (!event.location) {
          return null
        }
        const date = event.date
      Severity: Minor
      Found in web/src/components/JsonLdEvent.tsx - About 1 hr to fix

        Function fixBounds has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private fixBounds(
            viewWidth: number,
            viewHeight: number,
            realImageWidth: number,
            realImageHeight: number,
        Severity: Minor
        Found in native/src/components/PinchPanImage.tsx - About 1 hr to fix

          Function Consent has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const Consent = (): ReactElement | null => {
            const { settings, updateSettings } = useAppContext()
            const { t } = useTranslation('consent')
            const { externalSourcePermissions } = settings
          
          
          Severity: Minor
          Found in native/src/routes/Consent.tsx - About 1 hr to fix

            Function pathnameFromRouteInformation has a Cognitive Complexity of 11 (exceeds 5 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

            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 createTrackingEndpoint has a Cognitive Complexity of 11 (exceeds 5 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: Minor
            Found in shared/api/endpoints/createTrackingEndpoint.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 fetchAsync has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              func fetchAsync(sourceUrl: String, targetFilePath: String, collector: FetchResultCollector) {
                let targetFileURL = URL(fileURLWithPath: targetFilePath)
                
                let fileManager = FileManager.default
                
            Severity: Minor
            Found in native/ios/Integreat/fetcher/FetcherModule.swift - 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 Intro has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            const Intro = ({ route, navigation }: IntroProps): ReactElement => {
              const { updateSettings } = useContext(AppContext)
              const [currentSlide, setCurrentSlide] = useState(0)
              const { width } = useWindowDimensions()
              const { t } = useTranslation<['intro', 'settings']>(['intro', 'settings'])
            Severity: Minor
            Found in native/src/routes/Intro.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 useUserLocation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            const useUserLocation = ({ requestPermissionInitially }: UseUserLocationProps): UseUserLocationReturn => {
              const [locationState, setLocationState] = useState<LocationStateType>(initialState)
              const showSnackbar = useSnackbar()
              const { t } = useTranslation()
            
            
            Severity: Minor
            Found in native/src/hooks/useUserLocation.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 queryStringFromRouteInformation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            export const queryStringFromRouteInformation = (
              routeInformation: NonNullableRouteInformationType,
            ): string | undefined => {
              const queryParams = []
              if (routeInformation.route === POIS_ROUTE) {
            Severity: Minor
            Found in shared/routes/query.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 loadWithCache has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            const loadWithCache = async <T extends object>({
              cityCode,
              languageCode,
              isAvailable,
              getFromDataContainer,
            Severity: Minor
            Found in native/src/hooks/useLoadWithCache.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 SettingItem has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const SettingItem = (props: SettingItemProps): ReactElement => {
              const { title, description, onPress, value, hasBadge, hasSwitch, bigTitle, role } = props
              const { t } = useTranslation('settings')
            
              return (
            Severity: Minor
            Found in native/src/components/SettingItem.tsx - About 1 hr to fix

              Function buildConfigAssets has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const buildConfigAssets = (): AssetsType => {
                const assetsName = buildConfig().assets
              
                if (assetsName === INTEGREAT_ASSETS) {
                  return {
              Severity: Minor
              Found in native/src/constants/buildConfig.ts - About 1 hr to fix

                Function LanguageSelector has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const LanguageSelector = (props: LanguageSelectorProps): ReactElement => {
                  const { isHeaderActionItem, languageChangePaths, languageCode, inKebabMenu = false, closeSidebar } = props
                  const activeItemCode = languageCode
                  const { t } = useTranslation('layout')
                
                
                Severity: Minor
                Found in web/src/components/LanguageSelector.tsx - About 1 hr to fix

                  Function formatDevelopmentNotes has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const formatDevelopmentNotes = (params: { notes: NoteType[]; language: string; platforms: string[] }) => {
                    const { notes, language, platforms } = params
                    const emptyNotesMap = {
                      common: [] as NoteType[],
                      android: [] as NoteType[],
                  Severity: Minor
                  Found in tools/manage-metadata.ts - About 1 hr to fix

                    Function handleSubmit has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const handleSubmit = () => {
                        setSendingStatus('sending')
                    
                        const request = async () => {
                          const feedbackEndpoint = createFeedbackEndpoint(await determineApiUrl())
                    Severity: Minor
                    Found in native/src/components/FeedbackContainer.tsx - About 1 hr to fix

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

                        toICal(baseUrl: string, appName: string, recurring: boolean): string {
                          const { title, location, path, date, excerpt, lastUpdate } = this
                          const url = `${baseUrl}${path}`
                          const uid = v5(`${url}/${formatDateICal(lastUpdate)}`, v5.URL)
                          const timezone = date.startDate.zone.name
                      Severity: Minor
                      Found in shared/api/models/EventModel.ts - About 1 hr to fix

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

                          async storeCategories(categoriesMap: CategoriesMapModel, context: DatabaseContext): Promise<void> {
                            const categoryModels = categoriesMap.toArray()
                            const jsonModels = categoryModels.map(
                              (category: CategoryModel): ContentCategoryJsonType => ({
                                root: category.isRoot(),
                        Severity: Minor
                        Found in native/src/utils/DatabaseConnector.ts - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language