rekif/mastodon

View on GitHub

Showing 266 of 266 total issues

Always use raise to signal exceptions.
Open

            return fail(:invalid)
Severity: Minor
Found in lib/devise/ldap_authenticatable.rb by rubocop

This cop checks for uses of fail and raise.

Example: EnforcedStyle: only_raise (default)

# The `only_raise` style enforces the sole use of `raise`.
# bad
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  # handle it
end

Kernel.fail

# good
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  raise
rescue Exception
  # handle it
end

Kernel.raise

Example: EnforcedStyle: only_fail

# The `only_fail` style enforces the sole use of `fail`.
# bad
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  raise
rescue Exception
  # handle it
end

Kernel.raise

# good
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  # handle it
end

Kernel.fail

Example: EnforcedStyle: semantic

# The `semantic` style enforces the use of `fail` to signal an
# exception, then will use `raise` to trigger an offense after
# it has been rescued.
# bad
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  # Error thrown
rescue Exception
  fail
end

Kernel.fail
Kernel.raise

# good
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  raise 'Preferably with descriptive message'
end

explicit_receiver.fail
explicit_receiver.raise

Each selector in a comma sequence should be on its own single line
Open

a, abbr, acronym, address, big, cite, code,

Each selector in a comma sequence should be on its own single line
Open

b, u, i, center,

Each selector in a comma sequence should be on its own single line
Open

dl, dt, dd, ol, ul, li,

Each selector in a comma sequence should be on its own single line
Open

figure, figcaption, footer, header, hgroup,

Avoid rescuing without specifying an error class.
Open

  rescue

This cop checks for rescuing StandardError. There are two supported styles implicit and explicit. This cop will not register an offense if any error other than StandardError is specified.

Example: EnforcedStyle: implicit

# `implicit` will enforce using `rescue` instead of
# `rescue StandardError`.

# bad
begin
  foo
rescue StandardError
  bar
end

# good
begin
  foo
rescue
  bar
end

# good
begin
  foo
rescue OtherError
  bar
end

# good
begin
  foo
rescue StandardError, SecurityError
  bar
end

Example: EnforcedStyle: explicit (default)

# `explicit` will enforce using `rescue StandardError`
# instead of `rescue`.

# bad
begin
  foo
rescue
  bar
end

# good
begin
  foo
rescue StandardError
  bar
end

# good
begin
  foo
rescue OtherError
  bar
end

# good
begin
  foo
rescue StandardError, SecurityError
  bar
end

Each selector in a comma sequence should be on its own single line
Open

menu, nav, output, ruby, section, summary,

Method parameter must be at least 3 characters long.
Open

  def mention_link?(a)

This cop checks method parameter names for how descriptive they are. It is highly configurable.

The MinNameLength config option takes an integer. It represents the minimum amount of characters the name must be. Its default is 3. The AllowNamesEndingInNumbers config option takes a boolean. When set to false, this cop will register offenses for names ending with numbers. Its default is false. The AllowedNames config option takes an array of whitelisted names that will never register an offense. The ForbiddenNames config option takes an array of blacklisted names that will always register an offense.

Example:

# bad
def bar(varOne, varTwo)
  varOne + varTwo
end

# With `AllowNamesEndingInNumbers` set to false
def foo(num1, num2)
  num1 * num2
end

# With `MinArgNameLength` set to number greater than 1
def baz(a, b, c)
  do_stuff(a, b, c)
end

# good
def bar(thud, fred)
  thud + fred
end

def foo(speed, distance)
  speed * distance
end

def baz(age_a, height_b, gender_c)
  do_stuff(age_a, height_b, gender_c)
end

Each selector in a comma sequence should be on its own single line
Open

html, body, div, span, applet, object, iframe,

Each selector in a comma sequence should be on its own single line
Open

menu, nav, output, ruby, section, summary,

Each selector in a comma sequence should be on its own single line
Open

fieldset, form, label, legend,

Each selector in a comma sequence should be on its own single line
Open

time, mark, audio, video {

Each selector in a comma sequence should be on its own single line
Open

fieldset, form, label, legend,

Each selector in a comma sequence should be on its own single line
Open

time, mark, audio, video {

Each selector in a comma sequence should be on its own single line
Open

table, caption, tbody, tfoot, thead, tr, th, td,

Each selector in a comma sequence should be on its own single line
Open

article, aside, details, figcaption, figure,

Each selector in a comma sequence should be on its own single line
Open

table, caption, tbody, tfoot, thead, tr, th, td,

Each selector in a comma sequence should be on its own single line
Open

blockquote, q {

Each selector in a comma sequence should be on its own single line
Open

article, aside, canvas, details, embed,

Each selector in a comma sequence should be on its own single line
Open

blockquote:before, blockquote:after,
Severity
Category
Status
Source
Language