Showing 137 of 185 total issues

Function taskToAlarms has 37 lines of code (exceeds 25 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

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

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

    const ColorPicker = (props: ColorPickerProps): JSX.Element => {
      const colors = props.colors
    
      const click = (e) => {
        const id = e.target.value
    Severity: Minor
    Found in src/components/Sync/CalendarColorPicker.tsx - About 1 hr to fix

      Function getProjection has 35 lines of code (exceeds 25 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

        Function startTrackingForCalendarEvent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const startTrackingForCalendarEvent = async (eventId: string) => {
          const trackings = (await Storage.get(
            STORAGE_KEY.TRACKING_STATE,
          )) as TrackingState[]
          const eventLines = (await Storage.get(
        Severity: Minor
        Found in src/eventPage.ts - About 1 hr to fix

          Function useTagHistory has 34 lines of code (exceeds 25 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 1 hr to fix

            Function Tooltip has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function Tooltip(props: TooltipProp): JSX.Element {
              const [popperElement, setPopperElement] = useState(null)
              const [arrowElement, setArrowElement] = useState(null)
              const { styles, attributes } = usePopper(props.refElm, popperElement, {
                placement: props.location,
            Severity: Minor
            Found in src/components/Tooltip.tsx - About 1 hr to fix

              Function ReportSummary has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function ReportSummary(props: ReportSummaryProps): JSX.Element {
                const [mode, setMode] = useMode()
                const manager = useTaskManager()
                const root = manager.getRoot()
                const analytics = useAnalytics()
              Severity: Minor
              Found in src/components/Menu/ReportSummary.tsx - About 1 hr to fix

                Function gdTable has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    ...groups.reduce<string[][]>((acc, group) => {
                      const tasks = nodeToTasks(group, onlyCompleted)
                      const gt = aggregate(tasks)
                      const g = group.data as Group
                
                
                Severity: Minor
                Found in src/components/Report.tsx - About 1 hr to fix

                  Function selectRecord has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function selectRecord(
                    key: TaskRecordKey,
                    records: TaskRecordArray,
                  ): Node {
                    if (key.keyType === KEY_TYPE.SINGLE) {
                  Severity: Minor
                  Found in src/hooks/useTaskManager.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 fetchEvents has a Cognitive Complexity of 11 (exceeds 5 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: Minor
                  Found in src/services/google/calendar.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 useEventAlarm has a Cognitive Complexity of 11 (exceeds 5 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 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 TagMenu has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function TagMenu(props: TagMenuProps): JSX.Element {
                    const [pickerVisible, setPickerVisible] = useState(false)
                    const [refElm, setRefElm] = useState(null)
                    const analytics = useAnalytics()
                  
                  
                  Severity: Minor
                  Found in src/components/Tag/TagMenu.tsx - About 1 hr to fix

                    Function insertEvent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    async function insertEvent(
                      calendar: Calendar,
                      event: CalendarEvent,
                    ): Promise<boolean> {
                      const calendarId = calendar.id
                    Severity: Minor
                    Found in src/services/google/calendar.ts - About 1 hr to fix

                      Function SyncButton has 31 lines of code (exceeds 25 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 1 hr to fix

                        Function useTaskStorage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function useTaskStorage(): void {
                          const { addTimes } = useTimeHistory()
                          const [records, setRecords] = useRecoilState(allRecordsState)
                          const key = useRecoilValue(taskRecordKeyState)
                          const root = useRecoilValue(nodeState)
                        Severity: Minor
                        Found in src/hooks/useTaskStorage.ts - About 1 hr to fix

                          Function TaskTags has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function TaskTags(props: Props): JSX.Element {
                            const [hoverRef, isHovered] = useHover(200)
                            const tags = props.tags.slice(0, TagCountMax)
                            const isOmit = props.tags.length > TagCountMax
                            const omitCount = props.tags.length - TagCountMax
                          Severity: Minor
                          Found in src/components/Tag/TaskTags.tsx - About 1 hr to fix

                            Function treeItemsToNode has 30 lines of code (exceeds 25 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

                              Function ReportTable has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function ReportTable(props: Props): JSX.Element {
                                const header = props.table[0]
                                const table = props.table.slice(1).map((row) => {
                                  const key = cell2str(row[0])
                                  return [key, ...row]
                              Severity: Minor
                              Found in src/components/ReportTable.tsx - About 1 hr to fix

                                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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language