steem-third-party/ganymede

View on GitHub

Showing 38 of 231 total issues

Method accounts_last_bandwidth_updated has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def accounts_last_bandwidth_updated
    @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 fetch_voters has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def fetch_voters
    if @upvoted == 'true'
      json = AccountsController.rshares_json(rshares_json_url)
      
      if json.any?
Severity: Minor
Found in app/controllers/accounts_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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    init_params
    @oldest_vote = nil
    
    voting if @voting == 'true'
Severity: Minor
Found in app/controllers/accounts_controller.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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    @account = params[:account].presence || nil
    @transfers = []
    
    if !!@account
Severity: Minor
Found in app/controllers/transfers_controller.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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    @transaction_type = params[:transaction_type]
    
    case @transaction_type
    when 'transfer'
Severity: Minor
Found in app/controllers/blocks_controller.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 transfers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def transfers(account)
    ret_val = ""
    exchanges = %w(bittrex poloniex openledger blocktrades)
    
    if account.nil? || account == ''
Severity: Minor
Found in app/controllers/accounts_controller.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 powerups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def powerups(account)
    ret_val = ""
    if account.nil? || account == ''
      ret_val = 'Account name required.'
      return
Severity: Minor
Found in app/controllers/accounts_controller.rb - About 25 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 trending_by_reputation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def trending_by_reputation
    response = api_execute(:get_discussions_by_trending, limit: 100)
    
    @discussions += response.result.map do |comment|
      next if (author_reputation = to_rep(comment.author_reputation)) > @max_reputation
Severity: Minor
Found in app/controllers/discussions_controller.rb - About 25 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 powerdowns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def powerdowns(account)
    ret_val = ""
    
    if account.nil? || account == ''
      ret_val = 'Account name required.'
Severity: Minor
Found in app/controllers/accounts_controller.rb - About 25 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 discussions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def discussions(options = {})
    job = options.delete(:with)
    tag = options[:tag]
    
    if defined? job.discussions
Severity: Minor
Found in app/controllers/discussions_controller.rb - About 25 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 trending_by_rshares has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def trending_by_rshares
    response = api_execute(:get_discussions_by_trending, limit: 100)
    
    @discussions += response.result.map do |comment|
      next if (max_rshares = comment.active_votes.map(&:rshares).map(&:to_i).max) > @max_rshares
Severity: Minor
Found in app/controllers/discussions_controller.rb - About 25 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 votes_today has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def votes_today
    (@account_names || []).split(' ').map do |voter|
      suggested_voters.map do |v|
        next unless v.keys.first == voter
        "#{voter}: #{view_context.pluralize(v.values.last, 'vote')}"
Severity: Minor
Found in app/controllers/accounts_controller.rb - About 25 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 vesting_from has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def vesting_from(account)
    ret_val = ""
    
    if account.nil? || account == ''
      ret_val = 'Account name required.'
Severity: Minor
Found in app/controllers/accounts_controller.rb - About 25 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 extract_votes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_votes(comment)
    votes = comment.active_votes
    
    [
      votes.map { |vote| vote if vote.percent > 0 }.compact,
Severity: Minor
Found in app/jobs/find_flagwar_job.rb - About 25 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 query has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
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 - About 25 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 vesting_to has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def vesting_to(account)
    ret_val = ""
    
    if account.nil? || account == ''
      ret_val = 'Account name required.'
Severity: Minor
Found in app/controllers/accounts_controller.rb - About 25 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 commented_any? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def commented_any?(author)
    downvoter_accounts.map do |account|
      # Author has made at least one post (thus exposed to flag).
      if account.name == author && account.post_count > 0
        # Author reputation is above 25 (0 is Rep 25), meaning their comments
Severity: Minor
Found in app/jobs/find_flagwar_job.rb - About 25 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 build_net_transfers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def build_net_transfers(account_name, symbol, days, segments)
    bids = transfers.where(to: account_name, amount_symbol: symbol)
    bids = bids.where('timestamp > ?', days.day.ago)
    bids = bids.where('memo LIKE ?', '%@%')
    bids = bids.group_by do |b|
Severity: Minor
Found in app/controllers/charts_controller.rb - About 25 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