desloppify icon indicating copy to clipboard operation
desloppify copied to clipboard

Ruby non-empty rescue handlers are reported as empty_catch

Open cameronpriest opened this issue 3 weeks ago • 0 comments

Desloppify 1.0 (desloppify --version), Python 3.14.8, Linux, full extras installed.

Minimal example.rb:

class Example
  def recover
    perform_request
  rescue StandardError => error
    warn(error.message)
  end

  def translate
    perform_request
  rescue StandardError
    raise "Explicit failure"
  end

  def empty
    perform_request
  rescue StandardError
  end
end

Run in a directory containing this file:

desloppify --lang ruby scan --path . --no-badge
desloppify --lang ruby show smells

Expected: one empty_catch finding, for the genuinely empty rescue at line 16.

Actual: three high-confidence Empty rescue — swallows errors silently findings, at lines 4, 10 and 16. The first logs the exception and the second raises an explicit failure, so neither is an empty handler.

This also produces hundreds of false positives when auditing Rails controllers with explicit render/raise handlers. The minimal repro above contains no application code.

cameronpriest avatar Nov 10 '26 02:11 cameronpriest