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

Elixir 1.17 issues #1132

Closed Fudoshiki closed 5 months ago

Fudoshiki commented 6 months ago

Precheck

Environment

What were you trying to do?

run mix credo

Expected outcome

no errors on elixir 1.16 expected same on 1.17

Actual outcome

sharevari@MacBook-Air-sharevari Yui % mix credo
Checking 18 source files ...
Error while running Elixir.Credo.Check.Readability.Semicolons on lib/yui.ex
Error while running Elixir.Credo.Check.Readability.ParenthesesInCondition on lib/yui_web/controllers/error_json.ex
Error while running Elixir.Credo.Check.Readability.ParenthesesInCondition on lib/yui_web/components/core_components.ex
Error while running Elixir.Credo.Check.Readability.ParenthesesInCondition on lib/yui_web/components/layouts.ex
Error while running Elixir.Credo.Check.Readability.Semicolons on lib/yui_web/components/layouts.ex
Error while running Elixir.Credo.Check.Readability.ParenthesesInCondition on lib/yui/application.ex
Error while running Elixir.Credo.Check.Readability.Semicolons on lib/yui/application.ex
Error while running Elixir.Credo.Check.Readability.ParenthesesInCondition on lib/yui_web.ex
Error while running Elixir.Credo.Check.Readability.ParenthesesInCondition on lib/yui/mailer.ex
Error while running Elixir.Credo.Check.Readability.ParenthesesInCondition on lib/yui.ex
Error while running Elixir.Credo.Check.Readability.ParenthesesInCondition on lib/yui_web/controllers/error_html.ex
Error while running Elixir.Credo.Check.Readability.Semicolons on lib/yui_web.ex
Error while running Elixir.Credo.Check.Readability.Semicolons on lib/yui_web/controllers/error_html.ex
Error while running Elixir.Credo.Check.Readability.LargeNumbers on lib/yui_web.ex
Error while running Elixir.Credo.Check.Readability.Semicolons on lib/yui_web/controllers/error_json.ex
Error while running Elixir.Credo.Check.Readability.LargeNumbers on lib/yui/mailer.ex
Error while running Elixir.Credo.Check.Readability.Semicolons on lib/yui_web/components/core_components.ex
Error while running Elixir.Credo.Check.Readability.LargeNumbers on lib/yui.ex
Error while running Elixir.Credo.Check.Readability.LargeNumbers on lib/yui/application.ex
Error while running Elixir.Credo.Check.Readability.Semicolons on lib/yui/mailer.ex
Error while running Elixir.Credo.Check.Readability.LargeNumbers on lib/yui_web/components/layouts.ex
Error while running Elixir.Credo.Check.Readability.LargeNumbers on lib/yui_web/controllers/error_html.ex
Error while running Elixir.Credo.Check.Readability.LargeNumbers on lib/yui_web/controllers/error_json.ex
Error while running Elixir.Credo.Check.Readability.LargeNumbers on lib/yui_web/components/core_components.ex
Error while running Elixir.Credo.Check.Readability.SpaceAfterCommas on lib/yui_web/controllers/error_json.ex
Error while running Elixir.Credo.Check.Readability.SpaceAfterCommas on lib/yui.ex
Error while running Elixir.Credo.Check.Readability.SpaceAfterCommas on lib/yui_web/controllers/error_html.ex
Error while running Elixir.Credo.Check.Readability.SpaceAfterCommas on lib/yui/mailer.ex
Error while running Elixir.Credo.Check.Readability.SpaceAfterCommas on lib/yui_web/components/layouts.ex
Error while running Elixir.Credo.Check.Readability.SpaceAfterCommas on lib/yui_web.ex
Error while running Elixir.Credo.Check.Readability.SpaceAfterCommas on lib/yui/application.ex
Error while running Elixir.Credo.Check.Readability.SpaceAfterCommas on lib/yui_web/components/core_components.ex
** (EXIT from #PID<0.98.0>) an exception was raised:
    ** (CaseClauseError) no case clause matching: {:ok, 5, 1, [], [{:eol, {4, 4, 1}}, {:end, {4, 1, nil}}, {:eol, {3, 35, 1}}, {:atom, {3, 31, ~c"yui"}, :yui}, {:kw_identifier, {3, 22, ~c"otp_app"}, :otp_app}, {:",", {3, 20, 0}}, {:alias, {3, 14, ~c"Mailer"}, :Mailer}, {:., {3, 13, nil}}, {:alias, {3, 7, ~c"Swoosh"}, :Swoosh}, {:identifier, {3, 3, ~c"use"}, :use}, {:eol, {2, 19, 1}}, {false, {2, 14, nil}}, {:identifier, {2, 4, ~c"moduledoc"}, :moduledoc}, {:at_op, {2, 3, nil}, :@}, {:eol, {1, 24, 1}}, {:do, {1, 22, nil}}, {:alias, {1, 15, ~c"Mailer"}, :Mailer}, {:., {1, 14, nil}}, {:alias, {1, 11, ~c"Yui"}, :Yui}, {:identifier, {1, 1, ~c"defmodule"}, :defmodule}], []}
        (credo 1.7.6) lib/credo/code.ex:138: Credo.Code.to_tokens/2
        (credo 1.7.6) lib/credo/check/readability/semicolons.ex:32: Credo.Check.Readability.Semicolons.run/2
        (credo 1.7.6) lib/credo/check/readability/semicolons.ex:2: Credo.Check.Readability.Semicolons.do_run_on_source_file/3
        (elixir 1.17.0-dev) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
        (elixir 1.17.0-dev) lib/task/supervised.ex:36: Task.Supervised.reply/4

11:18:44.311 [error] Task #PID<0.262.0> started from #PID<0.224.0> terminating
** (CaseClauseError) no case clause matching: {:ok, 15, 1, [], [{:eol, {14, 4, 1}}, {:end, {14, 1, nil}}, {:eol, {13, 30, 1}}, {:bin_string, {13, 19, nil}, ["layouts/*"]}, {:identifier, {13, 3, ~c"embed_templates"}, :embed_templates}, {:eol, {11, 20, 2}}, {:atom, {11, 15, ~c"html"}, :html}, {:",", {11, 13, 0}}, {:alias, {11, 7, ~c"YuiWeb"}, :YuiWeb}, {:identifier, {11, 3, ~c"use"}, :use}, {:eol, {10, 6, 1}}, {:bin_heredoc, {2, 14, nil}, 2, ["This module holds different layouts used by your application.\n\nSee the `layouts` directory for all templates available.\nThe \"root\" layout is a skeleton rendered as part of the\napplication router. The \"app\" layout is set as the default\nlayout on both `use YuiWeb, :controller` and\n`use YuiWeb, :live_view`.\n"]}, {:identifier, {2, 4, ~c"moduledoc"}, :moduledoc}, {:at_op, {2, 3, nil}, :@}, {:eol, {1, 28, 1}}, {:do, {1, 26, nil}}, {:alias, {1, 18, ~c"Layouts"}, :Layouts}, {:., {1, 17, nil}}, {:alias, {1, 11, ~c"YuiWeb"}, :YuiWeb}, {:identifier, {1, 1, ~c"defmodule"}, :defmodule}], []}
    (credo 1.7.6) lib/credo/code.ex:138: Credo.Code.to_tokens/2
    (credo 1.7.6) lib/credo/code/interpolation_helper.ex:68: Credo.Code.InterpolationHelper.interpolation_positions/2
    (credo 1.7.6) lib/credo/code/interpolation_helper.ex:9: Credo.Code.InterpolationHelper.replace_interpolations/3
    (credo 1.7.6) lib/credo/code/heredocs.ex:70: Credo.Code.Heredocs.replace_with_spaces/5
    (credo 1.7.6) lib/credo/code.ex:190: Credo.Code.clean_charlists_strings_sigils_and_comments/2
    (credo 1.7.6) lib/credo/check/consistency/space_in_parentheses/collector.ex:14: Credo.Check.Consistency.SpaceInParentheses.Collector.collect_matches/2
    (credo 1.7.6) lib/credo/check/consistency/collector.ex:158: anonymous fn/3 in Credo.Check.Consistency.Collector.find_issues/5
    (elixir 1.17.0-dev) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
Function: &:erlang.apply/2
    Args: [#Function<0.62605471/1 in Credo.Check.Consistency.Collector.find_issues/5>, [%SourceFile<lib/yui_web/components/layouts.ex>]]

11:18:44.311 [error] Task #PID<0.446.0> started from #PID<0.435.0> terminating
** (CaseClauseError) no case clause matching: {:ok, 114, 1, [], [{:eol, {113, 4, 1}}, {:end, {113, 1, nil}}, {:eol, {112, 6, 1}}, {:end, {112, 3, nil}}, {:eol, {111, 33, 1}}, {:")", {111, 32, nil}}, {:"]", {111, 31, nil}}, {:"[", {111, 30, nil}}, {:",", {111, 28, 0}}, {:identifier, {111, 23, ~c"which"}, :which}, {:",", {111, 21, 0}}, {:identifier, {111, 11, ~c"__MODULE__"}, :__MODULE__}, {:"(", {111, 10, nil}}, {:paren_identifier, {111, 5, ~c"apply"}, :apply}, {:eol, {110, 51, 1}}, {:do, {110, 49, nil}}, {:")", {110, 47, nil}}, {:identifier, {110, 42, ~c"which"}, :which}, {:"(", {110, 41, nil}}, {:paren_identifier, {110, 34, ~c"is_atom"}, :is_atom}, {:when_op, {110, 29, nil}, :when}, {:")", {110, 27, nil}}, {:identifier, {110, 22, ~c"which"}, :which}, {:"(", {110, 21, nil}}, {:paren_identifier, {110, 12, ~c"__using__"}, :__using__}, {:identifier, {110, 3, ~c"defmacro"}, :defmacro}, {:eol, {109, 6, 1}}, {:bin_heredoc, {107, 8, nil}, 2, ["When used, dispatch to the appropriate controller/live_view/etc.\n"]}, {:identifier, {107, 4, ~c"doc"}, :doc}, {:at_op, {107, 3, nil}, :@}, {:eol, {105, 6, 2}}, {:end, {105, 3, nil}}, {:eol, {104, 8, 1}}, {:end, {104, 5, nil}}, {:eol, {103, 39, 1}}, {:")", {103, 38, nil}}, {:"(", {103, 37, nil}}, {:paren_identifier, {103, 25, ~c"static_paths"}, :static_paths}, {:., {103, 24, nil}}, {:alias, {103, 18, ~c"YuiWeb"}, :YuiWeb}, {:kw_identifier, {103, 9, ...}, :statics}, {:",", {102, ...}}, {:alias, {...}, ...}, {:., ...}, {...}, ...], []}
    (credo 1.7.6) lib/credo/code.ex:138: Credo.Code.to_tokens/2
    (credo 1.7.6) lib/credo/check/readability/parentheses_in_condition.ex:36: Credo.Check.Readability.ParenthesesInCondition.run/2
    (credo 1.7.6) lib/credo/check/readability/parentheses_in_condition.ex:2: Credo.Check.Readability.ParenthesesInCondition.do_run_on_source_file/3
    (elixir 1.17.0-dev) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
    (elixir 1.17.0-dev) lib/task/supervised.ex:36: Task.Supervised.reply/4
Function: &:erlang.apply/2
    Args: [#Function<2.16007744/1 in Credo.Check.Readability.ParenthesesInCondition.do_run_on_all_source_files/3>, [%SourceFile<lib/yui_web.ex>]]
rrrene commented 6 months ago

Thx for pointing this out. I will take a closer look soon. :+1:

peaceful-james commented 6 months ago

@rrrene I am pretty sure my PR and the associated Elixir PR will fix it. You may resume toddler-chasing! :)

rrrene commented 5 months ago

@Fudoshiki could you try the new version 1.7.7-rc.0?

Hermanverschooten commented 5 months ago

@rrrene I just checked version 1.7.7-rc.0 against my code on elixir 1.17.0-rc.1-otp-27 erlang 27.0 and it no longer has the listed errors.

moomerman commented 5 months ago

Just ran into this issue with elixir 1.17.0-rc.1 and credo 1.7.6 ; upgrading to credo 1.7.7-rc.0 fixed it.

Fudoshiki commented 5 months ago

@rrrene done

PragTob commented 5 months ago

@rrrene just FYI the rc also works for benchee :rocket: Thanks for your work! :green_heart: