我正在使用一种工具来查找名为 reek 的代码中的代码异味,而我对一个名为 Control Parameter 的工具有疑问
def place_ship(ship, start_position, orientation)
@row = start_position[:row]
@column = start_position[:column]
ship.length.times do
if orientation == :vertical
vertical_place_ship(row,column,ship)
else
horizontal_place_ship(row,column,ship)
end
end
end
def vertical_place_ship(row,column,ship)
self.grid[row][column].ship = ship
self.grid[row][column].status = :occupied
@row += 1
end
def horizontal_place_ship(row,column,ship)
self.grid[row][column].ship = ship
self.grid[row][column].status = :occupied
@column += 1
end
警告内容:[
55]:ControlParameter: Board#place_ship is controlled by argument 'orientation
我该如何解决?