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"
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
Cardio.config.file_buckets = @old_bucket_config
- Create a ticketCreate a ticket
- Exclude checks
Start context description with 'when', 'with', or 'without'. Open
context "web file" do
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
item_names_args = @context ? { context: @context } : {}
- Create a ticketCreate a ticket
- Exclude checks
Do not prefix writer method names with set_
. Open
def set_module_ancestor_hash subject
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
- Create a ticketCreate a ticket
- Exclude checks
Script file rule_set_radio.rb doesn't have execute permission. Open
#! no set module
- Create a ticketCreate a ticket
- Exclude checks
Script file link_parser.rb doesn't have execute permission. Open
#! no set module
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
@account = Card::Auth.find_account_by_email(@email)
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
assert_equal @account, authenticated
- Create a ticketCreate a ticket
- Exclude checks
Missing top-level module documentation comment. Open
module ClassMethods
- Read upRead up
- Create a ticketCreate a ticket
- 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, 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
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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)]
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
- Create a ticketCreate a ticket
- Exclude checks
Name your test subject if you need to reference it explicitly. Open
expect(subject.image.small.size).to be_positive
- Create a ticketCreate a ticket
- Exclude checks
Name your test subject if you need to reference it explicitly. Open
.to eq "/files/~#{subject.id}/#{subject.last_action_id}-original.jpg"
- Create a ticketCreate a ticket
- Exclude checks
Start context description with 'when', 'with', or 'without'. Open
context "local file" do
- Create a ticketCreate a ticket
- Exclude checks
Do not stub your test subject. Open
allow(format).to receive(:view_setting)
- Create a ticketCreate a ticket
- Exclude checks
Missing top-level class documentation comment. Open
class StartFollowLink < FollowLink
- Read upRead up
- Create a ticketCreate a ticket
- 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, 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"
- Create a ticketCreate a ticket
- Exclude checks