glitch-soc/mastodon

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

Summary

Maintainability
F
3 wks
Test Coverage

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

import { IntlMessageFormat } from 'intl-messageformat';
import { defineMessages } from 'react-intl';

import { List as ImmutableList } from 'immutable';

Severity: Minor
Found in app/javascript/mastodon/actions/notifications.js - About 7 hrs to fix

    Function updateNotifications has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function updateNotifications(notification, intlMessages, intlLocale) {
      return (dispatch, getState) => {
        const activeFilter = getState().getIn(['settings', 'notifications', 'quickFilter', 'active']);
        const showInColumn = activeFilter === 'all' ? getState().getIn(['settings', 'notifications', 'shows', notification.type], true) : activeFilter === notification.type;
        const showAlert    = getState().getIn(['settings', 'notifications', 'alerts', notification.type], true);
    Severity: Minor
    Found in app/javascript/mastodon/actions/notifications.js - About 1 hr to fix

      Function fetchNotificationsForRequest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export const fetchNotificationsForRequest = accountId => (dispatch, getState) => {
        const current = getState().getIn(['notificationRequests', 'current']);
        const params = { account_id: accountId };
      
        if (current.getIn(['item', 'account']) === accountId) {
      Severity: Minor
      Found in app/javascript/mastodon/actions/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

      Function expandNotificationsSuccess has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      export function expandNotificationsSuccess(notifications, next, isLoadingMore, isLoadingRecent, usePendingItems) {
      Severity: Minor
      Found in app/javascript/mastodon/actions/notifications.js - About 35 mins to fix

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

        export function updateNotifications(notification, intlMessages, intlLocale) {
          return (dispatch, getState) => {
            const activeFilter = getState().getIn(['settings', 'notifications', 'quickFilter', 'active']);
            const showInColumn = activeFilter === 'all' ? getState().getIn(['settings', 'notifications', 'shows', notification.type], true) : activeFilter === notification.type;
            const showAlert    = getState().getIn(['settings', 'notifications', 'alerts', notification.type], true);
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 4 days to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 108..168

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

        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

        export function expandNotifications({ maxId, forceLoad } = {}, done = noOp) {
          return (dispatch, getState) => {
            const activeFilter = getState().getIn(['settings', 'notifications', 'quickFilter', 'active']);
            const notifications = getState().get('notifications');
            const isLoadingMore = !!maxId;
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 3 days to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 193..247

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

        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

        export const fetchNotificationsForRequest = accountId => (dispatch, getState) => {
          const current = getState().getIn(['notificationRequests', 'current']);
          const params = { account_id: accountId };
        
          if (current.getIn(['item', 'account']) === accountId) {
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 2 days to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 625..651

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

        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

        export const expandNotificationsForRequest = () => (dispatch, getState) => {
          const url = getState().getIn(['notificationRequests', 'current', 'notifications', 'next']);
        
          if (!url || getState().getIn(['notificationRequests', 'current', 'notifications', 'isLoading'])) {
            return;
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 668..687

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

        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

        export const fetchNotificationRequests = () => (dispatch, getState) => {
          const params = {};
        
          if (getState().getIn(['notificationRequests', 'isLoading'])) {
            return;
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 471..491

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

        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

        export const expandNotificationRequests = () => (dispatch, getState) => {
          const url = getState().getIn(['notificationRequests', 'next']);
        
          if (!url || getState().getIn(['notificationRequests', 'isLoading'])) {
            return;
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 508..524

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

        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

        export const fetchNotificationRequest = id => (dispatch, getState) => {
          const current = getState().getIn(['notificationRequests', 'current']);
        
          if (current.getIn(['item', 'id']) === id || current.get('isLoading')) {
            return;
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 6 hrs to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 541..555

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

        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

        export function setupBrowserNotifications() {
          return dispatch => {
            dispatch(setBrowserSupport('Notification' in window));
            if ('Notification' in window) {
              dispatch(setBrowserPermission(Notification.permission));
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 6 hrs to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 395..408

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

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

        export const dismissNotificationRequest = id => (dispatch, getState) => {
          dispatch(dismissNotificationRequestRequest(id));
        
          api(getState).post(`/api/v1/notifications/requests/${id}/dismiss`).then(() =>{
            dispatch(dismissNotificationRequestSuccess(id));
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 5 other locations - About 3 hrs to fix
        app/javascript/flavours/glitch/actions/announcements.js on lines 64..72
        app/javascript/flavours/glitch/actions/notifications.js on lines 573..581
        app/javascript/flavours/glitch/actions/notifications.js on lines 599..607
        app/javascript/mastodon/actions/announcements.js on lines 64..72
        app/javascript/mastodon/actions/notifications.js on lines 485..493

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

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

        export const acceptNotificationRequest = id => (dispatch, getState) => {
          dispatch(acceptNotificationRequestRequest(id));
        
          api(getState).post(`/api/v1/notifications/requests/${id}/accept`).then(() => {
            dispatch(acceptNotificationRequestSuccess(id));
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 5 other locations - About 3 hrs to fix
        app/javascript/flavours/glitch/actions/announcements.js on lines 64..72
        app/javascript/flavours/glitch/actions/notifications.js on lines 573..581
        app/javascript/flavours/glitch/actions/notifications.js on lines 599..607
        app/javascript/mastodon/actions/announcements.js on lines 64..72
        app/javascript/mastodon/actions/notifications.js on lines 511..519

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

        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

        export const updateNotificationsPolicy = params => (dispatch, getState) => {
          dispatch(fetchNotificationPolicyRequest());
        
          api(getState).put('/api/v1/notifications/policy', params).then(({ data }) => {
            dispatch(fetchNotificationPolicySuccess(data));
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 461..469

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

        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 fetchRelatedRelationships = (dispatch, notifications) => {
          const accountIds = notifications.filter(item => ['follow', 'follow_request', 'admin.sign_up'].indexOf(item.type) !== -1).map(item => item.account.id);
        
          if (accountIds.length > 0) {
            dispatch(fetchRelationships(accountIds));
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 96..102

        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

        export const fetchNotificationPolicy = () => (dispatch, getState) => {
          dispatch(fetchNotificationPolicyRequest());
        
          api(getState).get('/api/v1/notifications/policy').then(({ data }) => {
            dispatch(fetchNotificationPolicySuccess(data));
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 437..445

        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

        export function requestBrowserPermission(callback = noOp) {
          return dispatch => {
            requestNotificationPermission((permission) => {
              dispatch(setBrowserPermission(permission));
              callback(permission);
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 410..421

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

        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

        export function setFilter (filterType) {
          return dispatch => {
            dispatch({
              type: NOTIFICATIONS_FILTER_SET,
              path: ['notifications', 'quickFilter', 'active'],
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 376..386

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

        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 excludeTypesFromFilter = filter => {
          const allTypes = ImmutableList([
            'follow',
            'follow_request',
            'favourite',
        Severity: Major
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 172..187

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 61.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        export function expandNotificationsFail(error, isLoadingMore) {
          return {
            type: NOTIFICATIONS_EXPAND_FAIL,
            error,
            skipLoading: !isLoadingMore,
        Severity: Minor
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 55 mins to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 267..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 53.

        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

        export function expandNotificationsSuccess(notifications, next, isLoadingMore, isLoadingRecent, usePendingItems) {
          return {
            type: NOTIFICATIONS_EXPAND_SUCCESS,
            notifications,
            next,
        Severity: Minor
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 50 mins to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 256..265

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

        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 excludeTypesFromSettings = state => state.getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
        Severity: Minor
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 50 mins to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 170..170

        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

        export function clearNotifications() {
          return (dispatch, getState) => {
            dispatch({
              type: NOTIFICATIONS_CLEAR,
            });
        Severity: Minor
        Found in app/javascript/mastodon/actions/notifications.js and 1 other location - About 40 mins to fix
        app/javascript/flavours/glitch/actions/notifications.js on lines 276..284

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

        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