ClusterLabs/hawk

View on GitHub
hawk/app/controllers/primitives_controller.rb

Summary

Maintainability
C
1 day
Test Coverage

Assignment Branch Condition size for create is too high. [47.76/15]
Open

  def create
    normalize_params! params[:primitive].permit!
    @title = _("Create Primitive")

    @primitive = Primitive.new params[:primitive].permit!

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 update is too high. [31.13/15]
Open

  def update
    normalize_params! params[:primitive].permit!
    @title = _("Edit Primitive")

    if params[:revert]

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 destroy is too high. [30.87/15]
Open

  def destroy
    respond_to do |format|
      out, err, rc = Invoker.instance.crm("--force", "configure", "delete", @primitive.id)
      if rc == 0
        format.html do

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 create has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    normalize_params! params[:primitive].permit!
    @title = _("Create Primitive")

    @primitive = Primitive.new params[:primitive].permit!
Severity: Minor
Found in hawk/app/controllers/primitives_controller.rb - About 2 hrs 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 has too many lines. [35/30]
Open

  def create
    normalize_params! params[:primitive].permit!
    @title = _("Create Primitive")

    @primitive = Primitive.new params[:primitive].permit!

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.

Assignment Branch Condition size for copy is too high. [17.03/15]
Open

  def copy
    @title = _("Create Primitive")
    other = @primitive
    @primitive = Primitive.new
    @primitive.unique_id! other.id

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

Perceived complexity for create is too high. [8/7]
Open

  def create
    normalize_params! params[:primitive].permit!
    @title = _("Create Primitive")

    @primitive = Primitive.new params[:primitive].permit!

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 create is too high. [7/6]
Open

  def create
    normalize_params! params[:primitive].permit!
    @title = _("Create Primitive")

    @primitive = Primitive.new params[:primitive].permit!

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 create has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create
    normalize_params! params[:primitive].permit!
    @title = _("Create Primitive")

    @primitive = Primitive.new params[:primitive].permit!
