mashirozx/mastodon

View on GitHub

Showing 720 of 1,785 total issues

Method make has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def make
      return File.open(@file.path) unless needs_convert?

      if options[:geometry]
        min_side = [@current_geometry.width, @current_geometry.height].min.to_i
Severity: Minor
Found in lib/paperclip/lazy_thumbnail.rb - About 35 mins 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 remove has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def remove(*domains)
      if domains.empty?
        say('No domain(s) given', :red)
        exit(1)
      end
Severity: Minor
Found in lib/mastodon/email_domain_blocks_cli.rb - About 35 mins 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 remove_statuses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_statuses
      return if options[:skip_status_remove]

      say('Creating temporary database indices...')

Severity: Minor
Found in lib/mastodon/statuses_cli.rb - About 35 mins 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 add_column_with_default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def add_column_with_default(table, column, type, default:, limit: nil, allow_null: false, &block)
      if transaction_open?
        raise 'add_column_with_default can not be run inside a transaction, ' \
          'you can disable transactions by calling disable_ddl_transaction! ' \
          'in the body of your migration class'
Severity: Minor
Found in lib/mastodon/migration_helpers.rb - About 35 mins 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 stoplight_wrap_request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def stoplight_wrap_request(domain, &block)
    if domain.present?
      Stoplight("source:#{domain}", &block)
        .with_fallback { nil }
        .with_threshold(1)
Severity: Minor
Found in app/workers/import/relationship_worker.rb - About 35 mins 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 perform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def perform(id)
    account = Account.find_by(id: id)
    return if account.nil? || account.local?

    ActivityPub::FetchRemoteAccountService.new.call(account.uri)
Severity: Minor
Found in app/workers/remote_account_refresh_worker.rb - About 35 mins 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 remove has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def remove(*addresses)
      if addresses.empty?
        say('No IP(s) given', :red)
        exit(1)
      end
Severity: Minor
Found in lib/mastodon/ip_blocks_cli.rb - About 35 mins 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 inboxes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

    @inboxes = [@status.mentions, @status.reblogs, @status.preloadable_poll.votes].flat_map do |relation|
      relation.includes(:account).map do |record|
Severity: Minor
Found in app/workers/activitypub/distribute_poll_update_worker.rb - About 35 mins 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 recount has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def recount(type)
      case type
      when 'accounts'
        processed, = parallelize_with_progress(Account.local.includes(:account_stat)) do |account|
          account_stat                 = account.account_stat
Severity: Minor
Found in lib/mastodon/cache_cli.rb - About 35 mins 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 add_timestamps_with_timezone has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def add_timestamps_with_timezone(table_name, **options)
      options[:null] = false if options[:null].nil?

      [:created_at, :updated_at].each do |column_name|
        if options[:default] && transaction_open?
Severity: Minor
Found in lib/mastodon/migration_helpers.rb - About 35 mins 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 carry_mutes_over! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def carry_mutes_over!
    @source_account.muted_by_relationships.where(account: Account.local).find_each do |mute|
      MuteService.new.call(mute.account, @target_account, notifications: mute.hide_notifications) unless mute.account.muting?(@target_account) || mute.account.following?(@target_account)
      add_account_note_if_needed!(mute.account, 'move_handler.carry_mutes_over_text')
    rescue => e
Severity: Minor
Found in app/workers/move_worker.rb - About 35 mins 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 carry_blocks_over! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def carry_blocks_over!
    @source_account.blocked_by_relationships.where(account: Account.local).find_each do |block|
      unless block.account.blocking?(@target_account) || block.account.following?(@target_account)
        BlockService.new.call(block.account, @target_account)
        add_account_note_if_needed!(block.account, 'move_handler.carry_blocks_over_text')
Severity: Minor
Found in app/workers/move_worker.rb - About 35 mins 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

Avoid too many return statements within this function.
Open

    return (
      <HotKeys handlers={handlers}>
        <div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility')}`, { 'status__wrapper-reply': !!status.get('in_reply_to_id'), unread, focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0} data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, status, rebloggedByText)} ref={this.handleRef}>
          {prepend}

Severity: Major
Found in app/javascript/mastodon/components/status.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return [sourceNumber, DECIMAL_UNITS.ONE, 0];
    Severity: Major
    Found in app/javascript/mastodon/utils/numbers.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/compose.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return;
        Severity: Major
        Found in streaming/index.js - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return unless supported_context?(@owner) && confirmed_owner?
          Severity: Major
          Found in app/services/activitypub/fetch_remote_key_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 !!should_filter
                Severity: Major
                Found in app/lib/feed_manager.rb - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language