mashirozx/mastodon

View on GitHub

Showing 720 of 1,785 total issues

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

  render () {
    const { intl, hasUnread, columnId, multiColumn, hasAnnouncements, unreadAnnouncements, showAnnouncements } = this.props;
    const pinned = !!columnId;

    let announcementsButton = null;
Severity: Minor
Found in app/javascript/mastodon/features/home_timeline/index.js - About 1 hr to fix

    Method perform_query has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def perform_query
        sql = <<-SQL.squish
          SELECT axis.*, (
            WITH new_users AS (
              SELECT users.id
    Severity: Minor
    Found in app/lib/admin/metrics/retention.rb - About 1 hr to fix

      Method make has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def make
            depth = 8
      
            # Determine background palette by getting colors close to the image's edge only
            background_palette = palette_from_histogram(convert(':source -alpha set -gravity Center -region 75%x75% -fill None -colorize 100% -alpha transparent +region -format %c -colors :quantity -depth :depth histogram:info:', source: File.expand_path(@file.path), quantity: 10, depth: depth), 10)
      Severity: Minor
      Found in lib/paperclip/color_extractor.rb - About 1 hr to fix

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

          render () {
            const { locale, components } = this.props;
        
            return (
              <IntlProvider locale={locale} messages={messages}>
        Severity: Minor
        Found in app/javascript/mastodon/containers/media_container.js - About 1 hr to fix

          Method merge_with! has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def merge_with!(other_account)
                  # Since it's the same remote resource, the remote resource likely
                  # already believes we are following/blocking, so it's safe to
                  # re-attribute the relationships too. However, during the presence
                  # of the index bug users could have *also* followed the reference
          Severity: Minor
          Found in lib/mastodon/maintenance_cli.rb - About 1 hr to fix

            Method self_destruct has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def self_destruct
                  require 'tty-prompt'
            
                  prompt = TTY::Prompt.new
            
            
            Severity: Minor
            Found in lib/cli.rb - About 1 hr to fix

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

                render () {
                  const { alt, src, width, height, intl } = this.props;
                  const { scale, lockTranslate } = this.state;
                  const overflow = scale === MIN_SCALE ? 'hidden' : 'scroll';
                  const zoomButtonShouldHide = this.state.navigationHidden || this.props.zoomButtonHidden || this.state.zoomMatrix.rate <= MIN_SCALE ? 'media-modal__zoom-button--hidden' : '';
              Severity: Minor
              Found in app/javascript/mastodon/features/ui/components/zoomable_image.js - About 1 hr to fix

                Function timelines has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function timelines(state = initialState, action) {
                  switch(action.type) {
                  case TIMELINE_LOAD_PENDING:
                    return state.update(action.timeline, initialTimeline, map =>
                      map.update('items', list => map.get('pendingItems').concat(list.take(40))).set('pendingItems', ImmutableList()).set('unread', 0));
                Severity: Minor
                Found in app/javascript/mastodon/reducers/timelines.js - About 1 hr to fix

                  Function search has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function search(state = initialState, action) {
                    switch(action.type) {
                    case SEARCH_CHANGE:
                      return state.set('value', action.value);
                    case SEARCH_CLEAR:
                  Severity: Minor
                  Found in app/javascript/mastodon/reducers/search.js - About 1 hr to fix

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

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

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

                      render () {
                        const { status, intl, withOpenButton } = this.props;
                    
                        if (status === null) return null
                    
                    

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

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

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

                      def minimal_account_action_button(account)
                        if user_signed_in?
                          return if account.id == current_user.account_id
                    
                          if current_account.following?(account) || current_account.requested?(account)
                    Severity: Minor
                    Found in app/helpers/accounts_helper.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 render_with_cache has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def render_with_cache(**options)
                        raise ArgumentError, 'only JSON render calls are supported' unless options.key?(:json) || block_given?
                    
                        key        = options.delete(:key) || [[params[:controller], params[:action]].join('/'), options[:json].respond_to?(:cache_key) ? options[:json].cache_key : nil, options[:fields].nil? ? nil : options[:fields].join(',')].compact.join(':')
                        expires_in = options.delete(:expires_in) || 3.minutes
                    Severity: Minor
                    Found in app/controllers/concerns/cache_concern.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 ensure_unique_username has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def ensure_unique_username(auth)
                          username = auth.uid
                          auth_provided_username = nil
                          i        = 1
                          force_use_number_suffix = false
                    Severity: Minor
                    Found in app/models/concerns/omniauthable.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 call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def call(account, params, raise_error: false)
                        was_locked    = account.locked
                        update_method = raise_error ? :update! : :update
                    
                        account.send(update_method, params).tap do |ret|
                    Severity: Minor
                    Found in app/services/update_account_service.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 update_poll! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def update_poll!(allow_significant_changes: true)
                        previous_poll        = @status.preloadable_poll
                        @previous_expires_at = previous_poll&.expires_at
                        poll_parser          = ActivityPub::Parser::PollParser.new(@json)
                    
                    
                    Severity: Minor
                    Found in app/services/activitypub/process_status_update_service.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 update_emojis! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def update_emojis!
                        return if skip_download?
                    
                        @raw_emojis.each do |raw_emoji|
                          custom_emoji_parser = ActivityPub::Parser::CustomEmojiParser.new(raw_emoji)
                    Severity: Minor
                    Found in app/services/activitypub/process_status_update_service.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 blocked? has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def blocked?
                        blocked   = @recipient.suspended?
                        blocked ||= from_self? && @notification.type != :poll
                    
                        return blocked if message? && from_staff?
                    Severity: Minor
                    Found in app/services/notify_service.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 call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def call(status, **options)
                        @payload  = Oj.dump(event: :delete, payload: status.id.to_s)
                        @status   = status
                        @account  = status.account
                        @options  = options
                    Severity: Minor
                    Found in app/services/remove_status_service.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