Showing 137 of 185 total issues

Function Autocomplete has a Cognitive Complexity of 21 (exceeds 5 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: Minor
Found in src/components/Autocomplete.tsx - About 2 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

Function MdHeading has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const MdHeading = (props: NodeProps): JSX.Element => {
  Log.v(props.node.data)
  const manager = useTaskManager()
  const [topMargin, setTopMargin] = useState(false)
  const line = props.node.line
Severity: Major
Found in src/components/MdHeading.tsx - About 2 hrs to fix

    Function useTrackingState has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function useTrackingState(): useTrackingStateReturn {
      const manager = useTaskManager()
      const { appendActivities } = useActivity()
      const { setAlarmsForTask, stopAlarmsForTask } = useAlarms()
      const [trackings, setTrackings] = useRecoilState(trackingStateSelector)
    Severity: Major
    Found in src/hooks/useTrackingState.ts - About 2 hrs to fix

      File node.ts has 278 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { TreeItem } from '@/components/Tree/types'
      import { Task } from '@/models/task'
      import { Group } from '@/models/group'
      import Log from '@/services/log'
      import { rand, depthToIndent, hasProperties } from '@/services/util'
      Severity: Minor
      Found in src/models/node.ts - About 2 hrs to fix

        Function Copy has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function Copy(): JSX.Element {
          const manager = useTaskManager()
          const analytics = useAnalytics()
          const report = useRecoilValue(reportState)
          const [mode] = useMode()
        Severity: Major
        Found in src/components/Menu/Copy.tsx - About 2 hrs to fix

          Function onKeyDown has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function onKeyDown(e: React.KeyboardEvent) {
              if (e.keyCode === KEYCODE_ENTER) {
                // KeyCode is used to distinguish it from the Enter key input during IME
                const start = inputArea.current.selectionStart
                const end = inputArea.current.selectionEnd
          Severity: Major
          Found in src/components/TodoEditor.tsx - About 2 hrs to fix

            Time has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class Time {
              static parseMs(ms: number): Time {
                const time = new Time()
                if (ms < 0) {
                  time._isNegative = true
            Severity: Minor
            Found in src/models/time.ts - About 2 hrs to fix

              Function Menu has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function Menu(): JSX.Element {
                const [isFixed, setFixed] = useState(false)
                const [mode, setMode] = useMode()
                const isReport = mode === MODE.REPORT
                const analytics = useAnalytics()
              Severity: Major
              Found in src/components/Menu/Menu.tsx - About 2 hrs to fix

                Function MdWrapper has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const MdWrapper: React.FC<Props> = (props: Props): JSX.Element => {
                  const manager = useTaskManager()
                  const [_, __, edit] = useEditable(props.line)
                  const { trackings } = useTrackingState()
                  const tracking = trackings.find((n) => n.line === props.line)
                Severity: Major
                Found in src/components/MdWrapper.tsx - About 2 hrs to fix

                  Function BasePicker has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const BasePicker = (props: BasePickerProps): JSX.Element => {
                    const eventType = props.eventType || EVENT_TYPE.CLICK
                    const [boundaryRef, isBoundaryHovered] = useHover()
                    const [overlayRef, isOverlayHovered] = useHover()
                    const [contentRef] = useHoverCancel()
                  Severity: Major
                  Found in src/components/BasePicker.tsx - About 2 hrs to fix

                    Function TaskItem has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const TaskItem: React.FC<TaskItemProps> = (
                      props: TaskItemProps,
                    ): JSX.Element => {
                      const checkboxProps = props.checkboxProps
                      const node = props.node
                    Severity: Minor
                    Found in src/components/TaskItem.tsx - About 2 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

                    Function Item has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const Item: React.FC<ItemProps> = ({
                      id,
                      children,
                      className,
                      style,
                    Severity: Minor
                    Found in src/lib/react-contexify/components/Item.tsx - About 2 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

                    Function useActivity has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function useActivity(): useActivityReturn {
                      const [uploadParam, setUploadParam] = useState<UploadParam>()
                      const [activities, setActivities] = useStorage<CalendarEvent[]>(
                        STORAGE_KEY.ACTIVITIES,
                      )
                    Severity: Major
                    Found in src/hooks/useActivity.ts - About 2 hrs to fix

                      Function AlarmModal has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function AlarmModal(): JSX.Element {
                        const analytics = useAnalytics()
                        const { alarms } = useAlarms()
                        const [visible, setVisible] = useModal(MODAL.ALARM)
                        const alarmExists = alarms?.length > 0
                      Severity: Major
                      Found in src/components/Alarm/AlarmModal.tsx - About 2 hrs to fix

                        Function Report has a Cognitive Complexity of 16 (exceeds 5 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: Minor
                        Found in src/components/Report.tsx - About 2 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

                        Function PlayStopButton has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function PlayStopButton(props: PlayStopProps) {
                          const { date } = useCalendarDate()
                          const [tooltipVisible, setTooltipVisible] = useState(false)
                          const [timeoutID, setTimeoutID] = useState<number>()
                          const available = props.available && isToday(date)
                        Severity: Major
                        Found in src/components/TaskController.tsx - About 2 hrs to fix

                          Function fetchEvents has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          async function fetchEvents(calendar: Calendar): Promise<CalendarEvent[]> {
                            if (!calendar) return []
                            const calendarId = calendar.id
                            const timeZone = calendar.timeZone
                            const url = `https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events`
                          Severity: Major
                          Found in src/services/google/calendar.ts - About 2 hrs to fix

                            Function TagButton has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const TagButton = (props: TagButtonProps): JSX.Element => {
                              const tag = props.tag
                              const { tags } = useTagHistory()
                              const tagRecord = tags.find((t) => t.name === tag.name)
                              const initialBg = tagRecord?.colorHex || COLOR.Gray200
                            Severity: Major
                            Found in src/components/Tag/TagButton.tsx - About 2 hrs to fix

                              Function useEventAlarm has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function useEventAlarm(): useEventAlarmReturn {
                                const [eventLines, setEventLines] = useStorage<EventLine[]>(
                                  STORAGE_KEY.CALENDAR_EVENT,
                                )
                                const { stopAlarms } = useAlarms()
                              Severity: Minor
                              Found in src/hooks/useEventAlarm.ts - About 2 hrs to fix

                                Function fetchRefreshToken has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function fetchRefreshToken(): Promise<boolean> {
                                  Log.d('fetchRefreshToken')
                                  return new Promise(async (resolve) => {
                                    const S = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
                                    const state = Array.from(crypto.getRandomValues(new Uint8Array(12)))
                                Severity: Minor
                                Found in src/services/google/oauth.ts - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language