Showing 185 of 185 total issues

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

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

      default: selector({
        key: 'savedTrackingStateList',
        get: async () => {
          const trackings = (await Storage.get(
            STORAGE_KEY.TRACKING_STATE,
    Severity: Major
    Found in src/hooks/useTrackingState.ts and 1 other location - About 1 hr to fix
    src/hooks/useTagHistory.ts on lines 14..21

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

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

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

          chrome.storage.local.remove(key, function () {
            Log.d('storage remove: ' + key)
            if (chrome.runtime.lastError != null) {
              reject(chrome.runtime.lastError)
            } else {
    Severity: Major
    Found in src/services/storage.ts and 1 other location - About 1 hr to fix
    src/services/storage.ts on lines 84..91

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

    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

          chrome.storage.local.set({ [key]: value }, function () {
            Log.d('storage set: ' + key)
            if (chrome.runtime.lastError != null) {
              reject(chrome.runtime.lastError)
            } else {
    Severity: Major
    Found in src/services/storage.ts and 1 other location - About 1 hr to fix
    src/services/storage.ts on lines 102..109

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

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

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

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

                        if (this._hours >= DAY) {
                          this._days += Math.floor(this._hours / DAY)
                          this._hours = this._hours % DAY
                        }
                    Severity: Major
                    Found in src/models/time.ts and 2 other locations - About 1 hr to fix
                    src/models/time.ts on lines 257..260
                    src/models/time.ts on lines 261..264

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

                    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 3 locations. Consider refactoring.
                    Open

                        if (this._minutes >= HOUR) {
                          this._hours += Math.floor(this._minutes / HOUR)
                          this._minutes = this._minutes % HOUR
                        }
                    Severity: Major
                    Found in src/models/time.ts and 2 other locations - About 1 hr to fix
                    src/models/time.ts on lines 257..260
                    src/models/time.ts on lines 265..268

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

                    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 3 locations. Consider refactoring.
                    Open

                        if (this._seconds >= MINUTE) {
                          this._minutes += Math.floor(this._seconds / MINUTE)
                          this._seconds = this._seconds % MINUTE
                        }
                    Severity: Major
                    Found in src/models/time.ts and 2 other locations - About 1 hr to fix
                    src/models/time.ts on lines 261..264
                    src/models/time.ts on lines 265..268

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

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

                      Severity
                      Category
                      Status
                      Source
                      Language