Closed axelson closed 6 months ago
On a file like:
defmodule MyApp.Error do @moduledoc """ docs """ defexception reason: "undefined error", code: nil @typedoc """ type doc """ @type t :: %__MODULE__{reason: any, code: integer() | nil} @doc nil def message(%{reason: reason}), do: inspect(reason) end
Recode fails with a FunctionClauseError error:
FunctionClauseError
> mix recode --dry Read 5 files in 0.06s ....!...................................................!!.. File: lib/error.ex [Specs 14/3] Functions should have a @spec type specification. Execution of the Recode.Task.TagTODO task failed with error: ** (FunctionClauseError) no function clause matching in String.split/3 (elixir 1.15.7) lib/string.ex:478: String.split(nil, "\n", []) (recode 0.7.0) lib/recode/task/tags.ex:98: Recode.Task.Tags.find_tags/2 (recode 0.7.0) lib/recode/task/tags.ex:54: Recode.Task.Tags.check_tags/3 (sourceror 0.14.1) lib/sourceror/zipper.ex:380: Sourceror.Zipper.do_traverse/3 (recode 0.7.0) lib/recode/task/tags.ex:17: Recode.Task.Tags.run/2 (recode 0.7.0) lib/recode/runner/impl.ex:144: Recode.Runner.Impl.run_task/3 (elixir 1.15.7) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3 (elixir 1.15.7) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2 Execution of the Recode.Task.TagFIXME task failed with error: ** (FunctionClauseError) no function clause matching in String.split/3 (elixir 1.15.7) lib/string.ex:478: String.split(nil, "\n", []) (recode 0.7.0) lib/recode/task/tags.ex:98: Recode.Task.Tags.find_tags/2 (recode 0.7.0) lib/recode/task/tags.ex:54: Recode.Task.Tags.check_tags/3 (sourceror 0.14.1) lib/sourceror/zipper.ex:380: Sourceror.Zipper.do_traverse/3 (recode 0.7.0) lib/recode/task/tags.ex:17: Recode.Task.Tags.run/2 (recode 0.7.0) lib/recode/runner/impl.ex:144: Recode.Runner.Impl.run_task/3 (elixir 1.15.7) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3 (elixir 1.15.7) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2 File: lib/fmt.ex [Specs 15/3] Functions should have a @spec type specification. [Specs 19/3] Functions should have a @spec type specification. File: mix.exs Updates: 1 Changed by: Format ...| 24 24 | {:freedom_formatter, ">= 2.0.0", only: :dev}, 25 25 | {:recode, "~> 0.6", only: :dev}, 26 + | 26 27 | # {:dep_from_hexpm, "~> 0.3.0"}, 28 + | 27 29 | # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"} 28 30 | ] ...| Executed 60 tasks in 0.02s. Files: 5 (.ex: 2, .exs: 3) Updated 1 file Found 5 issues Finished in 0.09s.
I've updated my https://github.com/axelson/recode_formatter_repro with this error case (in https://github.com/axelson/recode_formatter_repro/commit/7a3c5a683a03f188d513494015fefc13e4a29a69)
Thanks for reporting. The bug is fixed in 0.7.1.
On a file like:
Recode fails with a
FunctionClauseError
error:I've updated my https://github.com/axelson/recode_formatter_repro with this error case (in https://github.com/axelson/recode_formatter_repro/commit/7a3c5a683a03f188d513494015fefc13e4a29a69)