call4paperz/call4paperz

View on GitHub
app/models/event.rb

Summary

Maintainability
A
0 mins
Test Coverage

Align the arguments of a method call if they span more than one line.
Open

    ->(proposal) {
      Proposal.with_preloads.where(['proposals.event_id = ?', proposal.id])
    },
Severity: Minor
Found in app/models/event.rb by rubocop

Here we check if the arguments on a multi-line method definition are aligned.

Example: EnforcedStyle: withfirstargument (default)

# good

foo :bar,
    :baz

foo(
  :bar,
  :baz
)

# bad

foo :bar,
  :baz

foo(
  :bar,
    :baz
)

Example: EnforcedStyle: withfixedindentation

# good

foo :bar,
  :baz

# bad

foo :bar,
    :baz

1 trailing blank lines detected.
Open

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

This cop looks for trailing blank lines and a final newline in the source code.

Example: EnforcedStyle: finalblankline

# `final_blank_line` looks for one blank line followed by a new line
# at the end of files.

# bad
class Foo; end
# EOF

# bad
class Foo; end # EOF

# good
class Foo; end

# EOF

Example: EnforcedStyle: final_newline (default)

# `final_newline` looks for one newline at the end of files.

# bad
class Foo; end

# EOF

# bad
class Foo; end # EOF

# good
class Foo; end
# EOF

Align the operands of an expression in an assignment spanning multiple lines.
Open

      (twitter.match(/^([a-zA-Z0-9_]{1,15})$/) ||
       twitter.match(/^@([a-zA-Z0-9_]{1,15})$/) ||
       twitter.match(/^(http:\/\/)?www\.twitter\.com\/([a-zA-Z0-9_]{1,15})$/))
Severity: Minor
Found in app/models/event.rb by rubocop

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

Example: EnforcedStyle: aligned (default)

# bad
if a +
    b
  something
end

# good
if a +
   b
  something
end

Example: EnforcedStyle: indented

# bad
if a +
   b
  something
end

# good
if a +
    b
  something
end

Do not use space inside array brackets.
Open

  friendly_id :name, use: [ :slugged, :finders ]
Severity: Minor
Found in app/models/event.rb by rubocop

Checks that brackets used for array literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that array literals have
# surrounding space.

# bad
array = [a, b, c, d]

# good
array = [ a, b, c, d ]

Example: EnforcedStyle: no_space (default)

# The `no_space` style enforces that array literals have
# no surrounding space.

# bad
array = [ a, b, c, d ]

# good
array = [a, b, c, d]

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# array brackets, with the exception that successive left
# or right brackets are collapsed together in nested arrays.

# bad
array = [ a, [ b, c ] ]
array = [
  [ a ],
  [ b, c ]
]

# good
array = [ a, [ b, c ]]
array = [[ a ],
  [ b, c ]]

Example: EnforcedStyleForEmptyBrackets: no_space (default)

# The `no_space` EnforcedStyleForEmptyBrackets style enforces that
# empty array brackets do not contain spaces.

# bad
foo = [ ]
bar = [     ]

# good
foo = []
bar = []

Example: EnforcedStyleForEmptyBrackets: space

# The `space` EnforcedStyleForEmptyBrackets style enforces that
# empty array brackets contain exactly one space.

# bad
foo = []
bar = [    ]

# good
foo = [ ]
bar = [ ]

Align the arguments of a method call if they span more than one line.
Open

    dependent: :destroy do
Severity: Minor
Found in app/models/event.rb by rubocop

Here we check if the arguments on a multi-line method definition are aligned.

Example: EnforcedStyle: withfirstargument (default)

# good

foo :bar,
    :baz

foo(
  :bar,
  :baz
)

# bad

foo :bar,
  :baz

foo(
  :bar,
    :baz
)

Example: EnforcedStyle: withfixedindentation

# good

foo :bar,
  :baz

# bad

foo :bar,
    :baz

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

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

This cop checks the indentation of the method name part in method calls that span more than one line.

Example: EnforcedStyle: aligned (default)

# bad
while myvariable
.b
  # do something
end

# good
while myvariable
      .b
  # do something
end

# good
Thing.a
     .b
     .c

Example: EnforcedStyle: indented

# good
while myvariable
  .b

  # do something
end

Example: EnforcedStyle: indentedrelativeto_receiver

# good
while myvariable
        .a
        .b

  # do something
end

