Showing 137 of 185 total issues

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

  public filter(predicate: Predicate): Node {
    const [cloned] = clone([this])
    const queue: Node[] = [cloned]
    const flatten: Node[] = []

Severity: Minor
Found in src/models/node.ts - About 1 hr to fix

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

    async function fetchColors(): Promise<CalendarColor[]> {
      const url = 'https://www.googleapis.com/calendar/v3/colors'
    
      let p = new URLSearchParams()
      p.append('key', API_KEY)
    Severity: Minor
    Found in src/services/google/calendar.ts - About 1 hr to fix

      Function logout has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async logout(): Promise<boolean> {
          let logoutResult
      
          const tokenType = await Storage.get(STORAGE_KEY.TOKEN_TYPE)
          if (tokenType === TOKEN_TYPE.WEB) {
      Severity: Minor
      Found in src/services/google/oauth.ts - About 1 hr to fix

        Function Sync has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function Sync(): JSX.Element {
          const analytics = useAnalytics()
          const [mode] = useMode()
          const [_, setVisible] = useModal(MODAL.SYNC)
          const [hoverRef, isHovered] = useHover(200)
        Severity: Minor
        Found in src/components/Menu/Sync.tsx - About 1 hr to fix

          Function Alarm has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function Alarm(): JSX.Element {
            const [mode] = useMode()
            const [_, setVisible] = useModal(MODAL.ALARM)
            const analytics = useAnalytics()
            const [hoverRef, isHovered] = useHover(200)
          Severity: Minor
          Found in src/components/Menu/Alarm.tsx - About 1 hr to fix

            Function handleKeyboard has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function handleKeyboard(e: KeyboardEvent) {
                  switch (e.key) {
                    case 'Enter':
                    case ' ':
                      if (!menuController.openSubmenu()) hide();
            Severity: Minor
            Found in src/lib/react-contexify/components/Menu.tsx - About 1 hr to fix

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

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

                public toString(): string {
                  let str = `- [ ] ${this.title}`
                  // state
                  if (this.isComplete()) {
                    str = str.replace('[ ]', '[x]')
              Severity: Minor
              Found in src/models/task.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 getProjection has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              export function getProjection(
                items: FlattenedItem[],
                activeId: UniqueIdentifier,
                overId: UniqueIdentifier,
                dragOffset: number,
              Severity: Minor
              Found in src/components/Tree/utilities.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 SyncModal has a Cognitive Complexity of 10 (exceeds 5 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: Minor
              Found in src/components/Sync/SyncModal.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 Debug has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function Debug(): JSX.Element {
                const { trackings } = useTrackingState()
                const [sCalendar] = useStorage<EventLine[]>(STORAGE_KEY.CALENDAR_EVENT)
                const [sAlarms] = useStorage(STORAGE_KEY.ALARMS)
                const root = useTaskManager().getRoot()
              Severity: Minor
              Found in src/components/Debug.tsx - About 1 hr to fix

                Function changeIndent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const changeIndent = (
                    depth: number,
                    from: number,
                    to: number,
                  ): [string, number, number] => {
                Severity: Minor
                Found in src/components/TodoEditor.tsx - About 1 hr to fix

                  Function stopTracking has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      (node: Node, checked?: boolean) => {
                        // Clone the objects for updating.
                        const newNode = node.clone()
                        const newTask = newNode.data as Task
                  
                  
                  Severity: Minor
                  Found in src/hooks/useTrackingState.ts - About 1 hr to fix

                    Function setAlarm has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      setAlarm(param: Alarm, sendResponse: () => void) {
                        const alarm = new Alarm({
                          type: param.type,
                          name: param.name,
                          message: param.message,
                    Severity: Minor
                    Found in src/eventPage.ts - About 1 hr to fix

                      Function fetchCalendars has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async function fetchCalendars(): Promise<Calendar[]> {
                        const url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList'
                      
                        let p = new URLSearchParams()
                        p.append('minAccessRole', 'writer')
                      Severity: Minor
                      Found in src/services/google/calendar.ts - About 1 hr to fix

                        Function stopTrackings has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const stopTrackings = (
                          root: Node,
                          trackings: TrackingState[],
                        ): [Node, CalendarEvent[]] => {
                          const events = []
                        Severity: Minor
                        Found in src/hooks/useTrackingState.ts - About 1 hr to fix

                          Function fetchWrapper has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export async function fetchWrapper(
                            url,
                            option?: FetchOption,
                            retryCount = 0,
                          ): Promise<any> {
                          Severity: Minor
                          Found in src/services/google/util.ts - About 1 hr to fix

                            Function ColorPicker has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const ColorPicker = (props: Props): JSX.Element => {
                              const [visible, setVisible] = useState(false)
                              let presets = unique(props.presetColors) || []
                              if (presets.length < PresetMax) {
                                presets = unique(presets.concat(PresetColors))
                            Severity: Minor
                            Found in src/components/ColorPicker.tsx - About 1 hr to fix

                              Function Remain has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function Remain(props: RemainProps): JSX.Element {
                                const estimatedTime = props.estimatedTime
                                const [time, setTime] = useState<Time>(new Time())
                              
                                useLayoutEffect(() => {
                              Severity: Minor
                              Found in src/components/TrackingStatus/TrackingStatus.tsx - About 1 hr to fix

                                Function Inner has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function Inner(props: EventListProps): JSX.Element {
                                  const { data } = fetchEvents(props.calendar)
                                  const isExist = data.length !== 0
                                
                                  useEffect(() => {
                                Severity: Minor
                                Found in src/components/Sync/EventList.tsx - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language