You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flay hook ignores flay crashes by only reading stdout #884
The Flay pre-commit hook runs flay --mass <threshold> --fuzzy 1 <file> on each modified file. The problem is that flay can crash internally (there's a bug in flay 2.13.3 where --fuzzy causes a NoMethodError on certain Ruby AST structures), and when that happens the hook silently passes.
The crash goes to stderr and exits non-zero, but the plugin only checks result.stdout — which is empty when flay crashes — so it assumes nothing was found.
You can reproduce it with a file containing two similar methods with .map(&:to_s) or similar block-passing patterns, like:
Enable the Flay hook and run overcommit --run — it'll pass even though flay crashes with:
/home/.../flay-2.13.3/lib/flay.rb:318:in 'Flay#process_fuzzy':
undefined method 'modified=' for an instance of Array (NoMethodError)
tmpl.modified = true
The relevant code is at lib/overcommit/hook/pre_commit/flay.rb:24-28:
result.status and result.stderr are never checked, so crashes are invisible. Would be great if the plugin could also look at those to catch cases where flay itself fails.
Activity
Fail Flay hook when flay crashes instead of silently passing (#885)