glitch-soc/mastodon

View on GitHub
app/javascript/mastodon/components/status_action_bar.jsx

Summary

Maintainability
F
1 wk
Test Coverage

Function render has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
Open

  render () {
    const { status, relationship, intl, withDismiss, withCounters, scrollKey } = this.props;
    const { signedIn, permissions } = this.context.identity;

    const publicStatus       = ['public', 'unlisted'].includes(status.get('visibility'));
Severity: Minor
Found in app/javascript/mastodon/components/status_action_bar.jsx - About 1 day 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 render has 126 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { status, relationship, intl, withDismiss, withCounters, scrollKey } = this.props;
    const { signedIn, permissions } = this.context.identity;

    const publicStatus       = ['public', 'unlisted'].includes(status.get('visibility'));
Severity: Major
Found in app/javascript/mastodon/components/status_action_bar.jsx - About 5 hrs to fix

    File status_action_bar.jsx has 336 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import PropTypes from 'prop-types';
    
    import { defineMessages, injectIntl } from 'react-intl';
    
    import classNames from 'classnames';
    Severity: Minor
    Found in app/javascript/mastodon/components/status_action_bar.jsx - About 4 hrs to fix

      StatusActionBar has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class StatusActionBar extends ImmutablePureComponent {
      
        static contextTypes = {
          identity: PropTypes.object,
        };
      Severity: Minor
      Found in app/javascript/mastodon/components/status_action_bar.jsx - About 2 hrs to fix

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

                if (account.get('acct') !== account.get('username')) {
                  const domain = account.get('acct').split('@')[1];
        
                  menu.push(null);
        
        
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 7 hrs to fix
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 258..268

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 183.

        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

            if (status.get('reblogged')) {
              reblogTitle = intl.formatMessage(messages.cancel_reblog_private);
              reblogIconComponent = publicStatus ? RepeatActiveIcon : RepeatPrivateActiveIcon;
            } else if (publicStatus) {
              reblogTitle = intl.formatMessage(messages.reblog);
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 3 other locations - About 5 hrs to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 306..318
        app/javascript/flavours/glitch/features/status/components/action_bar.jsx on lines 238..250
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 299..311

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

        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

                if (relationship && relationship.get('muting')) {
                  menu.push({ text: intl.formatMessage(messages.unmute, { name: account.get('username') }), action: this.handleMuteClick });
                } else {
                  menu.push({ text: intl.formatMessage(messages.mute, { name: account.get('username') }), action: this.handleMuteClick, dangerous: true });
                }
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 3 other locations - About 4 hrs to fix
        app/javascript/mastodon/components/status_action_bar.jsx on lines 311..315
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 244..248
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 250..254

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

        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

                if (relationship && relationship.get('blocking')) {
                  menu.push({ text: intl.formatMessage(messages.unblock, { name: account.get('username') }), action: this.handleBlockClick });
                } else {
                  menu.push({ text: intl.formatMessage(messages.block, { name: account.get('username') }), action: this.handleBlockClick, dangerous: true });
                }
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 3 other locations - About 4 hrs to fix
        app/javascript/mastodon/components/status_action_bar.jsx on lines 305..309
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 244..248
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 250..254

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

        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 (writtenByMe) {
                menu.push({ text: intl.formatMessage(messages.edit), action: this.handleEditClick });
                menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick, dangerous: true });
                menu.push({ text: intl.formatMessage(messages.redraft), action: this.handleRedraftClick, dangerous: true });
              } else {
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 4 hrs to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 256..289

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

        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

                <IconButton className='status__action-bar__button star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' iconComponent={status.get('favourited') ? StarIcon : StarBorderIcon} onClick={this.handleFavouriteClick} counter={withCounters ? status.get('favourites_count') : undefined} />
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 336..336

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 107.

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

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

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

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

        Refactorings

        Further Reading

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

          handleReplyClick = () => {
            const { signedIn } = this.context.identity;
        
            if (signedIn) {
              this.props.onReply(this.props.status, this.props.history);
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 110..118

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 98.

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

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

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

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

        Refactorings

        Further Reading

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

                  if (isRemote && (permissions & PERMISSION_MANAGE_FEDERATION) === PERMISSION_MANAGE_FEDERATION) {
                    const domain = account.get('acct').split('@')[1];
                    menu.push({ text: intl.formatMessage(messages.admin_domain, { domain: domain }), href: `/admin/instances/${domain}` });
                  }
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 3 hrs to fix
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 276..279

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 96.

        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 197..206
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 136..145
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 147..156

        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')) {
        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 186..195
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 136..145
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 147..156

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

          handleReblogClick = e => {
            const { signedIn } = this.context.identity;
        
            if (signedIn) {
              this.props.onReblog(this.props.status, e);
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 2 other locations - About 2 hrs to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 126..134
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 136..144

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

        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

            if (status.get('in_reply_to_id', null) === null) {
              replyIcon = 'reply';
              replyIconComponent = ReplyIcon;
              replyTitle = intl.formatMessage(messages.reply);
            } else {
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 3 other locations - About 2 hrs to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 292..300
        app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx on lines 181..189
        app/javascript/mastodon/features/picture_in_picture/components/footer.jsx on lines 179..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 90.

        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

          handleOpen = () => {
            this.props.history.push(`/@${this.props.status.getIn(['account', 'acct'])}/${this.props.status.get('id')}`);
          };
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 182..184

        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

          handleUnblockDomain = () => {
            const { status, onUnblockDomain } = this.props;
            const account = status.get('account');
        
            onUnblockDomain(account.get('acct').split('@')[1]);
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 1 hr to fix
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 165..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 74.

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

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

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

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

        Refactorings

        Further Reading

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

            const filterButton = this.props.onFilter && (
              <IconButton className='status__action-bar__button' title={intl.formatMessage(messages.hide)} icon='eye' iconComponent={VisibilityIcon} onClick={this.handleHideClick} />
            );
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 320..322

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

        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 (writtenByMe || withDismiss) {
                menu.push({ text: intl.formatMessage(mutingConversation ? messages.unmuteConversation : messages.muteConversation), action: this.handleConversationMuteClick });
                menu.push(null);
              }
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 251..254

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

        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

                    menu.push({ text: intl.formatMessage(messages.admin_status), href: `/admin/accounts/${status.getIn(['account', 'id'])}/statuses/${status.get('id')}` });
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 1 hr to fix
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 274..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 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 4 locations. Consider refactoring.
        Open

            if (publicStatus && (signedIn || !isRemote)) {
              menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
            }
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 3 other locations - About 1 hr to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 239..241
        app/javascript/flavours/glitch/features/status/components/action_bar.jsx on lines 180..182
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 222..224

        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

          handleBlockDomain = () => {
            const { status, onBlockDomain } = this.props;
            const account = status.get('account');
        
            onBlockDomain(account);
        Severity: Minor
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 55 mins to fix
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 158..163

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

            if (publicStatus && isRemote) {
              menu.push({ text: intl.formatMessage(messages.openOriginalPage), href: status.get('url') });
            }
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 3 other locations - About 55 mins to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 229..231
        app/javascript/flavours/glitch/features/status/components/action_bar.jsx on lines 170..172
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 212..214

        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

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

            if (publicStatus && 'share' in navigator) {
              menu.push({ text: intl.formatMessage(messages.share), action: this.handleShareClick });
            }
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 3 other locations - About 55 mins to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 235..237
        app/javascript/flavours/glitch/features/status/components/action_bar.jsx on lines 176..178
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 218..220

        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

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

          handleMentionClick = () => {
            this.props.onMention(this.props.status.get('account'), this.props.history);
          };
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 7 other locations - About 45 mins to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 166..168
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 170..172
        app/javascript/flavours/glitch/features/status/components/action_bar.jsx on lines 115..117
        app/javascript/flavours/glitch/features/status/components/action_bar.jsx on lines 119..121
        app/javascript/mastodon/components/status_action_bar.jsx on lines 182..184
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 128..130
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 132..134

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

          handleDirectClick = () => {
            this.props.onDirect(this.props.status.get('account'), this.props.history);
          };
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 7 other locations - About 45 mins to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 166..168
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 170..172
        app/javascript/flavours/glitch/features/status/components/action_bar.jsx on lines 115..117
        app/javascript/flavours/glitch/features/status/components/action_bar.jsx on lines 119..121
        app/javascript/mastodon/components/status_action_bar.jsx on lines 178..180
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 128..130
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 132..134

        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

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

          handleCopy = () => {
            const url = this.props.status.get('url');
            navigator.clipboard.writeText(url);
          };
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 3 other locations - About 40 mins to fix
        app/javascript/flavours/glitch/components/status_action_bar.jsx on lines 198..201
        app/javascript/flavours/glitch/features/status/components/action_bar.jsx on lines 153..156
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 194..197

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 48.

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

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

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

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

        Refactorings

        Further Reading

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

        const mapStateToProps = (state, { status }) => ({
          relationship: state.getIn(['relationships', status.getIn(['account', 'id'])]),
        });
        Severity: Minor
        Found in app/javascript/mastodon/components/status_action_bar.jsx and 1 other location - About 35 mins to fix
        app/javascript/mastodon/features/status/components/action_bar.jsx on lines 65..67

        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