Showing 185 of 185 total issues

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

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

type Location =
  | 'auto'
  | 'auto-start'
  | 'auto-end'
  | 'top'
Severity: Minor
Found in src/components/BasePicker.tsx and 1 other location - About 50 mins to fix
src/components/Tooltip.tsx on lines 8..23

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

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

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

type Location =
  | 'auto'
  | 'auto-start'
  | 'auto-end'
  | 'top'
Severity: Minor
Found in src/components/Tooltip.tsx and 1 other location - About 50 mins to fix
src/components/BasePicker.tsx on lines 15..30

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

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

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

      <p className="alarm-list__content">
        <span className="alarm-list__name">{alarm.name}</span>
        <span className="alarm-list__message">{alarm.message}</span>
      </p>
Severity: Minor
Found in src/components/Alarm/AlarmModal.tsx and 1 other location - About 45 mins to fix
src/components/Autocomplete.tsx on lines 158..161

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

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

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

                  <button className="autocomplete__item" onClick={item.action}>
                    <span className="autocomplete__value">{item.value}</span>
                    <span className="autocomplete__name">{item.name}</span>
                  </button>
Severity: Minor
Found in src/components/Autocomplete.tsx and 1 other location - About 45 mins to fix
src/components/Alarm/AlarmModal.tsx on lines 49..52

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

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

            <option value={`${ALARM_TIMING.AFTER},${ALARM_ANCHOR.SCEHEDULED}`}>
              {t('alarm_opt_after_sceheduled')}
            </option>
Severity: Minor
Found in src/components/Alarm/AlarmEditor.tsx and 2 other locations - About 40 mins to fix
src/components/Alarm/AlarmEditor.tsx on lines 81..83
src/components/Alarm/AlarmEditor.tsx on lines 84..86

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

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

            <option value={`${ALARM_TIMING.AFTER},${ALARM_ANCHOR.START}`}>
              {t('alarm_opt_after_start')}
            </option>
Severity: Minor
Found in src/components/Alarm/AlarmEditor.tsx and 2 other locations - About 40 mins to fix
src/components/Alarm/AlarmEditor.tsx on lines 84..86
src/components/Alarm/AlarmEditor.tsx on lines 87..89

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

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

            <option value={`${ALARM_TIMING.BEFORE},${ALARM_ANCHOR.SCEHEDULED}`}>
              {t('alarm_opt_before_sceheduled')}
            </option>
Severity: Minor
Found in src/components/Alarm/AlarmEditor.tsx and 2 other locations - About 40 mins to fix
src/components/Alarm/AlarmEditor.tsx on lines 81..83
src/components/Alarm/AlarmEditor.tsx on lines 87..89

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

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

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

      const gsTable = groupSummary.map((row) => {
        return [row.name, row.actual, asciiBar(row.barLen, 30, false)]
      })
    Severity: Minor
    Found in src/components/Report.tsx and 1 other location - About 35 mins to fix
    src/components/Report.tsx on lines 178..180

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

    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

      const tsTable = tagSummary.map((row) => {
        return [row.name, row.actual, asciiBar(row.barLen, 30, false)]
      })
    Severity: Minor
    Found in src/components/Report.tsx and 1 other location - About 35 mins to fix
    src/components/Report.tsx on lines 272..274

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

    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

    Avoid too many return statements within this function.
    Open

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