glitch-soc/mastodon

View on GitHub
app/javascript/flavours/glitch/reducers/notifications.js

Summary

Maintainability
F
1 wk
Test Coverage

File notifications.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { fromJS, Map as ImmutableMap, List as ImmutableList } from 'immutable';

import { blockDomainSuccess } from 'flavours/glitch/actions/domain_blocks';

import {
Severity: Minor
Found in app/javascript/flavours/glitch/reducers/notifications.js - About 3 hrs to fix

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

    export default function notifications(state = initialState, action) {
      let st;
    
      switch(action.type) {
      case fetchMarkers.fulfilled.type:
    Severity: Major
    Found in app/javascript/flavours/glitch/reducers/notifications.js - About 2 hrs to fix

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

      export default function notifications(state = initialState, action) {
        let st;
      
        switch(action.type) {
        case fetchMarkers.fulfilled.type:
      Severity: Minor
      Found in app/javascript/flavours/glitch/reducers/notifications.js - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function expandNormalizedNotifications has 42 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/flavours/glitch/reducers/notifications.js - About 1 hr to fix

        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/flavours/glitch/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/flavours/glitch/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 markNewForDelete = state.get('markNewForDelete');
            const top = state.get('top');
          
            // Under currently unknown conditions, the client may receive duplicates from the server
          Severity: Minor
          Found in app/javascript/flavours/glitch/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/flavours/glitch/reducers/notifications.js and 1 other location - About 5 days to fix
          app/javascript/mastodon/reducers/notifications.js on lines 100..174

          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/flavours/glitch/reducers/notifications.js and 1 other location - About 1 day to fix
          app/javascript/mastodon/reducers/notifications.js on lines 198..210

          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/flavours/glitch/reducers/notifications.js and 1 other location - About 1 day to fix
          app/javascript/mastodon/reducers/notifications.js on lines 241..255

          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/flavours/glitch/reducers/notifications.js and 1 other location - About 7 hrs to fix
          app/javascript/mastodon/reducers/notifications.js on lines 230..239

          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/flavours/glitch/reducers/notifications.js and 1 other location - About 3 hrs to fix
          app/javascript/mastodon/reducers/notifications.js on lines 177..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 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/flavours/glitch/reducers/notifications.js and 1 other location - About 3 hrs to fix
          app/javascript/mastodon/reducers/notifications.js on lines 212..219

          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/flavours/glitch/reducers/notifications.js and 1 other location - About 3 hrs to fix
          app/javascript/mastodon/reducers/notifications.js on lines 182..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 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/flavours/glitch/reducers/notifications.js and 1 other location - About 2 hrs to fix
          app/javascript/mastodon/reducers/notifications.js on lines 66..68

          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/flavours/glitch/reducers/notifications.js and 1 other location - About 2 hrs to fix
          app/javascript/mastodon/reducers/notifications.js on lines 221..228

          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/flavours/glitch/reducers/notifications.js and 1 other location - About 1 hr to fix
          app/javascript/mastodon/reducers/notifications.js on lines 296..299

          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/flavours/glitch/reducers/notifications.js and 1 other location - About 1 hr to fix
          app/javascript/mastodon/reducers/notifications.js on lines 269..270

          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/flavours/glitch/reducers/notifications.js and 1 other location - About 1 hr to fix
          app/javascript/mastodon/reducers/notifications.js on lines 74..78

          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

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

          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 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/flavours/glitch/reducers/notifications.js and 1 other location - About 1 hr to fix
          app/javascript/mastodon/reducers/notifications.js on lines 300..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 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/flavours/glitch/reducers/notifications.js and 1 other location - About 55 mins to fix
          app/javascript/mastodon/reducers/notifications.js on lines 259..260

          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/flavours/glitch/reducers/notifications.js and 1 other location - About 40 mins to fix
          app/javascript/mastodon/reducers/notifications.js on lines 285..286

          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