glitch-soc/mastodon

View on GitHub
app/javascript/flavours/glitch/containers/status_container.js

Summary

Maintainability
F
6 days
Test Coverage

Function mapDispatchToProps has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

const mapDispatchToProps = (dispatch, { intl, contextType }) => ({

  onReply (status, router) {
    dispatch((_, getState) => {
      let state = getState();
Severity: Minor
Found in app/javascript/flavours/glitch/containers/status_container.js - About 5 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

File status_container.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { defineMessages, injectIntl } from 'react-intl';

import { connect } from 'react-redux';

import { initBlockModal } from 'flavours/glitch/actions/blocks';
Severity: Minor
Found in app/javascript/flavours/glitch/containers/status_container.js - About 2 hrs to fix

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

    const makeMapStateToProps = () => {
      const getStatus = makeGetStatus();
      const getPictureInPicture = makeGetPictureInPicture();
    
      const mapStateToProps = (state, props) => {
    Severity: Minor
    Found in app/javascript/flavours/glitch/containers/status_container.js - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    const makeMapStateToProps = () => {
      const getStatus = makeGetStatus();
      const getPictureInPicture = makeGetPictureInPicture();
    
      const mapStateToProps = (state, props) => {
    Severity: Minor
    Found in app/javascript/flavours/glitch/containers/status_container.js - About 1 hr to fix

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

      const messages = defineMessages({
        deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
        deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },
        redraftConfirm: { id: 'confirmations.redraft.confirm', defaultMessage: 'Delete & redraft' },
        redraftMessage: { id: 'confirmations.redraft.message', defaultMessage: 'Are you sure you want to delete this status and re-draft it? Favorites and boosts will be lost, and replies to the original post will be orphaned.' },
      app/javascript/mastodon/features/report/category.jsx on lines 14..27

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

      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

        onEdit (status, history) {
          dispatch((_, getState) => {
            let state = getState();
            if (state.getIn(['compose', 'text']).trim().length !== 0) {
              dispatch(openModal({
      app/javascript/mastodon/containers/status_container.jsx on lines 162..178

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

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

        onDelete (status, history, withRedraft = false) {
          if (!deleteModal) {
            dispatch(deleteStatus(status.get('id'), history, withRedraft));
          } else {
            dispatch(openModal({
      app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js on lines 115..128
      app/javascript/mastodon/containers/status_container.jsx on lines 147..160
      app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 118..131

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

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

        onFavourite (status, e) {
          if (status.get('favourited')) {
            dispatch(unfavourite(status));
          } else {
            if (e.shiftKey || !favouriteModal) {
      app/javascript/flavours/glitch/features/notifications/containers/notification_container.js on lines 42..52
      app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js on lines 77..87
      app/javascript/mastodon/features/notifications/containers/notification_container.js on lines 45..55
      app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 80..90

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

      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

        onTranslate (status) {
          if (status.get('translation')) {
            dispatch(undoStatusTranslation(status.get('id'), status.get('poll')));
          } else {
            dispatch(translateStatus(status.get('id')));
      app/javascript/mastodon/containers/status_container.jsx on lines 180..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 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

        onInteractionModal (type, status) {
          dispatch(openModal({
            modalType: 'INTERACTION',
            modalProps: {
              type,
      app/javascript/mastodon/containers/status_container.jsx on lines 267..276

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

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

        onMuteConversation (status) {
          if (status.get('muted')) {
            dispatch(unmuteStatus(status.get('id')));
          } else {
            dispatch(muteStatus(status.get('id')));
      app/javascript/flavours/glitch/containers/status_container.js on lines 273..279
      app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js on lines 165..171
      app/javascript/mastodon/containers/status_container.jsx on lines 235..241
      app/javascript/mastodon/containers/status_container.jsx on lines 243..249
      app/javascript/mastodon/features/notifications/containers/notification_container.js on lines 65..71
      app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 168..174
      app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 176..182

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 66.

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

        onToggleHidden (status) {
          if (status.get('hidden')) {
            dispatch(revealStatus(status.get('id')));
          } else {
            dispatch(hideStatus(status.get('id')));
      app/javascript/flavours/glitch/containers/status_container.js on lines 265..271
      app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js on lines 165..171
      app/javascript/mastodon/containers/status_container.jsx on lines 235..241
      app/javascript/mastodon/containers/status_container.jsx on lines 243..249
      app/javascript/mastodon/features/notifications/containers/notification_container.js on lines 65..71
      app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 168..174
      app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 176..182

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 66.

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

        onEmbed (status) {
          dispatch(openModal({
            modalType: 'EMBED',
            modalProps: {
              id: status.get('id'),
      app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js on lines 105..113
      app/javascript/mastodon/containers/status_container.jsx on lines 137..145
      app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 108..116

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

      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

        onOpenMedia (statusId, media, index, lang) {
          dispatch(openModal({
            modalType: 'MEDIA',
            modalProps: { statusId, media, index, lang },
          }));
      app/javascript/flavours/glitch/containers/status_container.js on lines 241..246
      app/javascript/mastodon/containers/status_container.jsx on lines 196..201
      app/javascript/mastodon/containers/status_container.jsx on lines 203..208

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 55.

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

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

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

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

      Refactorings

      Further Reading

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

        onOpenVideo (statusId, media, lang, options) {
          dispatch(openModal({
            modalType: 'VIDEO',
            modalProps: { statusId, media, lang, options },
          }));
      app/javascript/flavours/glitch/containers/status_container.js on lines 234..239
      app/javascript/mastodon/containers/status_container.jsx on lines 196..201
      app/javascript/mastodon/containers/status_container.jsx on lines 203..208

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 55.

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

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

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

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

      Refactorings

      Further Reading

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

            if (getState().getIn(['local_settings', 'media', 'pop_in_player'])) {
              dispatch(deployPictureInPicture({statusId: status.get('id'), accountId: status.getIn(['account', 'id']), playerType: type, props: mediaProps}));
            }
      Severity: Minor
      Found in app/javascript/flavours/glitch/containers/status_container.js and 1 other location - About 55 mins to fix
      app/javascript/mastodon/containers/status_container.jsx on lines 263..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 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

        onModalReblog (status, privacy) {
          if (status.get('reblogged')) {
            dispatch(unreblog(status));
          } else {
            dispatch(reblog(status, privacy));
      Severity: Minor
      Found in app/javascript/flavours/glitch/containers/status_container.js and 1 other location - About 50 mins to fix
      app/javascript/mastodon/containers/status_container.jsx on lines 97..103

      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

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

        onBookmark (status) {
          if (status.get('bookmarked')) {
            dispatch(unbookmark(status));
          } else {
            dispatch(bookmark(status));
      Severity: Major
      Found in app/javascript/flavours/glitch/containers/status_container.js and 10 other locations - About 45 mins to fix
      app/javascript/flavours/glitch/containers/status_container.js on lines 167..173
      app/javascript/flavours/glitch/features/notifications/containers/notification_container.js on lines 54..60
      app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js on lines 89..95
      app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js on lines 97..103
      app/javascript/mastodon/containers/status_container.jsx on lines 113..119
      app/javascript/mastodon/containers/status_container.jsx on lines 121..127
      app/javascript/mastodon/containers/status_container.jsx on lines 129..135
      app/javascript/mastodon/features/notifications/containers/notification_container.js on lines 57..63
      app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 92..98
      app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 100..106

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

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

        onPin (status) {
          if (status.get('pinned')) {
            dispatch(unpin(status));
          } else {
            dispatch(pin(status));
      Severity: Major
      Found in app/javascript/flavours/glitch/containers/status_container.js and 10 other locations - About 45 mins to fix
      app/javascript/flavours/glitch/containers/status_container.js on lines 137..143
      app/javascript/flavours/glitch/features/notifications/containers/notification_container.js on lines 54..60
      app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js on lines 89..95
      app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js on lines 97..103
      app/javascript/mastodon/containers/status_container.jsx on lines 113..119
      app/javascript/mastodon/containers/status_container.jsx on lines 121..127
      app/javascript/mastodon/containers/status_container.jsx on lines 129..135
      app/javascript/mastodon/features/notifications/containers/notification_container.js on lines 57..63
      app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 92..98
      app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 100..106

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

      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

            if (state.getIn(['local_settings', 'confirm_boost_missing_media_description']) && status.get('media_attachments').some(item => !item.get('description')) && !status.get('reblogged')) {
              dispatch(openModal({ modalType: 'BOOST', modalProps: { status, onReblog: this.onModalReblog, missingMediaDescription: true } }));
            } else if (e.shiftKey || !boostModal) {
              this.onModalReblog(status);
            } else {
      Severity: Minor
      Found in app/javascript/flavours/glitch/containers/status_container.js and 1 other location - About 35 mins to fix
      app/javascript/flavours/glitch/features/status/index.jsx on lines 363..369

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

      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