digitalfabrik/integreat-app

View on GitHub

Showing 156 of 190 total issues

Avoid too many return statements within this function.
Open

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

    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

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

    const Helmet = ({
      pageTitle,
      metaDescription,
      languageChangePaths,
      cityModel,
    Severity: Minor
    Found in web/src/components/Helmet.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 toFormattedString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      toFormattedString(locale: string, short = false): string {
        const dayFormat = short ? 'D' : 'DDD'
        const format = this.allDay ? dayFormat : `${dayFormat} t`
        const localizedStartDate = this.startDate.setLocale(locale).toFormat(format)
        const localizedEndDate = this.endDate.setLocale(locale)
    Severity: Minor
    Found in shared/api/models/DateModel.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 formatDevelopmentNotes has a Cognitive Complexity of 6 (exceeds 5 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 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 handleAllowedIframeSources has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export const handleAllowedIframeSources = (
      iframe: HTMLIFrameElement,
      externalSourcePermissions: ExternalSourcePermissions,
      storedIframeSource: string,
      t: TFunction,
    Severity: Minor
    Found in web/src/utils/iframes.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 tryToResolve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      func tryToResolve() {
        if (currentFetchCount() != expectedFetchCount) {
          return;
        }
    
    
    Severity: Minor
    Found in native/ios/Integreat/fetcher/FetchResultCollector.swift - 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 PoiDetails has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    const PoiDetails = ({ poi, language, distance }: PoiDetailsProps): ReactElement => {
      const { t } = useTranslation('pois')
      const thumbnail = poi.thumbnail ?? PoiThumbnailPlaceholderLarge
      const {
        title,
    Severity: Minor
    Found in native/src/components/PoiDetails.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 Chat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    const Chat = ({ messages, submitMessage, hasError, isLoading }: ChatProps): ReactElement => {
      const { t } = useTranslation('chat')
      const [textInput, setTextInput] = useState<string>('')
      const { height: deviceHeight } = useWindowDimensions()
      const chatInputContainerHeight = dimensions.getChatInputContainerHeight(messages)
    Severity: Minor
    Found in web/src/components/Chat.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 News has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    const News = ({
      news,
      loadMore,
      newsId,
      languageCode,
    Severity: Minor
    Found in native/src/components/News.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 CityContentToolbar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    const CityContentToolbar = (props: CityContentToolbarProps) => {
      const { viewportSmall } = useWindowDimensions()
      const {
        feedbackTarget,
        children,
    Severity: Minor
    Found in web/src/components/CityContentToolbar.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