# good
myvariable = Thing
               .a
               .b
               .c

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

  friendly_id :name, use: [ :slugged, :finders ]
Severity: Minor
Found in app/models/event.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]

Place the . on the next line, together with the method name.
Open

            where(['proposals.event_id = ?', proxy_association.owner.id]).
Severity: Minor
Found in app/models/event.rb by rubocop

This cop checks the . position in multi-line method calls.

Example: EnforcedStyle: leading (default)

# bad
something.
  method

# good
something
  .method

Example: EnforcedStyle: trailing

# bad
something
  .method

# good
something.
  method

Place the . on the next line, together with the method name.
Open

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

This cop checks the . position in multi-line method calls.

Example: EnforcedStyle: leading (default)

# bad
something.
  method

# good
something
  .method

Example: EnforcedStyle: trailing

# bad
something
  .method

# good
something.
  method

Use %r around regular expression.
Open

       twitter.match(/^(http:\/\/)?www\.twitter\.com\/([a-zA-Z0-9_]{1,15})$/))
Severity: Minor
Found in app/models/event.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 2 (not 4) spaces for indenting an expression spanning multiple lines.
Open

            where(['proposals.event_id = ?', proxy_association.owner.id]).
Severity: Minor
Found in app/models/event.rb by rubocop

This cop checks the indentation of the method name part in method calls that span more than one line.

Example: EnforcedStyle: aligned (default)

# bad
while myvariable
.b
  # do something
end

# good
while myvariable
      .b
  # do something
end

# good
Thing.a
     .b
     .c

Example: EnforcedStyle: indented

# good
while myvariable
  .b

  # do something
end

Example: EnforcedStyle: indentedrelativeto_receiver

# good
while myvariable
        .a
        .b

  # do something
end

# good
myvariable = Thing
               .a
               .b
               .c

Missing magic comment # frozen_string_literal: true.
Open

class Event < ApplicationRecord
Severity: Minor
Found in app/models/event.rb by rubocop

This cop is designed to help upgrade to after Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default after Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

Example: EnforcedStyle: always (default)

# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
  # ...
end

# good
# frozen_string_literal: true

module Bar
  # ...
end

Example: EnforcedStyle: never

# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true

module Baz
  # ...
end

# good
module Baz
  # ...
end

Do not use space inside array brackets.
Open

  friendly_id :name, use: [ :slugged, :finders ]
Severity: Minor
Found in app/models/event.rb by rubocop

Checks that brackets used for array literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that array literals have
# surrounding space.

# bad
array = [a, b, c, d]

# good
array = [ a, b, c, d ]

Example: EnforcedStyle: no_space (default)

# The `no_space` style enforces that array literals have
# no surrounding space.

# bad
array = [ a, b, c, d ]

# good
array = [a, b, c, d]

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# array brackets, with the exception that successive left
# or right brackets are collapsed together in nested arrays.

# bad
array = [ a, [ b, c ] ]
array = [
  [ a ],
  [ b, c ]
]

# good
array = [ a, [ b, c ]]
array = [[ a ],
  [ b, c ]]

Example: EnforcedStyleForEmptyBrackets: no_space (default)

# The `no_space` EnforcedStyleForEmptyBrackets style enforces that
# empty array brackets do not contain spaces.

# bad
foo = [ ]
bar = [     ]

# good
foo = []
bar = []

Example: EnforcedStyleForEmptyBrackets: space

# The `space` EnforcedStyleForEmptyBrackets style enforces that
# empty array brackets contain exactly one space.

# bad
foo = []
bar = [    ]

# good
foo = [ ]
bar = [ ]

Missing top-level class documentation comment.
Open

class Event < ApplicationRecord
Severity: Minor
Found in app/models/event.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 the lambda method for multiline lambdas.
Open

    ->(proposal) {
Severity: Minor
Found in app/models/event.rb by rubocop

This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

Example: EnforcedStyle: linecountdependent (default)

# bad
f = lambda { |x| x }
f = ->(x) do
      x
    end

# good
f = ->(x) { x }
f = lambda do |x|
      x
    end

Example: EnforcedStyle: lambda

# bad
f = ->(x) { x }
f = ->(x) do
      x
    end

# good
f = lambda { |x| x }
f = lambda do |x|
      x
    end

Example: EnforcedStyle: literal

# bad
f = lambda { |x| x }
f = lambda do |x|
      x
    end

# good
f = ->(x) { x }
f = ->(x) do
      x
    end

There are no issues that match your filters.

Category
Status