Skip to content

Commit

Permalink
Add unstable_sort to the call name list in `Performance/ChainedCall…
Browse files Browse the repository at this point in the history
…WithNoBang` rule
  • Loading branch information
Sija committed Jan 30, 2025
1 parent 59c11ff commit 3ab67ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ameba/rule/performance/chained_call_with_no_bang.cr
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module Ameba::Rule::Performance
# Enabled: true
# CallNames:
# - uniq
# - unstable_sort
# - sort
# - sort_by
# - shuffle
Expand All @@ -46,7 +47,7 @@ module Ameba::Rule::Performance
# All of those have bang method variants returning `self`
# and are not modifying the receiver type (like `compact` does),
# thus are safe to switch to the bang variant.
call_names %w[uniq sort sort_by shuffle reverse]
call_names %w[uniq unstable_sort sort sort_by shuffle reverse]
end

MSG = "Use bang method variant `%s!` after chained `%s` call"
Expand Down

0 comments on commit 3ab67ec

Please sign in to comment.