Showing 686 of 688 total issues
Use tr
instead of gsub
. Open
Open
tags_order = 'CASE WHEN name LIKE ? OR name LIKE ? THEN 1 WHEN name LIKE ? OR name LIKE ? THEN 2 WHEN name LIKE ? OR name LIKE ? THEN 4 ELSE 3 END', "#{query}", "#{query.to_s.gsub(' ', '-')}", "#{query}%", "#{query.to_s.gsub(' ', '-')}%", "%#{query}", "%#{query.to_s.gsub(' ', '-')}"
- 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(' ')
Use a guard clause instead of wrapping the code inside a conditional expression. Open
Open
if node.status == 4 # only if it remains unmoderated
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression
Example:
# bad
def test
if something
work
end
end
# good
def test
return unless something
work
end
# also good
def test
work if something
end
# bad
if something
raise 'exception'
else
ok
end
# good
raise 'exception' if something
ok
TODO found Open
Open
# TODO: make less redundant with https://github.com/publiclab/plots2/blob/main/app/helpers/application_helper.rb#L3
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
Open
// TODO: create multicase for "CREATE NEW COMMENT FORM" in reducers.js
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
Open
# TODO: evaluate if disabling this caching action actually speeds things up?
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
Open
<!-- TODO: could be resolved with `node.node.main_image` but applying quick fix here -->
- Create a ticketCreate a ticket
- Exclude checks