steem-third-party/ganymede

View on GitHub

Showing 231 of 231 total issues

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 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

Cyclomatic complexity for accounts_last_bandwidth_updated is too high. [9/6]
Open

  def accounts_last_bandwidth_updated
    @days = (params[:days] || '14.0').to_f
    @segments = params[:segments] || 'default'
    @average = 0
    @style = params[:style] || 'default'

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for accounts_created is too high. [9/6]
Open

  def accounts_created
    @days = (params[:days] || '14.0').to_f
    @segments = params[:segments] || 'default'
    @average = 0
    @style = params[:style] || 'default'

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method has too many lines. [33/30]
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'

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for other_promoted is too high. [9/6]
Open

  def other_promoted
    @limit = @limit.to_i

    response = api_execute(:get_account_history, 'null', -@limit, @limit)
    history = response.result

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for index is too high. [8/6]
Open

  def index
    init_params
    @oldest_vote = nil
    
    voting if @voting == 'true'

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for capture_chart is too high. [8/6]
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}"
  

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for query is too high. [8/6]
Open

  def query(options = {})
    tag = options[:tag]
    min_reputation = options[:min_reputation].presence || 25
    only_posts = options[:only_posts].presence || true
    exclude_tags = options[:exclude_tags].presence || ''
Severity: Minor
Found in app/jobs/find_mentions_job.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method has too many lines. [32/30]
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

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for query is too high. [8/6]
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 by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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 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

      Cyclomatic complexity for vote_ready is too high. [7/6]
      Open

        def vote_ready
          options = {
            limit: 100
          }
      
      

      This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

      An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

      Cyclomatic complexity for query is too high. [7/6]
      Open

        def query(options = {})
          options[:limit] ||= 100
          tag = options[:tag]
          flagged_by = options.delete(:flagged_by) || []
          by_trending = discussions_by_trending(options)

      This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

      An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

      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
            Severity
            Category
            Status
            Source
            Language