decko-commons/decko

View on GitHub

Showing 661 of 695 total issues

Missing top-level module documentation comment.
Open

    module Wrapper
Severity: Minor
Found in card/lib/card/format/wrapper.rb by rubocop

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 a guard clause instead of wrapping the code inside a conditional expression.
Open

        if wrapper.is_a? String
Severity: Minor
Found in card/lib/card/format/wrapper.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

When using method_missing, fall back on super.
Open

      def method_missing method, *opts, &proc
        if (match = api_render? method)
          api_render match, opts
        else
          delegate_to_action_view(method, opts, proc) { yield }

This cop checks for the presence of method_missing without also defining respond_to_missing? and falling back on super.

Example:

#bad
def method_missing(name, *args)
  # ...
end

#good
def respond_to_missing?(name, include_private)
  # ...
end

def method_missing(name, *args)
  # ...
  super
end

Do not suppress exceptions.
Open

      rescue NameError

This cop checks for rescue blocks with no body.

Example:

# bad

def some_method
  do_something
rescue
  # do nothing
end

Example:

# bad

begin
  do_something
rescue
  # do nothing
end

Example:

# good

def some_method
  do_something
rescue
  handle_exception
end

Example:

# good

begin
  do_something
rescue
  handle_exception
end

Do not use expect() without .to or .not_to. Chain the methods or remove it.
Open

          expect(v)

Missing top-level class documentation comment.
Open

class Card
Severity: Minor
Found in card/lib/card/set/event.rb by rubocop

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

Prefer Date or Time over DateTime.
Open

          I18n.localize(DateTime.new(date.year, date.mon, date.day),
Severity: Minor
Found in card/lib/card/format/content.rb by rubocop

This cop checks for uses of DateTime that should be replaced by Date or Time.

Example:

# bad - uses `DateTime` for current time
DateTime.now

# good - uses `Time` for current time
Time.now

# bad - uses `DateTime` for modern date
DateTime.iso8601('2016-06-29')

# good - uses `Date` for modern date
Date.iso8601('2016-06-29')

# good - uses `DateTime` with start argument for historical date
DateTime.iso8601('1751-04-23', Date::ENGLAND)

Missing top-level module documentation comment.
Open

    module MethodDelegation

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

Missing top-level class documentation comment.
Open

  class Logger
Severity: Minor
Found in card/spec/spec_helper.rb by rubocop

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

Prefer have_received for setting message expectations. Setup Cardio::Mod::LoadStrategy::Eval as a spy using allow or instance_spy.
Open

      .to receive(:new).with(instance_of(described_class))

Start context description with 'when', 'with', or 'without'.
Open

  context "class" do
Severity: Minor
Found in card/spec/card/content_spec.rb by rubocop

The second argument to describe should be the method being tested. '#instance' or '.class'.
Open

RSpec.describe Card::Codename, "Codename" do
Severity: Minor
Found in card/spec/card/codename_spec.rb by rubocop

Prefer have_received for setting message expectations. Setup store as a spy using allow or instance_spy.
Open

      expect(store).to receive(:write).with("#{prefix}/foo", "val")
Severity: Minor
Found in card/spec/card/cache_spec.rb by rubocop

Missing top-level module documentation comment.
Open

      module Callbacks

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

Missing top-level class documentation comment.
Open

        class IntegrateWithDelayJob < Cardio::Job

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

When using method_missing, define respond_to_missing?.
Open

      def method_missing m, *args, &block
        return super unless Card.rspec_binding

        suppress_name_error do
          method = eval("method(%s)" % m.inspect, Card.rspec_binding)

This cop checks for the presence of method_missing without also defining respond_to_missing? and falling back on super.

Example:

#bad
def method_missing(name, *args)
  # ...
end

#good
def respond_to_missing?(name, include_private)
  # ...
end

def method_missing(name, *args)
  # ...
  super
end

Missing top-level module documentation comment.
Open

    module Card::Set::Type::SetTestLoad
Severity: Minor
Found in card/spec/cardio/mod/loader_spec.rb by rubocop

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

Don't repeat examples within an example group.
Open

    it "check unstable key bug" do
      create "Matthias", subcards: { "+name" => "test" }
      expect(Card).to exist("Matthias+name")
    end
Severity: Minor
Found in card/spec/card/subcards_spec.rb by rubocop

Name your test subject if you need to reference it explicitly.
Open

      in_stage :prepare_to_validate, on: :create, trigger: -> { subject } do
Severity: Minor
Found in card/spec/card/set/trait_spec.rb by rubocop

Use let instead of an instance variable.
Open

    let(:example)       { EXAMPLES[@example] }
Severity: Minor
Found in card/spec/card/content_spec.rb by rubocop
Severity
Category
Status
Source
Language