GeekPark/gpk_account

View on GitHub
app/controllers/admin/broadcasts_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage

Assignment Branch Condition size for create is too high. [23.11/20] (http://c2.com/cgi/wiki?AbcMetric)
Open

  def create
    Rails.logger.info("title是")
    Rails.logger.info(broadcast_params.merge(user_id: current_user.id))
    @broadcast = Broadcast.new(broadcast_params.merge(user_id: current_user.id))
    @broadcast.development_only if params[:development_only].present?

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Prefer single-quoted strings when you don't need string interpolation or special symbols. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)
Open

    Rails.logger.info("title是")

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Put empty method definitions on a single line. (https://github.com/bbatsov/ruby-style-guide#no-single-line-methods)
Open

  def new
  end

This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions to go on a single line (compact style), but it can be configured to enforce the end to go on its own line (expanded style).

Note: A method definition is not considered empty if it contains comments.

Example: EnforcedStyle: compact (default)

# bad
def foo(bar)
end

def self.foo(bar)
end

# good
def foo(bar); end

def foo(bar)
  # baz
end

def self.foo(bar); end

Example: EnforcedStyle: expanded

# bad
def foo(bar); end

def self.foo(bar); end

# good
def foo(bar)
end

def self.foo(bar)
end

There are no issues that match your filters.

Category
Status