glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

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

      if (image.get('type') === 'image') {
        return (
          <ImageLoader
            previewSrc={image.get('preview_url')}
            src={image.get('url')}
app/javascript/flavours/glitch/features/ui/components/media_modal.jsx on lines 153..200

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

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

Function userLists has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function userLists(state = initialState, action) {
  switch(action.type) {
  case FOLLOWERS_FETCH_SUCCESS:
    return normalizeList(state, ['followers', action.id], action.accounts, action.next);
  case FOLLOWERS_EXPAND_SUCCESS:
Severity: Major
Found in app/javascript/flavours/glitch/reducers/user_lists.js - About 3 hrs to fix

    Function userLists has 96 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function userLists(state = initialState, action) {
      switch(action.type) {
      case FOLLOWERS_FETCH_SUCCESS:
        return normalizeList(state, ['followers', action.id], action.accounts, action.next);
      case FOLLOWERS_EXPAND_SUCCESS:
    Severity: Major
    Found in app/javascript/mastodon/reducers/user_lists.js - About 3 hrs to fix

      Status has 31 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Status extends ImmutablePureComponent {
      
        static contextType = SensitiveMediaContext;
      
        static propTypes = {
      Severity: Minor
      Found in app/javascript/mastodon/components/status.jsx - About 3 hrs to fix

        Class NoteSerializer has 31 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class ActivityPub::NoteSerializer < ActivityPub::Serializer
          include FormattingHelper
        
          context_extensions :atom_uri, :conversation, :sensitive, :voters_count, :direct_message
        
        
        Severity: Minor
        Found in app/serializers/activitypub/note_serializer.rb - About 3 hrs to fix

          File status_action_bar.jsx has 326 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 3 hrs to fix

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

              render () {
                const { multiColumn, intl, server, extendedDescription, domainBlocks } = this.props;
                const isLoading = server.get('isLoading');
            
                return (
            Severity: Major
            Found in app/javascript/flavours/glitch/features/about/index.jsx - About 3 hrs to fix

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

              export const navigateToStatus = (statusId) => {
                return (_dispatch, getState) => {
                  const state = getState();
                  const accountId = state.statuses.getIn([statusId, 'account']);
                  const acct = state.accounts.getIn([accountId, 'acct']);
              Severity: Major
              Found in app/javascript/flavours/glitch/actions/statuses.js and 1 other location - About 3 hrs to fix
              app/javascript/mastodon/actions/statuses.js on lines 371..381

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

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

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

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

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

              Refactorings

              Further Reading

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

              export const navigateToStatus = (statusId) => {
                return (_dispatch, getState) => {
                  const state = getState();
                  const accountId = state.statuses.getIn([statusId, 'account']);
                  const acct = state.accounts.getIn([accountId, 'acct']);
              Severity: Major
              Found in app/javascript/mastodon/actions/statuses.js and 1 other location - About 3 hrs to fix
              app/javascript/flavours/glitch/actions/statuses.js on lines 372..382

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

              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 (status.get('reblogged')) {
                    reblogTitle = intl.formatMessage(messages.cancel_reblog_private);
                  } else if (publicStatus) {
                    reblogTitle = intl.formatMessage(messages.reblog);
                  } else if (reblogPrivate) {
              app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx on lines 166..174

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

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

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

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

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

              Refactorings

              Further Reading

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

                case COMPOSE_UPLOAD_CHANGE_SUCCESS:
                  return state
                    .set('is_changing_upload', false)
                    .setIn(['media_modal', 'dirty'], false)
                    .update('media_attachments', list => list.map(item => {
              Severity: Major
              Found in app/javascript/mastodon/reducers/compose.js and 1 other location - About 3 hrs to fix
              app/javascript/flavours/glitch/reducers/compose.js on lines 565..575

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

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

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

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

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

              Refactorings

              Further Reading

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

              export default function tags(state = initialState, action) {
                switch(action.type) {
                case HASHTAG_FETCH_SUCCESS:
                  return state.set(action.name, fromJS(action.tag));
                case HASHTAG_FOLLOW_REQUEST:
              Severity: Major
              Found in app/javascript/mastodon/reducers/tags.js and 1 other location - About 3 hrs to fix
              app/javascript/flavours/glitch/reducers/tags.js on lines 13..26

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

              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 (status.get('reblogged')) {
                    reblogTitle = intl.formatMessage(messages.cancel_reblog_private);
                  } else if (publicStatus) {
                    reblogTitle = intl.formatMessage(messages.reblog);
                  } else if (reblogPrivate) {
              app/javascript/mastodon/features/picture_in_picture/components/footer.jsx on lines 164..172

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

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

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

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

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

              Refactorings

              Further Reading

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

                case COMPOSE_UPLOAD_CHANGE_SUCCESS:
                  return state
                    .set('is_changing_upload', false)
                    .setIn(['media_modal', 'dirty'], false)
                    .update('media_attachments', list => list.map(item => {
              Severity: Major
              Found in app/javascript/flavours/glitch/reducers/compose.js and 1 other location - About 3 hrs to fix
              app/javascript/mastodon/reducers/compose.js on lines 460..470

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

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

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

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

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

              Refactorings

              Further Reading

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

              export default function tags(state = initialState, action) {
                switch(action.type) {
                case HASHTAG_FETCH_SUCCESS:
                  return state.set(action.name, fromJS(action.tag));
                case HASHTAG_FOLLOW_REQUEST:
              Severity: Major
              Found in app/javascript/flavours/glitch/reducers/tags.js and 1 other location - About 3 hrs to fix
              app/javascript/mastodon/reducers/tags.js on lines 13..26

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

              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 prependBanner = feedType === 'community' ? (
                  <DismissableBanner id='community_timeline'>
                    <FormattedMessage
                      id='dismissable_banner.community_timeline'
                      defaultMessage='These are the most recent public posts from people whose accounts are hosted by {domain}.'
              Severity: Major
              Found in app/javascript/flavours/glitch/features/firehose/index.jsx and 1 other location - About 3 hrs to fix
              app/javascript/mastodon/features/firehose/index.jsx on lines 124..140

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

              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 = {
                  width: this.props.width,
                  currentTime: 0,
                  buffer: 0,
                  duration: null,
              Severity: Major
              Found in app/javascript/flavours/glitch/features/audio/index.jsx and 1 other location - About 3 hrs to fix
              app/javascript/mastodon/features/audio/index.jsx on lines 66..76

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

              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 = {
                  width: this.props.width,
                  currentTime: 0,
                  buffer: 0,
                  duration: null,
              Severity: Major
              Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 3 hrs to fix
              app/javascript/flavours/glitch/features/audio/index.jsx on lines 66..76

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

              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 prependBanner = feedType === 'community' ? (
                  <DismissableBanner id='community_timeline'>
                    <FormattedMessage
                      id='dismissable_banner.community_timeline'
                      defaultMessage='These are the most recent public posts from people whose accounts are hosted by {domain}.'
              Severity: Major
              Found in app/javascript/mastodon/features/firehose/index.jsx and 1 other location - About 3 hrs to fix
              app/javascript/flavours/glitch/features/firehose/index.jsx on lines 150..166

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

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

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

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

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

              Refactorings

              Further Reading

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

              export async function apiRequest<ApiResponse = unknown>(
                method: Method,
                url: string,
                args: {
                  params?: RequestParamsOrData;
              Severity: Major
              Found in app/javascript/mastodon/api.ts and 1 other location - About 3 hrs to fix
              app/javascript/flavours/glitch/api.ts on lines 64..79

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

              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