Showing 185 of 185 total issues

Function Report has 306 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function Report(): JSX.Element {
  const [report, setReport] = useRecoilState(reportState)
  const [onlyCompleted, setOnlyCompleted] = useState(true)
  const { tags } = useTagHistory()
  const manager = useTaskManager()
Severity: Major
Found in src/components/Report.tsx - About 1 day to fix

    Function TodoEditor has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
    Open

    export function TodoEditor(): JSX.Element {
      const manager = useTaskManager()
      const rootText = manager.getText()
      const [saving] = useStorageWatcher()
      const [text, setText] = useState('')
    Severity: Minor
    Found in src/components/TodoEditor.tsx - About 1 day 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 SortableTree has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

    export function SortableTree({
      collapsible,
      indicator = false,
      indentationWidth = 20,
      removable,
    Severity: Minor
    Found in src/components/Tree/SortableTree.tsx - About 1 day 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 TodoEditor has 207 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function TodoEditor(): JSX.Element {
      const manager = useTaskManager()
      const rootText = manager.getText()
      const [saving] = useStorageWatcher()
      const [text, setText] = useState('')
    Severity: Major
    Found in src/components/TodoEditor.tsx - About 1 day to fix

      Function sortableTreeKeyboardCoordinates has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
      Open

        (context, indicator, indentationWidth) =>
        (
          event,
          {
            currentCoordinates,
      Severity: Minor
      Found in src/components/Tree/keyboardCoordinates.ts - About 7 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

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

              <section>
                <h2 className="py-6 mt-5 text-base font-bold">
                  {i18n.t('total_by_tags')}
                </h2>
                {isTagExists ? (
      Severity: Major
      Found in src/components/Report.tsx and 1 other location - About 7 hrs to fix
      src/components/Report.tsx on lines 426..447

      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 184.

      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

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

              <section>
                <h2 className="py-6 mt-5 text-base font-bold">
                  {i18n.t('total_by_groups')}
                </h2>
                {isGroupExists ? (
      Severity: Major
      Found in src/components/Report.tsx and 1 other location - About 7 hrs to fix
      src/components/Report.tsx on lines 403..424

      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 184.

      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 SyncModal has 163 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function SyncModal(): JSX.Element {
        const manager = useTaskManager()
        const analytics = useAnalytics()
        const isLoggedIn = useOauthState()
        const [visible, setVisible] = useModal(MODAL.SYNC)
      Severity: Major
      Found in src/components/Sync/SyncModal.tsx - About 6 hrs to fix

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

          return (
            <button
              className={classnames('icon-button group mod--sync', {
                hidden: !isVisible,
              })}
        Severity: Major
        Found in src/components/Menu/Sync.tsx and 1 other location - About 6 hrs to fix
        src/components/Menu/Alarm.tsx on lines 26..44

        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 161.

        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

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

          return (
            <button
              className={classnames('icon-button group mod--alarm', {
                hidden: !isVisible,
              })}
        Severity: Major
        Found in src/components/Menu/Alarm.tsx and 1 other location - About 6 hrs to fix
        src/components/Menu/Sync.tsx on lines 26..44

        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 161.

        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 createKeyboardController has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

        export function createKeyboardController() {
          const menuList = new Map<HTMLElement, Menu>();
          let focusedIndex: number;
          let parentNode: HTMLElement;
          let isRoot: boolean;
        Severity: Minor
        Found in src/lib/react-contexify/components/keyboardController.ts - About 5 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

        File Report.tsx has 395 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { useState } from 'react'
        import { atom, useRecoilState } from 'recoil'
        import { color } from 'd3-color'
        
        import { Checkbox } from '@/components/Checkbox'
        Severity: Minor
        Found in src/components/Report.tsx - About 5 hrs to fix

          Function Autocomplete has 121 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            (props: AutocompleteProps, ref: React.RefObject<HTMLDivElement>) => {
              const { tags } = useTagHistory()
              const { times } = useTimeHistory()
              const [cursor, setCursor] = useState(CURSOR_NONE)
              const tokenPosition = useRef(0)
          Severity: Major
          Found in src/components/Autocomplete.tsx - About 4 hrs to fix

            Function TaskItem has 112 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const TaskItem: React.FC<TaskItemProps> = (
              props: TaskItemProps,
            ): JSX.Element => {
              const checkboxProps = props.checkboxProps
              const node = props.node
            Severity: Major
            Found in src/components/TaskItem.tsx - About 4 hrs to fix

              Function TagPicker has 107 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const TagPicker = (props: Props): JSX.Element => {
                const [currentTags, setCurrentTags] = useState(props.initialTags)
                const [inputTxt, setInputTxt] = useState('')
                const [tmpTag, setTmpTag] = useState<string>(null)
                const { tags, upsertTag } = useTagHistory()
              Severity: Major
              Found in src/components/Tag/TagPicker.tsx - About 4 hrs to fix

                File SortableTree.tsx has 341 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React, { useEffect, useMemo, useRef, useState } from 'react'
                import { createPortal } from 'react-dom'
                import {
                  Announcements,
                  DndContext,
                Severity: Minor
                Found in src/components/Tree/SortableTree.tsx - About 4 hrs to fix

                  Function createKeyboardController has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function createKeyboardController() {
                    const menuList = new Map<HTMLElement, Menu>();
                    let focusedIndex: number;
                    let parentNode: HTMLElement;
                    let isRoot: boolean;
                  Severity: Major
                  Found in src/lib/react-contexify/components/keyboardController.ts - About 4 hrs to fix

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

                        if (this.tags.length > 0) {
                          const tagStr = this.tags
                            .map((t) => (t.quantity ? `#${t.name}:${t.quantity}` : `#${t.name}`))
                            .join(' ')
                          str += ` ${tagStr}`
                    Severity: Major
                    Found in src/models/group.ts and 1 other location - About 3 hrs to fix
                    src/models/task.ts on lines 207..212

                    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 112.

                    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

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

                        if (this.tags.length > 0) {
                          const tagStr = this.tags
                            .map((t) => (t.quantity ? `#${t.name}:${t.quantity}` : `#${t.name}`))
                            .join(' ')
                          str += ` ${tagStr}`
                    Severity: Major
                    Found in src/models/task.ts and 1 other location - About 3 hrs to fix
                    src/models/group.ts on lines 54..59

                    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 112.

                    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 AlarmEditor has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function AlarmEditor(): JSX.Element {
                      const [minutes, setMinutes] = useState<number>(0)
                      const [timing, setTiming] = useState<Timing>({} as Timing)
                      const [alarms, setAlarms] = useStorage<AlarmRule[]>(STORAGE_KEY.ALARMS)
                      const analytics = useAnalytics()
                    Severity: Major
                    Found in src/components/Alarm/AlarmEditor.tsx - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language