Showing 667 of 699 total issues
Use let
instead of an instance variable. Open
expect(@email_card.db_content).to eq("quire@example.com")
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
expect(@signup.account.status).to eq("unverified")
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
edit_view = @card.format.render_edit
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
expect(@card.errors[:signin].first).to match(/Unrecognized email/)
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
@card.update! "+*email" => "joe@admin.com",
- Create a ticketCreate a ticket
- Exclude checks
Start context description with 'when', 'with', or 'without'. Open
context "updates" do
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
expect(ids.length).to eq(@read_rules.size + 11)
- 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
raw_source = @mail.parts[0].body.raw_source
- Create a ticketCreate a ticket
- Exclude checks
Use %r
around regular expression. Open
special_char: /[!"#$%&'()*+,-.\/:;<=>?@\[\]\\^_`{|}~]/,
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop enforces using // or %r around regular expressions.
Example: EnforcedStyle: slashes (default)
# bad
snake_case = %r{^[\dA-Z_]+$}
# bad
regex = %r{
foo
(bar)
(baz)
}x
# good
snake_case = /^[\dA-Z_]+$/
# good
regex = /
foo
(bar)
(baz)
/x
Example: EnforcedStyle: percent_r
# bad
snake_case = /^[\dA-Z_]+$/
# bad
regex = /
foo
(bar)
(baz)
/x
# good
snake_case = %r{^[\dA-Z_]+$}
# good
regex = %r{
foo
(bar)
(baz)
}x
Example: EnforcedStyle: mixed
# bad
snake_case = %r{^[\dA-Z_]+$}
# bad
regex = /
foo
(bar)
(baz)
/x
# good
snake_case = /^[\dA-Z_]+$/
# good
regex = %r{
foo
(bar)
(baz)
}x
Example: AllowInnerSlashes: false (default)
# If `false`, the cop will always recommend using `%r` if one or more
# slashes are found in the regexp string.
# bad
x =~ /home\//
# good
x =~ %r{home/}
Example: AllowInnerSlashes: true
# good
x =~ /home\//
Use let
instead of an instance variable. Open
expect(@account.salt).not_to eq("")
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
rps_view = @card.format.render_reset_password_success
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
@card.update! "+*email" => "joe@admin.com", trigger: :send_reset_password_token
- Create a ticketCreate a ticket
- Exclude checks
Start context description with 'when', 'with', or 'without'. Open
context "update" do
- Create a ticketCreate a ticket
- Exclude checks
Use let
instead of an instance variable. Open
body = @mail.parts[0].body.raw_source
- Create a ticketCreate a ticket
- Exclude checks
Use match?
instead of =~
when MatchData
is not used. Open
self =~ /^#{Regexp.escape joint}/ ? self : (joint + self)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
In Ruby 2.4, String#match?
, Regexp#match?
and Symbol#match?
have been added. The methods are faster than match
.
Because the methods avoid creating a MatchData
object or saving
backref.
So, when MatchData
is not used, use match?
instead of match
.
Example:
# bad
def foo
if x =~ /re/
do_something
end
end
# bad
def foo
if x.match(/re/)
do_something
end
end
# bad
def foo
if /re/ === x
do_something
end
end
# good
def foo
if x.match?(/re/)
do_something
end
end
# good
def foo
if x =~ /re/
do_something(Regexp.last_match)
end
end
# good
def foo
if x.match(/re/)
do_something($~)
end
end
# good
def foo
if /re/ === x
do_something($~)
end
end
Missing top-level class documentation comment. Open
class Object
- 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
Method Cardname#key
is defined at both cardname/lib/cardname.rb:42 and cardname/lib/cardname.rb:74. Open
def key
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for duplicated instance (or singleton) method definitions.
Example:
# bad
def duplicated
1
end
def duplicated
2
end
Example:
# bad
def duplicated
1
end
alias duplicated other_duplicated
Example:
# good
def duplicated
1
end
def other_duplicated
2
end
Start context description with 'when', 'with', or 'without'. Open
context "comment addition" do
- Create a ticketCreate a ticket
- Exclude checks
Start context description with 'when', 'with', or 'without'. Open
context "signup form form" do
- Create a ticketCreate a ticket
- Exclude checks