starburstgem/starburst

View on GitHub

Showing 122 of 122 total issues

Use 2 (not 1) spaces for indentation.
Open

                    render json: nil, :status => :unprocessable_entity

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

Redundant return detected.
Open

            return nil

This cop checks for redundant return expressions.

Example:

# These bad cases should be extended to handle methods whose body is
# if/else or a case expression with a default branch.

# bad
def test
  return something
end

# bad
def test
  one
  two
  three
  return something
end

# good
def test
  return something if something_else
end

# good
def test
  if x
  elsif y
  else
  end
end

Example: AllowMultipleReturnValues: false (default)

# bad
def test
  return x, y
end

Example: AllowMultipleReturnValues: true

# good
def test
  return x, y
end

Tab detected in indentation.
Open

        belongs_to :user

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

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

                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)

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

            where("(start_delivering_at < ? OR start_delivering_at IS NULL)

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

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

                    if user[condition[:field]] != condition[:value]

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

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

            .where("starburst_announcement_views.announcement_id IS NULL AND starburst_announcement_views.user_id IS NULL")

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"

Use 2 (not 1) spaces for indentation.
Open

        def mark_as_read

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

Missing frozen string literal comment.
Open

module Starburst

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

Use 2 (not 1) spaces for indentation.
Open

        scope :in_delivery_order, lambda { order("start_delivering_at ASC")}

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 the -> { ... } lambda literal syntax for single line lambdas.
Open

        scope :in_delivery_order, lambda { order("start_delivering_at ASC")}

This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

Example: EnforcedStyle: linecountdependent (default)

# bad
f = lambda { |x| x }
f = ->(x) do
      x
    end

# good
f = ->(x) { x }
f = lambda do |x|
      x
    end

Example: EnforcedStyle: lambda

# bad
f = ->(x) { x }
f = ->(x) do
      x
    end

# good
f = lambda { |x| x }
f = lambda do |x|
      x
    end

Example: EnforcedStyle: literal

# bad
f = lambda { |x| x }
f = lambda do |x|
      x
    end

# good
f = ->(x) { x }
f = ->(x) do
      x
    end

Use 2 (not 1) spaces for indentation.
Open

        validates :announcement_id, presence: true

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

        serialize :limit_to_users

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 :in_delivery_order, lambda { order("start_delivering_at ASC")}

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.current(current_user)

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|

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

                    if user[condition[:field]] != condition[:value]

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

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
Severity
Category
Status
Source
Language