glitch-soc/mastodon

View on GitHub
app/javascript/mastodon/reducers/notifications.js

Summary

Maintainability
F
1 wk
Test Coverage

Function notifications has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function notifications(state = initialState, action) {
  switch(action.type) {
  case fetchMarkers.fulfilled.type:
    return action.payload.markers.notifications ? recountUnread(state, action.payload.markers.notifications.last_read_id) : state;
  case NOTIFICATIONS_MOUNT:
Severity: Major
Found in app/javascript/mastodon/reducers/notifications.js - About 2 hrs to fix

    Function expandNormalizedNotifications has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const expandNormalizedNotifications = (state, notifications, next, isLoadingMore, isLoadingRecent, usePendingItems) => {
      // This method is pretty tricky because:
      // - existing notifications might be out of order
      // - the existing notifications may have gaps, most often explicitly noted with a `null` item
      // - ideally, we don't want it to reorder existing items
    Severity: Minor
    Found in app/javascript/mastodon/reducers/notifications.js - About 1 hr to fix

      Function notifications has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function notifications(state = initialState, action) {
        switch(action.type) {
        case fetchMarkers.fulfilled.type:
          return action.payload.markers.notifications ? recountUnread(state, action.payload.markers.notifications.last_read_id) : state;
        case NOTIFICATIONS_MOUNT:
      Severity: Minor
      Found in app/javascript/mastodon/reducers/notifications.js - 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 recountUnread has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const recountUnread = (state, last_read_id) => {
        return state.withMutations(mutable => {
          if (compareId(last_read_id, mutable.get('lastReadId')) > 0) {
            mutable.set('lastReadId', last_read_id);
          }
      Severity: Minor
      Found in app/javascript/mastodon/reducers/notifications.js - 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

      Consider simplifying this complex logical expression.
      Open

          if (!newItems.isEmpty()) {
            usePendingItems = isLoadingRecent && (usePendingItems || !mutable.get('pendingItems').isEmpty());
      
            mutable.update(usePendingItems ? 'pendingItems' : 'items', oldItems => {
              // If called to poll *new* notifications, we just need to add them on top without duplicates
      Severity: Major
      Found in app/javascript/mastodon/reducers/notifications.js - About 40 mins to fix

        Function normalizeNotification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const normalizeNotification = (state, notification, usePendingItems) => {
          const top = state.get('top');
        
          // Under currently unknown conditions, the client may receive duplicates from the server
          if (state.get('pendingItems').some((item) => item?.get('id') === notification.id) || state.get('items').some((item) => item?.get('id') === notification.id)) {
        Severity: Minor
        Found in app/javascript/mastodon/reducers/notifications.js - About 25 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

          return state.withMutations(mutable => {
            if (!newItems.isEmpty()) {
              usePendingItems = isLoadingRecent && (usePendingItems || !mutable.get('pendingItems').isEmpty());
        
              mutable.update(usePendingItems ? 'pendingItems' : 'items', oldItems => {
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 5 days to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 108..182

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

        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

        const deleteByStatus = (state, statusId) => {
          const lastReadId = state.get('lastReadId');
        
          if (shouldCountUnreadNotifications(state)) {
            const deletedUnread = state.get('items').filter(item => item !== null && item.get('status') === statusId && compareId(item.get('id'), lastReadId) > 0);
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 206..218

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

        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

        const recountUnread = (state, last_read_id) => {
          return state.withMutations(mutable => {
            if (compareId(last_read_id, mutable.get('lastReadId')) > 0) {
              mutable.set('lastReadId', last_read_id);
            }
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 281..295

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

        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 shouldCountUnreadNotifications = (state, ignoreScroll = false) => {
          const isTabVisible   = state.get('isTabVisible');
          const isOnTop        = state.get('top');
          const isMounted      = state.get('mounted') > 0;
          const lastReadId     = state.get('lastReadId');
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 7 hrs to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 270..279

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

        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 filterNotifications = (state, accountIds, type) => {
          const helper = list => list.filterNot(item => item !== null && accountIds.includes(item.get('account')) && (type === undefined || type === item.get('type')));
          return state.update('items', helper).update('pendingItems', helper);
        };
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 185..188

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

        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

        const updateMounted = (state) => {
          state = state.update('mounted', count => count + 1);
          if (!shouldCountUnreadNotifications(state, state.get('mounted') === 1)) {
            state = state.set('readMarkerId', state.get('lastReadId'));
            state = clearUnread(state);
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 252..259

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

        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

        const clearUnread = (state) => {
          state = state.set('unread', state.get('pendingItems').size);
          const lastNotification = state.get('items').find(item => item !== null);
          return state.set('lastReadId', lastNotification ? lastNotification.get('id') : '0');
        };
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 190..194

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

        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

          if (state.get('pendingItems').some((item) => item?.get('id') === notification.id) || state.get('items').some((item) => item?.get('id') === notification.id)) {
            return state;
          }
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 73..75

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

        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

        const updateVisibility = (state, visibility) => {
          state = state.set('isTabVisible', visibility);
          if (!shouldCountUnreadNotifications(state)) {
            state = state.set('readMarkerId', state.get('lastReadId'));
            state = clearUnread(state);
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 261..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 81.

        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

          case TIMELINE_DISCONNECT:
            return action.timeline === 'home' ?
              state.update(action.usePendingItems ? 'pendingItems' : 'items', items => items.first() ? items.unshift(null) : items) :
              state;
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 338..341

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

        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

          case NOTIFICATIONS_LOAD_PENDING:
            return state.update('items', list => state.get('pendingItems').concat(list.take(40))).set('pendingItems', ImmutableList()).set('unread', 0);
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 309..310

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

        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

          if (shouldCountUnreadNotifications(state)) {
            state = state.update('unread', unread => unread + 1);
          } else {
            state = state.set('lastReadId', notification.id);
          }
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 81..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 59.

        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

          case NOTIFICATIONS_MARK_AS_READ:
            const lastNotification = state.get('items').find(item => item !== null);
            return lastNotification ? recountUnread(state, lastNotification.get('id')) : state;
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 371..373

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

        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

        const updateTop = (state, top) => {
          state = state.set('top', top);
        
          if (!shouldCountUnreadNotifications(state)) {
            state = clearUnread(state);
        Severity: Major
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 196..204

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

        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

          case fetchMarkers.fulfilled.type:
            return action.payload.markers.notifications ? recountUnread(state, action.payload.markers.notifications.last_read_id) : state;
        Severity: Minor
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 55 mins to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 301..302

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

        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

          case muteAccountSuccess.type:
            return action.payload.relationship.muting_notifications ? filterNotifications(state, [action.payload.relationship.id]) : state;
        Severity: Minor
        Found in app/javascript/mastodon/reducers/notifications.js and 1 other location - About 40 mins to fix
        app/javascript/flavours/glitch/reducers/notifications.js on lines 327..328

        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

        There are no issues that match your filters.

        Category
        Status