rubocop: Refactor codes

Comply with the ABC metrics when updating rubocop.