Showing 137 of 185 total issues

Function useAlarms has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useAlarms(): useAlarmsReturn {
  const [alarms, _setAlarms] = useRecoilState<Alarm[]>(alarmState)
  const [alarmRules] = useStorage<AlarmRule[]>(STORAGE_KEY.ALARMS)

  const setAlarms = useCallback(
Severity: Minor
Found in src/hooks/useAlarms.ts - About 1 hr to fix

    Function CalendarListInner has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function CalendarListInner(props: CalendarListProps): JSX.Element {
      const [calendar, setCalendar] = useStorage<Calendar>(props.calendarKey)
      const resApi = fetchCalendars()
    
      const needReAuth = resApi.data == null
    Severity: Minor
    Found in src/components/Sync/CalendarList.tsx - About 1 hr to fix

      Function taskToAlarms has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        taskToAlarms: (task: Task, alarmRules: AlarmRule[]): Alarm[] => {
          return alarmRules
            .map((rule) => {
              let minutes = 0
              let message: string
      Severity: Minor
      Found in src/services/alarmService.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 TagPicker has a Cognitive Complexity of 15 (exceeds 5 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: Minor
      Found in src/components/Tag/TagPicker.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 Inner has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Inner(props: CalendarColorsProps): JSX.Element {
        const analytics = useAnalytics()
        const [visible, setVisible] = useState(false)
        const [refElm, setRefElm] = useState(null)
        const [colors, setColors] = useStorage<ColorStorage>(
      Severity: Minor
      Found in src/components/Sync/CalendarColorPicker.tsx - About 1 hr to fix

        Function parseStr has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static parseStr(timeStr: string): Time {
            const timeRegexps = [
              { type: TIME_TYPE.NEGATIVE_SIGN, regexp: /^(-)/ },
              { type: TIME_TYPE.MINUTE, regexp: /(\d+)m/ },
              { type: TIME_TYPE.HOUR, regexp: /(\d+(?:\.\d+)?)h/ },
        Severity: Minor
        Found in src/models/time.ts - About 1 hr to fix

          Function importGoogle has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const importGoogle = async () => {
              analytics.track('import google calendar')
          
              let eventsFiltered = events.filter(
                (e) => e.responseStatus !== RESPONSE_STATUS.DECLINED,
          Severity: Minor
          Found in src/components/Sync/SyncModal.tsx - About 1 hr to fix

            Function TrackingStatus has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function TrackingStatus(): JSX.Element {
              const manager = useTaskManager()
              const analytics = useAnalytics()
              const [mode] = useMode()
              const { trackings } = useTrackingState()
            Severity: Minor
            Found in src/components/TrackingStatus/TrackingStatus.tsx - About 1 hr to fix

              Function ItemConfirm has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const ItemConfirm: React.FC<Props> = (props: Props): JSX.Element => {
                const [confirm, setConfirm] = useState(false)
                const [event, setEvent] = useState()
                const { hideAll } = useContextMenu()
              
              
              Severity: Minor
              Found in src/components/ContextMenu/ItemConfirm.tsx - About 1 hr to fix

                Function moveLine has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function moveLine(
                  current: number,
                  from: number,
                  to: number,
                  length: number,
                Severity: Minor
                Found in src/services/util.ts - About 1 hr to fix

                  Function Edit has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function Edit(): JSX.Element {
                    const { stopAllTracking } = useTrackingStop()
                    const analytics = useAnalytics()
                    const [hoverRef, isHovered] = useHover(200)
                    const [mode, setMode] = useMode()
                  Severity: Minor
                  Found in src/components/Menu/Edit.tsx - About 1 hr to fix

                    Function treeItemsToNode has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function treeItemsToNode(items: TreeItems): Node {
                      let parent = new Node(NODE_TYPE.ROOT, 0, null)
                      let queue: TreeItems = [...items]
                    
                      // for ROOT
                    Severity: Minor
                    Found in src/services/util.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 LineEditor has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function LineEditor(props: Props): JSX.Element {
                      const line = props.line
                      const manager = useTaskManager()
                      const analytics = useAnalytics()
                      const finishEdit = useEditFinish()
                    Severity: Minor
                    Found in src/components/LineEditor.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 MyCalendar has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function MyCalendar(props: Props): JSX.Element {
                      const [visible, setVisible] = useState(false)
                      const { date, range, setDate, setDateRange } = useCalendarDate()
                      const { setKey, recordKeys } = useTaskRecordKey()
                      const analytics = useAnalytics()
                    Severity: Minor
                    Found in src/components/Menu/Calendar.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 getMovementAnnouncement has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function getMovementAnnouncement(
                        eventName: string,
                        activeId: UniqueIdentifier,
                        overId?: UniqueIdentifier,
                      ) {
                    Severity: Minor
                    Found in src/components/Tree/SortableTree.tsx - About 1 hr to fix

                      Function ButtonGroup has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function ButtonGroup(props: ButtonGroupProps): JSX.Element {
                        const [selected, setSelected] = useState<string>(props.initial)
                        const [bgLeft, setBgLeft] = useState(0)
                        const ref = useRef<HTMLButtonElement>()
                      
                      
                      Severity: Minor
                      Found in src/components/ButtonGroup.tsx - About 1 hr to fix

                        Function parse has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function parse(text: string): Node {
                          Log.v('start parse')
                          const root = new Node(NODE_TYPE.ROOT, 0, null)
                          let parent = root
                          let prevDepth = 0
                        Severity: Minor
                        Found in src/services/parser.ts - About 1 hr to fix

                          Function useHover has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function useHover(wait = 0 /* ms */): useHoverReturn {
                            const [hovered, setHovered] = useState(false)
                            const [isHovered, setIsHovered] = useState(false)
                            const [timeoutID, setTimeoutID] = useState<number>()
                            const hoverRef = useRef<HTMLElement>(null)
                          Severity: Minor
                          Found in src/hooks/useHover.ts - About 1 hr to fix

                            Function Submenu has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const Submenu: React.FC<SubMenuProps> = ({
                              arrow,
                              children,
                              disabled = false,
                              hidden = false,
                            Severity: Minor
                            Found in src/lib/react-contexify/components/Submenu.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 PieChart has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function PieChart(props: Props): JSX.Element {
                              const options = {
                                animation: {
                                  duration: 0,
                                },
                            Severity: Minor
                            Found in src/components/Menu/ReportSummary.tsx - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language