Showing 137 of 185 total issues

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

  async ensureToken(): Promise<string> {
    const token = (await Storage.get(STORAGE_KEY.ACCESS_TOKEN)) as string
    try {
      const response = await fetch(
        `https://oauth2.googleapis.com/tokeninfo?access_token=${token}`,
Severity: Minor
Found in src/services/google/oauth.ts - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

        } else if (animation && 'enter' in animation && 'exit' in animation) {
          return cx({
            [`${CssClass.animationWillEnter}${animation.enter}`]:
              animation.enter && visible && !willLeave,
            [`${CssClass.animationWillLeave}${animation.exit} ${CssClass.animationWillLeave}'disabled'`]:
    Severity: Major
    Found in src/lib/react-contexify/components/Menu.tsx - About 1 hr to fix

      Function findItemDeep has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      export function findItemDeep(
        items: TreeItems,
        itemId: UniqueIdentifier,
      ): TreeItem | undefined {
        for (const item of items) {
      Severity: Minor
      Found in src/components/Tree/utilities.ts - About 55 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 useTagHistory has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      export function useTagHistory(): useTagHistoryReturn {
        const [tags, setTags] = useRecoilState(tagRecordState)
      
        const upsertTag = useCallback(
          (record: TagRecord) => {
      Severity: Minor
      Found in src/hooks/useTagHistory.ts - About 55 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 useMode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      export function useMode(): ModeReturn {
        const [mode, setMode] = useRecoilState(modeState)
        const setIsPossibleToSave = useSetRecoilState(isPossibleToSaveState)
        const { setKey } = useTaskRecordKey()
        const { date, range } = useCalendarDate()
      Severity: Minor
      Found in src/hooks/useMode.ts - About 55 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 useTrackingState has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export function useTrackingState(): useTrackingStateReturn {
        const manager = useTaskManager()
        const { appendActivities } = useActivity()
        const { setAlarmsForTask, stopAlarmsForTask } = useAlarms()
        const [trackings, setTrackings] = useRecoilState(trackingStateSelector)
      Severity: Minor
      Found in src/hooks/useTrackingState.ts - About 45 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 updateToken has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        async updateToken(): Promise<boolean> {
          try {
            // Remove cached AuthToken if exists.
            const tokenType = await Storage.get(STORAGE_KEY.TOKEN_TYPE)
            const token = (await Storage.get(STORAGE_KEY.ACCESS_TOKEN)) as string
      Severity: Minor
      Found in src/services/google/oauth.ts - About 45 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 MdHeading has a Cognitive Complexity of 8 (exceeds 5 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: Minor
      Found in src/components/MdHeading.tsx - About 45 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 getProjection has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        items: FlattenedItem[],
        activeId: UniqueIdentifier,
        overId: UniqueIdentifier,
        dragOffset: number,
        indentationWidth: number,
      Severity: Minor
      Found in src/components/Tree/utilities.ts - About 35 mins to fix

        Function setComplete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          public setComplete(isComplete: boolean): void {
            if (isComplete) {
              this.taskState = TASK_STATE.COMPLETE
        
              if (this.actualTimes.isEmpty() && !this.estimatedTimes.isEmpty()) {
        Severity: Minor
        Found in src/models/task.ts - About 35 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 SyncButton has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export function SyncButton(param: SyncButtonParam): JSX.Element {
          const [sync, setSync] = useState(false)
          const [completed, setCompleted] = useState(false)
        
          const onClick = async () => {
        Severity: Minor
        Found in src/components/Sync/SyncButton.tsx - About 35 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 fetchColors has a Cognitive Complexity of 7 (exceeds 5 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 35 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

        Avoid too many return statements within this function.
        Open

              return to - (length - 1)
        Severity: Major
        Found in src/services/util.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return to + (current - from)
          Severity: Major
          Found in src/services/util.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return current - length
            Severity: Major
            Found in src/services/util.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return newCoordinates
              Severity: Major
              Found in src/components/Tree/keyboardCoordinates.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return current + length
                Severity: Major
                Found in src/services/util.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return current
                  Severity: Major
                  Found in src/services/util.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return current
                    Severity: Major
                    Found in src/services/util.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return to
                      Severity: Major
                      Found in src/services/util.ts - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language