decko-commons/decko

View on GitHub

Showing 667 of 699 total issues

Use let instead of an instance variable.
Open

          expect(@email_card.db_content).to eq("quire@example.com")

Use let instead of an instance variable.
Open

        expect(@signup.account.status).to eq("unverified")

Use let instead of an instance variable.
Open

    edit_view = @card.format.render_edit

Use let instead of an instance variable.
Open

      expect(@card.errors[:signin].first).to match(/Unrecognized email/)

Use let instead of an instance variable.
Open

      @card.update! "+*email" => "joe@admin.com",

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

  context "updates" do

Use let instead of an instance variable.
Open

        expect(ids.length).to eq(@read_rules.size + 11)

Use let instead of an instance variable.
Open

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

Use let instead of an instance variable.
Open

      raw_source = @mail.parts[0].body.raw_source

Use %r around regular expression.
Open

  special_char: /[!"#$%&'()*+,-.\/:;<=>?@\[\]\\^_`{|}~]/,
Severity: Minor
Found in mod/account/set/right/password.rb by rubocop

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("")

Use let instead of an instance variable.
Open

    rps_view = @card.format.render_reset_password_success

Use let instead of an instance variable.
Open

      @card.update! "+*email" => "joe@admin.com", trigger: :send_reset_password_token

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

    context "update" do

Use let instead of an instance variable.
Open

      body = @mail.parts[0].body.raw_source

Use match? instead of =~ when MatchData is not used.
Open

      self =~ /^#{Regexp.escape joint}/ ? self : (joint + self)
Severity: Minor
Found in cardname/lib/cardname/manipulate.rb by rubocop

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
Severity: Minor
Found in cardname/lib/core_ext.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

Method Cardname#key is defined at both cardname/lib/cardname.rb:42 and cardname/lib/cardname.rb:74.
Open

  def key
Severity: Minor
Found in cardname/lib/cardname.rb by rubocop

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

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

  context "signup form form" do
Severity
Category
Status
Source
Language