Class: RuboCop::Cop::Legion::Llm::NoLoopDo
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Legion::Llm::NoLoopDo
- Defined in:
- lib/rubocop/cop/legion/llm/no_loop_do.rb
Overview
Flags ‘loop do` in legion-llm production code. Unbounded loops have caused runaway threads and hard-to-debug hangs. Use `N.times`, `each`, or a `while` with an explicit counter instead.
No auto-correct is provided — the fix requires choosing the correct bound.
Constant Summary collapse
- MSG =
'`loop do` is prohibited — use bounded iteration (`N.times`, `each`, ' \ 'or `while` with an explicit decrement) instead.'
Instance Method Summary collapse
- #on_block(node) ⇒ Object (also: #on_numblock)
Instance Method Details
#on_block(node) ⇒ Object Also known as: on_numblock
29 30 31 32 33 34 |
# File 'lib/rubocop/cop/legion/llm/no_loop_do.rb', line 29 def on_block(node) return unless node.send_node.method_name == :loop return unless node.send_node.receiver.nil? add_offense(node.send_node) end |