znamenica/dneslov

View on GitHub
app/models/event.rb

Summary

Maintainability
B
6 hrs
Test Coverage
F
37%

Class has too many lines. [375/100]
Open

class Event < ActiveRecord::Base
   extend Informatible
   extend TotalSize
   include WithTitles
   include WithDescriptions
Severity: Minor
Found in app/models/event.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

File event.rb has 377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Event < ActiveRecord::Base
   extend Informatible
   extend TotalSize
   include WithTitles
   include WithDescriptions
Severity: Minor
Found in app/models/event.rb - About 5 hrs to fix

    Block has too many lines. [66/25]
    Open

       scope :with_memoes, -> context do
          language_codes = [ context[:locales] ].flatten
          cslugs_rule = context[:calendary_slugs] ? "AND calendary_slugs.text IN ('#{context[:calendary_slugs].join("','")}')" : ""
    
          selector = "COALESCE((WITH __memoes AS (
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Perceived complexity for year_date_for is too high. [11/7]
    Open

       def self.year_date_for year_date, date_in, julian
          return nil if date_in.blank?
    
          date =  [ Time, Date, DateTime ].any? {|c| date_in.is_a?(c) } && date_in || Time.parse(date_in)
          if /(?<day>\d+)\.(?<month>\d+)%(?<weekday>\d+)$/ =~ year_date
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Cyclomatic complexity for year_date_for is too high. [10/6]
    Open

       def self.year_date_for year_date, date_in, julian
          return nil if date_in.blank?
    
          date =  [ Time, Date, DateTime ].any? {|c| date_in.is_a?(c) } && date_in || Time.parse(date_in)
          if /(?<day>\d+)\.(?<month>\d+)%(?<weekday>\d+)$/ =~ year_date
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Block has too many lines. [43/25]
    Open

       scope :with_short_memoes, -> context do
          language_codes = [ context[:locales] ].flatten
          cslugs_rule = context[:calendary_slugs] ? "AND calendary_slugs.text IN ('#{context[:calendary_slugs].join("','")}')" : ""
    
          selector = "COALESCE((WITH __memoes AS (
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Method year_date_for has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

       def self.year_date_for year_date, date_in, julian
          return nil if date_in.blank?
    
          date =  [ Time, Date, DateTime ].any? {|c| date_in.is_a?(c) } && date_in || Time.parse(date_in)
          if /(?<day>\d+)\.(?<month>\d+)%(?<weekday>\d+)$/ =~ year_date
    Severity: Minor
    Found in app/models/event.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Block has too many lines. [31/25]
    Open

       scope :with_orders, -> context do
          language_codes = [ context[:locales] ].flatten
          cslugs_rule = context[:calendary_slugs] ? "AND calendary_slugs.text IN ('#{context[:calendary_slugs].join("','")}')" : ""
          as = table.table_alias || table.name
    
    
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [30/25]
    Open

       scope :with_value, -> context do
          language_codes = [ context[:locales] ].flatten
          alphabeth_codes = Languageble.alphabeth_list_for( language_codes ).flatten
          selector = self.select_values.dup
    
    
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Do not use space inside array brackets.
    Open

          date =  [ Time, Date, DateTime ].any? {|c| date_in.is_a?(c) } && date_in || Time.parse(date_in)
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Use only ascii symbols in comments.
    Open

    # item_id[int]   id предмета, к которому применяется событие
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

    Example:

    # bad
    # Translates from English to 日本語。
    
    # good
    # Translates from English to Japanese

    Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
    Open

          if selector.empty?
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

    Example:

    # bad
    if condition
      do_stuff(bar)
    end
    
    unless qux.empty?
      Foo.do_something
    end
    
    # good
    do_stuff(bar) if condition
    Foo.do_something unless qux.empty?

    Use the lambda method for multiline lambdas.
    Open

       scope :by_did_and_short_name, -> did, short_name do
    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

    Redundant self detected.
    Open

          selector = self.select_values.dup
    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

    Missing space after #.
    Open

          #binding.pry
    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

    Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
    Open

             where("unaccent(descriptions_subjects.text) ~* unaccent(?)", "\\m#{text}.*")))))
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks that the closing brace in a method call is either on the same line as the last method argument, or a new line.

    When using the symmetrical (default) style:

    If a method call's opening brace is on the same line as the first argument of the call, then the closing brace should be on the same line as the last argument of the call.

    If an method call's opening brace is on the line above the first argument of the call, then the closing brace should be on the line below the last argument of the call.

    When using the new_line style:

    The closing brace of a multi-line method call must be on the line after the last argument of the call.

    When using the same_line style:

    The closing brace of a multi-line method call must be on the same line as the last argument of the call.

    Example:

    # symmetrical: bad
      # new_line: good
      # same_line: bad
      foo(a,
        b
      )
    
      # symmetrical: bad
      # new_line: bad
      # same_line: good
      foo(
        a,
        b)
    
      # symmetrical: good
      # new_line: bad
      # same_line: good
      foo(a,
        b)
    
      # symmetrical: good
      # new_line: good
      # same_line: bad
      foo(
        a,
        b
      )

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Use only ascii symbols in comments.
    Open

    # memory_id[int] id памяти, событие которой произошло
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

    Example:

    # bad
    # Translates from English to 日本語。
    
    # good
    # Translates from English to Japanese

    Use the lambda method for multiline lambdas.
    Open

       scope :with_key, -> _ do
    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

    Use the lambda method for multiline lambdas.
    Open

       scope :with_scripta, -> context do
    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

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :with_short_memoes, -> context do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :by_token, -> text do
          left_outer_joins( :kind, :titles ).
             merge(Subject.by_token(text)).
             where("unaccent(events.kind_code) ~* unaccent(?)", "\\m#{text}.*").or(
             where(type_number: text.to_i).or(
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :by_memory_id, -> memory_id do
          where(memory_id: memory_id)
       end
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Bad indentation of the first parameter.
    Open

             where("unaccent(descriptions_subjects.text) ~* unaccent(?)", "\\m#{text}.*")))))
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks the indentation of the first parameter in a method call. Parameters after the first one are checked by Style/AlignParameters, not by this cop.

    Example:

    # bad
    some_method(
    first_param,
    second_param)
    
    # good
    some_method(
      first_param,
    second_param)

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :by_did_and_short_name, -> did, short_name do
          if /^[0-9]+$/ =~ did
             where(id: did)
          else
             by_title(did)
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

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

             "COALESCE(jsonb_build_object(
                'slug', memory_slugs.text,
                'order', #{join_name}_memories.order,
                'short_name', #{join_name}_memories.short_name)) AS _memory"
    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:

    # bad
    if a +
    b
      something
    end
    
    # good
    if a +
       b
      something
    end

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :with_icon, -> context do
          as = table.table_alias || table.name
          language_codes = [ context[:locales] ].flatten
          selector = self.select_values.dup
          selector << "#{as}.*" if selector.empty?
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Do not use space inside array brackets.
    Open

          selector = [ 'events.id AS _key' ]
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Space inside parentheses detected.
    Open

          alphabeth_codes = Languageble.alphabeth_list_for( language_codes ).flatten
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Checks for spaces inside ordinary round parentheses.

    Example:

    # bad
    f( 3)
    g = (a + 3 )
    
    # good
    f(3)
    g = (a + 3)

    Use only ascii symbols in comments.
    Open

    # kind_code[string]   наименование класса события
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

    Example:

    # bad
    # Translates from English to 日本語。
    
    # good
    # Translates from English to Japanese

    Use \ instead of + or << to concatenate those strings.
    Open

          selector = self.select_values.dup << "#{join_name}.*" <<
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for string literal concatenation at the end of a line.

    Example:

    # bad
    some_str = 'ala' +
               'bala'
    
    some_str = 'ala' <<
               'bala'
    
    # good
    some_str = 'ala' \
               'bala'

    Use the lambda method for multiline lambdas.
    Open

       scope :by_event_code, -> code do
    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

    Use the lambda method for multiline lambdas.
    Open

       scope :with_place, -> context do
    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

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

          select(selector).group('_key').reorder("_key")
    Severity: Minor
    Found in app/models/event.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"

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

          left_outer_joins( :kind, :titles ).
    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.
      mehod
    
    # good
    something
      .method

    Example: EnforcedStyle: trailing

    # bad
    something
      .method
    
    # good
    something.
      mehod

    Missing space after #.
    Open

          #binding.pry
    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

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :with_value, -> context do
          language_codes = [ context[:locales] ].flatten
          alphabeth_codes = Languageble.alphabeth_list_for( language_codes ).flatten
          selector = self.select_values.dup
    
    
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :with_scripta, -> context do
          language_codes = [ context[:locales] ].flatten
          selector = self.select_values.dup
          if selector.empty?
             selector << 'events.*'
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Use the lambda method for multiline lambdas.
    Open

       scope :with_icon, -> context do
    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

    Freeze mutable objects assigned to constants.
    Open

       NOTICE = [
          'Repose',
          'Veneration',
          'Writing',
          'Appearance',
    Severity: Minor
    Found in app/models/event.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

          selector = self.select_values.dup << "#{join_name}.*" <<
    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

    Operator = should be surrounded by a single space.
    Open

          date =  [ Time, Date, DateTime ].any? {|c| date_in.is_a?(c) } && date_in || Time.parse(date_in)
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Checks that operators have space around them, except for ** which should not have surrounding space.

    Example:

    # bad
    total = 3*4
    "apple"+"juice"
    my_number = 38/4
    a ** b
    
    # good
    total = 3 * 4
    "apple" + "juice"
    my_number = 38 / 4
    a**b

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :with_key, -> _ do
          selector = [ 'events.id AS _key' ]
    
          select(selector).group('_key').reorder("_key")
       end
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Space inside parentheses detected.
    Open

          left_outer_joins( :kind, :titles ).
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Checks for spaces inside ordinary round parentheses.

    Example:

    # bad
    f( 3)
    g = (a + 3 )
    
    # good
    f(3)
    g = (a + 3)

    Use the lambda method for multiline lambdas.
    Open

       scope :with_memoes, -> context do
    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

    Redundant self detected.
    Open

       scope :calendaried, ->(calendary_slugs) { self.joins(:memos).where(memoes: { calendary_id: Calendary.by_slugs(calendary_slugs).unscope(:select).select(:id) }) }
    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

    Indent the first parameter one step more than the start of the previous line.
    Open

             where(type_number: text.to_i).or(
             where("unaccent(descriptions.text) ~* unaccent(?)", "\\m#{text}.*").or(
             where("unaccent(names_subjects.text) ~* unaccent(?)", "\\m#{text}.*").or(
             where("unaccent(descriptions_subjects.text) ~* unaccent(?)", "\\m#{text}.*")))))
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks the indentation of the first parameter in a method call. Parameters after the first one are checked by Style/AlignParameters, not by this cop.

    Example:

    # bad
    some_method(
    first_param,
    second_param)
    
    # good
    some_method(
      first_param,
    second_param)

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :by_title_and_short_name, -> title, short_name do
          joins(:memory).merge(Memory.by_short_name(short_name)).by_title(title)
       end
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :with_place, -> context do
          language_codes = [ context[:locales] ].flatten
          selector = "jsonb_build_object('id', places.id, 'name', place_descriptions.text) AS _place"
          join = "LEFT OUTER JOIN places
                               ON events.place_id = places.id
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :by_did_and_short_name, -> did, short_name do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

    Line is too long. [163/130]
    Open

       scope :calendaried, ->(calendary_slugs) { self.joins(:memos).where(memoes: { calendary_id: Calendary.by_slugs(calendary_slugs).unscope(:select).select(:id) }) }
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Use the lambda method for multiline lambdas.
    Open

       scope :with_short_memoes, -> context do
    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

    Use the lambda method for multiline lambdas.
    Open

       scope :with_orders, -> context do
    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

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

             merge(Subject.by_token(text)).
    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.
      mehod
    
    # good
    something
      .method

    Example: EnforcedStyle: trailing

    # bad
    something
      .method
    
    # good
    something.
      mehod

    Missing space after #.
    Open

          #binding.pry
    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 inside parentheses detected.
    Open

          left_outer_joins( :kind, :titles ).
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Checks for spaces inside ordinary round parentheses.

    Example:

    # bad
    f( 3)
    g = (a + 3 )
    
    # good
    f(3)
    g = (a + 3)

    Freeze mutable objects assigned to constants.
    Open

       USUAL = [
          'Marriage',
          'Exaltation',
          'Ascension',
          'Restoration',
    Severity: Minor
    Found in app/models/event.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

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Use the lambda method for multiline lambdas.
    Open

       scope :by_memory_id, -> memory_id do
    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

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :by_memory_id, -> memory_id do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

    Bad indentation of the first parameter.
    Open

             where("unaccent(descriptions.text) ~* unaccent(?)", "\\m#{text}.*").or(
             where("unaccent(names_subjects.text) ~* unaccent(?)", "\\m#{text}.*").or(
             where("unaccent(descriptions_subjects.text) ~* unaccent(?)", "\\m#{text}.*")))))
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks the indentation of the first parameter in a method call. Parameters after the first one are checked by Style/AlignParameters, not by this cop.

    Example:

    # bad
    some_method(
    first_param,
    second_param)
    
    # good
    some_method(
      first_param,
    second_param)

    Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
    Open

             where("unaccent(descriptions_subjects.text) ~* unaccent(?)", "\\m#{text}.*")))))
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks that the closing brace in a method call is either on the same line as the last method argument, or a new line.

    When using the symmetrical (default) style:

    If a method call's opening brace is on the same line as the first argument of the call, then the closing brace should be on the same line as the last argument of the call.

    If an method call's opening brace is on the line above the first argument of the call, then the closing brace should be on the line below the last argument of the call.

    When using the new_line style:

    The closing brace of a multi-line method call must be on the line after the last argument of the call.

    When using the same_line style:

    The closing brace of a multi-line method call must be on the same line as the last argument of the call.

    Example:

    # symmetrical: bad
      # new_line: good
      # same_line: bad
      foo(a,
        b
      )
    
      # symmetrical: bad
      # new_line: bad
      # same_line: good
      foo(
        a,
        b)
    
      # symmetrical: good
      # new_line: bad
      # same_line: good
      foo(a,
        b)
    
      # symmetrical: good
      # new_line: good
      # same_line: bad
      foo(
        a,
        b
      )

    Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
    Open

             where("unaccent(descriptions_subjects.text) ~* unaccent(?)", "\\m#{text}.*")))))
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks that the closing brace in a method call is either on the same line as the last method argument, or a new line.

    When using the symmetrical (default) style:

    If a method call's opening brace is on the same line as the first argument of the call, then the closing brace should be on the same line as the last argument of the call.

    If an method call's opening brace is on the line above the first argument of the call, then the closing brace should be on the line below the last argument of the call.

    When using the new_line style:

    The closing brace of a multi-line method call must be on the line after the last argument of the call.

    When using the same_line style:

    The closing brace of a multi-line method call must be on the same line as the last argument of the call.

    Example:

    # symmetrical: bad
      # new_line: good
      # same_line: bad
      foo(a,
        b
      )
    
      # symmetrical: bad
      # new_line: bad
      # same_line: good
      foo(
        a,
        b)
    
      # symmetrical: good
      # new_line: bad
      # same_line: good
      foo(a,
        b)
    
      # symmetrical: good
      # new_line: good
      # same_line: bad
      foo(
        a,
        b
      )

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Use the lambda method for multiline lambdas.
    Open

       scope :with_value, -> context do
    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

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :by_title_and_short_name, -> title, short_name do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

    Use %w or %W for an array of words.
    Open

       SORT = [
          'Genum',
          'Nativity',
          'Resurrection',
       ]
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop can check for array literals made up of word-like strings, that are not using the %w() syntax.

    Alternatively, it can check for uses of the %w() syntax, in projects which do not want to include that syntax.

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

    Example: EnforcedStyle: percent (default)

    # good
    %w[foo bar baz]
    
    # bad
    ['foo', 'bar', 'baz']

    Example: EnforcedStyle: brackets

    # good
    ['foo', 'bar', 'baz']
    
    # bad
    %w[foo bar baz]

    Freeze mutable objects assigned to constants.
    Open

       SORT = [
          'Genum',
          'Nativity',
          'Resurrection',
       ]
    Severity: Minor
    Found in app/models/event.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

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :with_icon, -> context do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

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

             where("unaccent(names_subjects.text) ~* unaccent(?)", "\\m#{text}.*").or(
    Severity: Minor
    Found in app/models/event.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"

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

          joins(join).select(selector).group(:id, "titles.text", "events.happened_at")
    Severity: Minor
    Found in app/models/event.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"

    Use %w or %W for an array of words.
    Open

       NOTICE = [
          'Repose',
          'Veneration',
          'Writing',
          'Appearance',
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop can check for array literals made up of word-like strings, that are not using the %w() syntax.

    Alternatively, it can check for uses of the %w() syntax, in projects which do not want to include that syntax.

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

    Example: EnforcedStyle: percent (default)

    # good
    %w[foo bar baz]
    
    # bad
    ['foo', 'bar', 'baz']

    Example: EnforcedStyle: brackets

    # good
    ['foo', 'bar', 'baz']
    
    # bad
    %w[foo bar baz]

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :with_place, -> context do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

    Redundant self detected.
    Open

          selector = self.select_values.dup
    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

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

             where("unaccent(descriptions.text) ~* unaccent(?)", "\\m#{text}.*").or(
    Severity: Minor
    Found in app/models/event.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"

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

          joins(join).select(selector).group(:id, "titles.text", "events.happened_at")
    Severity: Minor
    Found in app/models/event.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"

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

          cslugs_rule = context[:calendary_slugs] ? "AND calendary_slugs.text IN ('#{context[:calendary_slugs].join("','")}')" : ""
    Severity: Minor
    Found in app/models/event.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"

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :with_value, -> context do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

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

             (base_date + (base_offset < 1 && (base_offset + 7) || base_offset)).strftime("%d.%m")
    Severity: Minor
    Found in app/models/event.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"

    Unnecessary spacing detected.
    Open

          date =  [ Time, Date, DateTime ].any? {|c| date_in.is_a?(c) } && date_in || Time.parse(date_in)
    Severity: Minor
    Found in app/models/event.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"

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :with_memory, -> context do
          join_name = table.table_alias || table.name
          selector = self.select_values.dup << "#{join_name}.*" <<
             "COALESCE(jsonb_build_object(
                'slug', memory_slugs.text,
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :with_memoes, -> context do
          language_codes = [ context[:locales] ].flatten
          cslugs_rule = context[:calendary_slugs] ? "AND calendary_slugs.text IN ('#{context[:calendary_slugs].join("','")}')" : ""
    
          selector = "COALESCE((WITH __memoes AS (
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Redundant self detected.
    Open

                self.where(calendary_id: calendary_ids)
    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

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :with_memoes, -> context do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :by_event_code, -> code do
          if code =~ /^\d+$/
             where(id: code)
          else
             left_outer_joins(:kind_titles).where(kind_titles: { text: code })
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Do not use space inside array brackets.
    Open

          date =  [ Time, Date, DateTime ].any? {|c| date_in.is_a?(c) } && date_in || Time.parse(date_in)
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Use the lambda method for multiline lambdas.
    Open

       scope :by_title_and_short_name, -> title, short_name do
    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

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :by_token, -> text do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

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

       has_many :thumbs, -> { where(thumbs: { thumbable_type: "Event" }) }, foreign_key: :thumbable_id, dependent: :destroy
    Severity: Minor
    Found in app/models/event.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"

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :with_short_memoes, -> context do
          language_codes = [ context[:locales] ].flatten
          cslugs_rule = context[:calendary_slugs] ? "AND calendary_slugs.text IN ('#{context[:calendary_slugs].join("','")}')" : ""
    
          selector = "COALESCE((WITH __memoes AS (
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

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

          cslugs_rule = context[:calendary_slugs] ? "AND calendary_slugs.text IN ('#{context[:calendary_slugs].join("','")}')" : ""
    Severity: Minor
    Found in app/models/event.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"

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

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

             (easter + offset.to_i.days).strftime("%d.%m")
    Severity: Minor
    Found in app/models/event.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"

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Do not use space inside array brackets.
    Open

          language_codes = [ context[:locales] ].flatten
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Space between { and | missing.
    Open

          date =  [ Time, Date, DateTime ].any? {|c| date_in.is_a?(c) } && date_in || Time.parse(date_in)
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

    Example: EnforcedStyle: space (default)

    # The `space` style enforces that block braces have
    # surrounding space.
    
    # bad
    some_array.each {puts e}
    
    # good
    some_array.each { puts e }

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that block braces don't
    # have surrounding space.
    
    # bad
    some_array.each { puts e }
    
    # good
    some_array.each {puts e}

    Example: EnforcedStyleForEmptyBraces: no_space (default)

    # The `no_space` EnforcedStyleForEmptyBraces style enforces that
    # block braces don't have a space in between when empty.
    
    # bad
    some_array.each {   }
    some_array.each {  }
    some_array.each { }
    
    # good
    some_array.each {}

    Example: EnforcedStyleForEmptyBraces: space

    # The `space` EnforcedStyleForEmptyBraces style enforces that
    # block braces have at least a spece in between when empty.
    
    # bad
    some_array.each {}
    
    # good
    some_array.each { }
    some_array.each {  }
    some_array.each {   }

    Example: SpaceBeforeBlockParameters: true (default)

    # The SpaceBeforeBlockParameters style set to `true` enforces that
    # there is a space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each {|n| n * 2 }
    
    # good
    [1, 2, 3].each { |n| n * 2 }

    Example: SpaceBeforeBlockParameters: true

    # The SpaceBeforeBlockParameters style set to `false` enforces that
    # there is no space between `{` and `|`. Overrides `EnforcedStyle`
    # if there is a conflict.
    
    # bad
    [1, 2, 3].each { |n| n * 2 }
    
    # good
    [1, 2, 3].each {|n| n * 2 }

    Use only ascii symbols in comments.
    Open

    # place_id[int]  id места, где произошло событие
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

    Example:

    # bad
    # Translates from English to 日本語。
    
    # good
    # Translates from English to Japanese

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :with_memory, -> context do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :with_orders, -> context do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :with_scripta, -> context do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

    Bad indentation of the first parameter.
    Open

             where("unaccent(names_subjects.text) ~* unaccent(?)", "\\m#{text}.*").or(
             where("unaccent(descriptions_subjects.text) ~* unaccent(?)", "\\m#{text}.*")))))
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks the indentation of the first parameter in a method call. Parameters after the first one are checked by Style/AlignParameters, not by this cop.

    Example:

    # bad
    some_method(
    first_param,
    second_param)
    
    # good
    some_method(
      first_param,
    second_param)

    Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
    Open

             where("unaccent(descriptions_subjects.text) ~* unaccent(?)", "\\m#{text}.*")))))
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks that the closing brace in a method call is either on the same line as the last method argument, or a new line.

    When using the symmetrical (default) style:

    If a method call's opening brace is on the same line as the first argument of the call, then the closing brace should be on the same line as the last argument of the call.

    If an method call's opening brace is on the line above the first argument of the call, then the closing brace should be on the line below the last argument of the call.

    When using the new_line style:

    The closing brace of a multi-line method call must be on the line after the last argument of the call.

    When using the same_line style:

    The closing brace of a multi-line method call must be on the same line as the last argument of the call.

    Example:

    # symmetrical: bad
      # new_line: good
      # same_line: bad
      foo(a,
        b
      )
    
      # symmetrical: bad
      # new_line: bad
      # same_line: good
      foo(
        a,
        b)
    
      # symmetrical: good
      # new_line: bad
      # same_line: good
      foo(a,
        b)
    
      # symmetrical: good
      # new_line: good
      # same_line: bad
      foo(
        a,
        b
      )

    Do not use spaces between -> and opening brace in lambda literals
    Open

       scope :with_orders, -> context do
          language_codes = [ context[:locales] ].flatten
          cslugs_rule = context[:calendary_slugs] ? "AND calendary_slugs.text IN ('#{context[:calendary_slugs].join("','")}')" : ""
          as = table.table_alias || table.name
    
    
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop checks for spaces between -> and opening parameter brace in lambda literals.

    Example: EnforcedStyle: requirenospace (default)

    # bad
      a = -> (x, y) { x + y }
    
      # good
      a = ->(x, y) { x + y }

    Example: EnforcedStyle: require_space

    # bad
      a = ->(x, y) { x + y }
    
      # good
      a = -> (x, y) { x + y }

    Do not use space inside array brackets.
    Open

          selector = [ 'events.id AS _key' ]
    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

    # 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 ] ]
    
    # good
    array = [ a, [ b, c ]]

    Space inside parentheses detected.
    Open

          alphabeth_codes = Languageble.alphabeth_list_for( language_codes ).flatten
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Checks for spaces inside ordinary round parentheses.

    Example:

    # bad
    f( 3)
    g = (a + 3 )
    
    # good
    f(3)
    g = (a + 3)

    Use the lambda method for multiline lambdas.
    Open

       scope :by_token, -> text do
    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

    Use the lambda method for multiline lambdas.
    Open

       scope :with_memory, -> context do
    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

    Redundant self detected.
    Open

          selector = self.select_values.dup
    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

    Avoid comma after the last item of an array.
    Open

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

    This cop checks for trailing comma in array and hash literals.

    Example: EnforcedStyleForMultiline: consistent_comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1, 2,
      3,
    ]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: no_comma (default)

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2
    ]

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

             where("unaccent(descriptions_subjects.text) ~* unaccent(?)", "\\m#{text}.*")))))
    Severity: Minor
    Found in app/models/event.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"

    Avoid comma after the last item of an array.
    Open

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

    This cop checks for trailing comma in array and hash literals.

    Example: EnforcedStyleForMultiline: consistent_comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1, 2,
      3,
    ]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: no_comma (default)

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2
    ]

    Use %w or %W for an array of words.
    Open

       USUAL = [
          'Marriage',
          'Exaltation',
          'Ascension',
          'Restoration',
    Severity: Minor
    Found in app/models/event.rb by rubocop

    This cop can check for array literals made up of word-like strings, that are not using the %w() syntax.

    Alternatively, it can check for uses of the %w() syntax, in projects which do not want to include that syntax.

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

    Example: EnforcedStyle: percent (default)

    # good
    %w[foo bar baz]
    
    # bad
    ['foo', 'bar', 'baz']

    Example: EnforcedStyle: brackets

    # good
    ['foo', 'bar', 'baz']
    
    # bad
    %w[foo bar baz]

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :by_event_code, -> code do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

    Wrap stabby lambda arguments with parentheses.
    Open

       scope :with_key, -> _ do
    Severity: Minor
    Found in app/models/event.rb by rubocop

    Check for parentheses around stabby lambda arguments. There are two different styles. Defaults to require_parentheses.

    Example: EnforcedStyle: require_parentheses (default)

    # bad
    ->a,b,c { a + b + c }
    
    # good
    ->(a,b,c) { a + b + c}

    Example: EnforcedStyle: requirenoparentheses

    # bad
    ->(a,b,c) { a + b + c }
    
    # good
    ->a,b,c { a + b + c}

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

             where("unaccent(events.kind_code) ~* unaccent(?)", "\\m#{text}.*").or(
    Severity: Minor
    Found in app/models/event.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"

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

          cslugs_rule = context[:calendary_slugs] ? "AND calendary_slugs.text IN ('#{context[:calendary_slugs].join("','")}')" : ""
    Severity: Minor
    Found in app/models/event.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"

    There are no issues that match your filters.

    Category
    Status