Showing 185 of 185 total issues

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 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 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 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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    <div className="modal-window-header">
                      <h2>{t('label_alarm')}</h2>
                      <button
                        className="modal-window-header__close icon-button"
                        onClick={onRequestClose}
              Severity: Major
              Found in src/components/Alarm/AlarmModal.tsx and 1 other location - About 2 hrs to fix
              src/components/Sync/SyncModal.tsx on lines 137..145

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 79.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      <Item id="color" onClick={handleInsert}>
                        <div className="context-menu__color">
                          <Icon className="context-menu__color-icon" name="plus" />
                          <span>{t('context_menu_add')}</span>
                        </div>
              Severity: Major
              Found in src/components/MdWrapper.tsx and 1 other location - About 2 hrs to fix
              src/components/Tag/TagContextMenu.tsx on lines 87..92

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 79.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    <div className="modal-window-header">
                      <h2>{t('label_google_calendar')}</h2>
                      <button
                        className="modal-window-header__close icon-button"
                        onClick={onRequestClose}
              Severity: Major
              Found in src/components/Sync/SyncModal.tsx and 1 other location - About 2 hrs to fix
              src/components/Alarm/AlarmModal.tsx on lines 77..85

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 79.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      <Item id="color" onClick={handleItemClick}>
                        <div className="context-menu__color">
                          <Icon className="context-menu__color-icon" name="palette" />
                          <span>{t('tag_change_color')}</span>
                        </div>
              Severity: Major
              Found in src/components/Tag/TagContextMenu.tsx and 1 other location - About 2 hrs to fix
              src/components/MdWrapper.tsx on lines 72..77

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 79.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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 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 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 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

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