mashirozx/mastodon

View on GitHub

Showing 720 of 1,785 total issues

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

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

    let actionBtn;

Severity: Major
Found in app/javascript/mastodon/features/directory/components/account_card.js - About 2 hrs to fix

    File feed_manager.rb has 289 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'singleton'
    
    class FeedManager
      include Singleton
      include Redisable
    Severity: Minor
    Found in app/lib/feed_manager.rb - About 2 hrs to fix

      Function userLists has 73 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 2 hrs to fix

        Method cull has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def cull(*domains)
              skip_threshold = 7.days.ago
              dry_run        = options[:dry_run] ? ' (DRY RUN)' : ''
              skip_domains   = Concurrent::Set.new
        
        
        Severity: Minor
        Found in lib/mastodon/accounts_cli.rb - About 2 hrs 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

        Method cleanup_concurrent_column_type_change has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def cleanup_concurrent_column_type_change(table, column)
              temp_column = rename_column_name(column)
        
              # Wait for the indices to be built
              indexes_for(table, column).each do |index|
        Severity: Major
        Found in lib/mastodon/migration_helpers.rb - About 2 hrs to fix

          File card.js has 286 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React from 'react';
          import PropTypes from 'prop-types';
          import Immutable from 'immutable';
          import ImmutablePropTypes from 'react-immutable-proptypes';
          import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
          Severity: Minor
          Found in app/javascript/mastodon/features/status/components/card.js - About 2 hrs to fix

            File statuses.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import api from '../api';
            
            import { deleteFromTimelines } from './timelines';
            import { importFetchedStatus, importFetchedStatuses, importFetchedAccount } from './importer';
            import { ensureComposeIsVisible, setComposeToStatus } from './compose';
            Severity: Minor
            Found in app/javascript/mastodon/actions/statuses.js - About 2 hrs to fix

              File media_attachment.rb has 285 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class MediaAttachment < ApplicationRecord
                self.inheritance_column = nil
              
                include Attachmentable
              
              
              Severity: Minor
              Found in app/models/media_attachment.rb - About 2 hrs to fix

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

                export default @connect(mapStateToProps)
                @injectIntl
                class StatusActionBar extends ImmutablePureComponent {
                
                  static contextTypes = {
                Severity: Minor
                Found in app/javascript/mastodon/components/status_action_bar.js - About 2 hrs to fix

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

                    render () {
                      const style = {
                        fontSize: `${this.props.size}px`,
                        width: `${this.props.size * 1.28571429}px`,
                        height: `${this.props.size * 1.28571429}px`,
                  Severity: Major
                  Found in app/javascript/mastodon/components/icon_button.js - About 2 hrs to fix

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

                      render () {
                        const { intl, myAccount, columns, multiColumn, unreadFollowRequests } = this.props;
                    
                        const navItems = [];
                        let height = (multiColumn) ? 0 : 60;
                    Severity: Major
                    Found in app/javascript/mastodon/features/getting_started/index.js - About 2 hrs to fix

                      Function normalizeWheel has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const normalizeWheel = event => {
                        // Reasonable defaults
                        const PIXEL_STEP = 10;
                        const LINE_HEIGHT = 40;
                        const PAGE_HEIGHT = 800;
                      Severity: Minor
                      Found in app/javascript/mastodon/features/ui/components/zoomable_image.js - About 2 hrs 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

                      Method call has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def call(uri, id: true, prefetched_body: nil, break_on_redirect: false, only_key: false)
                          return if domain_not_allowed?(uri)
                          return ActivityPub::TagManager.instance.uri_to_resource(uri, Account) if ActivityPub::TagManager.instance.local_uri?(uri)
                      
                          @json = begin
                      Severity: Minor
                      Found in app/services/activitypub/fetch_remote_account_service.rb - About 2 hrs 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

                      Method call has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def call(uri, options = {})
                          return if uri.blank?
                      
                          process_options!(uri, options)
                      
                      
                      Severity: Minor
                      Found in app/services/resolve_account_service.rb - About 2 hrs 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

                      Method call has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def call(uri, id: true, prefetched_body: nil)
                          return if uri.blank?
                      
                          if prefetched_body.nil?
                            if id
                      Severity: Minor
                      Found in app/services/activitypub/fetch_remote_key_service.rb - About 2 hrs 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

                      Method initialize has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def initialize(path, max_frames = 2)
                          @path      = path
                          @nb_frames = 0
                      
                          File.open(path, 'rb') do |s|
                      Severity: Minor
                      Found in lib/paperclip/gif_transcoder.rb - About 2 hrs 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

                      Method upgrade_storage_filesystem has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def upgrade_storage_filesystem(progress, attachment, style)
                            previous_storage_schema_version = attachment.storage_schema_version
                            previous_path                   = attachment.path(style)
                            success                         = true
                      
                      
                      Severity: Minor
                      Found in lib/mastodon/upgrade_cli.rb - About 2 hrs 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 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        render () {
                          const { accounts, lastStatus, unread, scrollKey, intl } = this.props;
                      
                          if (lastStatus === null) {
                            return null;

                        Method update_column_in_batches has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def update_column_in_batches(table_name, column, value)
                              if transaction_open?
                                raise 'update_column_in_batches can not be run inside a transaction, ' \
                                  'you can disable transactions by calling disable_ddl_transaction! ' \
                                  'in the body of your migration class'
                        Severity: Major
                        Found in lib/mastodon/migration_helpers.rb - About 2 hrs to fix

                          Class RegistrationsController has 24 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Auth::RegistrationsController < Devise::RegistrationsController
                            include RegistrationSpamConcern
                          
                            layout :determine_layout
                          
                          
                          Severity: Minor
                          Found in app/controllers/auth/registrations_controller.rb - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language