Showing 122 of 122 total issues
Tab detected in indentation. Open
belongs_to :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
render json: nil, :status => :unprocessable_entity
- 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
render :json => :ok
- 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
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
scope :unread_by, lambda {|current_user|
- 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 conditions
- 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 expand_path('../lib/starburst/engine', __dir__)
instead of expand_path('../../lib/starburst/engine', __FILE__)
. Open
ENGINE_PATH = File.expand_path('../../lib/starburst/engine', __FILE__)
- Read upRead up
- Exclude checks
This cop checks for use of the File.expand_path
arguments.
Likewise, it also checks for the Pathname.new
argument.
Contrastive bad case and good case are alternately shown in the following examples.
Example:
# bad
File.expand_path('..', __FILE__)
# good
File.expand_path(__dir__)
# bad
File.expand_path('../..', __FILE__)
# good
File.expand_path('..', __dir__)
# bad
File.expand_path('.', __FILE__)
# good
File.expand_path(__FILE__)
# bad
Pathname(__FILE__).parent.expand_path
# good
Pathname(__dir__).expand_path
# bad
Pathname.new(__FILE__).parent.expand_path
# good
Pathname.new(__dir__).expand_path
Tab detected in 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 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
render json: nil, :status => :unprocessable_entity
- 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
announcements.each do |announcement|
- 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.user_matches_conditions(user, conditions = nil)
- 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
class AnnouncementView < ActiveRecord::Base
- 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
validates_uniqueness_of :user_id, scope: :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 expand_path('..', __dir__)
instead of expand_path('../..', __FILE__)
. Open
ENGINE_ROOT = File.expand_path('../..', __FILE__)
- Read upRead up
- Exclude checks
This cop checks for use of the File.expand_path
arguments.
Likewise, it also checks for the Pathname.new
argument.
Contrastive bad case and good case are alternately shown in the following examples.
Example:
# bad
File.expand_path('..', __FILE__)
# good
File.expand_path(__dir__)
# bad
File.expand_path('../..', __FILE__)
# good
File.expand_path('..', __dir__)
# bad
File.expand_path('.', __FILE__)
# good
File.expand_path(__FILE__)
# bad
Pathname(__FILE__).parent.expand_path
# good
Pathname(__dir__).expand_path
# bad
Pathname.new(__FILE__).parent.expand_path
# good
Pathname.new(__dir__).expand_path
Use expand_path('../Gemfile', __dir__)
instead of expand_path('../../Gemfile', __FILE__)
. Open
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
- Read upRead up
- Exclude checks
This cop checks for use of the File.expand_path
arguments.
Likewise, it also checks for the Pathname.new
argument.
Contrastive bad case and good case are alternately shown in the following examples.
Example:
# bad
File.expand_path('..', __FILE__)
# good
File.expand_path(__dir__)
# bad
File.expand_path('../..', __FILE__)
# good
File.expand_path('..', __dir__)
# bad
File.expand_path('.', __FILE__)
# good
File.expand_path(__FILE__)
# bad
Pathname(__FILE__).parent.expand_path
# good
Pathname(__dir__).expand_path
# bad
Pathname.new(__FILE__).parent.expand_path
# good
Pathname.new(__dir__).expand_path
Use 2 (not 1) spaces for indentation. Open
def mark_as_read
- 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
if respond_to?(Starburst.current_user_method, true) && send(Starburst.current_user_method) && announcement
- 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 the new Ruby 1.9 hash syntax. Open
render :json => :ok
- Read upRead up
- Exclude checks
This cop checks hash literal syntax.
It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).
A separate offense is registered for each problematic pair.
The supported styles are:
- ruby19 - forces use of the 1.9 syntax (e.g.
{a: 1}
) when hashes have all symbols for keys - hash_rockets - forces use of hash rockets for all hashes
- nomixedkeys - simply checks for hashes with mixed syntaxes
- ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes
Example: EnforcedStyle: ruby19 (default)
# bad
{:a => 2}
{b: 1, :c => 2}
# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
{d: 1, 'e' => 2} # technically not forbidden
Example: EnforcedStyle: hash_rockets
# bad
{a: 1, b: 2}
{c: 1, 'd' => 5}
# good
{:a => 1, :b => 2}
Example: EnforcedStyle: nomixedkeys
# bad
{:a => 1, b: 2}
{c: 1, 'd' => 2}
# good
{:a => 1, :b => 2}
{c: 1, d: 2}
Example: EnforcedStyle: ruby19nomixed_keys
# bad
{:a => 1, :b => 2}
{c: 2, 'd' => 3} # should just use hash rockets
# good
{a: 1, b: 2}
{:c => 3, 'd' => 4}
Missing top-level class documentation comment. Open
class AnnouncementsController < Starburst.base_controller.constantize
- 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