steem-third-party/ganymede

View on GitHub

Showing 38 of 231 total issues

Method other_promoted has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def other_promoted
    @limit = @limit.to_i

    response = api_execute(:get_account_history, 'null', -@limit, @limit)
    history = response.result
Severity: Minor
Found in app/controllers/discussions_controller.rb - About 3 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

File accounts_controller.rb has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'open-uri'
require 'json'

class AccountsController < ApplicationController
  before_action :prune_account_votes_cache
Severity: Minor
Found in app/controllers/accounts_controller.rb - About 2 hrs to fix

    Class AccountsController has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class AccountsController < ApplicationController
      before_action :prune_account_votes_cache
      helper_method :suggested_voters, :votes_today, :accounts
      
      def index
    Severity: Minor
    Found in app/controllers/accounts_controller.rb - About 2 hrs to fix

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

        def index
          @request_at = Time.now
          @activity_after = Time.parse(params[:activity_after].presence || '1970-01-01T00:00:00Z')
          @activity_before = Time.parse(params[:activity_before].presence || @request_at.to_s)
          @op = params[:op].presence || nil
      Severity: Minor
      Found in app/controllers/follows_controller.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 query has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        def query(options = {})
          data_labels = %w(
            author_reputation percent_steem_dollars promoted category net_votes
            total_pending_payout_value
          )
      Severity: Minor
      Found in app/jobs/find_predicted_job.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 query has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def query(options = {})
          options[:limit] ||= 100
          tag = options[:tag]
          flagged_by = options.delete(:flagged_by) || []
          by_trending = discussions_by_trending(options)
      Severity: Minor
      Found in app/jobs/find_trending_flagged_job.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 query has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def query(options = {})
          data_labels = %w(
            author_reputation percent_steem_dollars promoted category net_votes
            total_pending_payout_value
          )
      Severity: Major
      Found in app/jobs/find_predicted_job.rb - About 2 hrs to fix

        Method query has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def query(options = {})
            options[:limit] ||= 100
            tag = options[:tag]
            by_cashout = discussions_by_cashout(tag, options)
        
        
        Severity: Minor
        Found in app/jobs/find_flagwar_job.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 vote_ready has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def vote_ready
            options = {
              limit: 100
            }
        
        
        Severity: Minor
        Found in app/controllers/discussions_controller.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 query has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def query(options = {})
            options[:limit] ||= 100
            tag = options[:tag]
            min_reputation = options[:min_reputation].presence || 25
            exclude_tags = options[:exclude_tags].presence || ''
        Severity: Minor
        Found in app/jobs/find_first_post_job.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 index has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def index
            @request_at = Time.now
            @activity_after = Time.parse(params[:activity_after].presence || '1970-01-01T00:00:00Z')
            @activity_before = Time.parse(params[:activity_before].presence || @request_at.to_s)
            @op = params[:op].presence || nil
        Severity: Minor
        Found in app/controllers/follows_controller.rb - About 1 hr to fix

          Method other_promoted has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def other_promoted
              @limit = @limit.to_i
          
              response = api_execute(:get_account_history, 'null', -@limit, @limit)
              history = response.result
          Severity: Minor
          Found in app/controllers/discussions_controller.rb - About 1 hr to fix

            Method net_transfers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def net_transfers
                @compare_to = params[:compare_to]
                @account_name = params[:account_name]
                @days = (params[:days] || '14.0').to_f
                @symbol = params[:symbol] || default_debt_asset
            Severity: Minor
            Found in app/controllers/charts_controller.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 capture_chart has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def capture_chart(pair)
                fmt = params[:format]
                base_href = "https://www.worldcoinindex.com"
                btc_usd = "#{base_href}/widget/renderWidget?size=large&from=BTC&to=usd&clearstyle=true&ms5=#{md5_title}"
              
            Severity: Minor
            Found in app/controllers/tickers_controller.rb - About 1 hr to fix

              Method index has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def index
                  @other_promoted = params[:other_promoted].presence || 'false'
                  @predicted = params[:predicted].presence || 'false'
                  @trending_flagged = params[:trending_flagged].presence || 'false'
                  @trending_by_reputation = params[:trending_by_reputation].presence || 'false'
              Severity: Minor
              Found in app/controllers/discussions_controller.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 index has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def index
                  @other_promoted = params[:other_promoted].presence || 'false'
                  @predicted = params[:predicted].presence || 'false'
                  @trending_flagged = params[:trending_flagged].presence || 'false'
                  @trending_by_reputation = params[:trending_by_reputation].presence || 'false'
              Severity: Minor
              Found in app/controllers/discussions_controller.rb - About 1 hr to fix

                Method net_transfers has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def net_transfers
                    @compare_to = params[:compare_to]
                    @account_name = params[:account_name]
                    @days = (params[:days] || '14.0').to_f
                    @symbol = params[:symbol] || default_debt_asset
                Severity: Minor
                Found in app/controllers/charts_controller.rb - About 1 hr to fix

                  Method discussions_by_cashout has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def discussions_by_cashout(tag, options = {})
                      by_cashout = []
                      
                      if !!tag
                        response = api_execute(:get_discussions_by_cashout, options)
                  Severity: Minor
                  Found in app/jobs/find_flagwar_job.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 accounts_created has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def accounts_created
                      @days = (params[:days] || '14.0').to_f
                      @segments = params[:segments] || 'default'
                      @average = 0
                      @style = params[:style] || 'default'
                  Severity: Minor
                  Found in app/controllers/charts_controller.rb - About 45 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 capture_chart has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def capture_chart(pair)
                      fmt = params[:format]
                      base_href = "https://www.worldcoinindex.com"
                      btc_usd = "#{base_href}/widget/renderWidget?size=large&from=BTC&to=usd&clearstyle=true&ms5=#{md5_title}"
                    
                  Severity: Minor
                  Found in app/controllers/tickers_controller.rb - About 45 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

                  Severity
                  Category
                  Status
                  Source
                  Language