Skip to content

Commit

Permalink
refactoring from f..l//s -> Range.new(f,l,s) bc checks don't like the…
Browse files Browse the repository at this point in the history
… step notation
  • Loading branch information
bradhanks committed Jan 4, 2024
1 parent ee1195c commit 000353c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/credo/check/readability/large_numbers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ defmodule Credo.Check.Readability.LargeNumbers do
Enum.map(allowed_trailing_digits, fn trailing_digits ->
if String.length(string) > trailing_digits do
base =
Credo.Backports.String.slice(string, 0..(-1 * trailing_digits - 1))
Credo.Backports.String.slice(string, Range.new(0, -1 * trailing_digits - 1, -1))
|> String.reverse()
|> String.replace(~r/(\d{3})(?=\d)/, "\\1_")
|> String.reverse()
Expand Down
2 changes: 1 addition & 1 deletion lib/credo/check/warning/unused_function_return_helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ defmodule Credo.Check.Warning.UnusedFunctionReturnHelper do
when is_list(arguments) do
# IO.inspect(ast, label: "#{unquote(op)} (#{Macro.to_string(candidate)} #{acc})")

head_expression = Credo.Backports.Enum.slice(arguments, 0..-2//-1)
head_expression = Credo.Backports.Enum.slice(arguments, Range.new(0, -2, -1))

if Credo.Code.contains_child?(head_expression, candidate) do
{nil, :VERIFIED}
Expand Down

0 comments on commit 000353c

Please sign in to comment.