hpi-swt2/workshop-portal

View on GitHub

Showing 494 of 494 total issues

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 2 (not 0) spaces for indenting an expression spanning multiple lines.
Open

    (menu_item t(:requests, scope: 'navbar'), requests_path)
Severity: Minor
Found in app/helpers/application_helper.rb by rubocop

This cop checks the indentation of the right hand side operand in binary operations that span more than one line.

Example:

# bad
if a +
b
  something
end

# good
if a +
   b
  something
end

Line is too long. [95/80]
Open

    o << (menu_item t(:logout, scope: 'navbar'), destroy_user_session_path, :method => :delete)
Severity: Minor
Found in app/helpers/application_helper.rb by rubocop

Missing top-level class documentation comment.
Open

class ApplicationController < ActionController::Base

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

Inconsistent indentation detected.
Open

    def event_params
      params.require(:event).permit(:name, :description, :max_participants, :kind, :organizer, :knowledge_level, :application_deadline, date_ranges_attributes: [:start_date, :end_date, :id])
    end

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Use of !important
Open

    padding-right: 0 !important;

Rule doesn't have all its properties in alphabetical order.
Open

pre {
Severity: Minor
Found in app/assets/stylesheets/scaffold.css by csslint

Use of !important
Open

    color: black !important;
Severity: Minor
Found in app/assets/stylesheets/scaffold.css by csslint

Trailing whitespace detected.
Open

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

Rename is_file? to file?.
Open

    def is_file?(file)
Severity: Minor
Found in app/models/agreement_letter.rb by rubocop

This cop makes sure that predicates are named properly.

Example:

# bad
def is_even?(value)
end

# good
def even?(value)
end

# bad
def has_value?
end

# good
def value?
end

Line is too long. [93/80]
Open

    accepted_applications.map{ |application_letter| application_letter.user.email }.join(',')
Severity: Minor
Found in app/models/event.rb by rubocop

Line is too long. [82/80]
Open

    application_letters.where(status: ApplicationLetter.statuses[:accepted]).count
Severity: Minor
Found in app/models/event.rb by rubocop

Use max_by(&:end_date) instead of max { |a, b| a.end_date <=> b.end_date }.
Open

    (date_ranges.max { |a,b| a.end_date <=> b.end_date }).end_date
Severity: Minor
Found in app/models/event.rb by rubocop

This cop identifies places where sort { |a, b| a.foo <=> b.foo } can be replaced by sort_by(&:foo). This cop also checks max and min methods.

Example:

# bad
array.sort { |a, b| a.foo <=> b.foo }
array.max { |a, b| a.foo <=> b.foo }
array.min { |a, b| a.foo <=> b.foo }
array.sort { |a, b| a[:foo] <=> b[:foo] }

# good
array.sort_by(&:foo)
array.sort_by { |v| v.foo }
array.sort_by do |var|
  var.foo
end
array.max_by(&:foo)
array.min_by(&:foo)
array.sort_by { |a| a[:foo] }

Missing top-level class documentation comment.
Open

class Email
Severity: Minor
Found in app/models/email.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

Use proc instead of Proc.new.
Open

  validate :status_cannot_be_changed, :if => Proc.new { |letter| letter.status_changed?}
Severity: Minor
Found in app/models/application_letter.rb by rubocop

This cops checks for uses of Proc.new where Kernel#proc would be more appropriate.

Example:

# bad
p = Proc.new { |n| puts n }

# good
p = proc { |n| puts n }

Unnecessary spacing detected.
Open

    first_name + " " +  last_name
Severity: Minor
Found in app/models/profile.rb by rubocop

This cop checks for extra/unnecessary whitespace.

Example:

# good if AllowForAlignment is true
name      = "RuboCop"
# Some comment and an empty line

website  += "/bbatsov/rubocop" unless cond
puts        "rubocop"          if     debug

# bad for any configuration
set_app("RuboCop")
website  = "https://github.com/bbatsov/rubocop"

Extra empty line detected at class body end.
Open


end
Severity: Minor
Found in app/models/user.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

Inconsistent indentation detected.
Open

    return age_at_event_start >= age
Severity: Minor
Found in app/models/user.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Line is too long. [115/80]
Open

    age_at_event_start = event_start.year - self.profile.birth_date.year - (event_start_is_before_birthday ? 0 : 1)
Severity: Minor
Found in app/models/user.rb by rubocop

Redundant self detected.
Open

    return self.older_than_required_age_at_start_date_of_event?(given_event, 18)
Severity: Minor
Found in app/models/user.rb by rubocop

This cop checks for redundant uses of self.

The usage of self is only needed when:

  • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

  • Calling an attribute writer to prevent an local variable assignment.

Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

Note we allow uses of self with operators because it would be awkward otherwise.

Example:

# bad
def foo(bar)
  self.baz
end

# good
def foo(bar)
  self.bar  # Resolves name clash with the argument.
end

def foo
  bar = 1
  self.bar  # Resolves name clash with the local variable.
end

def foo
  %w[x y z].select do |bar|
    self.bar == bar  # Resolves name clash with argument of the block.
  end
end
Severity
Category
Status
Source
Language