Showing 185 of 185 total issues

Function toString has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  public toString(): string {
    let str = `- [ ] ${this.title}`
    // state
    if (this.isComplete()) {
      str = str.replace('[ ]', '[x]')
Severity: Minor
Found in src/models/task.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 a Cognitive Complexity of 10 (exceeds 5 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

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 SyncModal has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function SyncModal(): JSX.Element {
  const manager = useTaskManager()
  const analytics = useAnalytics()
  const isLoggedIn = useOauthState()
  const [visible, setVisible] = useModal(MODAL.SYNC)
Severity: Minor
Found in src/components/Sync/SyncModal.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

Function Debug has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function Debug(): JSX.Element {
  const { trackings } = useTrackingState()
  const [sCalendar] = useStorage<EventLine[]>(STORAGE_KEY.CALENDAR_EVENT)
  const [sAlarms] = useStorage(STORAGE_KEY.ALARMS)
  const root = useTaskManager().getRoot()
Severity: Minor
Found in src/components/Debug.tsx - About 1 hr to fix

    Function changeIndent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const changeIndent = (
        depth: number,
        from: number,
        to: number,
      ): [string, number, number] => {
    Severity: Minor
    Found in src/components/TodoEditor.tsx - About 1 hr to fix

      Function stopTracking has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          (node: Node, checked?: boolean) => {
            // Clone the objects for updating.
            const newNode = node.clone()
            const newTask = newNode.data as Task
      
      
      Severity: Minor
      Found in src/hooks/useTrackingState.ts - About 1 hr to fix

        Function setAlarm has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          setAlarm(param: Alarm, sendResponse: () => void) {
            const alarm = new Alarm({
              type: param.type,
              name: param.name,
              message: param.message,
        Severity: Minor
        Found in src/eventPage.ts - About 1 hr to fix

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

              [i18n.t('tag'), i18n.t('actual'), i18n.t('estimate'), i18n.t('aer'), i18n.t('amount'), i18n.t('avg')],
          Severity: Major
          Found in src/components/Report.tsx and 1 other location - About 1 hr to fix
          src/components/Report.tsx on lines 229..229

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

          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

              [i18n.t('group'), i18n.t('actual'), i18n.t('estimate'), i18n.t('aer'), i18n.t('amount'), i18n.t('avg')],
          Severity: Major
          Found in src/components/Report.tsx and 1 other location - About 1 hr to fix
          src/components/Report.tsx on lines 186..186

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

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

          async function fetchCalendars(): Promise<Calendar[]> {
            const url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList'
          
            let p = new URLSearchParams()
            p.append('minAccessRole', 'writer')
          Severity: Minor
          Found in src/services/google/calendar.ts - About 1 hr to fix

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

            export const stopTrackings = (
              root: Node,
              trackings: TrackingState[],
            ): [Node, CalendarEvent[]] => {
              const events = []
            Severity: Minor
            Found in src/hooks/useTrackingState.ts - About 1 hr to fix

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

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

                export const ColorPicker = (props: Props): JSX.Element => {
                  const [visible, setVisible] = useState(false)
                  let presets = unique(props.presetColors) || []
                  if (presets.length < PresetMax) {
                    presets = unique(presets.concat(PresetColors))
                Severity: Minor
                Found in src/components/ColorPicker.tsx - About 1 hr to fix

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

                  function Remain(props: RemainProps): JSX.Element {
                    const estimatedTime = props.estimatedTime
                    const [time, setTime] = useState<Time>(new Time())
                  
                    useLayoutEffect(() => {
                  Severity: Minor
                  Found in src/components/TrackingStatus/TrackingStatus.tsx - About 1 hr to fix

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

                    function Inner(props: EventListProps): JSX.Element {
                      const { data } = fetchEvents(props.calendar)
                      const isExist = data.length !== 0
                    
                      useEffect(() => {
                    Severity: Minor
                    Found in src/components/Sync/EventList.tsx - About 1 hr to fix

                      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

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

                                if (obj.type === ALARM_TYPE.TASK) {
                                  Log.d(`clear alarm: ${obj.name} | ${obj.message}`)
                                  return chrome.alarms.clear(alarm.name)
                                }
                        Severity: Major
                        Found in src/eventPage.ts and 1 other location - About 1 hr to fix
                        src/eventPage.ts on lines 107..113

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

                        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

                        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

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

                                  if (
                                    obj.type === ALARM_TYPE.EVENT &&
                                    obj.calendarEventId === param.calendarEventId
                                  ) {
                                    Log.d(`clear alarm: ${obj.name} | ${obj.message}`)
                          Severity: Major
                          Found in src/eventPage.ts and 1 other location - About 1 hr to fix
                          src/eventPage.ts on lines 148..151

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

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

                          Severity
                          Category
                          Status
                          Source
                          Language