Showing 122 of 122 total issues
Missing frozen string literal comment. Open
module Starburst
- Read upRead up
- Exclude checks
This cop is designed to help you transition from mutable string literals
to frozen string literals.
It will add the comment # frozen_string_literal: true
to the top of
files to enable frozen string literals. Frozen string literals may be
default in future Ruby. The comment will be added below a shebang and
encoding comment. The frozen string literal comment is only valid in
Ruby 2.3+.
Note that the cop will ignore files where the comment exists but is set
to false
instead of true
.
Example: EnforcedStyle: always (default)
# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
# ...
end
# good
# frozen_string_literal: true
module Bar
# ...
end
# good
# frozen_string_literal: false
module Bar
# ...
end
Example: EnforcedStyle: never
# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true
module Baz
# ...
end
# good
module Baz
# ...
end
Example: EnforcedStyle: always_true
# The `always_true` style enforces that the frozen string literal
# comment is set to `true`. This is a stricter option than `always`
# and forces projects to use frozen string literals.
# bad
# frozen_string_literal: false
module Baz
# ...
end
# bad
module Baz
# ...
end
# good
# frozen_string_literal: true
module Bar
# ...
end
Tab detected in indentation. Open
scope :ready_for_delivery, lambda {
- Read upRead up
- Exclude checks
This cop checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.
Example: EnforcedStyle: spaces (default)
# bad
# This example uses a tab to indent bar.
def foo
bar
end
# good
# This example uses spaces to indent bar.
def foo
bar
end
Example: EnforcedStyle: tabs
# bad
# This example uses spaces to indent bar.
def foo
bar
end
# good
# This example uses a tab to indent bar.
def foo
bar
end
Tab detected in indentation. Open
scope :unread_by, lambda {|current_user|
- Read upRead up
- Exclude checks
This cop checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.
Example: EnforcedStyle: spaces (default)
# bad
# This example uses a tab to indent bar.
def foo
bar
end
# good
# This example uses spaces to indent bar.
def foo
bar
end
Example: EnforcedStyle: tabs
# bad
# This example uses spaces to indent bar.
def foo
bar
end
# good
# This example uses a tab to indent bar.
def foo
bar
end
Tab detected in indentation. Open
where("(start_delivering_at < ? OR start_delivering_at IS NULL)
- Read upRead up
- Exclude checks
This cop checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.
Example: EnforcedStyle: spaces (default)
# bad
# This example uses a tab to indent bar.
def foo
bar
end
# good
# This example uses spaces to indent bar.
def foo
bar
end
Example: EnforcedStyle: tabs
# bad
# This example uses spaces to indent bar.
def foo
bar
end
# good
# This example uses a tab to indent bar.
def foo
bar
end
Tab detected in indentation. Open
return false
- Read upRead up
- Exclude checks
This cop checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.
Example: EnforcedStyle: spaces (default)
# bad
# This example uses a tab to indent bar.
def foo
bar
end
# good
# This example uses spaces to indent bar.
def foo
bar
end
Example: EnforcedStyle: tabs
# bad
# This example uses spaces to indent bar.
def foo
bar
end
# good
# This example uses a tab to indent bar.
def foo
bar
end
Tab detected in indentation. Open
end
- Read upRead up
- Exclude checks
This cop checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.
Example: EnforcedStyle: spaces (default)
# bad
# This example uses a tab to indent bar.
def foo
bar
end
# good
# This example uses spaces to indent bar.
def foo
bar
end
Example: EnforcedStyle: tabs
# bad
# This example uses spaces to indent bar.
def foo
bar
end
# good
# This example uses a tab to indent bar.
def foo
bar
end
Use 2 (not 1) spaces for indentation. Open
serialize :limit_to_users
- Read upRead up
- Exclude checks
This cop 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
Tab detected in indentation. Open
}
- Read upRead up
- Exclude checks
This cop checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.
Example: EnforcedStyle: spaces (default)
# bad
# This example uses a tab to indent bar.
def foo
bar
end
# good
# This example uses spaces to indent bar.
def foo
bar
end
Example: EnforcedStyle: tabs
# bad
# This example uses spaces to indent bar.
def foo
bar
end
# good
# This example uses a tab to indent bar.
def foo
bar
end
Tab detected in indentation. Open
announcement = Announcement.find(params[:id].to_i)
- Read upRead up
- Exclude checks
This cop checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.
Example: EnforcedStyle: spaces (default)
# bad
# This example uses a tab to indent bar.
def foo
bar
end
# good
# This example uses spaces to indent bar.
def foo
bar
end
Example: EnforcedStyle: tabs
# bad
# This example uses spaces to indent bar.
def foo
bar
end
# good
# This example uses a tab to indent bar.
def foo
bar
end
Tab detected in indentation. Open
end
- Read upRead up
- Exclude checks
This cop checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.
Example: EnforcedStyle: spaces (default)
# bad
# This example uses a tab to indent bar.
def foo
bar
end
# good
# This example uses spaces to indent bar.
def foo
bar
end
Example: EnforcedStyle: tabs
# bad
# This example uses spaces to indent bar.
def foo
bar
end
# good
# This example uses a tab to indent bar.
def foo
bar
end
Tab detected in indentation. Open
end
- Read upRead up
- Exclude checks
This cop checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.
Example: EnforcedStyle: spaces (default)
# bad
# This example uses a tab to indent bar.
def foo
bar
end
# good
# This example uses spaces to indent bar.
def foo
bar
end
Example: EnforcedStyle: tabs
# bad
# This example uses spaces to indent bar.
def foo
bar
end
# good
# This example uses a tab to indent bar.
def foo
bar
end
Tab detected in indentation. Open
def self.find_announcement_for_current_user(announcements, user)
- Read upRead up
- Exclude checks
This cop checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.
Example: EnforcedStyle: spaces (default)
# bad
# This example uses a tab to indent bar.
def foo
bar
end
# good
# This example uses spaces to indent bar.
def foo
bar
end
Example: EnforcedStyle: tabs
# bad
# This example uses spaces to indent bar.
def foo
bar
end
# good
# This example uses a tab to indent bar.
def foo
bar
end
Use 2 (not 1) spaces for indentation. Open
announcement = Announcement.find(params[:id].to_i)
- Read upRead up
- Exclude checks
This cop 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
Use 2 (not 1) spaces for indentation. Open
if AnnouncementView.where(user_id: send(Starburst.current_user_method).id, announcement_id: announcement.id).first_or_create(user_id: send(Starburst.current_user_method).id, announcement_id: announcement.id)
- Read upRead up
- Exclude checks
This cop 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
Use 2 (not 1) spaces for indentation. Open
if user[condition[:field]] != condition[:value]
- Read upRead up
- Exclude checks
This cop 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
Extra empty line detected at class body beginning. Open
validates :body, presence: true
- Read upRead up
- Exclude checks
This cop checks if empty lines around the bodies of classes match the configuration.
Example: EnforcedStyle: empty_lines
# good
class Foo
def bar
# ...
end
end
Example: EnforcedStyle: emptylinesexcept_namespace
# good
class Foo
class Bar
# ...
end
end
Example: EnforcedStyle: emptylinesspecial
# good
class Foo
def bar; end
end
Example: EnforcedStyle: beginning_only
# good
class Foo
def bar
# ...
end
end
Example: EnforcedStyle: ending_only
# good
class Foo
def bar
# ...
end
end
Example: EnforcedStyle: noemptylines (default)
# good
class Foo
def bar
# ...
end
end
Space between { and | missing. Open
scope :unread_by, lambda {|current_user|
- Read upRead up
- Exclude checks
Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.
Example: EnforcedStyle: space (default)
# The `space` style enforces that block braces have
# surrounding space.
# bad
some_array.each {puts e}
# good
some_array.each { puts e }
Example: EnforcedStyle: no_space
# The `no_space` style enforces that block braces don't
# have surrounding space.
# bad
some_array.each { puts e }
# good
some_array.each {puts e}
Example: EnforcedStyleForEmptyBraces: no_space (default)
# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.
# bad
some_array.each { }
some_array.each { }
some_array.each { }
# good
some_array.each {}
Example: EnforcedStyleForEmptyBraces: space
# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a space in between when empty.
# bad
some_array.each {}
# good
some_array.each { }
some_array.each { }
some_array.each { }
Example: SpaceBeforeBlockParameters: true (default)
# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.
# bad
[1, 2, 3].each {|n| n * 2 }
# good
[1, 2, 3].each { |n| n * 2 }
Example: SpaceBeforeBlockParameters: false
# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.
# bad
[1, 2, 3].each { |n| n * 2 }
# good
[1, 2, 3].each {|n| n * 2 }
Extra empty line detected at class body end. Open
end
- Read upRead up
- Exclude checks
This cop checks if empty lines around the bodies of classes match the configuration.
Example: EnforcedStyle: empty_lines
# good
class Foo
def bar
# ...
end
end
Example: EnforcedStyle: emptylinesexcept_namespace
# good
class Foo
class Bar
# ...
end
end
Example: EnforcedStyle: emptylinesspecial
# good
class Foo
def bar; end
end
Example: EnforcedStyle: beginning_only
# good
class Foo
def bar
# ...
end
end
Example: EnforcedStyle: ending_only
# good
class Foo
def bar
# ...
end
end
Example: EnforcedStyle: noemptylines (default)
# good
class Foo
def bar
# ...
end
end
Missing top-level class documentation comment. Open
class Announcement < ActiveRecord::Base
- 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, constant definitions or constant visibility declarations.
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
module Math
end
# good
# Description/Explanation of Person class
class Person
# ...
end
# allowed
# Class without body
class Person
end
# Namespace - A namespace can be a class or a module
# Containing a class
module Namespace
# Description/Explanation of Person class
class Person
# ...
end
end
# Containing constant visibility declaration
module Namespace
class Private
end
private_constant :Private
end
# Containing constant definition
module Namespace
Public = Class.new
end
Tab detected in indentation. Open
user_as_array = user.serializable_hash(methods: Starburst.user_instance_methods)
- Read upRead up
- Exclude checks
This cop checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.
Example: EnforcedStyle: spaces (default)
# bad
# This example uses a tab to indent bar.
def foo
bar
end
# good
# This example uses spaces to indent bar.
def foo
bar
end
Example: EnforcedStyle: tabs
# bad
# This example uses spaces to indent bar.
def foo
bar
end
# good
# This example uses a tab to indent bar.
def foo
bar
end