Severity: Minor
Found in hawk/app/controllers/primitives_controller.rb - About 1 hr to fix

    Method destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def destroy
        respond_to do |format|
          out, err, rc = Invoker.instance.crm("--force", "configure", "delete", @primitive.id)
          if rc == 0
            format.html do
    Severity: Minor
    Found in hawk/app/controllers/primitives_controller.rb - About 45 mins 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

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

      def destroy
        respond_to do |format|
          out, err, rc = Invoker.instance.crm("--force", "configure", "delete", @primitive.id)
          if rc == 0
            format.html do
    Severity: Major
    Found in hawk/app/controllers/primitives_controller.rb and 8 other locations - About 2 hrs to fix
    hawk/app/controllers/alerts_controller.rb on lines 98..120
    hawk/app/controllers/clones_controller.rb on lines 98..120
    hawk/app/controllers/groups_controller.rb on lines 98..120
    hawk/app/controllers/locations_controller.rb on lines 116..138
    hawk/app/controllers/masters_controller.rb on lines 98..120
    hawk/app/controllers/orders_controller.rb on lines 98..120
    hawk/app/controllers/tags_controller.rb on lines 94..116
    hawk/app/controllers/templates_controller.rb on lines 109..131

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 100.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

      def update
        normalize_params! params[:primitive].permit!
        @title = _("Edit Primitive")
    
        if params[:revert]
    Severity: Major
    Found in hawk/app/controllers/primitives_controller.rb and 8 other locations - About 2 hrs to fix
    hawk/app/controllers/clones_controller.rb on lines 68..93
    hawk/app/controllers/colocations_controller.rb on lines 67..92
    hawk/app/controllers/groups_controller.rb on lines 68..93
    hawk/app/controllers/locations_controller.rb on lines 86..111
    hawk/app/controllers/masters_controller.rb on lines 68..93
    hawk/app/controllers/orders_controller.rb on lines 68..93
    hawk/app/controllers/tags_controller.rb on lines 64..89
    hawk/app/controllers/tickets_controller.rb on lines 77..102

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 82.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      def set_record
        @primitive = Primitive.find params[:id]
    
        unless @primitive
          respond_to do |format|
    Severity: Major
    Found in hawk/app/controllers/primitives_controller.rb and 11 other locations - About 20 mins to fix
    hawk/app/controllers/alerts_controller.rb on lines 144..151
    hawk/app/controllers/clones_controller.rb on lines 144..151
    hawk/app/controllers/colocations_controller.rb on lines 142..149
    hawk/app/controllers/groups_controller.rb on lines 144..151
    hawk/app/controllers/locations_controller.rb on lines 162..169
    hawk/app/controllers/orders_controller.rb on lines 144..151
    hawk/app/controllers/roles_controller.rb on lines 143..150
    hawk/app/controllers/tags_controller.rb on lines 140..147
    hawk/app/controllers/templates_controller.rb on lines 161..168
    hawk/app/controllers/tickets_controller.rb on lines 193..200
    hawk/app/controllers/users_controller.rb on lines 145..152

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 28.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Favor format over String#%.
    Open

              flash[:alert] = _("Error deleting %s: %s") % [@primitive.id, err]

    This cop enforces the use of a single string formatting utility. Valid options include Kernel#format, Kernel#sprintf and String#%.

    The detection of String#% cannot be implemented in a reliable manner for all cases, so only two scenarios are considered - if the first argument is a string literal and if the second argument is an array literal.

    Example: EnforcedStyle: format(default)

    # bad
    puts sprintf('%10s', 'hoge')
    puts '%10s' % 'hoge'
    
    # good
    puts format('%10s', 'hoge')

    Example: EnforcedStyle: sprintf

    # bad
    puts format('%10s', 'hoge')
    puts '%10s' % 'hoge'
    
    # good
    puts sprintf('%10s', 'hoge')

    Example: EnforcedStyle: percent

    # bad
    puts format('%10s', 'hoge')
    puts sprintf('%10s', 'hoge')
    
    # good
    puts '%10s' % 'hoge'

    Favor format over String#%.
    Open

              render json: { error: _("Error deleting %s: %s") % [@primitive.id, err] }, status: :unprocessable_entity

    This cop enforces the use of a single string formatting utility. Valid options include Kernel#format, Kernel#sprintf and String#%.

    The detection of String#% cannot be implemented in a reliable manner for all cases, so only two scenarios are considered - if the first argument is a string literal and if the second argument is an array literal.

    Example: EnforcedStyle: format(default)

    # bad
    puts sprintf('%10s', 'hoge')
    puts '%10s' % 'hoge'
    
    # good
    puts format('%10s', 'hoge')

    Example: EnforcedStyle: sprintf

    # bad
    puts format('%10s', 'hoge')
    puts '%10s' % 'hoge'
    
    # good
    puts sprintf('%10s', 'hoge')

    Example: EnforcedStyle: percent

    # bad
    puts format('%10s', 'hoge')
    puts sprintf('%10s', 'hoge')
    
    # good
    puts '%10s' % 'hoge'

    Useless assignment to variable - out. Use _ or _out as a variable name to indicate that it won't be used.
    Open

          out, err, rc = Invoker.instance.crm("--force", "configure", "delete", @primitive.id)

    This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

    assigned but unused variable - foo

    Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

    Example:

    # bad
    
    def some_method
      some_var = 1
      do_something
    end

    Example:

    # good
    
    def some_method
      some_var = 1
      do_something(some_var)
    end

    Put empty method definitions on a single line.
    Open

      def normalize_params!(current)
      end

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

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

    Example: EnforcedStyle: compact (default)

    # bad
    def foo(bar)
    end
    
    def self.foo(bar)
    end
    
    # good
    def foo(bar); end
    
    def foo(bar)
      # baz
    end
    
    def self.foo(bar); end

    Example: EnforcedStyle: expanded

    # bad
    def foo(bar); end
    
    def self.foo(bar); end
    
    # good
    def foo(bar)
    end
    
    def self.foo(bar)
    end

    Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
    Open

              render json: { error: _("Error deleting %s: %s") % [@primitive.id, err] }, status: :unprocessable_entity

    Use a consistent style for named format string tokens.

    Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

    Example: EnforcedStyle: annotated (default)

    # bad
    format('%{greeting}', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%<greeting>s', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: template

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%{greeting}', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: unannotated

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%{greeting}', 'Hello')
    
    # good
    format('%s', 'Hello')</greeting>

    Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
    Open

              render json: { error: _("Error deleting %s: %s") % [@primitive.id, err] }, status: :unprocessable_entity

    Use a consistent style for named format string tokens.

    Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

    Example: EnforcedStyle: annotated (default)

    # bad
    format('%{greeting}', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%<greeting>s', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: template

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%{greeting}', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: unannotated

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%{greeting}', 'Hello')
    
    # good
    format('%s', 'Hello')</greeting>

    Put empty method definitions on a single line.
    Open

      def post_process_for!(record)
      end

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

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

    Example: EnforcedStyle: compact (default)

    # bad
    def foo(bar)
    end
    
    def self.foo(bar)
    end
    
    # good
    def foo(bar); end
    
    def foo(bar)
      # baz
    end
    
    def self.foo(bar); end

    Example: EnforcedStyle: expanded

    # bad
    def foo(bar); end
    
    def self.foo(bar); end
    
    # good
    def foo(bar)
    end
    
    def self.foo(bar)
    end

    Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
    Open

              flash[:alert] = _("Error deleting %s: %s") % [@primitive.id, err]

    Use a consistent style for named format string tokens.

    Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

    Example: EnforcedStyle: annotated (default)

    # bad
    format('%{greeting}', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%<greeting>s', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: template

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%{greeting}', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: unannotated

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%{greeting}', 'Hello')
    
    # good
    format('%s', 'Hello')</greeting>

    Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
    Open

              flash[:alert] = _("Error deleting %s: %s") % [@primitive.id, err]

    Use a consistent style for named format string tokens.

    Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

    Example: EnforcedStyle: annotated (default)

    # bad
    format('%{greeting}', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%<greeting>s', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: template

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%{greeting}', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: unannotated

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%{greeting}', 'Hello')
    
    # good
    format('%s', 'Hello')</greeting>

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

        if params[:revert]

    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?

    Unnecessary spacing detected.
    Open

          format.any { not_found  }

    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"

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

        unless @primitive

    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

    Always use raise to signal exceptions.
    Open

            fail CreateFailure, Util.strip_error_message(parent) unless parent.save

    This cop checks for uses of fail and raise.

    Example: EnforcedStyle: only_raise (default)

    # The `only_raise` style enforces the sole use of `raise`.
    # bad
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      # handle it
    end
    
    Kernel.fail
    
    # good
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      raise
    rescue Exception
      # handle it
    end
    
    Kernel.raise

    Example: EnforcedStyle: only_fail

    # The `only_fail` style enforces the sole use of `fail`.
    # bad
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      raise
    rescue Exception
      # handle it
    end
    
    Kernel.raise
    
    # good
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      # handle it
    end
    
    Kernel.fail

    Example: EnforcedStyle: semantic

    # The `semantic` style enforces the use of `fail` to signal an
    # exception, then will use `raise` to trigger an offense after
    # it has been rescued.
    # bad
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      # Error thrown
    rescue Exception
      fail
    end
    
    Kernel.fail
    Kernel.raise
    
    # good
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      raise 'Preferably with descriptive message'
    end
    
    explicit_receiver.fail
    explicit_receiver.raise

    Use rc.zero? instead of rc == 0.
    Open

          if rc == 0

    This cop checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. The cop can also be configured to do the reverse.

    The cop disregards #nonzero? as it its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

    The cop ignores comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Interger polymorphic.

    Example: EnforcedStyle: predicate (default)

    # bad
    
    foo == 0
    0 > foo
    bar.baz > 0
    
    # good
    
    foo.zero?
    foo.negative?
    bar.baz.positive?

    Example: EnforcedStyle: comparison

    # bad
    
    foo.zero?
    foo.negative?
    bar.baz.positive?
    
    # good
    
    foo == 0
    0 > foo
    bar.baz > 0

    Always use raise to signal exceptions.
    Open

        fail CreateFailure, Util.strip_error_message(@primitive) unless @primitive.save

    This cop checks for uses of fail and raise.

    Example: EnforcedStyle: only_raise (default)

    # The `only_raise` style enforces the sole use of `raise`.
    # bad
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      # handle it
    end
    
    Kernel.fail
    
    # good
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      raise
    rescue Exception
      # handle it
    end
    
    Kernel.raise

    Example: EnforcedStyle: only_fail

    # The `only_fail` style enforces the sole use of `fail`.
    # bad
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      raise
    rescue Exception
      # handle it
    end
    
    Kernel.raise
    
    # good
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      # handle it
    end
    
    Kernel.fail

    Example: EnforcedStyle: semantic

    # The `semantic` style enforces the use of `fail` to signal an
    # exception, then will use `raise` to trigger an offense after
    # it has been rescued.
    # bad
    begin
      raise
    rescue Exception
      # handle it
    end
    
    def watch_out
      # Error thrown
    rescue Exception
      fail
    end
    
    Kernel.fail
    Kernel.raise
    
    # good
    begin
      fail
    rescue Exception
      # handle it
    end
    
    def watch_out
      fail
    rescue Exception
      raise 'Preferably with descriptive message'
    end
    
    explicit_receiver.fail
    explicit_receiver.raise

    There are no issues that match your filters.

    Category
    Status