Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use explicit negative ranges #1135

Merged
merged 1 commit into from
Jun 2, 2024

Conversation

kevinschweikert
Copy link
Contributor

In Elixir 1.17-rc.0 we get these warnings:

==> credo
Compiling 253 files (.ex)
warning: x..y inside match is deprecated, you must always match on the step: x..y//var or x..y//_ if you want to ignore it
  (credo 1.7.4) lib/credo/backports.ex:4: Credo.Backports.Enum.slice/2

warning: x..y inside match is deprecated, you must always match on the step: x..y//var or x..y//_ if you want to ignore it
  (credo 1.7.4) lib/credo/backports.ex:16: Credo.Backports.String.slice/2

warning: 0..-2 has a default step of -1, please write 0..-2//-1 instead
  (credo 1.7.4) lib/credo/cli/command/explain/output/default.ex:272: Credo.CLI.Command.Explain.Output.Default.print_check_explanation/2

warning: 1..-1 has a default step of -1, please write 1..-1//-1 instead
  (credo 1.7.4) lib/credo/cli/command/diff/task/get_git_diff.ex:107: Credo.CLI.Command.Diff.Task.GetGitDiff.run_credo_on_dir/4

warning: 1..-2 has a default step of -1, please write 1..-2//-1 instead
  (credo 1.7.4) lib/credo/cli/command/diff/task/get_git_diff.ex:109: Credo.CLI.Command.Diff.Task.GetGitDiff.run_credo_on_dir/4

warning: 1..-2 has a default step of -1, please write 1..-2//-1 instead
  (credo 1.7.4) lib/credo/cli/command/diff/task/get_git_diff.ex:110: Credo.CLI.Command.Diff.Task.GetGitDiff.run_credo_on_dir/4

warning: 1..-2 has a default step of -1, please write 1..-2//-1 instead
  (credo 1.7.4) lib/credo/cli/command/diff/task/get_git_diff.ex:111: Credo.CLI.Command.Diff.Task.GetGitDiff.run_credo_on_dir/4

warning: 1..-2 has a default step of -1, please write 1..-2//-1 instead
  (credo 1.7.4) lib/credo/cli/command/diff/task/get_git_diff.ex:112: Credo.CLI.Command.Diff.Task.GetGitDiff.run_credo_on_dir/4

warning: 1..-2 has a default step of -1, please write 1..-2//-1 instead
  (credo 1.7.4) lib/credo/cli/command/diff/task/get_git_diff.ex:113: Credo.CLI.Command.Diff.Task.GetGitDiff.run_credo_on_dir/4

warning: 1..-2 has a default step of -1, please write 1..-2//-1 instead
  (credo 1.7.4) lib/credo/check/config_comment.ex:138: Credo.Check.ConfigComment.value_for/1

warning: 0..-2 has a default step of -1, please write 0..-2//-1 instead
  (credo 1.7.4) lib/credo/check/consistency/multi_alias_import_require_use/collector.ex:41: Credo.Check.Consistency.MultiAliasImportRequireUse.Collector.traverse/2

warning: 0..-2 has a default step of -1, please write 0..-2//-1 instead
  (credo 1.7.4) lib/credo/check/warning/unused_function_return_helper.ex:135: Credo.Check.Warning.UnusedFunctionReturnHelper.verify_candidate/3

warning: 0..-2 has a default step of -1, please write 0..-2//-1 instead
  (credo 1.7.4) lib/credo/check/warning/unused_function_return_helper.ex:135: Credo.Check.Warning.UnusedFunctionReturnHelper.verify_candidate/3

warning: 0..-2 has a default step of -1, please write 0..-2//-1 instead
  (credo 1.7.4) lib/credo/check/warning/unused_function_return_helper.ex:135: Credo.Check.Warning.UnusedFunctionReturnHelper.verify_candidate/3

warning: 0..-2 has a default step of -1, please write 0..-2//-1 instead
  (credo 1.7.4) lib/credo/check/warning/unused_function_return_helper.ex:135: Credo.Check.Warning.UnusedFunctionReturnHelper.verify_candidate/3

warning: 0..-2 has a default step of -1, please write 0..-2//-1 instead
  (credo 1.7.4) lib/credo/check/warning/unused_function_return_helper.ex:135: Credo.Check.Warning.UnusedFunctionReturnHelper.verify_candidate/3

This PR fixes them

@rrrene
Copy link
Owner

rrrene commented May 25, 2024

With the release of 1.17, we can no longer use the Backports module and have to move the minimum Elixir version up to 1.13 (I think).

I will take a closer look soon. 👍

@rrrene rrrene merged commit d5662f4 into rrrene:master Jun 2, 2024
18 of 20 checks passed
@rrrene
Copy link
Owner

rrrene commented Jun 2, 2024

@kevinschweikert Thx for this!

@rrrene
Copy link
Owner

rrrene commented Jun 2, 2024

Please check out the RC to see if there are remaining issues: https://github.com/rrrene/credo/releases/tag/v1.7.7-rc.0 🧡

@kevinschweikert
Copy link
Contributor Author

Tested 1.7.7-rc.o, and it compiles without warnings in my projects!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants