glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

Method remove_files has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def remove_files
    keys = []

    logger.debug { "Preparing to delete attachments for #{records.size} records" }

Severity: Major
Found in app/lib/attachment_batch.rb - About 2 hrs to fix

    Method crawl has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def crawl(start = nil)
          stats           = Concurrent::Hash.new
          processed       = Concurrent::AtomicFixnum.new(0)
          failed          = Concurrent::AtomicFixnum.new(0)
          start_at        = Time.now.to_f
    Severity: Major
    Found in lib/mastodon/cli/domains.rb - About 2 hrs to fix

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

      const messages = defineMessages({
        legal: { id: 'report.categories.legal', defaultMessage: 'Legal' },
        other: { id: 'report.categories.other', defaultMessage: 'Other' },
        spam: { id: 'report.categories.spam', defaultMessage: 'Spam' },
        violation: { id: 'report.categories.violation', defaultMessage: 'Content violates one or more server rules' },
      app/javascript/flavours/glitch/actions/alerts.js on lines 3..8
      app/javascript/flavours/glitch/components/admin/ReportReasonSelector.jsx on lines 10..15
      app/javascript/flavours/glitch/components/notification_purge_buttons.jsx on lines 19..24
      app/javascript/flavours/glitch/features/compose/components/secondary_privacy_button.jsx on lines 12..17
      app/javascript/mastodon/actions/alerts.js on lines 3..8
      app/javascript/mastodon/features/status/index.jsx on lines 75..80

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

      const messages = defineMessages({
        unexpectedTitle: { id: 'alert.unexpected.title', defaultMessage: 'Oops!' },
        unexpectedMessage: { id: 'alert.unexpected.message', defaultMessage: 'An unexpected error occurred.' },
        rateLimitedTitle: { id: 'alert.rate_limited.title', defaultMessage: 'Rate limited' },
        rateLimitedMessage: { id: 'alert.rate_limited.message', defaultMessage: 'Please retry after {retry_time, time, medium}.' },
      Severity: Major
      Found in app/javascript/mastodon/actions/alerts.js and 6 other locations - About 2 hrs to fix
      app/javascript/flavours/glitch/actions/alerts.js on lines 3..8
      app/javascript/flavours/glitch/components/admin/ReportReasonSelector.jsx on lines 10..15
      app/javascript/flavours/glitch/components/notification_purge_buttons.jsx on lines 19..24
      app/javascript/flavours/glitch/features/compose/components/secondary_privacy_button.jsx on lines 12..17
      app/javascript/mastodon/components/admin/ReportReasonSelector.jsx on lines 10..15
      app/javascript/mastodon/features/status/index.jsx on lines 75..80

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

      const messages = defineMessages({
        revealAll: { id: 'status.show_more_all', defaultMessage: 'Show more for all' },
        hideAll: { id: 'status.show_less_all', defaultMessage: 'Show less for all' },
        statusTitleWithAttachments: { id: 'status.title.with_attachments', defaultMessage: '{user} posted {attachmentCount, plural, one {an attachment} other {# attachments}}' },
        detailedStatus: { id: 'status.detailed_status', defaultMessage: 'Detailed conversation view' },
      Severity: Major
      Found in app/javascript/mastodon/features/status/index.jsx and 6 other locations - About 2 hrs to fix
      app/javascript/flavours/glitch/actions/alerts.js on lines 3..8
      app/javascript/flavours/glitch/components/admin/ReportReasonSelector.jsx on lines 10..15
      app/javascript/flavours/glitch/components/notification_purge_buttons.jsx on lines 19..24
      app/javascript/flavours/glitch/features/compose/components/secondary_privacy_button.jsx on lines 12..17
      app/javascript/mastodon/actions/alerts.js on lines 3..8
      app/javascript/mastodon/components/admin/ReportReasonSelector.jsx on lines 10..15

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

      const messages = defineMessages({
        btnAll : { id: 'notification_purge.btn_all', defaultMessage: 'Select\nall' },
        btnNone : { id: 'notification_purge.btn_none', defaultMessage: 'Select\nnone' },
        btnInvert : { id: 'notification_purge.btn_invert', defaultMessage: 'Invert\nselection' },
        btnApply : { id: 'notification_purge.btn_apply', defaultMessage: 'Clear\nselected' },
      app/javascript/flavours/glitch/actions/alerts.js on lines 3..8
      app/javascript/flavours/glitch/components/admin/ReportReasonSelector.jsx on lines 10..15
      app/javascript/flavours/glitch/features/compose/components/secondary_privacy_button.jsx on lines 12..17
      app/javascript/mastodon/actions/alerts.js on lines 3..8
      app/javascript/mastodon/components/admin/ReportReasonSelector.jsx on lines 10..15
      app/javascript/mastodon/features/status/index.jsx on lines 75..80

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

      const messages = defineMessages({
        legal: { id: 'report.categories.legal', defaultMessage: 'Legal' },
        other: { id: 'report.categories.other', defaultMessage: 'Other' },
        spam: { id: 'report.categories.spam', defaultMessage: 'Spam' },
        violation: { id: 'report.categories.violation', defaultMessage: 'Content violates one or more server rules' },
      app/javascript/flavours/glitch/actions/alerts.js on lines 3..8
      app/javascript/flavours/glitch/components/notification_purge_buttons.jsx on lines 19..24
      app/javascript/flavours/glitch/features/compose/components/secondary_privacy_button.jsx on lines 12..17
      app/javascript/mastodon/actions/alerts.js on lines 3..8
      app/javascript/mastodon/components/admin/ReportReasonSelector.jsx on lines 10..15
      app/javascript/mastodon/features/status/index.jsx on lines 75..80

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

      const messages = defineMessages({
        public: { id: 'privacy.public.short', defaultMessage: 'Public' },
        unlisted: { id: 'privacy.unlisted.short', defaultMessage: 'Quiet public' },
        private: { id: 'privacy.private.short', defaultMessage: 'Followers' },
        direct: { id: 'privacy.direct.short', defaultMessage: 'Specific people' },
      app/javascript/flavours/glitch/actions/alerts.js on lines 3..8
      app/javascript/flavours/glitch/components/admin/ReportReasonSelector.jsx on lines 10..15
      app/javascript/flavours/glitch/components/notification_purge_buttons.jsx on lines 19..24
      app/javascript/mastodon/actions/alerts.js on lines 3..8
      app/javascript/mastodon/components/admin/ReportReasonSelector.jsx on lines 10..15
      app/javascript/mastodon/features/status/index.jsx on lines 75..80

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

      const messages = defineMessages({
        unexpectedTitle: { id: 'alert.unexpected.title', defaultMessage: 'Oops!' },
        unexpectedMessage: { id: 'alert.unexpected.message', defaultMessage: 'An unexpected error occurred.' },
        rateLimitedTitle: { id: 'alert.rate_limited.title', defaultMessage: 'Rate limited' },
        rateLimitedMessage: { id: 'alert.rate_limited.message', defaultMessage: 'Please retry after {retry_time, time, medium}.' },
      Severity: Major
      Found in app/javascript/flavours/glitch/actions/alerts.js and 6 other locations - About 2 hrs to fix
      app/javascript/flavours/glitch/components/admin/ReportReasonSelector.jsx on lines 10..15
      app/javascript/flavours/glitch/components/notification_purge_buttons.jsx on lines 19..24
      app/javascript/flavours/glitch/features/compose/components/secondary_privacy_button.jsx on lines 12..17
      app/javascript/mastodon/actions/alerts.js on lines 3..8
      app/javascript/mastodon/components/admin/ReportReasonSelector.jsx on lines 10..15
      app/javascript/mastodon/features/status/index.jsx on lines 75..80

      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

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

          if (state.getIn([timeline, 'pendingItems'], ImmutableList()).includes(status.get('id')) || state.getIn([timeline, 'items'], ImmutableList()).includes(status.get('id'))) {
            return state;
          }
      Severity: Major
      Found in app/javascript/mastodon/reducers/timelines.js and 1 other location - About 2 hrs to fix
      app/javascript/flavours/glitch/reducers/timelines.js on lines 110..112

      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

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

      const notificationForScreenReader = (intl, message, timestamp) => {
        const output = [message];
      
        output.push(intl.formatDate(timestamp, { hour: '2-digit', minute: '2-digit', month: 'short', day: 'numeric' }));
      
      
      app/javascript/flavours/glitch/features/notifications/components/notification.jsx on lines 37..43

      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

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

        handleVolumeChange = () => {
          this.setState({ volume: this.video.volume, muted: this.video.muted });
          this._saveVolumeState(this.video.volume, this.video.muted);
        };
      Severity: Major
      Found in app/javascript/flavours/glitch/features/video/index.jsx and 1 other location - About 2 hrs to fix
      app/javascript/mastodon/features/video/index.jsx on lines 504..507

      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

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

      const notificationForScreenReader = (intl, message, timestamp) => {
        const output = [message];
      
        output.push(intl.formatDate(timestamp, { hour: '2-digit', minute: '2-digit', month: 'short', day: 'numeric' }));
      
      
      app/javascript/mastodon/features/notifications/components/notification.jsx on lines 47..53

      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

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

          if (state.getIn([timeline, 'pendingItems'], ImmutableList()).includes(status.get('id')) || state.getIn([timeline, 'items'], ImmutableList()).includes(status.get('id'))) {
            return state;
          }
      Severity: Major
      Found in app/javascript/flavours/glitch/reducers/timelines.js and 1 other location - About 2 hrs to fix
      app/javascript/mastodon/reducers/timelines.js on lines 110..112

      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

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

        handleVolumeChange = () => {
          this.setState({ volume: this.video.volume, muted: this.video.muted });
          this._saveVolumeState(this.video.volume, this.video.muted);
        };
      Severity: Major
      Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 2 hrs to fix
      app/javascript/flavours/glitch/features/video/index.jsx on lines 511..514

      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

      const mapStateToProps = state => ({
        isLoading: state.getIn(['search', 'isLoading']),
        results: state.getIn(['search', 'results']),
        q: state.getIn(['search', 'searchTerm']),
        submittedType: state.getIn(['search', 'type']),
      Severity: Major
      Found in app/javascript/flavours/glitch/features/explore/results.jsx and 1 other location - About 2 hrs to fix
      app/javascript/mastodon/features/explore/results.jsx on lines 28..33

      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

        it('renders a overlay avatar', () => {
          const component = renderer.create(<AvatarOverlay account={account} friend={friend} />);
          const tree      = component.toJSON();
      
          expect(tree).toMatchSnapshot();
      app/javascript/mastodon/components/__tests__/avatar-test.jsx on lines 28..33

      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

        state = {
          visible: this.props.visible !== undefined ? this.props.visible : (displayMedia !== 'hide_all' && !this.props.sensitive || displayMedia === 'show_all'),
          width: this.props.defaultWidth,
        };
      Severity: Major
      Found in app/javascript/flavours/glitch/components/media_gallery.jsx and 1 other location - About 2 hrs to fix
      app/javascript/mastodon/components/media_gallery.jsx on lines 218..221

      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

          it('renders a still avatar', () => {
            const component = renderer.create(<Avatar account={account} size={size} />);
            const tree      = component.toJSON();
      
            expect(tree).toMatchSnapshot();
      Severity: Major
      Found in app/javascript/mastodon/components/__tests__/avatar-test.jsx and 1 other location - About 2 hrs to fix
      app/javascript/mastodon/components/__tests__/avatar_overlay-test.jsx on lines 24..29

      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

        state = {
          visible: this.props.visible !== undefined ? this.props.visible : (displayMedia !== 'hide_all' && !this.props.sensitive || displayMedia === 'show_all'),
          width: this.props.defaultWidth,
        };
      Severity: Major
      Found in app/javascript/mastodon/components/media_gallery.jsx and 1 other location - About 2 hrs to fix
      app/javascript/flavours/glitch/components/media_gallery.jsx on lines 227..230

      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

      Severity
      Category
      Status
      Source
      Language