From 3ab67ec91611bf5dab527fcd3a0072d39cb5b94b Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Thu, 30 Jan 2025 17:51:34 +0100 Subject: [PATCH] Add `unstable_sort` to the call name list in `Performance/ChainedCallWithNoBang` rule --- src/ameba/rule/performance/chained_call_with_no_bang.cr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ameba/rule/performance/chained_call_with_no_bang.cr b/src/ameba/rule/performance/chained_call_with_no_bang.cr index bf4671568..5fd4240a0 100644 --- a/src/ameba/rule/performance/chained_call_with_no_bang.cr +++ b/src/ameba/rule/performance/chained_call_with_no_bang.cr @@ -31,6 +31,7 @@ module Ameba::Rule::Performance # Enabled: true # CallNames: # - uniq + # - unstable_sort # - sort # - sort_by # - shuffle @@ -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"