Method: RuboCop::Cop::Style::NestedFileDirname#on_send
- Defined in:
- lib/rubocop/cop/style/nested_file_dirname.rb
#on_send(node) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rubocop/cop/style/nested_file_dirname.rb', line 33 def on_send(node) return if file_dirname?(node.parent) || !file_dirname?(node.first_argument) path, level = path_with_dir_level(node, 1) return if level < 2 = format(MSG, path: path, level: level) range = offense_range(node) add_offense(range, message: ) do |corrector| corrector.replace(range, "dirname(#{path}, #{level})") end end |