glitch-soc/mastodon

View on GitHub

Showing 4,906 of 4,906 total issues

Function submitCompose has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function submitCompose() {
  return function (dispatch, getState) {
    const status   = getState().getIn(['compose', 'text'], '');
    const media    = getState().getIn(['compose', 'media_attachments']);
    const statusId = getState().getIn(['compose', 'id'], null);
Severity: Major
Found in app/javascript/mastodon/actions/compose.js - About 2 hrs to fix

    Function setupMetrics has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function setupMetrics(channels, pgPool) {
      // Collect metrics from Node.js
      metrics.collectDefaultMetrics();
    
      new metrics.Gauge({
    Severity: Major
    Found in streaming/metrics.js - About 2 hrs to fix

      Method remove_orphans has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def remove_orphans
            progress        = create_progress_bar(nil)
            reclaimed_bytes = 0
            removed         = 0
            prefix          = options[:prefix]
      Severity: Major
      Found in lib/mastodon/cli/media.rb - About 2 hrs to fix

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

        export const deleteConversation = conversationId => (dispatch) => {
          dispatch(deleteConversationRequest(conversationId));
        
          api().delete(`/api/v1/conversations/${conversationId}`)
            .then(() => dispatch(deleteConversationSuccess(conversationId)))
        Severity: Major
        Found in app/javascript/flavours/glitch/actions/conversations.js and 3 other locations - About 2 hrs to fix
        app/javascript/flavours/glitch/actions/lists.js on lines 65..71
        app/javascript/mastodon/actions/conversations.js on lines 91..97
        app/javascript/mastodon/actions/lists.js on lines 65..71

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

        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 messages = defineMessages({
          openReport: { id: 'report_notification.open', defaultMessage: 'Open report' },
          other: { id: 'report_notification.categories.other', defaultMessage: 'Other' },
          spam: { id: 'report_notification.categories.spam', defaultMessage: 'Spam' },
          legal: { id: 'report_notification.categories.legal', defaultMessage: 'Legal' },
        app/javascript/flavours/glitch/features/notifications/components/report.jsx on lines 12..18

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

        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

          handleTranslate = status => {
            const { dispatch } = this.props;
        
            if (status.get('translation')) {
              dispatch(undoStatusTranslation(status.get('id'), status.get('poll')));
        Severity: Major
        Found in app/javascript/mastodon/features/status/index.jsx and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/features/status/index.jsx on lines 423..431

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

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

        export const deleteConversation = conversationId => (dispatch) => {
          dispatch(deleteConversationRequest(conversationId));
        
          api().delete(`/api/v1/conversations/${conversationId}`)
            .then(() => dispatch(deleteConversationSuccess(conversationId)))
        Severity: Major
        Found in app/javascript/mastodon/actions/conversations.js and 3 other locations - About 2 hrs to fix
        app/javascript/flavours/glitch/actions/conversations.js on lines 91..97
        app/javascript/flavours/glitch/actions/lists.js on lines 65..71
        app/javascript/mastodon/actions/lists.js on lines 65..71

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

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

          handleMuteClick = () => {
            const { status, relationship, onMute, onUnmute } = this.props;
            const account = status.get('account');
        
            if (relationship && relationship.get('muting')) {
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 3 other locations - About 2 hrs to fix
        app/javascript/mastodon/components/status_action_bar.jsx on lines 192..201
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 130..139
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 141..150

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

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

          handleBlockClick = () => {
            const { status, relationship, onBlock, onUnblock } = this.props;
            const account = status.get('account');
        
            if (relationship && relationship.get('blocking')) {
        app/javascript/mastodon/components/status_action_bar.jsx on lines 181..190
        app/javascript/mastodon/components/status_action_bar.jsx on lines 192..201
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 130..139

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

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

        export const deleteList = id => (dispatch) => {
          dispatch(deleteListRequest(id));
        
          api().delete(`/api/v1/lists/${id}`)
            .then(() => dispatch(deleteListSuccess(id)))
        Severity: Major
        Found in app/javascript/flavours/glitch/actions/lists.js and 3 other locations - About 2 hrs to fix
        app/javascript/flavours/glitch/actions/conversations.js on lines 91..97
        app/javascript/mastodon/actions/conversations.js on lines 91..97
        app/javascript/mastodon/actions/lists.js on lines 65..71

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

        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 default function alerts(state = initialState, action) {
          switch(action.type) {
          case ALERT_SHOW:
            return addAlert(state, action.alert);
          case ALERT_DISMISS:
        Severity: Major
        Found in app/javascript/flavours/glitch/reducers/alerts.js and 1 other location - About 2 hrs to fix
        app/javascript/mastodon/reducers/alerts.js on lines 19..30

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 94.

        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 timelineDelete.type:
            if (action.payload.statusId === state.get('in_reply_to')) {
              return state.set('in_reply_to', null);
            } else if (action.payload.statusId === state.get('id')) {
              return state.set('id', null);
        Severity: Major
        Found in app/javascript/flavours/glitch/reducers/compose.js and 1 other location - About 2 hrs to fix
        app/javascript/mastodon/reducers/compose.js on lines 451..458

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

        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

        Object.keys(emojiIndex.emojis).forEach(key => {
          let emoji = emojiIndex.emojis[key];
        
          // Emojis with skin tone modifiers are stored like this
          if (Object.hasOwn(emoji, '1')) {
        app/javascript/mastodon/features/emoji/emoji_compressed.js on lines 35..44

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

        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 fetchServerTranslationLanguages = () => (dispatch) => {
          dispatch(fetchServerTranslationLanguagesRequest());
        
          api()
            .get('/api/v1/instance/translation_languages').then(({ data }) => {
        Severity: Major
        Found in app/javascript/mastodon/actions/server.js and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/actions/server.js on lines 49..56

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

        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

          handleTranslate = status => {
            const { dispatch } = this.props;
        
            if (status.get('translation')) {
              dispatch(undoStatusTranslation(status.get('id'), status.get('poll')));
        Severity: Major
        Found in app/javascript/flavours/glitch/features/status/index.jsx and 1 other location - About 2 hrs to fix
        app/javascript/mastodon/features/status/index.jsx on lines 395..403

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

        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 messages = defineMessages({
          openReport: { id: 'report_notification.open', defaultMessage: 'Open report' },
          other: { id: 'report_notification.categories.other', defaultMessage: 'Other' },
          spam: { id: 'report_notification.categories.spam', defaultMessage: 'Spam' },
          legal: { id: 'report_notification.categories.legal', defaultMessage: 'Legal' },
        app/javascript/mastodon/features/notifications/components/report.jsx on lines 12..18

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

        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 fetchServerTranslationLanguages = () => (dispatch) => {
          dispatch(fetchServerTranslationLanguagesRequest());
        
          api()
            .get('/api/v1/instance/translation_languages').then(({ data }) => {
        Severity: Major
        Found in app/javascript/flavours/glitch/actions/server.js and 1 other location - About 2 hrs to fix
        app/javascript/mastodon/actions/server.js on lines 49..56

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

        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 default function alerts(state = initialState, action) {
          switch(action.type) {
          case ALERT_SHOW:
            return addAlert(state, action.alert);
          case ALERT_DISMISS:
        Severity: Major
        Found in app/javascript/mastodon/reducers/alerts.js and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/reducers/alerts.js on lines 19..30

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 94.

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

        export const deleteList = id => (dispatch) => {
          dispatch(deleteListRequest(id));
        
          api().delete(`/api/v1/lists/${id}`)
            .then(() => dispatch(deleteListSuccess(id)))
        Severity: Major
        Found in app/javascript/mastodon/actions/lists.js and 3 other locations - About 2 hrs to fix
        app/javascript/flavours/glitch/actions/conversations.js on lines 91..97
        app/javascript/flavours/glitch/actions/lists.js on lines 65..71
        app/javascript/mastodon/actions/conversations.js on lines 91..97

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

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

          handleMuteClick = () => {
            const { status, relationship, onMute, onUnmute } = this.props;
            const account = status.get('account');
        
            if (relationship && relationship.get('muting')) {
        app/javascript/mastodon/components/status_action_bar.jsx on lines 181..190
        app/javascript/mastodon/components/status_action_bar.jsx on lines 192..201
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 141..150

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

        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

        Severity
        Category
        Status
        Source
        Language