glitch-soc/mastodon

View on GitHub

Showing 4,633 of 4,633 total issues

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

  def follows
    return @follows if defined?(@follows)

    scope = Follow.where(account: @account)
    scope = scope.where.not(target_account_id: current_account.excluded_from_timeline_account_ids) if user_signed_in?
Severity: Minor
Found in app/controllers/following_accounts_controller.rb and 1 other location - About 35 mins to fix
app/controllers/follower_accounts_controller.rb on lines 36..41

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

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

  def follows
    return @follows if defined?(@follows)

    scope = Follow.where(target_account: @account)
    scope = scope.where.not(account_id: current_account.excluded_from_timeline_account_ids) if user_signed_in?
Severity: Minor
Found in app/controllers/follower_accounts_controller.rb and 1 other location - About 35 mins to fix
app/controllers/following_accounts_controller.rb on lines 39..44

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

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 interface ApiCustomEmojiJSON {
  shortcode: string;
  static_url: string;
  url: string;
  category?: string;
Severity: Minor
Found in app/javascript/mastodon/api_types/custom_emoji.ts and 1 other location - About 35 mins to fix
app/javascript/flavours/glitch/api_types/custom_emoji.ts on lines 2..8

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

Avoid too many return statements within this function.
Open

    return state.withMutations(map => {
      map.set('text', text);
      map.set('content_type', action.content_type || 'text/plain');
      map.set('in_reply_to', action.status.get('in_reply_to_id'));
      map.set('privacy', action.status.get('visibility'));
Severity: Major
Found in app/javascript/flavours/glitch/reducers/compose.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return value;
    Severity: Major
    Found in app/javascript/flavours/glitch/features/interaction_modal/index.jsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return state;
      Severity: Major
      Found in app/javascript/flavours/glitch/reducers/statuses.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return '';
        Severity: Major
        Found in app/javascript/flavours/glitch/features/interaction_modal/index.jsx - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return messages.follow;
          Severity: Major
          Found in app/javascript/mastodon/features/account/components/header.jsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return value;
            Severity: Major
            Found in app/javascript/mastodon/features/interaction_modal/index.jsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return state.set('id', null);
              Severity: Major
              Found in app/javascript/mastodon/reducers/compose.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return state;
                Severity: Major
                Found in app/javascript/mastodon/reducers/statuses.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return '';
                  Severity: Major
                  Found in app/javascript/mastodon/features/interaction_modal/index.jsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return state;
                    Severity: Major
                    Found in app/javascript/mastodon/reducers/compose.js - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                            return nil if discoveries > DISCOVERIES_PER_REQUEST
                      Severity: Major
                      Found in app/services/activitypub/fetch_remote_status_service.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                              return
                        Severity: Major
                        Found in app/services/resolve_account_service.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                              return @account if @account&.local? || gone_from_origin? || !webfinger_update_due?
                          Severity: Major
                          Found in app/services/resolve_account_service.rb - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                return actor unless verify_signature(actor, signature, compare_signed_string).nil?
                            Severity: Major
                            Found in app/controllers/concerns/signature_verification.rb - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                  return ActivityPub::TagManager.instance.uri_to_resource(object_uri, Status) if ActivityPub::TagManager.instance.local_uri?(object_uri)
                              Severity: Major
                              Found in app/services/activitypub/fetch_remote_status_service.rb - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                    return if actor.nil? || actor.suspended?
                                Severity: Major
                                Found in app/services/activitypub/fetch_remote_status_service.rb - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                        return !!should_filter
                                  Severity: Major
                                  Found in app/lib/feed_manager.rb - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language