Summary of API misuses
Our static checker in powerstation finds all API misuses in source code by pattern matching and suggests a more efficient API to replace with. Common API misuse patterns are summarized in our paper. More specifically, the API misuses detected in this checker includes:
- any?, to be replaced with (=>)- exists?
- where.first?=>- find_by
- *=>- *.except(order)
- each.update=>- update_all
- .count=>- size
- .map=>- .pluck
- pluck.sum=>- sum
- .pluck + pluck=>- SQL UNION
- if exists? find else create end=>- find_or_create_by
We list how many times such misuses happen in the applications we studied, and each instance of misuse. The list can be found here.