app/models/manageiq/providers/vmware/cloud_manager/event_parser.rb
Use tr
instead of gsub
. Open
Open
:event_type => event[:type].sub('com/vmware/vcloud/event/', '').gsub('/', '-'), # normalized
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop identifies places where gsub
can be replaced by
tr
or delete
.
Example:
# bad
'abc'.gsub('b', 'd')
'abc'.gsub('a', '')
'abc'.gsub(/a/, 'd')
'abc'.gsub!('a', 'd')
# good
'abc'.gsub(/.*/, 'a')
'abc'.gsub(/a+/, 'd')
'abc'.tr('b', 'd')
'a b c'.delete(' ')