Closed ypconstante closed 4 months ago
In Elixir 1.16 the file detection paths have an additional ../ in front, causing the detection to fail.
../
This PR fixes this by changing from Path.relative_to(".") to Path.relative_to_cwd().
Path.relative_to(".")
Path.relative_to_cwd()
find_failed_detection before
find_failed_detection
[(ex_check 0.15.0) lib/ex_check/check/compiler.ex:162: ExCheck.Check.Compiler.find_failed_detection/2] ... |> Keyword.get(:detect, []) #=> [file: "test"] |> Enum.map(&split_detection_opts/1) #=> [{{:file, "test"}, []}] |> Enum.map(fn {base, opts} -> {prepare_detection_base(base, name, tool_opts), opts} end) #=> [{{:file, "../test"}, []}] |> Enum.find(fn {base, _} -> failed_detection?(base) end) #=> {{:file, "../test"}, []} ... [(ex_check 0.15.0) lib/ex_check/check/compiler.ex:162: ExCheck.Check.Compiler.find_failed_detection/2] ... |> Keyword.get(:detect, []) #=> [file: ".formatter.exs"] |> Enum.map(&split_detection_opts/1) #=> [{{:file, ".formatter.exs"}, []}] |> Enum.map(fn {base, opts} -> {prepare_detection_base(base, name, tool_opts), opts} end) #=> [{{:file, "../.formatter.exs"}, []}] |> Enum.find(fn {base, _} -> failed_detection?(base) end) #=> {{:file, "../.formatter.exs"}, []}
find_failed_detection after
[(ex_check 0.15.0) lib/ex_check/check/compiler.ex:162: ExCheck.Check.Compiler.find_failed_detection/2] ... |> Keyword.get(:detect, []) #=> [file: "test"] |> Enum.map(&split_detection_opts/1) #=> [{{:file, "test"}, []}] |> Enum.map(fn {base, opts} -> {prepare_detection_base(base, name, tool_opts), opts} end) #=> [{{:file, "test"}, []}] |> Enum.find(fn {base, _} -> failed_detection?(base) end) #=> nil ... [(ex_check 0.15.0) lib/ex_check/check/compiler.ex:162: ExCheck.Check.Compiler.find_failed_detection/2] ... |> Keyword.get(:detect, []) #=> [file: ".formatter.exs"] |> Enum.map(&split_detection_opts/1) #=> [{{:file, ".formatter.exs"}, []}] |> Enum.map(fn {base, opts} -> {prepare_detection_base(base, name, tool_opts), opts} end) #=> [{{:file, ".formatter.exs"}, []}] |> Enum.find(fn {base, _} -> failed_detection?(base) end) #=> nil
Fixes #41
@karolsluszniak can you check this PR, now that Elixir 1.16 got released?
Sorry for the delay & thank you for the fix!
In Elixir 1.16 the file detection paths have an additional
../
in front, causing the detection to fail.This PR fixes this by changing from
Path.relative_to(".")
toPath.relative_to_cwd()
.find_failed_detection
beforefind_failed_detection
afterFixes #41