Use 2 (not 4) spaces for indentation. Open
config.action_view.field_error_proc = Proc.new { |html_tag, instance|
- Read upRead up
- Exclude checks
This cops checks for indentation that doesn't use the specified number of spaces.
See also the IndentationConsistency cop which is the companion to this one.
Example:
# bad
class A
def test
puts 'hello'
end
end
# good
class A
def test
puts 'hello'
end
end
Example: IgnoredPatterns: ['^\s*module']
# bad
module A
class B
def test
puts 'hello'
end
end
end
# good
module A
class B
def test
puts 'hello'
end
end
end
}
at 13, 4 is not aligned with config.action_view.field_error_proc = Proc.new { |html_tag, instance|
at 11, 6. Open
}
- Read upRead up
- Exclude checks
This cop checks whether the end keywords are aligned properly for do end blocks.
Three modes are supported through the EnforcedStyleAlignWith
configuration parameter:
start_of_block
: the end
shall be aligned with the
start of the line where the do
appeared.
start_of_line
: the end
shall be aligned with the
start of the line where the expression started.
either
(which is the default) : the end
is allowed to be in either
location. The autofixer will default to start_of_line
.
Example: EnforcedStyleAlignWith: either (default)
# bad
foo.bar
.each do
baz
end
# good
variable = lambda do |i|
i
end
Example: EnforcedStyleAlignWith: startofblock
# bad
foo.bar
.each do
baz
end
# good
foo.bar
.each do
baz
end
Example: EnforcedStyleAlignWith: startofline
# bad
foo.bar
.each do
baz
end
# good
foo.bar
.each do
baz
end
Line is too long. [98/80] Open
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
- Exclude checks
Line is too long. [87/80] Open
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
- Exclude checks
Line is too long. [82/80] Open
"<div class=\"field_with_errors has-error\">#{html_tag}</div>".html_safe
- Exclude checks
Line is too long. [82/80] Open
# Settings in config/environments/* take precedence over those specified here.
- Exclude checks
Inconsistent indentation detected. Open
config.i18n.default_locale = :de
- Read upRead up
- Exclude checks
This cops checks for inconsistent indentation.
Example:
class A
def test
puts 'hello'
puts 'world'
end
end
Line is too long. [81/80] Open
# ApplicationLetter configuration should go into files in config/initializers
- Exclude checks
Unused block argument - instance
. If it's necessary, use _
or _instance
as an argument name to indicate that it won't be used. Open
config.action_view.field_error_proc = Proc.new { |html_tag, instance|
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end
Line is too long. [89/80] Open
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
- Exclude checks
Use proc
instead of Proc.new
. Open
config.action_view.field_error_proc = Proc.new { |html_tag, instance|
- Read upRead up
- Exclude checks
This cops checks for uses of Proc.new where Kernel#proc would be more appropriate.
Example:
# bad
p = Proc.new { |n| puts n }
# good
p = proc { |n| puts n }
Inconsistent indentation detected. Open
config.active_record.raise_in_transactional_callbacks = true
- Read upRead up
- Exclude checks
This cops checks for inconsistent indentation.
Example:
class A
def test
puts 'hello'
puts 'world'
end
end
Line is too long. [99/80] Open
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
- Exclude checks
Inconsistent indentation detected. Open
config.unreasonably_long_event_time_span = 300
- Read upRead up
- Exclude checks
This cops checks for inconsistent indentation.
Example:
class A
def test
puts 'hello'
puts 'world'
end
end
Missing top-level class documentation comment. Open
class ApplicationLetter < Rails::Application
- Read upRead up
- Exclude checks
This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.
The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.
Example:
# bad
class Person
# ...
end
# good
# Description/Explanation of Person class
class Person
# ...
end
Use 2 (not 6) spaces for indentation. Open
"<div class=\"field_with_errors has-error\">#{html_tag}</div>".html_safe
- Read upRead up
- Exclude checks
This cops checks for indentation that doesn't use the specified number of spaces.
See also the IndentationConsistency cop which is the companion to this one.
Example:
# bad
class A
def test
puts 'hello'
end
end
# good
class A
def test
puts 'hello'
end
end
Example: IgnoredPatterns: ['^\s*module']
# bad
module A
class B
def test
puts 'hello'
end
end
end
# good
module A
class B
def test
puts 'hello'
end
end
end