mashirozx/mastodon

View on GitHub

Showing 720 of 1,785 total issues

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

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

    if (!accountIds) {
      return (
Severity: Minor
Found in app/javascript/mastodon/features/favourites/index.js - About 1 hr to fix

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

      render () {
        const { intl, accountIds, multiColumn } = this.props;
    
        if (!accountIds) {
          return (
    Severity: Minor
    Found in app/javascript/mastodon/features/reblogs/index.js - About 1 hr to fix

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

        render () {
          const { value, intl, disabled } = this.props;
          const { open, placement } = this.state;
      
          const valueOption = this.options.find(item => item.value === value);

        Method show has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def show
            respond_to do |format|
              format.html do
                expires_in 0, public: true unless user_signed_in?
        
        
        Severity: Minor
        Found in app/controllers/accounts_controller.rb - About 1 hr to fix

          Method update_media_attachments! has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def update_media_attachments!
              previous_media_attachments     = @status.media_attachments.to_a
              previous_media_attachments_ids = @status.ordered_media_attachment_ids || previous_media_attachments.map(&:id)
              next_media_attachments         = []
          
          
          Severity: Minor
          Found in app/services/activitypub/process_status_update_service.rb - About 1 hr to fix

            Method import! has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def import!
                # The idea is that instead of iterating over all statuses in the database
                # and calculating the searchable_by for each of them (majority of which
                # would be empty), we approach the index from the other end
            
            
            Severity: Minor
            Found in app/lib/importer/statuses_index_importer.rb - About 1 hr to fix

              Method process_attachments has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def process_attachments
                  return [] if @object['attachment'].nil?
              
                  media_attachments = []
              
              
              Severity: Minor
              Found in app/lib/activitypub/activity/create.rb - About 1 hr to fix

                Method upgrade_storage_filesystem has 29 lines of code (exceeds 25 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 1 hr to fix

                  Method rename_column_concurrently has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def rename_column_concurrently(table, old, new, type: nil)
                        if transaction_open?
                          raise 'rename_column_concurrently can not be run inside a transaction'
                        end
                  
                  
                  Severity: Minor
                  Found in lib/mastodon/migration_helpers.rb - About 1 hr to fix

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

                      render () {
                        const { emoji, emojiMap, hovered } = this.props;
                    
                        if (unicodeMapping[emoji]) {
                          const { filename, shortCode } = unicodeMapping[this.props.emoji];

                      Function relationships has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function relationships(state = initialState, action) {
                        switch(action.type) {
                        case ACCOUNT_FOLLOW_REQUEST:
                          return state.getIn([action.id, 'following']) ? state : state.setIn([action.id, action.locked ? 'requested' : 'following'], true);
                        case ACCOUNT_FOLLOW_FAIL:
                      Severity: Minor
                      Found in app/javascript/mastodon/reducers/relationships.js - About 1 hr to fix

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

                          render () {
                            const { intl, value, submitted } = this.props;
                            const { expanded } = this.state;
                            const hasValue = value.length > 0 || submitted;
                        
                        
                        Severity: Minor
                        Found in app/javascript/mastodon/features/compose/components/search.js - About 1 hr to fix

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

                            render () {
                              const { intl, hidden, report, account } = this.props;
                          
                              if (!report) {
                                return null;
                          Severity: Minor
                          Found in app/javascript/mastodon/features/notifications/components/report.js - About 1 hr to fix

                            Function _updateLinks has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _updateLinks () {
                                const node = this.node;
                            
                                if (!node) {
                                  return;

                              Method account_link_to has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def account_link_to(account, button = '', path: nil)
                                  content_tag(:div, class: 'account') do
                                    content_tag(:div, class: 'account__wrapper') do
                                      section = if account.nil?
                                                  content_tag(:div, class: 'account__display-name') do
                              Severity: Minor
                              Found in app/helpers/home_helper.rb - About 1 hr to fix

                                Method lookup has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def lookup(url)
                                      path = Addressable::URI.parse(url).path
                                
                                      path_segments = path.split('/')[2..-1]
                                      path_segments.delete('cache')
                                Severity: Minor
                                Found in lib/mastodon/media_cli.rb - About 1 hr to fix

                                  Method refresh has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def refresh(username = nil)
                                        dry_run = options[:dry_run] ? ' (DRY RUN)' : ''
                                  
                                        if options[:domain] || options[:all]
                                          scope  = Account.remote
                                  Severity: Minor
                                  Found in lib/mastodon/accounts_cli.rb - About 1 hr to fix

                                    Function render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      render () {
                                        const { announcement } = this.props;
                                        const { unread } = this.state;
                                        const startsAt = announcement.get('starts_at') && new Date(announcement.get('starts_at'));
                                        const endsAt = announcement.get('ends_at') && new Date(announcement.get('ends_at'));

                                    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 statuses_to_delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def statuses_to_delete(limit = 50, max_id = nil, min_id = nil)
                                        scope = account.statuses
                                        scope.merge!(old_enough_scope(max_id))
                                        scope = scope.where(Status.arel_table[:id].gteq(min_id)) if min_id.present?
                                        scope.merge!(without_popular_scope) unless min_favs.nil? && min_reblogs.nil?
                                    Severity: Minor
                                    Found in app/models/account_statuses_cleanup_policy.rb - About 1 hr 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 show? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def show?
                                        return false if author.suspended? || local_only? && (current_account.nil? || !current_account.local?)
                                    
                                        if requires_mention?
                                          owned? || mention_exists?
                                    Severity: Minor
                                    Found in app/policies/status_policy.rb - About 1 hr 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language