rrrene / credo

A static code analysis tool for the Elixir language with a focus on code consistency and teaching.
http://credo-ci.org/
MIT License
4.94k stars 419 forks source link

Not ready for Elixir 1.16: a lot of 'warning: negative steps are not supported in Enum.slice/2 #1131

Closed lovebes closed 6 months ago

lovebes commented 6 months ago

Precheck

Environment

What were you trying to do?

mix credo

Expected outcome

Warning messages should not show

Actual outcome

A LOT of rules show warnings. Samples are:

warning: negative steps are not supported in Enum.slice/2, pass 34..-1//1 instead
  (elixir 1.16.2) lib/enum.ex:2994: Enum.slice/2
  (credo 1.6.7) lib/credo/code/interpolation_helper.ex:61: Credo.Code.InterpolationHelper.replace_line/4
  (elixir 1.16.2) lib/list.ex:1351: List.do_update_at/3
  (elixir 1.16.2) lib/list.ex:1355: List.do_update_at/3
  (elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
  (credo 1.6.7) lib/credo/code/interpolation_helper.ex:14: Credo.Code.InterpolationHelper.replace_interpolations/3

warning: negative steps are not supported in String.slice/2, pass 63..-1//1 instead
  (elixir 1.16.2) lib/string.ex:2369: String.slice/2
  (credo 1.6.7) lib/credo/check/readability/large_numbers.ex:239: Credo.Check.Readability.LargeNumbers.source_fragment/2
  (credo 1.6.7) lib/credo/check/readability/large_numbers.ex:137: Credo.Check.Readability.LargeNumbers.find_issue/6
  (credo 1.6.7) lib/credo/check/readability/large_numbers.ex:106: Credo.Check.Readability.LargeNumbers.find_issues/4
  (credo 1.6.7) lib/credo/check/readability/large_numbers.ex:2: Credo.Check.Readability.LargeNumbers.do_run_on_source_file/3
  (elixir 1.16.2) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2

warning: negative steps are not supported in Enum.slice/2, pass 0..-2//1 instead
  (elixir 1.16.2) lib/enum.ex:2994: Enum.slice/2
  (credo 1.6.7) lib/credo/check/consistency/multi_alias_import_require_use/collector.ex:27: Credo.Check.Consistency.MultiAliasImportRequireUse.Collector.traverse/2
  (elixir 1.16.2) lib/macro.ex:640: anonymous fn/4 in Macro.do_traverse_args/4
  (stdlib 4.3.1.3) lists.erl:1462: :lists.mapfoldl_1/3
  (stdlib 4.3.1.3) lists.erl:1463: :lists.mapfoldl_1/3
  (elixir 1.16.2) lib/macro.ex:605: Macro.do_traverse/4
lovebes commented 6 months ago

My bad. This is fixed in latest release of credo.