hpi-swt2/workshop-portal

View on GitHub
app/models/date_range.rb

Summary

Maintainability
A
0 mins
Test Coverage

Extra empty line detected at class body beginning.
Open



Severity: Minor
Found in app/models/date_range.rb by rubocop

This cops checks if empty lines around the bodies of classes match the configuration.

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

    if end_date < start_date
Severity: Minor
Found in app/models/date_range.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

Extra blank line detected.
Open


  belongs_to :event
Severity: Minor
Found in app/models/date_range.rb by rubocop

This cops checks for two or more consecutive blank lines.

Example:

# bad - It has two empty lines.
some_method
# one empty line
# two empty lines
some_method

# good
some_method
# one empty line
some_method

Line is too long. [90/80]
Open

      I18n.l(start_date) + ' ' + I18n.t('date_range.pronouns.to') + ' ' + I18n.l(end_date)
Severity: Minor
Found in app/models/date_range.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

    if end_date < Date.current
Severity: Minor
Found in app/models/date_range.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

There are no issues that match your filters.

Category
Status