hpi-swt2/workshop-portal

View on GitHub

Showing 494 of 494 total issues

Using width with padding can sometimes make elements larger than you expect.
Open

  padding: 7px;
Severity: Minor
Found in app/assets/stylesheets/scaffold.css by csslint

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

Tab detected.
Open

    @participants.sort { |x, y| self.compare_participants_by_agreement(x,y) }
Severity: Minor
Found in app/models/event.rb by rubocop

Line is too long. [98/80]
Open

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

Use %i or %I for an array of symbols.
Open

        can [:new, :create], ApplicationLetter
Severity: Minor
Found in app/models/ability.rb by rubocop

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

Line is too long. [128/80]
Open

  validates_presence_of :first_name, :last_name, :gender, :birth_date, :school, :street_name, :zip_code, :city, :state, :country
Severity: Minor
Found in app/models/profile.rb by rubocop

Freeze mutable objects assigned to constants.
Open

  ROLES = %i[pupil coach organizer admin]
Severity: Minor
Found in app/models/user.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Redundant self detected.
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

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

Use 2 (not 0) spaces for indenting an expression spanning multiple lines.
Open

    (menu_item t(:events, scope: 'navbar'), events_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

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

    if current_user.role == "admin"
Severity: Minor
Found in app/helpers/application_helper.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Inconsistent indentation detected.
Open

    def set_request
      @request = Request.find(params[:id])
    end

This cops checks for inconsistent indentation.

Example:

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

Put empty method definitions on a single line.
Open

  def show
  end

This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions to go on a single line (compact style), but it can be configured to enforce the end to go on its own line (expanded style).

Note: A method definition is not considered empty if it contains comments.

Example: EnforcedStyle: compact (default)

# bad
def foo(bar)
end

def self.foo(bar)
end

# good
def foo(bar); end

def foo(bar)
  # baz
end

def self.foo(bar); end

Example: EnforcedStyle: expanded

# bad
def foo(bar); end

def self.foo(bar); end

# good
def foo(bar)
end

def self.foo(bar)
end

Use %i or %I for an array of symbols.
Open

  before_action :set_request, only: [:show, :edit, :update, :destroy]

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

Line is too long. [137/80]
Open

      redirect_to :back, notice: 'Application was successfully updated.' rescue ActionController::RedirectBackError redirect_to root_path

Use %i or %I for an array of symbols.
Open

  before_action :set_profile, only: [:show, :edit, :update, :destroy]

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

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

a:hover:not(.btn) { color: #fff; background-color:#000; }
Severity: Minor
Found in app/assets/stylesheets/scaffold.css by csslint

Missing space after #.
Open

  #validate that application deadline is before the start of the event
Severity: Minor
Found in app/models/event.rb by rubocop

This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

Example:

# bad
#Some comment

# good
# Some comment

Space missing to the left of {.
Open

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

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Redundant self detected.
Open

    @participants.sort { |x, y| self.compare_participants_by_agreement(x,y) }
Severity: Minor
Found in app/models/event.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

Line is too long. [114/80]
Open

      errors.add(:event, "Die Bewerbungen wurden bereits bearbeitet, eine Statusänderung ist nicht mehr erlaubt.")
Severity: Minor
Found in app/models/application_letter.rb by rubocop
Severity
Category
Status
Source
Language