decko-commons/decko

View on GitHub

Showing 661 of 695 total issues

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

      expect(subject.content).to eq ":#{subject.codename}/bootstrap.png"

Use let instead of an instance variable.
Open

    Cardio.config.file_buckets = @old_bucket_config

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

    context "web file" do

Use let instead of an instance variable.
Open

      item_names_args = @context ? { context: @context } : {}

Do not prefix writer method names with set_.
Open

  def set_module_ancestor_hash subject
Severity: Minor
Found in mod/monkey/set/all/debug.rb by rubocop

This cop makes sure that accessor methods are named properly.

Example:

# bad
def set_attribute(value)
end

# good
def attribute=(value)
end

# bad
def get_attribute
end

# good
def attribute
end

Do not stub your test subject.
Open

      allow(format).to receive(:view_setting).and_return :modal

Script file rule_set_radio.rb doesn't have execute permission.
Open

#! no set module

Script file link_parser.rb doesn't have execute permission.
Open

#! no set module

Use let instead of an instance variable.
Open

      @account = Card::Auth.find_account_by_email(@email)

Use let instead of an instance variable.
Open

      assert_equal @account, authenticated

Missing top-level module documentation comment.
Open

module ClassMethods

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 {...} over do...end for single-line blocks.
Open

format :html do include Abstract::Permission::HtmlFormat end
Severity: Minor
Found in mod/permissions/set/right/read.rb by rubocop

Check for uses of braces or do/end around single line or multi-line blocks.

Example: EnforcedStyle: linecountbased (default)

# bad - single line block
items.each do |item| item / 5 end

# good - single line block
items.each { |item| item / 5 }

# bad - multi-line block
things.map { |thing|
  something = thing.some_method
  process(something)
}

# good - multi-line block
things.map do |thing|
  something = thing.some_method
  process(something)
end

Example: EnforcedStyle: semantic

# Prefer `do...end` over `{...}` for procedural blocks.

# return value is used/assigned
# bad
foo = map do |x|
  x
end
puts (map do |x|
  x
end)

# return value is not used out of scope
# good
map do |x|
  x
end

# Prefer `{...}` over `do...end` for functional blocks.

# return value is not used out of scope
# bad
each { |x|
  x
}

# return value is used/assigned
# good
foo = map { |x|
  x
}
map { |x|
  x
}.inspect

Example: EnforcedStyle: bracesforchaining

# bad
words.each do |word|
  word.flip.flop
end.join("-")

# good
words.each { |word|
  word.flip.flop
}.join("-")

Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
Open

        "%s/%s/%s" % [local_url_base(opts), file_dir, full_filename(url_filename)]

Use a consistent style for named format string tokens.

Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

Example: EnforcedStyle: annotated (default)

# bad
format('%{greeting}', greeting: 'Hello')
format('%s', 'Hello')

# good
format('%<greeting>s', greeting: 'Hello')</greeting>

Example: EnforcedStyle: template

# bad
format('%<greeting>s', greeting: 'Hello')
format('%s', 'Hello')

# good
format('%{greeting}', greeting: 'Hello')</greeting>

Example: EnforcedStyle: unannotated

# bad
format('%<greeting>s', greeting: 'Hello')
format('%{greeting}', 'Hello')

# good
format('%s', 'Hello')</greeting>

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

    context "storage type:" do

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

      expect(subject.image.small.size).to be_positive

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

        .to eq "/files/~#{subject.id}/#{subject.last_action_id}-original.jpg"

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

    context "local file" do

Do not stub your test subject.
Open

      allow(format).to receive(:view_setting)

Missing top-level class documentation comment.
Open

class StartFollowLink < FollowLink

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

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

          expect(subject.last_action.comment).to eq "file1.txt"
Severity
Category
Status
Source
Language