maa123/mastodon

View on GitHub
app/javascript/mastodon/features/report/components/status_check_box.jsx

Summary

Maintainability
C
1 day
Test Coverage

Function render has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { status, checked, intl } = this.props;

    if (status.get('reblog')) {
      return null;

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

        const visibilityIconInfo = {
          'public': { icon: 'globe', text: intl.formatMessage(messages.public_short) },
          'unlisted': { icon: 'unlock', text: intl.formatMessage(messages.unlisted_short) },
          'private': { icon: 'lock', text: intl.formatMessage(messages.private_short) },
          'direct': { icon: 'at', text: intl.formatMessage(messages.direct_short) },
    app/javascript/mastodon/components/status.jsx on lines 539..544
    app/javascript/mastodon/features/status/components/detailed_status.jsx on lines 228..233
    app/javascript/mastodon/features/ui/components/boost_modal.jsx on lines 89..94

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

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

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

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

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

    Refactorings

    Further Reading

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

    const messages = defineMessages({
      public_short: { id: 'privacy.public.short', defaultMessage: 'Public' },
      unlisted_short: { id: 'privacy.unlisted.short', defaultMessage: 'Unlisted' },
      private_short: { id: 'privacy.private.short', defaultMessage: 'Followers only' },
      direct_short: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' },
    app/javascript/mastodon/actions/alerts.js on lines 3..8
    app/javascript/mastodon/components/admin/ReportReasonSelector.jsx on lines 10..15
    app/javascript/mastodon/components/column_header.jsx on lines 11..16
    app/javascript/mastodon/features/status/components/detailed_status.jsx on lines 27..32
    app/javascript/mastodon/features/ui/components/mute_modal.jsx on lines 15..20

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

    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

              <div className='detailed-status__display-avatar'>
                <Avatar account={status.get('account')} size={46} />
              </div>
    app/javascript/mastodon/features/ui/components/boost_modal.jsx on lines 109..111

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

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

                <DisplayName account={status.get('account')} /> ยท <span className='status__visibility-icon'><Icon id={visibilityIcon.icon} title={visibilityIcon.text} /></span> <RelativeTimestamp timestamp={status.get('created_at')} />
    app/javascript/mastodon/components/status.jsx on lines 562..562
    app/javascript/mastodon/features/ui/components/boost_modal.jsx on lines 104..104

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

    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