ClusterLabs/hawk

View on GitHub
hawk/app/models/alert.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Assignment Branch Condition size for instantiate is too high. [60.21/15]
Open

    def instantiate(xml)
      record = allocate
      record.id = xml.attributes["id"] || ""
      record.path = xml.attributes["path"] || ""

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

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for shell_syntax is too high. [44.18/15]
Open

  def shell_syntax
    [].tap do |cmd|
      cmd.push "alert #{id} #{path.shellescape}"

      unless params.empty?
Severity: Minor
Found in hawk/app/models/alert.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [44/30]
Open

    def instantiate(xml)
      record = allocate
      record.id = xml.attributes["id"] || ""
      record.path = xml.attributes["path"] || ""

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

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

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

    def instantiate(xml)
      record = allocate
      record.id = xml.attributes["id"] || ""
      record.path = xml.attributes["path"] || ""

Severity: Minor
Found in hawk/app/models/alert.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 instantiate is too high. [7/6]
Open

    def instantiate(xml)
      record = allocate
      record.id = xml.attributes["id"] || ""
      record.path = xml.attributes["path"] || ""

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

Method instantiate has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def instantiate(xml)
      record = allocate
      record.id = xml.attributes["id"] || ""
      record.path = xml.attributes["path"] || ""

Severity: Minor
Found in hawk/app/models/alert.rb - About 1 hr to fix

    Method shell_syntax has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def shell_syntax
        [].tap do |cmd|
          cmd.push "alert #{id} #{path.shellescape}"
    
          unless params.empty?
    Severity: Minor
    Found in hawk/app/models/alert.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

    Method instantiate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def instantiate(xml)
          record = allocate
          record.id = xml.attributes["id"] || ""
          record.path = xml.attributes["path"] || ""
    
    
    Severity: Minor
    Found in hawk/app/models/alert.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

    Do not use space inside array brackets.
    Open

              [ el.attributes["name"], el.attributes["value"] ]
    Severity: Minor
    Found in hawk/app/models/alert.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

                                     [ el.attributes["name"], el.attributes["value"] ]
    Severity: Minor
    Found in hawk/app/models/alert.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 || instead of or.
    Open

        unless File.exist?(path) or File.symlink?(path)
    Severity: Minor
    Found in hawk/app/models/alert.rb by rubocop

    This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

    Example: EnforcedStyle: always (default)

    # bad
    foo.save and return
    
    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    if foo && bar
    end

    Example: EnforcedStyle: conditionals

    # bad
    if foo and bar
    end
    
    # good
    foo.save && return
    
    # good
    foo.save and return
    
    # good
    if foo && bar
    end

    Add an empty line after magic comments.
    Open

    # Copyright (c) 2016 Kristoffer Gronlund <kgronlund@suse.com>
    Severity: Minor
    Found in hawk/app/models/alert.rb by rubocop

    Checks for a newline after the final magic comment.

    Example:

    # good
    # frozen_string_literal: true
    
    # Some documentation for Person
    class Person
      # Some code
    end
    
    # bad
    # frozen_string_literal: true
    # Some documentation for Person
    class Person
      # Some code
    end

    Use 2 (not 21) spaces for indentation.
    Open

                                   vals = r.elements["instance_attributes"].elements.collect do |el|
    Severity: Minor
    Found in hawk/app/models/alert.rb by rubocop

    This cops checks for indentation that doesn't use the specified number of spaces.

    See also the IndentationConsistency cop which is the companion to this one.

    Example:

    # bad
    class A
     def test
      puts 'hello'
     end
    end
    
    # good
    class A
      def test
        puts 'hello'
      end
    end

    Example: IgnoredPatterns: ['^\s*module']

    # bad
    module A
    class B
      def test
      puts 'hello'
      end
    end
    end
    
    # good
    module A
    class B
      def test
        puts 'hello'
      end
    end
    end

    Do not use space inside array brackets.
    Open

              [ el.attributes["name"], el.attributes["value"] ]
    Severity: Minor
    Found in hawk/app/models/alert.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 ]]

    end at 81, 29 is not aligned with recipient.params = if at 74, 10.
    Open

                                 end
    Severity: Minor
    Found in hawk/app/models/alert.rb by rubocop

    This cop checks whether the end keywords are aligned properly.

    Three modes are supported through the EnforcedStyleAlignWith configuration parameter:

    If it's set to keyword (which is the default), the end shall be aligned with the start of the keyword (if, class, etc.).

    If it's set to variable the end shall be aligned with the left-hand-side of the variable assignment, if there is one.

    If it's set to start_of_line, the end shall be aligned with the start of the line where the matching keyword appears.

    Example: EnforcedStyleAlignWith: keyword (default)

    # bad
    
    variable = if true
        end
    
    # good
    
    variable = if true
               end

    Example: EnforcedStyleAlignWith: variable

    # bad
    
    variable = if true
        end
    
    # good
    
    variable = if true
    end

    Example: EnforcedStyleAlignWith: startofline

    # bad
    
    variable = if true
        end
    
    # good
    
    puts(if true
    end)

    Do not use space inside array brackets.
    Open

              recipient.params.each { |key, value| cmd.push [ key, value.shellescape ].join("=") }
    Severity: Minor
    Found in hawk/app/models/alert.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

            params.each { |key, value| cmd.push [ key, value.shellescape ].join("=") }
    Severity: Minor
    Found in hawk/app/models/alert.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 a guard clause instead of wrapping the code inside a conditional expression.
    Open

        unless File.exist?(path) or File.symlink?(path)
    Severity: Minor
    Found in hawk/app/models/alert.rb by rubocop

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

    Example:

    # bad
    def test
      if something
        work
      end
    end
    
    # good
    def test
      return unless something
      work
    end
    
    # also good
    def test
      work if something
    end
    
    # bad
    if something
      raise 'exception'
    else
      ok
    end
    
    # good
    raise 'exception' if something
    ok

    Do not use space inside array brackets.
    Open

            meta.each { |key, value| cmd.push [ key, value.shellescape ].join("=") }
    Severity: Minor
    Found in hawk/app/models/alert.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 ]]

    Unnecessary utf-8 encoding comment.
    Open

    # coding: utf-8
    Severity: Minor
    Found in hawk/app/models/alert.rb by rubocop

    end at 89, 27 is not aligned with recipient.meta = if at 82, 10.
    Open

                               end
    Severity: Minor
    Found in hawk/app/models/alert.rb by rubocop

    This cop checks whether the end keywords are aligned properly.

    Three modes are supported through the EnforcedStyleAlignWith configuration parameter:

    If it's set to keyword (which is the default), the end shall be aligned with the start of the keyword (if, class, etc.).

    If it's set to variable the end shall be aligned with the left-hand-side of the variable assignment, if there is one.

    If it's set to start_of_line, the end shall be aligned with the start of the line where the matching keyword appears.

    Example: EnforcedStyleAlignWith: keyword (default)

    # bad
    
    variable = if true
        end
    
    # good
    
    variable = if true
               end

    Example: EnforcedStyleAlignWith: variable

    # bad
    
    variable = if true
        end
    
    # good
    
    variable = if true
    end

    Example: EnforcedStyleAlignWith: startofline

    # bad
    
    variable = if true
        end
    
    # good
    
    puts(if true
    end)

    Do not use space inside array brackets.
    Open

            meta.each { |key, value| cmd.push [ key, value.shellescape ].join("=") }
    Severity: Minor
    Found in hawk/app/models/alert.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

              recipient.meta.each { |key, value| cmd.push [ key, value.shellescape ].join("=") }
    Severity: Minor
    Found in hawk/app/models/alert.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

              recipient.meta.each { |key, value| cmd.push [ key, value.shellescape ].join("=") }
    Severity: Minor
    Found in hawk/app/models/alert.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

              [ el.attributes["name"], el.attributes["value"] ]
    Severity: Minor
    Found in hawk/app/models/alert.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

              [ el.attributes["name"], el.attributes["value"] ]
    Severity: Minor
    Found in hawk/app/models/alert.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

            params.each { |key, value| cmd.push [ key, value.shellescape ].join("=") }
    Severity: Minor
    Found in hawk/app/models/alert.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

                                     [ el.attributes["name"], el.attributes["value"] ]
    Severity: Minor
    Found in hawk/app/models/alert.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

                                   [ el.attributes["name"], el.attributes["value"] ]
    Severity: Minor
    Found in hawk/app/models/alert.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

              recipient.params.each { |key, value| cmd.push [ key, value.shellescape ].join("=") }
    Severity: Minor
    Found in hawk/app/models/alert.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 ]]

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

        unless File.exist?(path) or File.symlink?(path)
    Severity: Minor
    Found in hawk/app/models/alert.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 2 (not 19) spaces for indentation.
    Open

                                 vals = r.elements["meta_attributes"].elements.collect do |el|
    Severity: Minor
    Found in hawk/app/models/alert.rb by rubocop

    This cops checks for indentation that doesn't use the specified number of spaces.

    See also the IndentationConsistency cop which is the companion to this one.

    Example:

    # bad
    class A
     def test
      puts 'hello'
     end
    end
    
    # good
    class A
      def test
        puts 'hello'
      end
    end

    Example: IgnoredPatterns: ['^\s*module']

    # bad
    module A
    class B
      def test
      puts 'hello'
      end
    end
    end
    
    # good
    module A
    class B
      def test
        puts 'hello'
      end
    end
    end

    Do not use space inside array brackets.
    Open

                                   [ el.attributes["name"], el.attributes["value"] ]
    Severity: Minor
    Found in hawk/app/models/alert.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 ]]

    There are no issues that match your filters.

    Category
    Status