Class: RuboCop::Cop::Isucon::Shell::System
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Isucon::Shell::System
- Defined in:
- lib/rubocop/cop/isucon/shell/system.rb
Overview
Avoid external command calls with Kernel#system
Constant Summary collapse
- MSG =
"Use pure-ruby code instead of external command execution if possible"
Instance Method Summary collapse
- #on_send(node) ⇒ Object
-
#system?(node) ⇒ Boolean
Whether matches
system
.
Instance Method Details
#on_send(node) ⇒ Object
27 28 29 30 31 |
# File 'lib/rubocop/cop/isucon/shell/system.rb', line 27 def on_send(node) return unless system?(node) add_offense(node) end |
#system?(node) ⇒ Boolean
Whether matches system
22 23 24 |
# File 'lib/rubocop/cop/isucon/shell/system.rb', line 22 def_node_matcher :system?, <<~PATTERN (send nil? :system ...) PATTERN |